Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support render targets for cache instances #180

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions client/ayon_houdini/plugins/create/create_alembic_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""Creator plugin for creating alembic camera products."""
from ayon_houdini.api import plugin
from ayon_core.pipeline import CreatorError
from ayon_core.lib import EnumDef

import hou

Expand All @@ -14,10 +15,16 @@ class CreateAlembicCamera(plugin.HoudiniCreator):
product_type = "camera"
icon = "camera"

# Default render target
render_target = "local"

def create(self, product_name, instance_data, pre_create_data):
import hou

instance_data.update({"node_type": "alembic"})
creator_attributes = instance_data.setdefault(
"creator_attributes", dict())
creator_attributes["render_target"] = pre_create_data["render_target"]

instance = super(CreateAlembicCamera, self).create(
product_name,
Expand Down Expand Up @@ -54,3 +61,21 @@ def get_network_categories(self):
hou.ropNodeTypeCategory(),
hou.objNodeTypeCategory()
]

def get_instance_attr_defs(self):
render_target_items = {
"local": "Local machine rendering",
"local_no_render": "Use existing frames (local)",
"farm": "Farm Rendering",
}

return [
EnumDef("render_target",
items=render_target_items,
label="Render target",
default=self.render_target)
]

def get_pre_create_attr_defs(self):
attrs = super().get_pre_create_attr_defs()
return attrs + self.get_instance_attr_defs()
20 changes: 15 additions & 5 deletions client/ayon_houdini/plugins/create/create_arnold_ass.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Creator plugin for creating Arnold ASS files."""
from ayon_houdini.api import plugin
from ayon_core.lib import BoolDef
from ayon_core.lib import EnumDef


class CreateArnoldAss(plugin.HoudiniCreator):
Expand All @@ -17,13 +17,16 @@ class CreateArnoldAss(plugin.HoudiniCreator):
# will override it by the value in the project settings
ext = ".ass"

# Default render target
render_target = "local"

def create(self, product_name, instance_data, pre_create_data):
import hou

instance_data.update({"node_type": "arnold"})
creator_attributes = instance_data.setdefault(
"creator_attributes", dict())
creator_attributes["farm"] = pre_create_data["farm"]
creator_attributes["render_target"] = pre_create_data["render_target"]

instance = super(CreateArnoldAss, self).create(
product_name,
Expand Down Expand Up @@ -57,10 +60,17 @@ def create(self, product_name, instance_data, pre_create_data):
self.lock_parameters(instance_node, to_lock)

def get_instance_attr_defs(self):
render_target_items = {
"local": "Local machine rendering",
"local_no_render": "Use existing frames (local)",
"farm": "Farm Rendering",
}

return [
BoolDef("farm",
label="Submitting to Farm",
default=False)
EnumDef("render_target",
items=render_target_items,
label="Render target",
default=self.render_target)
]

def get_pre_create_attr_defs(self):
Expand Down
20 changes: 15 additions & 5 deletions client/ayon_houdini/plugins/create/create_bgeo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from ayon_houdini.api import plugin
from ayon_core.pipeline import CreatorError
import hou
from ayon_core.lib import EnumDef, BoolDef
from ayon_core.lib import EnumDef


class CreateBGEO(plugin.HoudiniCreator):
Expand All @@ -13,6 +13,9 @@ class CreateBGEO(plugin.HoudiniCreator):
product_type = "pointcache"
icon = "gears"

# Default render target
render_target = "local"

def get_publish_families(self):
return ["pointcache", "bgeo"]

Expand All @@ -21,7 +24,7 @@ def create(self, product_name, instance_data, pre_create_data):
instance_data.update({"node_type": "geometry"})
creator_attributes = instance_data.setdefault(
"creator_attributes", dict())
creator_attributes["farm"] = pre_create_data["farm"]
creator_attributes["render_target"] = pre_create_data["render_target"]

instance = super(CreateBGEO, self).create(
product_name,
Expand Down Expand Up @@ -63,10 +66,17 @@ def create(self, product_name, instance_data, pre_create_data):
instance_node.setParms(parms)

def get_instance_attr_defs(self):
render_target_items = {
"local": "Local machine rendering",
"local_no_render": "Use existing frames (local)",
"farm": "Farm Rendering",
}

return [
BoolDef("farm",
label="Submitting to Farm",
default=False)
EnumDef("render_target",
items=render_target_items,
label="Render target",
default=self.render_target)
]

def get_pre_create_attr_defs(self):
Expand Down
20 changes: 15 additions & 5 deletions client/ayon_houdini/plugins/create/create_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"""

from ayon_houdini.api import plugin
from ayon_core.lib import BoolDef
from ayon_core.lib import EnumDef

import hou

Expand All @@ -24,14 +24,17 @@ class CreateModel(plugin.HoudiniCreator):
product_type = "model"
icon = "cube"

# Default render target
render_target = "local"

def get_publish_families(self):
return ["model", "abc"]

def create(self, product_name, instance_data, pre_create_data):
instance_data.update({"node_type": "alembic"})
creator_attributes = instance_data.setdefault(
"creator_attributes", dict())
creator_attributes["farm"] = pre_create_data["farm"]
creator_attributes["render_target"] = pre_create_data["render_target"]

instance = super(CreateModel, self).create(
product_name,
Expand Down Expand Up @@ -130,10 +133,17 @@ def get_obj_output(self, obj_node):
key=lambda node: node.evalParm('outputidx'))

def get_instance_attr_defs(self):
render_target_items = {
"local": "Local machine rendering",
"local_no_render": "Use existing frames (local)",
"farm": "Farm Rendering",
}

return [
BoolDef("farm",
label="Submitting to Farm",
default=False)
EnumDef("render_target",
items=render_target_items,
label="Render target",
default=self.render_target)
]

def get_pre_create_attr_defs(self):
Expand Down
20 changes: 15 additions & 5 deletions client/ayon_houdini/plugins/create/create_pointcache.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Creator plugin for creating pointcache alembics."""
from ayon_houdini.api import plugin
from ayon_core.lib import BoolDef
from ayon_core.lib import EnumDef

import hou

Expand All @@ -14,14 +14,17 @@ class CreatePointCache(plugin.HoudiniCreator):
product_type = "pointcache"
icon = "gears"

# Default render target
render_target = "local"

def get_publish_families(self):
return ["pointcache", "abc"]

def create(self, product_name, instance_data, pre_create_data):
instance_data.update({"node_type": "alembic"})
creator_attributes = instance_data.setdefault(
"creator_attributes", dict())
creator_attributes["farm"] = pre_create_data["farm"]
creator_attributes["render_target"] = pre_create_data["render_target"]

instance = super(CreatePointCache, self).create(
product_name,
Expand Down Expand Up @@ -114,10 +117,17 @@ def get_obj_output(self, obj_node):
key=lambda node: node.evalParm('outputidx'))

def get_instance_attr_defs(self):
render_target_items = {
"local": "Local machine rendering",
"local_no_render": "Use existing frames (local)",
"farm": "Farm Rendering",
}

return [
BoolDef("farm",
label="Submitting to Farm",
default=False)
EnumDef("render_target",
items=render_target_items,
label="Render target",
default=self.render_target)
]

def get_pre_create_attr_defs(self):
Expand Down
20 changes: 15 additions & 5 deletions client/ayon_houdini/plugins/create/create_redshift_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""Creator plugin for creating Redshift proxies."""
from ayon_houdini.api import plugin
import hou
from ayon_core.lib import BoolDef
from ayon_core.lib import EnumDef


class CreateRedshiftProxy(plugin.HoudiniCreator):
Expand All @@ -12,6 +12,9 @@ class CreateRedshiftProxy(plugin.HoudiniCreator):
product_type = "redshiftproxy"
icon = "magic"

# Default render target
render_target = "local"

def create(self, product_name, instance_data, pre_create_data):

# Redshift provides a `Redshift_Proxy_Output` node type which shows
Expand All @@ -24,7 +27,7 @@ def create(self, product_name, instance_data, pre_create_data):
instance_data.update({"node_type": "Redshift_Proxy_Output"})
creator_attributes = instance_data.setdefault(
"creator_attributes", dict())
creator_attributes["farm"] = pre_create_data["farm"]
creator_attributes["render_target"] = pre_create_data["render_target"]

instance = super(CreateRedshiftProxy, self).create(
product_name,
Expand Down Expand Up @@ -53,10 +56,17 @@ def get_network_categories(self):
]

def get_instance_attr_defs(self):
render_target_items = {
"local": "Local machine rendering",
"local_no_render": "Use existing frames (local)",
"farm": "Farm Rendering",
}

return [
BoolDef("farm",
label="Submitting to Farm",
default=False)
EnumDef("render_target",
items=render_target_items,
label="Render target",
default=self.render_target)
]

def get_pre_create_attr_defs(self):
Expand Down
24 changes: 22 additions & 2 deletions client/ayon_houdini/plugins/create/create_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ class CreateReview(plugin.HoudiniCreator):
icon = "video-camera"
review_color_space = ""
node_type = "opengl"

# Default render target
render_target = "local"

# TODO: Publish families should reflect the node type,
# such as `rop.flipbook` for flipbook nodes
Expand All @@ -35,6 +38,9 @@ def apply_settings(self, project_settings):
def create(self, product_name, instance_data, pre_create_data):

self.node_type = pre_create_data.get("node_type")
creator_attributes = instance_data.setdefault(
"creator_attributes", dict())
creator_attributes["render_target"] = pre_create_data["render_target"]

instance_data.update({"node_type": self.node_type})
instance_data["imageFormat"] = pre_create_data.get("imageFormat")
Expand Down Expand Up @@ -121,9 +127,23 @@ def create(self, product_name, instance_data, pre_create_data):
to_lock = ["id", "productType"]

self.lock_parameters(instance_node, to_lock)

def get_instance_attr_defs(self):
render_target_items = {
"local": "Local machine rendering",
"local_no_render": "Use existing frames (local)",
"farm": "Farm Rendering",
}

return [
EnumDef("render_target",
items=render_target_items,
label="Render target",
default=self.render_target)
]

def get_pre_create_attr_defs(self):
attrs = super(CreateReview, self).get_pre_create_attr_defs()
attrs = super().get_pre_create_attr_defs()

image_format_enum = [
"bmp", "cin", "exr", "jpg", "pic", "pic.gz", "png",
Expand Down Expand Up @@ -165,4 +185,4 @@ def get_pre_create_attr_defs(self):
default=1.0,
minimum=0.0001,
decimals=3)
]
] + self.get_instance_attr_defs()
26 changes: 24 additions & 2 deletions client/ayon_houdini/plugins/create/create_staticmesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,15 @@ class CreateStaticMesh(plugin.HoudiniCreator):

default_variants = ["Main"]

# Default render target
render_target = "local"

def create(self, product_name, instance_data, pre_create_data):

instance_data.update({"node_type": "filmboxfbx"})
creator_attributes = instance_data.setdefault(
"creator_attributes", dict())
creator_attributes["render_target"] = pre_create_data["render_target"]

instance = super(CreateStaticMesh, self).create(
product_name,
Expand Down Expand Up @@ -57,11 +63,25 @@ def get_network_categories(self):
hou.objNodeTypeCategory(),
hou.sopNodeTypeCategory()
]

def get_instance_attr_defs(self):
render_target_items = {
"local": "Local machine rendering",
"local_no_render": "Use existing frames (local)",
"farm": "Farm Rendering",
}

return [
EnumDef("render_target",
items=render_target_items,
label="Render target",
default=self.render_target)
]

def get_pre_create_attr_defs(self):
"""Add settings for users. """

attrs = super(CreateStaticMesh, self).get_pre_create_attr_defs()
attrs = super().get_pre_create_attr_defs()
createsubnetroot = BoolDef("createsubnetroot",
tooltip="Create an extra root for the "
"Export node when it's a "
Expand All @@ -85,7 +105,9 @@ def get_pre_create_attr_defs(self):
default=False,
label="Convert Units")

return attrs + [createsubnetroot, vcformat, convert_units]
return attrs + [
createsubnetroot, vcformat, convert_units
] + self.get_instance_attr_defs()

def get_dynamic_data(
self,
Expand Down
Loading