mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
Added new style validators for New Publisher for Standalone Publisher
This commit is contained in:
parent
eeca451c64
commit
7c6d63f893
18 changed files with 275 additions and 28 deletions
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<root>
|
||||
<error id="main">
|
||||
<title>Invalid frame range</title>
|
||||
<description>
|
||||
## Invalid frame range
|
||||
|
||||
Expected duration or '{duration}' frames set in database, workfile contains only '{found}' frames.
|
||||
|
||||
### How to repair?
|
||||
|
||||
Modify configuration in the database or tweak frame range in the workfile.
|
||||
</description>
|
||||
</error>
|
||||
</root>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<root>
|
||||
<error id="main">
|
||||
<title>Duplicate shots</title>
|
||||
<description>
|
||||
## Duplicate shot names
|
||||
|
||||
Process contains duplicated shot names '{duplicates_str}'.
|
||||
|
||||
### How to repair?
|
||||
|
||||
Remove shot duplicates.
|
||||
</description>
|
||||
</error>
|
||||
</root>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<root>
|
||||
<error id="main">
|
||||
<title>Files not found</title>
|
||||
<description>
|
||||
## Source files not found
|
||||
|
||||
Process contains duplicated shot names:
|
||||
'{files_not_found}'
|
||||
|
||||
### How to repair?
|
||||
|
||||
Add missing files or run Publish again to collect new publishable files.
|
||||
</description>
|
||||
</error>
|
||||
</root>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<root>
|
||||
<error id="main">
|
||||
<title>Task not found</title>
|
||||
<description>
|
||||
## Task not found in database
|
||||
|
||||
Process contains tasks that don't exist in database:
|
||||
'{task_not_found}'
|
||||
|
||||
### How to repair?
|
||||
|
||||
Remove set task or add task into database into proper place.
|
||||
</description>
|
||||
</error>
|
||||
</root>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<root>
|
||||
<error id="main">
|
||||
<title>No texture files found</title>
|
||||
<description>
|
||||
## Batch doesn't contain texture files
|
||||
|
||||
Batch must contain at least one texture file.
|
||||
|
||||
### How to repair?
|
||||
|
||||
Add texture file to the batch or check name if it follows naming convention to match texture files to the batch.
|
||||
</description>
|
||||
</error>
|
||||
</root>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<root>
|
||||
<error id="main">
|
||||
<title>No workfile found</title>
|
||||
<description>
|
||||
## Batch should contain workfile
|
||||
|
||||
It is expected that published contains workfile that served as a source for textures.
|
||||
|
||||
### How to repair?
|
||||
|
||||
Add workfile to the batch, or disable this validator if you do not want workfile published.
|
||||
</description>
|
||||
</error>
|
||||
</root>
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<root>
|
||||
<error id="main">
|
||||
<title>Asset name not found</title>
|
||||
<description>
|
||||
## Couldn't parse asset name from a file
|
||||
|
||||
Unable to parse asset name from '{file_name}'. File name doesn't match configured naming convention.
|
||||
|
||||
### How to repair?
|
||||
|
||||
Check Settings: project_settings/standalonepublisher/publish/CollectTextures for naming convention.
|
||||
</description>
|
||||
<detail>
|
||||
### __Detailed Info__ (optional)
|
||||
|
||||
This error happens when parsing cannot figure out name of asset texture files belong under.
|
||||
</detail>
|
||||
</error>
|
||||
<error id="missing_values">
|
||||
<title>Missing keys</title>
|
||||
<description>
|
||||
## Texture file name is missing some required keys
|
||||
|
||||
Texture '{file_name}' is missing values for {missing_str} keys.
|
||||
|
||||
### How to repair?
|
||||
|
||||
Fix name of texture file and Publish again.
|
||||
</description>
|
||||
</error>
|
||||
</root>
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<root>
|
||||
<error id="main">
|
||||
<title>Texture version</title>
|
||||
<description>
|
||||
## Texture version mismatch with workfile
|
||||
|
||||
Workfile '{file_name}' version doesn't match with '{version}' of a texture.
|
||||
|
||||
### How to repair?
|
||||
|
||||
Rename either workfile or texture to contain matching versions
|
||||
</description>
|
||||
<detail>
|
||||
### __Detailed Info__ (optional)
|
||||
|
||||
This might happen if you are trying to publish textures for older version of workfile (or the other way).
|
||||
(Eg. publishing 'workfile_v001' and 'texture_file_v002')
|
||||
</detail>
|
||||
</error>
|
||||
<error id="too_many">
|
||||
<title>Too many versions</title>
|
||||
<description>
|
||||
## Too many versions published at same time
|
||||
|
||||
It is currently expected to publish only batch with single version.
|
||||
|
||||
Found {found} versions.
|
||||
|
||||
### How to repair?
|
||||
|
||||
Please remove files with different version and split publishing into multiple steps.
|
||||
</description>
|
||||
</error>
|
||||
</root>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<root>
|
||||
<error id="main">
|
||||
<title>No secondary workfile</title>
|
||||
<description>
|
||||
## No secondary workfile found
|
||||
|
||||
Current process expects that primary workfile (for example with a extension '{extension}') will contain also 'secondary' workfile.
|
||||
|
||||
Secondary workfile for '{file_name}' wasn't found.
|
||||
|
||||
### How to repair?
|
||||
|
||||
Attach secondary workfile or disable this validator and Publish again.
|
||||
</description>
|
||||
<detail>
|
||||
### __Detailed Info__ (optional)
|
||||
|
||||
This process was implemented for a possible use case of first workfile coming from Mari, secondary workfile for textures from Substance.
|
||||
Publish should contain both if primary workfile is present.
|
||||
</detail>
|
||||
</error>
|
||||
</root>
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
import re
|
||||
|
||||
import pyblish.api
|
||||
|
||||
import openpype.api
|
||||
from openpype import lib
|
||||
from openpype.pipeline import PublishXmlValidationError
|
||||
|
||||
|
||||
class ValidateFrameRange(pyblish.api.InstancePlugin):
|
||||
|
|
@ -48,9 +50,15 @@ class ValidateFrameRange(pyblish.api.InstancePlugin):
|
|||
files = [files]
|
||||
frames = len(files)
|
||||
|
||||
err_msg = "Frame duration from DB:'{}' ". format(int(duration)) +\
|
||||
" doesn't match number of files:'{}'".format(frames) +\
|
||||
" Please change frame range for Asset or limit no. of files"
|
||||
assert frames == duration, err_msg
|
||||
msg = "Frame duration from DB:'{}' ". format(int(duration)) +\
|
||||
" doesn't match number of files:'{}'".format(frames) +\
|
||||
" Please change frame range for Asset or limit no. of files"
|
||||
|
||||
self.log.debug("Valid ranges {} - {}".format(int(duration), frames))
|
||||
formatting_data = {"duration": duration,
|
||||
"found": frames}
|
||||
if frames == duration:
|
||||
raise PublishXmlValidationError(self, msg,
|
||||
formatting_data=formatting_data)
|
||||
|
||||
self.log.debug("Valid ranges expected '{}' - found '{}'".
|
||||
format(int(duration), frames))
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import pyblish.api
|
||||
import openpype.api
|
||||
|
||||
import openpype.api
|
||||
from openpype.pipeline import PublishXmlValidationError
|
||||
|
||||
class ValidateShotDuplicates(pyblish.api.ContextPlugin):
|
||||
"""Validating no duplicate names are in context."""
|
||||
|
|
@ -20,4 +21,8 @@ class ValidateShotDuplicates(pyblish.api.ContextPlugin):
|
|||
shot_names.append(name)
|
||||
|
||||
msg = "There are duplicate shot names:\n{}".format(duplicate_names)
|
||||
assert not duplicate_names, msg
|
||||
|
||||
formatting_data = {"duplicate_str": ','.join(duplicate_names)}
|
||||
if duplicate_names:
|
||||
raise PublishXmlValidationError(self, msg,
|
||||
formatting_data=formatting_data)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
import pyblish.api
|
||||
import openpype.api
|
||||
|
||||
import os
|
||||
|
||||
import pyblish.api
|
||||
|
||||
import openpype.api
|
||||
from openpype.pipeline import PublishXmlValidationError
|
||||
|
||||
|
||||
class ValidateSources(pyblish.api.InstancePlugin):
|
||||
"""Validates source files.
|
||||
|
|
@ -11,7 +13,6 @@ class ValidateSources(pyblish.api.InstancePlugin):
|
|||
got deleted between starting of SP and now.
|
||||
|
||||
"""
|
||||
|
||||
order = openpype.api.ValidateContentsOrder
|
||||
label = "Check source files"
|
||||
|
||||
|
|
@ -22,6 +23,7 @@ class ValidateSources(pyblish.api.InstancePlugin):
|
|||
def process(self, instance):
|
||||
self.log.info("instance {}".format(instance.data))
|
||||
|
||||
missing_files = set()
|
||||
for repre in instance.data.get("representations") or []:
|
||||
files = []
|
||||
if isinstance(repre["files"], str):
|
||||
|
|
@ -34,4 +36,10 @@ class ValidateSources(pyblish.api.InstancePlugin):
|
|||
file_name)
|
||||
|
||||
if not os.path.exists(source_file):
|
||||
raise ValueError("File {} not found".format(source_file))
|
||||
missing_files.add(source_file)
|
||||
|
||||
msg = "Files '{}' not found".format(','.join(missing_files))
|
||||
formatting_data = {"files_not_found": ' - {}'.join(missing_files)}
|
||||
if missing_files:
|
||||
raise PublishXmlValidationError(self, msg,
|
||||
formatting_data=formatting_data)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import pyblish.api
|
||||
from avalon import io
|
||||
|
||||
from openpype.pipeline import PublishXmlValidationError
|
||||
|
||||
|
||||
class ValidateTaskExistence(pyblish.api.ContextPlugin):
|
||||
"""Validating tasks on instances are filled and existing."""
|
||||
|
|
@ -53,4 +55,9 @@ class ValidateTaskExistence(pyblish.api.ContextPlugin):
|
|||
"Asset: \"{}\" Task: \"{}\"".format(*missing_pair)
|
||||
)
|
||||
|
||||
raise AssertionError(msg.format("\n".join(pair_msgs)))
|
||||
msg = msg.format("\n".join(pair_msgs))
|
||||
|
||||
formatting_data = {"task_not_found": ' - {}'.join(pair_msgs)}
|
||||
if pair_msgs:
|
||||
raise PublishXmlValidationError(self, msg,
|
||||
formatting_data=formatting_data)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import pyblish.api
|
||||
import openpype.api
|
||||
|
||||
from openpype.pipeline import PublishXmlValidationError
|
||||
|
||||
|
||||
class ValidateTextureBatch(pyblish.api.InstancePlugin):
|
||||
"""Validates that some texture files are present."""
|
||||
|
|
@ -15,8 +17,10 @@ class ValidateTextureBatch(pyblish.api.InstancePlugin):
|
|||
present = False
|
||||
for instance in instance.context:
|
||||
if instance.data["family"] == "textures":
|
||||
self.log.info("Some textures present.")
|
||||
self.log.info("At least some textures present.")
|
||||
|
||||
return
|
||||
|
||||
assert present, "No textures found in published batch!"
|
||||
msg = "No textures found in published batch!"
|
||||
if not present:
|
||||
raise PublishXmlValidationError(self, msg)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import pyblish.api
|
||||
|
||||
import openpype.api
|
||||
from openpype.pipeline import PublishXmlValidationError
|
||||
|
||||
|
||||
class ValidateTextureHasWorkfile(pyblish.api.InstancePlugin):
|
||||
|
|
@ -17,4 +19,6 @@ class ValidateTextureHasWorkfile(pyblish.api.InstancePlugin):
|
|||
def process(self, instance):
|
||||
wfile = instance.data["versionData"].get("workfile")
|
||||
|
||||
assert wfile, "Textures are missing attached workfile"
|
||||
msg = "Textures are missing attached workfile"
|
||||
if not wfile:
|
||||
raise PublishXmlValidationError(self, msg)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import pyblish.api
|
||||
import openpype.api
|
||||
|
||||
import openpype.api
|
||||
from openpype.pipeline import PublishXmlValidationError
|
||||
|
||||
class ValidateTextureBatchNaming(pyblish.api.InstancePlugin):
|
||||
"""Validates that all instances had properly formatted name."""
|
||||
|
|
@ -16,12 +17,16 @@ class ValidateTextureBatchNaming(pyblish.api.InstancePlugin):
|
|||
if isinstance(file_name, list):
|
||||
file_name = file_name[0]
|
||||
|
||||
msg = "Couldnt find asset name in '{}'\n".format(file_name) + \
|
||||
msg = "Couldn't find asset name in '{}'\n".format(file_name) + \
|
||||
"File name doesn't follow configured pattern.\n" + \
|
||||
"Please rename the file."
|
||||
assert "NOT_AVAIL" not in instance.data["asset_build"], msg
|
||||
|
||||
instance.data.pop("asset_build")
|
||||
formatting_data = {"file_name": file_name}
|
||||
if "NOT_AVAIL" in instance.data["asset_build"]:
|
||||
raise PublishXmlValidationError(self, msg,
|
||||
formatting_data=formatting_data)
|
||||
|
||||
instance.data.pop("asset_build") # not needed anymore
|
||||
|
||||
if instance.data["family"] == "textures":
|
||||
file_name = instance.data["representations"][0]["files"][0]
|
||||
|
|
@ -47,4 +52,10 @@ class ValidateTextureBatchNaming(pyblish.api.InstancePlugin):
|
|||
"Name of the texture file doesn't match expected pattern.\n" + \
|
||||
"Please rename file(s) {}".format(file_name)
|
||||
|
||||
assert not missing_key_values, msg
|
||||
missing_str = ','.join(["'{}'".format(key)
|
||||
for key in missing_key_values])
|
||||
formatting_data = {"file_name": file_name,
|
||||
"missing_str": missing_str}
|
||||
if missing_key_values:
|
||||
raise PublishXmlValidationError(self, msg, key="missing_values",
|
||||
formatting_data=formatting_data)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import pyblish.api
|
||||
|
||||
import openpype.api
|
||||
from openpype.pipeline import PublishXmlValidationError
|
||||
|
||||
|
||||
class ValidateTextureBatchVersions(pyblish.api.InstancePlugin):
|
||||
|
|
@ -25,14 +27,21 @@ class ValidateTextureBatchVersions(pyblish.api.InstancePlugin):
|
|||
self.log.info("No workfile present for textures")
|
||||
return
|
||||
|
||||
msg = "Not matching version: texture v{:03d} - workfile {}"
|
||||
assert version_str in wfile, \
|
||||
if version_str not in wfile:
|
||||
msg = "Not matching version: texture v{:03d} - workfile {}"
|
||||
msg.format(
|
||||
instance.data["version"], wfile
|
||||
)
|
||||
raise PublishXmlValidationError(self, msg)
|
||||
|
||||
present_versions = set()
|
||||
for instance in instance.context:
|
||||
present_versions.add(instance.data["version"])
|
||||
|
||||
assert len(present_versions) == 1, "Too many versions in a batch!"
|
||||
if len(present_versions) != 1:
|
||||
msg = "Too many versions in a batch!"
|
||||
found = ','.join(["'{}'".format(val) for val in present_versions])
|
||||
formatting_data = {"found": found}
|
||||
|
||||
raise PublishXmlValidationError(self, msg, key="too_many",
|
||||
formatting_data=formatting_data)
|
||||
|
|
|
|||
|
|
@ -1,11 +1,13 @@
|
|||
import pyblish.api
|
||||
|
||||
import openpype.api
|
||||
from openpype.pipeline import PublishXmlValidationError
|
||||
|
||||
|
||||
class ValidateTextureBatchWorkfiles(pyblish.api.InstancePlugin):
|
||||
"""Validates that textures workfile has collected resources (optional).
|
||||
|
||||
Collected recourses means secondary workfiles (in most cases).
|
||||
Collected resources means secondary workfiles (in most cases).
|
||||
"""
|
||||
|
||||
label = "Validate Texture Workfile Has Resources"
|
||||
|
|
@ -24,6 +26,13 @@ class ValidateTextureBatchWorkfiles(pyblish.api.InstancePlugin):
|
|||
self.log.warning("Only secondary workfile present!")
|
||||
return
|
||||
|
||||
msg = "No secondary workfiles present for workfile {}".\
|
||||
format(instance.data["name"])
|
||||
assert instance.data.get("resources"), msg
|
||||
if not instance.data.get("resources"):
|
||||
msg = "No secondary workfile present for workfile '{}'". \
|
||||
format(instance.data["name"])
|
||||
ext = self.main_workfile_extensions[0]
|
||||
formatting_data = {"file_name": instance.data["name"],
|
||||
"extension": ext}
|
||||
|
||||
raise PublishXmlValidationError(self, msg,
|
||||
formatting_data=formatting_data
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue