From 2f25119f282945692d65e777edf1540e30c51046 Mon Sep 17 00:00:00 2001 From: MustafaJafar Date: Tue, 6 Aug 2024 17:55:26 +0300 Subject: [PATCH 1/3] add `ValidateWaitForRender` --- .../publish/validate_wait_for_render.py | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 client/ayon_houdini/plugins/publish/validate_wait_for_render.py diff --git a/client/ayon_houdini/plugins/publish/validate_wait_for_render.py b/client/ayon_houdini/plugins/publish/validate_wait_for_render.py new file mode 100644 index 0000000000..8eea655b17 --- /dev/null +++ b/client/ayon_houdini/plugins/publish/validate_wait_for_render.py @@ -0,0 +1,68 @@ +# -*- coding: utf-8 -*- +import hou + +import pyblish.api +from ayon_core.pipeline import PublishValidationError +from ayon_core.pipeline.publish import RepairAction + +from ayon_houdini.api import plugin + + +class EnableWaitForRender(RepairAction): + label = "Enable WaitForRendertoComplete" + icon = "mdi.pencil-plus-outline" + + +class ValidateWaitForRender(plugin.HoudiniInstancePlugin): + """Validate `WaitForRendertoComplete` is enabled. + + Disabling `WaitForRendertoComplete` cause the local render to fail + as the publish execution continues while the render may not be finished yet. + + """ + + order = pyblish.api.ValidatorOrder + families = ["usdrender"] + label = "Validate Wait For Render to Complete" + actions = [EnableWaitForRender] + + def process(self, instance): + + if not instance.data.get("instance_node"): + # Ignore instances without an instance node + # e.g. in memory bootstrap instances + self.log.debug( + "Skipping instance without instance node: {}".format(instance) + ) + return + + if instance.data["creator_attributes"].get("render_target") != "local": + # This validator should work only with local render target. + self.log.debug( + "Skipping Validator, Render target is not 'Local machine rendering'" + ) + return + + invalid = self.get_invalid(instance) + if invalid: + rop = invalid[0] + raise PublishValidationError( + ("ROP node '{}' has 'Wait For Render to Complete' parm disabled." + "Please, enable it.".format(rop.path())), + title=self.label + ) + + @classmethod + def get_invalid(cls, instance): + + rop = hou.node(instance.data["instance_node"]) + if not rop.evalParm("soho_foreground"): + return [rop] + + @classmethod + def repair(cls, instance): + """Enable WaitForRendertoComplete. """ + + rop = hou.node(instance.data["instance_node"]) + rop.parm("soho_foreground").set(True) + From 0c977ba516b6df0663725d9e9e81916415760359 Mon Sep 17 00:00:00 2001 From: Mustafa Jafar Date: Wed, 7 Aug 2024 12:09:19 +0300 Subject: [PATCH 2/3] use f string instead. Co-authored-by: Kayla Man <64118225+moonyuet@users.noreply.github.com> --- client/ayon_houdini/plugins/publish/validate_wait_for_render.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_houdini/plugins/publish/validate_wait_for_render.py b/client/ayon_houdini/plugins/publish/validate_wait_for_render.py index 8eea655b17..13d6c167d5 100644 --- a/client/ayon_houdini/plugins/publish/validate_wait_for_render.py +++ b/client/ayon_houdini/plugins/publish/validate_wait_for_render.py @@ -32,7 +32,7 @@ def process(self, instance): # Ignore instances without an instance node # e.g. in memory bootstrap instances self.log.debug( - "Skipping instance without instance node: {}".format(instance) + f"Skipping instance without instance node: {instance}" ) return From 9f2c93acaa9b78fe05674bef2517d2ae02b30f49 Mon Sep 17 00:00:00 2001 From: MustafaJafar Date: Wed, 7 Aug 2024 12:18:54 +0300 Subject: [PATCH 3/3] use the default form of repair action --- .../plugins/publish/validate_wait_for_render.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/client/ayon_houdini/plugins/publish/validate_wait_for_render.py b/client/ayon_houdini/plugins/publish/validate_wait_for_render.py index 13d6c167d5..09c54878fe 100644 --- a/client/ayon_houdini/plugins/publish/validate_wait_for_render.py +++ b/client/ayon_houdini/plugins/publish/validate_wait_for_render.py @@ -8,11 +8,6 @@ from ayon_houdini.api import plugin -class EnableWaitForRender(RepairAction): - label = "Enable WaitForRendertoComplete" - icon = "mdi.pencil-plus-outline" - - class ValidateWaitForRender(plugin.HoudiniInstancePlugin): """Validate `WaitForRendertoComplete` is enabled. @@ -24,7 +19,7 @@ class ValidateWaitForRender(plugin.HoudiniInstancePlugin): order = pyblish.api.ValidatorOrder families = ["usdrender"] label = "Validate Wait For Render to Complete" - actions = [EnableWaitForRender] + actions = [RepairAction] def process(self, instance):