Skip to content

Commit

Permalink
revert changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MustafaJafar committed Nov 12, 2024
1 parent ada21e5 commit e09b62f
Showing 1 changed file with 3 additions and 43 deletions.
46 changes: 3 additions & 43 deletions client/ayon_deadline/plugins/publish/global/collect_pools.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,7 @@ def process(self, instance):
instance.data["secondaryPool"] = None

@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):
# TODO: Preferably this would be an enum for the user
# but the Deadline server URL can be dynamic and
# can be set per render instance. Since get_attribute_defs
Expand All @@ -91,42 +83,10 @@ def get_attr_defs_for_instance(cls, create_context, instance):
label="Primary Pool",
default=cls.primary_pool,
tooltip="Deadline primary pool, "
"applicable for farm rendering",
visible=visible),
"applicable for farm rendering"),
TextDef("secondaryPool",
label="Secondary Pool",
default=cls.secondary_pool,
tooltip="Deadline secondary pool, "
"applicable for farm rendering",
visible=visible)
"applicable for farm rendering")
]

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

Please sign in to comment.