From 36eeb976f78cd3a038454caeebdad0703f673c4f Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Thu, 26 Jan 2023 16:04:41 +0100 Subject: [PATCH] New style creator --- .../houdini/plugins/create/create_review.py | 43 ++++++++++--------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/openpype/hosts/houdini/plugins/create/create_review.py b/openpype/hosts/houdini/plugins/create/create_review.py index 36d87ba8de..a1bcfc23ed 100644 --- a/openpype/hosts/houdini/plugins/create/create_review.py +++ b/openpype/hosts/houdini/plugins/create/create_review.py @@ -1,9 +1,14 @@ from openpype.hosts.houdini.api import plugin +from openpype.pipeline import ( + CreatedInstance, + OpenPypePyblishPluginMixin +) -class CreateReview(plugin.Creator): +class CreateReview(plugin.HoudiniCreator, OpenPypePyblishPluginMixin): """Review with OpenGL ROP""" + identifier = "io.openpype.creators.houdini.review" label = "Review" family = "review" icon = "video-camera" @@ -15,27 +20,26 @@ class CreateReview(plugin.Creator): height = 720 aspect = 1.0 - def __init__(self, *args, **kwargs): - super(CreateReview, self).__init__(*args, **kwargs) + def create(self, subset_name, instance_data, pre_create_data): + + import hou # Remove the active, we are checking the bypass flag of the nodes - self.data.pop("active", None) + instance_data.pop("active", None) - self.data.update({"node_type": "opengl"}) + instance_data["node_type"] = "opengl" - def _process(self, instance): - """Creator main entry point. + instance = super(CreateReview, self).create( + subset_name, + instance_data, + pre_create_data) # type: CreatedInstance - Args: - instance (hou.Node): Created Houdini instance. - - """ - import hou + instance_node = hou.node(instance.get("instance_node")) frame_range = hou.playbar.frameRange() parms = { - "picture": "$HIP/pyblish/{0}/{0}.$F4.png".format(self.name), + "picture": '$HIP/pyblish/`chs("subset")`/`chs("subset")`.$F4.png', # Render frame range "trange": 1, @@ -55,19 +59,16 @@ class CreateReview(plugin.Creator): "aspect": self.aspect }) - if self.nodes: + if self.selected_nodes: # todo: allow only object paths? - node_paths = " ".join(node.path() for node in self.nodes) + node_paths = " ".join(node.path() for node in self.selected_nodes) parms.update({"scenepath": node_paths}) - instance.setParms(parms) + instance_node.setParms(parms) # Lock any parameters in this list to_lock = [ - # Lock some Avalon attributes "family", - "id", + "id" ] - for name in to_lock: - parm = instance.parm(name) - parm.lock(True) + self.lock_parameters(instance_node, to_lock)