diff --git a/client/ayon_houdini/plugins/publish/validate_abc_primitive_to_detail.py b/client/ayon_houdini/plugins/publish/validate_abc_primitive_to_detail.py index f8977f710f..17097ced74 100644 --- a/client/ayon_houdini/plugins/publish/validate_abc_primitive_to_detail.py +++ b/client/ayon_houdini/plugins/publish/validate_abc_primitive_to_detail.py @@ -30,7 +30,7 @@ def process(self, instance): "to detail attributes.", detail=( "See log for more info." - f"Incorrect Rop(s)\n\n - {invalid[0].pah()}" + f"Incorrect Rop(s)\n\n - {invalid[0].path()}" ) ) @@ -45,7 +45,7 @@ def get_invalid(cls, instance): "Ensure a valid SOP output path is set." % rop_node.path() ) - return [rop_node.path()] + return [rop_node] pattern = rop_node.parm("prim_to_detail_pattern").eval().strip() if not pattern: @@ -70,7 +70,7 @@ def get_invalid(cls, instance): "value set, but 'Build Hierarchy from Attribute'" "is enabled." ) - return [rop_node.path()] + return [rop_node] # Let's assume each attribute is explicitly named for now and has no # wildcards for Primitive to Detail. This simplifies the check. @@ -106,7 +106,7 @@ def get_invalid(cls, instance): "Geometry Primitives are missing " "path attribute: `%s`" % path_attr ) - return [output_node.path()] + return [output_node] # Ensure at least a single string value is present if not attrib.strings(): @@ -114,7 +114,7 @@ def get_invalid(cls, instance): "Primitive path attribute has no " "string values: %s" % path_attr ) - return [output_node.path()] + return [output_node] paths = None for attr in pattern.split(" "): @@ -150,4 +150,4 @@ def get_invalid(cls, instance): "Path has multiple values: %s (path: %s)" % (list(values), path) ) - return [output_node.path()] + return [output_node] diff --git a/client/ayon_houdini/plugins/publish/validate_alembic_input_node.py b/client/ayon_houdini/plugins/publish/validate_alembic_input_node.py index aab3068171..d5c750bd1b 100644 --- a/client/ayon_houdini/plugins/publish/validate_alembic_input_node.py +++ b/client/ayon_houdini/plugins/publish/validate_alembic_input_node.py @@ -41,7 +41,7 @@ def get_invalid(cls, instance): "Ensure a valid SOP output path is set." % node.path() ) - return [node.path()] + return [node] if not hasattr(output_node, "geometry"): # In the case someone has explicitly set an Object @@ -63,4 +63,4 @@ def get_invalid(cls, instance): invalid = True if invalid: - return [instance] + return [output_node] diff --git a/client/ayon_houdini/plugins/publish/validate_animation_settings.py b/client/ayon_houdini/plugins/publish/validate_animation_settings.py index 1cc9e24dc9..cd40a0988a 100644 --- a/client/ayon_houdini/plugins/publish/validate_animation_settings.py +++ b/client/ayon_houdini/plugins/publish/validate_animation_settings.py @@ -33,7 +33,7 @@ def process(self, instance): invalid = self.get_invalid(instance) if invalid: raise PublishValidationError( - "Output settings do no match for '%s'" % instance + f"Output settings do no match for '{invalid[0].path()}'" ) @classmethod @@ -43,11 +43,11 @@ def get_invalid(cls, instance): # Check trange parm, 0 means Render Current Frame frame_range = node.evalParm("trange") if frame_range == 0: - return [] + return output_parm = lib.get_output_parameter(node) unexpanded_str = output_parm.unexpandedString() if "$F" not in unexpanded_str: cls.log.error("No frame token found in '%s'" % node.path()) - return [instance] + return [node] diff --git a/client/ayon_houdini/plugins/publish/validate_cop_output_node.py b/client/ayon_houdini/plugins/publish/validate_cop_output_node.py index 1d63e15d90..702aecbc89 100644 --- a/client/ayon_houdini/plugins/publish/validate_cop_output_node.py +++ b/client/ayon_houdini/plugins/publish/validate_cop_output_node.py @@ -27,7 +27,7 @@ def process(self, instance): if invalid: raise PublishValidationError( "Output node '{}' is incorrect. " - "See plug-in log for details.".format(invalid), + "See plug-in log for details.".format(invalid[0].path()), title=self.label, description=( "### Invalid COP output node\n\n" @@ -47,7 +47,7 @@ def get_invalid(cls, instance): "Ensure a valid COP output path is set." % node.path() ) - return [node.path()] + return [node] # Output node must be a Sop node. if not isinstance(output_node, hou.CopNode): @@ -57,7 +57,7 @@ def get_invalid(cls, instance): "instead found category type: %s", output_node.path(), output_node.type().category().name() ) - return [output_node.path()] + return [output_node] # For the sake of completeness also assert the category type # is Cop2 to avoid potential edge case scenarios even though @@ -66,4 +66,4 @@ def get_invalid(cls, instance): cls.log.error( "Output node %s is not of category Cop2.", output_node.path() ) - return [output_node.path()] + return [output_node] diff --git a/client/ayon_houdini/plugins/publish/validate_export_is_a_single_frame.py b/client/ayon_houdini/plugins/publish/validate_export_is_a_single_frame.py index 62bc5e3b44..3970979b76 100644 --- a/client/ayon_houdini/plugins/publish/validate_export_is_a_single_frame.py +++ b/client/ayon_houdini/plugins/publish/validate_export_is_a_single_frame.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- """Validator for checking that export is a single frame.""" +import hou + from ayon_core.pipeline import ( PublishValidationError, OptionalPyblishPluginMixin @@ -26,17 +28,14 @@ def process(self, instance): invalid = self.get_invalid(instance) if invalid: - nodes = [n.path() for n in invalid] raise PublishValidationError( "See log for details. " - "Invalid nodes: {0}".format(nodes) + "Invalid ROP node: {0}".format(invalid[0].path()) ) @classmethod def get_invalid(cls, instance): - invalid = [] - frame_start = instance.data.get("frameStartHandle") frame_end = instance.data.get("frameEndHandle") @@ -48,12 +47,11 @@ def get_invalid(cls, instance): return if frame_start != frame_end: - invalid.append(instance.data["instance_node"]) + rop = hou.node(instance.data["instance_node"]) cls.log.error( "Invalid frame range on '%s'." "You should use the same frame number for 'f1' " "and 'f2' parameters.", - instance.data["instance_node"].path() + rop.path() ) - - return invalid + return [rop] diff --git a/client/ayon_houdini/plugins/publish/validate_file_extension.py b/client/ayon_houdini/plugins/publish/validate_file_extension.py index 1b3a58f4b3..f8a7c63697 100644 --- a/client/ayon_houdini/plugins/publish/validate_file_extension.py +++ b/client/ayon_houdini/plugins/publish/validate_file_extension.py @@ -32,7 +32,7 @@ def process(self, instance): invalid = self.get_invalid(instance) if invalid: raise PublishValidationError( - "ROP node has incorrect file extension: {}".format(invalid), + f"ROP node has incorrect file extension: {invalid[0].path()}", title=self.label ) @@ -61,4 +61,4 @@ def get_invalid(cls, instance): title=cls.label) if output_extension != extension: - return [node.path()] + return [node] diff --git a/client/ayon_houdini/plugins/publish/validate_frame_token.py b/client/ayon_houdini/plugins/publish/validate_frame_token.py index 3d30302e92..201a91fd36 100644 --- a/client/ayon_houdini/plugins/publish/validate_frame_token.py +++ b/client/ayon_houdini/plugins/publish/validate_frame_token.py @@ -33,7 +33,7 @@ def process(self, instance): invalid = self.get_invalid(instance) if invalid: raise PublishValidationError( - "Output settings do no match for '%s'" % instance + f"Output settings do no match for '{invalid[0].path()}'" ) @classmethod @@ -43,11 +43,11 @@ def get_invalid(cls, instance): # Check trange parm, 0 means Render Current Frame frame_range = node.evalParm("trange") if frame_range == 0: - return [] + return output_parm = lib.get_output_parameter(node) unexpanded_str = output_parm.unexpandedString() if "$F" not in unexpanded_str: cls.log.error("No frame token found in '%s'" % node.path()) - return [instance] + return [node] diff --git a/client/ayon_houdini/plugins/publish/validate_mkpaths_toggled.py b/client/ayon_houdini/plugins/publish/validate_mkpaths_toggled.py index 4573d4ba0b..dbca201410 100644 --- a/client/ayon_houdini/plugins/publish/validate_mkpaths_toggled.py +++ b/client/ayon_houdini/plugins/publish/validate_mkpaths_toggled.py @@ -17,9 +17,10 @@ def process(self, instance): invalid = self.get_invalid(instance) if invalid: + nodes = "\n".join(f"- {node.path()}" for node in invalid) raise PublishValidationError( ("Found ROP node with Create Intermediate " - "Directories turned off: {}".format(invalid)), + "Directories turned off:\n {}".format(nodes)), title=self.label) @classmethod @@ -30,6 +31,6 @@ def get_invalid(cls, instance): for node in instance[:]: if node.parm("mkpath").eval() != 1: cls.log.error("Invalid settings found on `%s`" % node.path()) - result.append(node.path()) + result.append(node) return result diff --git a/client/ayon_houdini/plugins/publish/validate_render_product_paths_unique.py b/client/ayon_houdini/plugins/publish/validate_render_product_paths_unique.py index b76be502fb..8eb8f3c829 100644 --- a/client/ayon_houdini/plugins/publish/validate_render_product_paths_unique.py +++ b/client/ayon_houdini/plugins/publish/validate_render_product_paths_unique.py @@ -1,6 +1,6 @@ import inspect from collections import defaultdict -from typing import Dict, List +from typing import Dict, List, Optional import pyblish.api import clique @@ -91,11 +91,11 @@ def process(self, context): ) @classmethod - def get_invalid(cls, context) -> "List[hou.Node]": + def get_invalid(cls, context) -> "Optional[List[hou.Node]]": # Get instances matching this plugin families instances = pyblish.api.instances_by_plugin(list(context), cls) if not instances: - return [] + return # Get expected rendered filepaths paths_to_instance_id = defaultdict(list) @@ -119,7 +119,7 @@ def get_invalid(cls, context) -> "List[hou.Node]": invalid_paths.append(path) if not invalid_instance_ids: - return [] + return # Log invalid sequences as single collection collections, remainder = clique.assemble(invalid_paths) diff --git a/client/ayon_houdini/plugins/publish/validate_subset_name.py b/client/ayon_houdini/plugins/publish/validate_subset_name.py index a63a4f16c7..b00c2d6bc7 100644 --- a/client/ayon_houdini/plugins/publish/validate_subset_name.py +++ b/client/ayon_houdini/plugins/publish/validate_subset_name.py @@ -39,17 +39,14 @@ def process(self, instance): invalid = self.get_invalid(instance) if invalid: - nodes = [n.path() for n in invalid] raise PublishValidationError( "See log for details. " - "Invalid nodes: {0}".format(nodes) + "Invalid ROP node: {0}".format(invalid[0].path()) ) @classmethod def get_invalid(cls, instance): - invalid = [] - rop_node = hou.node(instance.data["instance_node"]) # Check product name @@ -76,13 +73,11 @@ def get_invalid(cls, instance): ) if instance.data.get("productName") != product_name: - invalid.append(rop_node) cls.log.error( "Invalid product name on rop node '%s' should be '%s'.", rop_node.path(), product_name ) - - return invalid + return [rop_node] @classmethod def repair(cls, instance): diff --git a/client/ayon_houdini/plugins/publish/validate_usd_output_node.py b/client/ayon_houdini/plugins/publish/validate_usd_output_node.py index 7ef9a80394..f08227b11f 100644 --- a/client/ayon_houdini/plugins/publish/validate_usd_output_node.py +++ b/client/ayon_houdini/plugins/publish/validate_usd_output_node.py @@ -30,9 +30,8 @@ def process(self, instance): invalid = self.get_invalid(instance) if invalid: - path = invalid[0] raise PublishValidationError( - "Output node '{}' has no valid LOP path set.".format(path), + f"Output node '{invalid[0].path()}' has no valid LOP path set.", title=self.label, description=self.get_description() ) @@ -51,7 +50,7 @@ def get_invalid(cls, instance): "Ensure a valid LOP path is set." % node.path() ) - return [node.path()] + return [node] # Output node must be a Sop node. if not isinstance(output_node, hou.LopNode): @@ -61,7 +60,7 @@ def get_invalid(cls, instance): "instead found category type: %s" % (output_node.path(), output_node.type().category().name()) ) - return [output_node.path()] + return [output_node] def get_description(self): return inspect.cleandoc(