Merge pull request #4339 from BigRoy/new_publisher_plugin_tweaks

This commit is contained in:
Milan Kolar 2023-01-19 09:25:42 +01:00 committed by GitHub
commit e0b0b51d62
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 37 additions and 22 deletions

View file

@ -106,7 +106,7 @@ class CollectUpstreamInputs(pyblish.api.InstancePlugin):
# If no valid output node is set then ignore it as validation
# will be checking those cases.
self.log.debug(
"No output node found, skipping " "collecting of inputs.."
"No output node found, skipping collecting of inputs.."
)
return

View file

@ -22,7 +22,7 @@ class ValidateAlembicInputNode(pyblish.api.InstancePlugin):
invalid = self.get_invalid(instance)
if invalid:
raise PublishValidationError(
("Primitive types found that are not supported"
("Primitive types found that are not supported "
"for Alembic output."),
title=self.label
)

View file

@ -73,7 +73,7 @@ class ExplicitCleanUp(pyblish.api.ContextPlugin):
)
# Delete folders with it's content
succeded_dirs = set()
succeeded = set()
for dirpath in dirpaths:
# Check if directory still exists
# - it is possible that directory was already deleted with
@ -81,13 +81,13 @@ class ExplicitCleanUp(pyblish.api.ContextPlugin):
if os.path.exists(dirpath):
try:
shutil.rmtree(dirpath)
succeded_dirs.add(dirpath)
succeeded.add(dirpath)
except Exception:
failed.append(dirpath)
if succeded_dirs:
if succeeded:
self.log.info(
"Removed direcoties:\n{}".format("\n".join(succeded_dirs))
"Removed directories:\n{}".format("\n".join(succeeded))
)
# Prepare lines for report of failed removements

View file

@ -144,7 +144,7 @@ class CollectAnatomyInstanceData(pyblish.api.ContextPlugin):
None
"""
self.log.debug("Qeurying latest versions for instances.")
self.log.debug("Querying latest versions for instances.")
hierarchy = {}
names_by_asset_ids = collections.defaultdict(set)
@ -153,7 +153,7 @@ class CollectAnatomyInstanceData(pyblish.api.ContextPlugin):
latest_version = instance.data.get("latestVersion")
instance.data["latestVersion"] = latest_version
# Skip instances withou "assetEntity"
# Skip instances without "assetEntity"
asset_doc = instance.data.get("assetEntity")
if not asset_doc:
continue
@ -162,7 +162,7 @@ class CollectAnatomyInstanceData(pyblish.api.ContextPlugin):
asset_id = asset_doc["_id"]
subset_name = instance.data["subset"]
# Prepare instance hiearchy for faster filling latest versions
# Prepare instance hierarchy for faster filling latest versions
if asset_id not in hierarchy:
hierarchy[asset_id] = {}
if subset_name not in hierarchy[asset_id]:
@ -226,7 +226,7 @@ class CollectAnatomyInstanceData(pyblish.api.ContextPlugin):
"version": version_number
}
# Hiearchy
# Hierarchy
asset_doc = instance.data.get("assetEntity")
if (
asset_doc

View file

@ -65,7 +65,7 @@ class IntegrateHeroVersion(pyblish.api.InstancePlugin):
published_repres = instance.data.get("published_representations")
if not published_repres:
self.log.debug(
"*** There are not published representations on the instance."
"*** There are no published representations on the instance."
)
return

View file

@ -23,7 +23,7 @@ class ValidateContainers(OptionalPyblishPluginMixin,
"""Containers are must be updated to latest version on publish."""
label = "Validate Containers"
label = "Validate Outdated Containers"
order = pyblish.api.ValidatorOrder
hosts = ["maya", "houdini", "nuke", "harmony", "photoshop", "aftereffects"]
optional = True

View file

@ -1,10 +1,11 @@
import pyblish.api
from openpype.pipeline.publish import PublishValidationError
class ValidateVersion(pyblish.api.InstancePlugin):
"""Validate instance version.
Pype is not allowing overwiting previously published versions.
OpenPype does not allow overwriting previously published versions.
"""
order = pyblish.api.ValidatorOrder
@ -20,11 +21,25 @@ class ValidateVersion(pyblish.api.InstancePlugin):
version = instance.data.get("version")
latest_version = instance.data.get("latestVersion")
if latest_version is not None:
if latest_version is not None and int(version) <= int(latest_version):
# TODO: Remove full non-html version upon drop of old publisher
msg = (
"Version `{0}` from instance `{1}` that you are trying to"
" publish, already exists in the database. Version in"
" database: `{2}`. Please version up your workfile to a higher"
" version number than: `{2}`."
"Version '{0}' from instance '{1}' that you are "
" trying to publish is lower or equal to an existing version "
" in the database. Version in database: '{2}'."
"Please version up your workfile to a higher version number "
"than: '{2}'."
).format(version, instance.data["name"], latest_version)
assert (int(version) > int(latest_version)), msg
msg_html = (
"Version <b>{0}</b> from instance <b>{1}</b> that you are "
" trying to publish is lower or equal to an existing version "
" in the database. Version in database: <b>{2}</b>.<br><br>"
"Please version up your workfile to a higher version number "
"than: <b>{2}</b>."
).format(version, instance.data["name"], latest_version)
raise PublishValidationError(
title="Higher version of publish already exists",
message=msg,
description=msg_html
)

View file

@ -581,7 +581,7 @@ def load_jsons_from_dir(path, *args, **kwargs):
Data are loaded recursively from a directory and recreate the
hierarchy as a dictionary.
Entered path hiearchy:
Entered path hierarchy:
|_ folder1
| |_ data1.json
|_ folder2

View file

@ -86,9 +86,9 @@ class CreateWidgetAssetsWidget(SingleSelectAssetsWidget):
class AssetsHierarchyModel(QtGui.QStandardItemModel):
"""Assets hiearrchy model.
"""Assets hierarchy model.
For selecting asset for which should beinstance created.
For selecting asset for which an instance should be created.
Uses controller to load asset hierarchy. All asset documents are stored by
their parents.