diff --git a/openpype/hosts/houdini/api/plugin.py b/openpype/hosts/houdini/api/plugin.py index 610f260426..d84427bfee 100644 --- a/openpype/hosts/houdini/api/plugin.py +++ b/openpype/hosts/houdini/api/plugin.py @@ -1,17 +1,23 @@ # -*- coding: utf-8 -*- """Houdini specific Avalon/Pyblish plugin definitions.""" +import sys from avalon import houdini +import six + import hou from openpype.api import PypeCreatorMixin +class OpenPypeCreatorError(Exception): + pass + + class Creator(PypeCreatorMixin, houdini.Creator): def process(self): - # reraise as standard Python exception so + instance = super(houdini.Creator, self).process() + # re-raise as standard Python exception so # Avalon can catch it try: - self._process() + self._process(instance) except hou.Error as er: - # cannot do re-raise with six as it will cause - # infinite recursion. - raise Exception(er) + six.reraise(OpenPypeCreatorError, OpenPypeCreatorError("Creator error"), sys.exc_info()[2]) diff --git a/openpype/hosts/houdini/plugins/create/create_alembic_camera.py b/openpype/hosts/houdini/plugins/create/create_alembic_camera.py index a36b6642fa..d65e2a5e98 100644 --- a/openpype/hosts/houdini/plugins/create/create_alembic_camera.py +++ b/openpype/hosts/houdini/plugins/create/create_alembic_camera.py @@ -18,9 +18,13 @@ class CreateAlembicCamera(plugin.Creator): # Set node type to create for output self.data.update({"node_type": "alembic"}) - def _process(self): - instance = super(CreateAlembicCamera, self).process() + def _process(self, instance): + """Creator main entry point. + Args: + instance (hou.Node): Created Houdini instance. + + """ parms = { "filename": "$HIP/pyblish/%s.abc" % self.name, "use_sop_path": False, diff --git a/openpype/hosts/houdini/plugins/create/create_composite.py b/openpype/hosts/houdini/plugins/create/create_composite.py index 06d10f3ad0..d19c97de86 100644 --- a/openpype/hosts/houdini/plugins/create/create_composite.py +++ b/openpype/hosts/houdini/plugins/create/create_composite.py @@ -17,9 +17,13 @@ class CreateCompositeSequence(plugin.Creator): # Type of ROP node to create self.data.update({"node_type": "comp"}) - def _process(self): - instance = super(CreateCompositeSequence, self).process() + def _process(self, instance): + """Creator main entry point. + Args: + instance (hou.Node): Created Houdini instance. + + """ parms = {"copoutput": "$HIP/pyblish/%s.$F4.exr" % self.name} if self.nodes: diff --git a/openpype/hosts/houdini/plugins/create/create_pointcache.py b/openpype/hosts/houdini/plugins/create/create_pointcache.py index 8aef274340..28468bf073 100644 --- a/openpype/hosts/houdini/plugins/create/create_pointcache.py +++ b/openpype/hosts/houdini/plugins/create/create_pointcache.py @@ -17,9 +17,13 @@ class CreatePointCache(plugin.Creator): self.data.update({"node_type": "alembic"}) - def _process(self): - instance = super(CreatePointCache, self).process() + def _process(self, instance): + """Creator main entry point. + Args: + instance (hou.Node): Created Houdini instance. + + """ parms = { "use_sop_path": True, # Export single node from SOP Path "build_from_path": True, # Direct path of primitive in output diff --git a/openpype/hosts/houdini/plugins/create/create_redshift_rop.py b/openpype/hosts/houdini/plugins/create/create_redshift_rop.py index 3798bd8240..06b70a01c2 100644 --- a/openpype/hosts/houdini/plugins/create/create_redshift_rop.py +++ b/openpype/hosts/houdini/plugins/create/create_redshift_rop.py @@ -27,9 +27,13 @@ class CreateRedshiftROP(plugin.Creator): self.data.update({"node_type": "Redshift_ROP"}) - def _process(self): - instance = super(CreateRedshiftROP, self).process() + def _process(self, instance): + """Creator main entry point. + Args: + instance (hou.Node): Created Houdini instance. + + """ basename = instance.name() instance.setName(basename + "_ROP", unique_name=True) diff --git a/openpype/hosts/houdini/plugins/create/create_remote_publish.py b/openpype/hosts/houdini/plugins/create/create_remote_publish.py index 66ed35c618..18074fa560 100644 --- a/openpype/hosts/houdini/plugins/create/create_remote_publish.py +++ b/openpype/hosts/houdini/plugins/create/create_remote_publish.py @@ -9,7 +9,7 @@ class CreateRemotePublish(plugin.Creator): family = "remotePublish" icon = "cloud-upload" - def _process(self): + def _process(self, instance): """This is a stub creator process. This does not create a regular instance that the instance collector diff --git a/openpype/hosts/houdini/plugins/create/create_usd.py b/openpype/hosts/houdini/plugins/create/create_usd.py index 96c56c2918..076197bace 100644 --- a/openpype/hosts/houdini/plugins/create/create_usd.py +++ b/openpype/hosts/houdini/plugins/create/create_usd.py @@ -7,6 +7,7 @@ class CreateUSD(plugin.Creator): label = "USD" family = "usd" icon = "gears" + enabled = False def __init__(self, *args, **kwargs): super(CreateUSD, self).__init__(*args, **kwargs) @@ -16,9 +17,13 @@ class CreateUSD(plugin.Creator): self.data.update({"node_type": "usd"}) - def _process(self): - instance = super(CreateUSD, self).process() + def _process(self, instance): + """Creator main entry point. + Args: + instance (hou.Node): Created Houdini instance. + + """ parms = { "lopoutput": "$HIP/pyblish/%s.usd" % self.name, "enableoutputprocessor_simplerelativepaths": False, diff --git a/openpype/hosts/houdini/plugins/create/create_usd_model.py b/openpype/hosts/houdini/plugins/create/create_usd_model.py index 3e4e7d9d69..5e6bd9e3b0 100644 --- a/openpype/hosts/houdini/plugins/create/create_usd_model.py +++ b/openpype/hosts/houdini/plugins/create/create_usd_model.py @@ -10,8 +10,13 @@ class CreateUSDModel(plugin.Creator): family = "usdModel" icon = "gears" - def _process(self): + def _process(self, instance): + """Creator main entry point. + Args: + instance (hou.Node): Created Houdini instance. + + """ node_type = "op::author_model:1.0" subset = self.data["subset"] @@ -20,6 +25,7 @@ class CreateUSDModel(plugin.Creator): # Get stage root and create node stage = hou.node("/stage") + print("creating node {}/{}".format(node_type, name)) instance = stage.createNode(node_type, node_name=name) instance.moveToGoodPosition(move_unconnected=True) diff --git a/openpype/hosts/houdini/plugins/create/create_usd_workspaces.py b/openpype/hosts/houdini/plugins/create/create_usd_workspaces.py index 2b4577ba41..0e24ca086b 100644 --- a/openpype/hosts/houdini/plugins/create/create_usd_workspaces.py +++ b/openpype/hosts/houdini/plugins/create/create_usd_workspaces.py @@ -10,8 +10,13 @@ class _USDWorkspace(plugin.Creator): step = None icon = "gears" - def _process(self): + def _process(self, instance): + """Creator main entry point. + Args: + instance (hou.Node): Created Houdini instance. + + """ if not all([self.node_type, self.node_name, self.step]): self.log.error("Incomplete USD Workspace parameters") return diff --git a/openpype/hosts/houdini/plugins/create/create_usdrender.py b/openpype/hosts/houdini/plugins/create/create_usdrender.py index 9070457864..5cf03a211f 100644 --- a/openpype/hosts/houdini/plugins/create/create_usdrender.py +++ b/openpype/hosts/houdini/plugins/create/create_usdrender.py @@ -19,9 +19,13 @@ class CreateUSDRender(plugin.Creator): self.data.update({"node_type": "usdrender_rop"}) - def _process(self): - instance = super(CreateUSDRender, self).process() + def _process(self, instance): + """Creator main entry point. + Args: + instance (hou.Node): Created Houdini instance. + + """ parms = { # Render frame range "trange": 1 diff --git a/openpype/hosts/houdini/plugins/create/create_vbd_cache.py b/openpype/hosts/houdini/plugins/create/create_vbd_cache.py index b069be3f83..2047ae2e76 100644 --- a/openpype/hosts/houdini/plugins/create/create_vbd_cache.py +++ b/openpype/hosts/houdini/plugins/create/create_vbd_cache.py @@ -18,9 +18,13 @@ class CreateVDBCache(plugin.Creator): # Set node type to create for output self.data["node_type"] = "geometry" - def _process(self): - instance = super(CreateVDBCache, self).process() + def _process(self, instance): + """Creator main entry point. + Args: + instance (hou.Node): Created Houdini instance. + + """ parms = { "sopoutput": "$HIP/pyblish/%s.$F4.vdb" % self.name, "initsim": True, diff --git a/openpype/settings/defaults/project_settings/houdini.json b/openpype/settings/defaults/project_settings/houdini.json index 811a446e59..809c732d6f 100644 --- a/openpype/settings/defaults/project_settings/houdini.json +++ b/openpype/settings/defaults/project_settings/houdini.json @@ -1,4 +1,46 @@ { + "create": { + "CreateAlembicCamera": { + "enabled": true, + "defaults": [] + }, + "CreateCompositeSequence": { + "enabled": true, + "defaults": [] + }, + "CreatePointCache": { + "enabled": true, + "defaults": [] + }, + "CreateRedshiftROP": { + "enabled": true, + "defaults": [] + }, + "CreateRemotePublish": { + "enabled": true, + "defaults": [] + }, + "CreateVDBCache": { + "enabled": true, + "defaults": [] + }, + "CreateUSD": { + "enabled": false, + "defaults": [] + }, + "CreateUSDModel": { + "enabled": false, + "defaults": [] + }, + "USDCreateShadingWorkspace": { + "enabled": false, + "defaults": [] + }, + "CreateUSDRender": { + "enabled": false, + "defaults": [] + } + }, "publish": { "ValidateContainers": { "enabled": true, diff --git a/openpype/settings/entities/schemas/projects_schema/schema_project_houdini.json b/openpype/settings/entities/schemas/projects_schema/schema_project_houdini.json index c6de257a61..cad99dde22 100644 --- a/openpype/settings/entities/schemas/projects_schema/schema_project_houdini.json +++ b/openpype/settings/entities/schemas/projects_schema/schema_project_houdini.json @@ -5,6 +5,10 @@ "label": "Houdini", "is_file": true, "children": [ + { + "type": "schema", + "name": "schema_houdini_create" + }, { "type": "dict", "collapsible": true, diff --git a/openpype/settings/entities/schemas/projects_schema/schemas/schema_houdini_create.json b/openpype/settings/entities/schemas/projects_schema/schemas/schema_houdini_create.json new file mode 100644 index 0000000000..72b8032d4b --- /dev/null +++ b/openpype/settings/entities/schemas/projects_schema/schemas/schema_houdini_create.json @@ -0,0 +1,54 @@ +{ + "type": "dict", + "collapsible": true, + "key": "create", + "label": "Creator plugins", + "children": [ + { + "type": "schema_template", + "name": "template_create_plugin", + "template_data": [ + { + "key": "CreateAlembicCamera", + "label": "Create Alembic Camera" + }, + { + "key": "CreateCompositeSequence", + "label": "Create Composite (Image Sequence)" + }, + { + "key": "CreatePointCache", + "label": "Create Point Cache" + }, + { + "key": "CreateRedshiftROP", + "label": "Create Redshift ROP" + }, + { + "key": "CreateRemotePublish", + "label": "Create Remote Publish" + }, + { + "key": "CreateVDBCache", + "label": "Create VDB Cache" + }, + { + "key": "CreateUSD", + "label": "Create USD" + }, + { + "key": "CreateUSDModel", + "label": "Create USD Model" + }, + { + "key": "USDCreateShadingWorkspace", + "label": "Create USD Shading Workspace" + }, + { + "key": "CreateUSDRender", + "label": "Create USD Render" + } + ] + } + ] +} \ No newline at end of file