fix few validators

This commit is contained in:
Jakub Trllo 2023-02-15 10:46:17 +01:00
parent 71d9ceb91e
commit b3e34fce32
3 changed files with 16 additions and 9 deletions

View file

@ -85,6 +85,5 @@ class ValidateLayersGroup(pyblish.api.InstancePlugin):
),
"expected_group": correct_group["name"],
"layer_names": ", ".join(invalid_layer_names)
}
)

View file

@ -1,5 +1,9 @@
import pyblish.api
from openpype.pipeline import PublishXmlValidationError, registered_host
from openpype.pipeline import (
PublishXmlValidationError,
PublishValidationError,
registered_host,
)
class ValidateWorkfileMetadataRepair(pyblish.api.Action):
@ -27,13 +31,18 @@ class ValidateWorkfileMetadata(pyblish.api.ContextPlugin):
actions = [ValidateWorkfileMetadataRepair]
required_keys = {"project", "asset", "task"}
required_keys = {"project_name", "asset_name", "task_name"}
def process(self, context):
workfile_context = context.data["workfile_context"]
if not workfile_context:
raise AssertionError(
"Current workfile is missing whole metadata about context."
raise PublishValidationError(
"Current workfile is missing whole metadata about context.",
"Missing context",
(
"Current workfile is missing metadata about task."
" To fix this issue save the file using Workfiles tool."
)
)
missing_keys = []

View file

@ -1,4 +1,3 @@
import os
import pyblish.api
from openpype.pipeline import PublishXmlValidationError
@ -16,15 +15,15 @@ class ValidateWorkfileProjectName(pyblish.api.ContextPlugin):
def process(self, context):
workfile_context = context.data.get("workfile_context")
# If workfile context is missing than project is matching to
# `AVALON_PROJECT` value for 100%
# global project
if not workfile_context:
self.log.info(
"Workfile context (\"workfile_context\") is not filled."
)
return
workfile_project_name = workfile_context["project"]
env_project_name = os.environ["AVALON_PROJECT"]
workfile_project_name = workfile_context["project_name"]
env_project_name = context.data["projectName"]
if workfile_project_name == env_project_name:
self.log.info((
"Both workfile project and environment project are same. {}"