Skip to content

Commit

Permalink
revert changes in collect_chunk_size.py
Browse files Browse the repository at this point in the history
  • Loading branch information
MustafaJafar committed Nov 13, 2024
1 parent 2055f8d commit 4f646b5
Showing 1 changed file with 3 additions and 43 deletions.
46 changes: 3 additions & 43 deletions client/ayon_houdini/plugins/publish/collect_chunk_size.py
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 = ["publish.hou"]
families = ["ass", "pointcache", "vdbcache", "redshiftproxy", "model"]
targets = ["local", "remote"]
label = "Collect Chunk Size"
chunk_size = 999999
Expand All @@ -20,52 +20,12 @@ def process(self, instance):
instance.data["chunkSize"] = attr_values.get("chunkSize")

@classmethod
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)

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

@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)

0 comments on commit 4f646b5

Please sign in to comment.