mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
action is using settings
This commit is contained in:
parent
ce179f086a
commit
9beb9c8eb4
1 changed files with 15 additions and 9 deletions
|
|
@ -59,10 +59,8 @@ class PushHierValuesToNonHier(ServerAction):
|
|||
)
|
||||
|
||||
# configurable
|
||||
interest_entity_types = ["Shot"]
|
||||
interest_attributes = ["frameStart", "frameEnd"]
|
||||
|
||||
settings_key = "sync_hier_entity_attributes"
|
||||
settings_enabled_key = "action_enabled"
|
||||
|
||||
def discover(self, session, entities, event):
|
||||
""" Validation """
|
||||
|
|
@ -94,7 +92,7 @@ class PushHierValuesToNonHier(ServerAction):
|
|||
session.commit()
|
||||
|
||||
try:
|
||||
result = self.propagate_values(session, entities)
|
||||
result = self.propagate_values(session, event, entities)
|
||||
job["status"] = "done"
|
||||
session.commit()
|
||||
|
||||
|
|
@ -117,9 +115,9 @@ class PushHierValuesToNonHier(ServerAction):
|
|||
job["status"] = "failed"
|
||||
session.commit()
|
||||
|
||||
def attrs_configurations(self, session, object_ids):
|
||||
def attrs_configurations(self, session, object_ids, interest_attributess):
|
||||
attrs = session.query(self.cust_attrs_query.format(
|
||||
self.join_query_keys(self.interest_attributes),
|
||||
self.join_query_keys(interest_attributes),
|
||||
self.join_query_keys(object_ids)
|
||||
)).all()
|
||||
|
||||
|
|
@ -135,7 +133,14 @@ class PushHierValuesToNonHier(ServerAction):
|
|||
output[obj_id].append(attr)
|
||||
return output, hiearchical
|
||||
|
||||
def propagate_values(self, session, selected_entities):
|
||||
def propagate_values(self, session, event, selected_entities):
|
||||
ftrack_settings = self.get_ftrack_settings(
|
||||
session, event, selected_entities
|
||||
)
|
||||
action_settings = (
|
||||
ftrack_settings[self.settings_frack_subkey][self.settings_key]
|
||||
)
|
||||
|
||||
project_entity = self.get_project_from_entity(selected_entities[0])
|
||||
selected_ids = [entity["id"] for entity in selected_entities]
|
||||
|
||||
|
|
@ -144,7 +149,7 @@ class PushHierValuesToNonHier(ServerAction):
|
|||
))
|
||||
interest_entity_types = tuple(
|
||||
ent_type.lower()
|
||||
for ent_type in self.interest_entity_types
|
||||
for ent_type in action_settings["interest_entity_types"]
|
||||
)
|
||||
all_object_types = session.query("ObjectType").all()
|
||||
object_types_by_low_name = {
|
||||
|
|
@ -164,9 +169,10 @@ class PushHierValuesToNonHier(ServerAction):
|
|||
for obj_type in destination_object_types
|
||||
)
|
||||
|
||||
interest_attributess = action_settings["interest_attributess"]
|
||||
# Find custom attributes definitions
|
||||
attrs_by_obj_id, hier_attrs = self.attrs_configurations(
|
||||
session, destination_object_type_ids
|
||||
session, destination_object_type_ids, interest_attributess
|
||||
)
|
||||
# Filter destination object types if they have any object specific
|
||||
# custom attribute
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue