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

Add publish families to cache creators #149

Closed
3 changes: 3 additions & 0 deletions client/ayon_houdini/plugins/create/create_arnold_ass.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ class CreateArnoldAss(plugin.HoudiniCreator):
# will override it by the value in the project settings
ext = ".ass"

def get_publish_families(self):
return ["ass", "publish.hou"]

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

Expand Down
3 changes: 3 additions & 0 deletions client/ayon_houdini/plugins/create/create_bgeo.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ class CreateBGEO(plugin.HoudiniCreator):
product_type = "pointcache"
icon = "gears"

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

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

instance_data.update({"node_type": "geometry"})
Expand Down
3 changes: 3 additions & 0 deletions client/ayon_houdini/plugins/create/create_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ class CreateModel(plugin.HoudiniCreator):
product_type = "model"
icon = "cube"

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

def create(self, product_name, instance_data, pre_create_data):
instance_data.update({"node_type": "alembic"})
creator_attributes = instance_data.setdefault(
Expand Down
3 changes: 3 additions & 0 deletions client/ayon_houdini/plugins/create/create_pointcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ class CreatePointCache(plugin.HoudiniCreator):
product_type = "pointcache"
icon = "gears"

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

def create(self, product_name, instance_data, pre_create_data):
instance_data.update({"node_type": "alembic"})
creator_attributes = instance_data.setdefault(
Expand Down
3 changes: 3 additions & 0 deletions client/ayon_houdini/plugins/create/create_redshift_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ class CreateRedshiftProxy(plugin.HoudiniCreator):
product_type = "redshiftproxy"
icon = "magic"

def get_publish_families(self):
return ["redshiftproxy", "publish.hou"]

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

# Redshift provides a `Redshift_Proxy_Output` node type which shows
Expand Down
3 changes: 3 additions & 0 deletions client/ayon_houdini/plugins/create/create_vbd_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ class CreateVDBCache(plugin.HoudiniCreator):
product_type = "vdbcache"
icon = "cloud"

def get_publish_families(self):
return ["vbdcache", "publish.hou"]

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

Expand Down
46 changes: 43 additions & 3 deletions client/ayon_houdini/plugins/publish/collect_chunk_size.py
MustafaJafar marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class CollectChunkSize(plugin.HoudiniInstancePlugin,
"""Collect chunk size for cache submission to Deadline."""

order = pyblish.api.CollectorOrder + 0.05
families = ["ass", "pointcache", "vdbcache", "redshiftproxy", "model"]
families = ["publish.hou"]
targets = ["local", "remote"]
label = "Collect Chunk Size"
chunk_size = 999999
Expand All @@ -20,12 +20,52 @@ def process(self, instance):
instance.data["chunkSize"] = attr_values.get("chunkSize")

@classmethod
def get_attribute_defs(cls):
def get_attr_defs_for_instance(cls, create_context, instance):
# Filtering of instance, if needed, can be customized
if not cls.instance_matches_plugin_families(instance):
return []

# Attributes logic
creator_attributes = instance["creator_attributes"]

visible = creator_attributes.get("farm", False)

return [
NumberDef("chunkSize",
minimum=1,
maximum=999999,
decimals=0,
default=cls.chunk_size,
label="Frame Per Task")
label="Frame Per Task",
visible=visible)
]

@classmethod
def register_create_context_callbacks(cls, create_context):
create_context.add_value_changed_callback(cls.on_values_changed)

@classmethod
def on_values_changed(cls, event):
"""Update instance attribute definitions on attribute changes."""

# Update attributes if any of the following plug-in attributes
# change:
keys = ["farm"]

for instance_change in event["changes"]:
instance = instance_change["instance"]
if not cls.instance_matches_plugin_families(instance):
continue
value_changes = instance_change["changes"]
plugin_attribute_changes = (
value_changes.get("creator_attributes", {})
.get(cls.__name__, {}))

if not any(key in plugin_attribute_changes for key in keys):
continue

# Update the attribute definitions
new_attrs = cls.get_attr_defs_for_instance(
event["create_context"], instance
)
instance.set_publish_plugin_attr_defs(cls.__name__, new_attrs)
24 changes: 0 additions & 24 deletions client/ayon_houdini/plugins/publish/collect_instances_type.py
MustafaJafar marked this conversation as resolved.
Show resolved Hide resolved

This file was deleted.