Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Bugfix/158 ftrack tools are not syncing to avalon #159

Merged
merged 2 commits into from
May 20, 2020
Merged
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
23 changes: 15 additions & 8 deletions pype/ftrack/lib/avalon_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import re
import queue
import collections
import copy

from pype.ftrack.lib.io_nonsingleton import DbConnector

Expand Down Expand Up @@ -756,19 +757,19 @@ def set_cutom_attributes(self):
prepared_avalon_attr_ca_id = avalon_attrs_ca_id.get(attr_key)
if prepared_attrs:
self.entities_dict[entity_id]["custom_attributes"] = (
prepared_attrs.copy()
copy.deepcopy(prepared_attrs)
)
if prepared_attrs_ca_id:
self.entities_dict[entity_id]["custom_attributes_id"] = (
prepared_attrs_ca_id.copy()
copy.deepcopy(prepared_attrs_ca_id)
)
if prepared_avalon_attr:
self.entities_dict[entity_id]["avalon_attrs"] = (
prepared_avalon_attr.copy()
copy.deepcopy(prepared_avalon_attr)
)
if prepared_avalon_attr_ca_id:
self.entities_dict[entity_id]["avalon_attrs_id"] = (
prepared_avalon_attr_ca_id.copy()
copy.deepcopy(prepared_avalon_attr_ca_id)
)

# TODO query custom attributes by entity_id
Expand Down Expand Up @@ -852,7 +853,7 @@ def set_hierarchical_attribute(self, hier_attrs, sync_ids):
# Skip project because has stored defaults at the moment
if entity_dict["entity_type"] == "project":
continue
entity_dict["hier_attrs"] = prepare_dict.copy()
entity_dict["hier_attrs"] = copy.deepcopy(prepare_dict)
for key, val in prepare_dict_avalon.items():
entity_dict["avalon_attrs"][key] = val

Expand All @@ -878,7 +879,13 @@ def set_hierarchical_attribute(self, hier_attrs, sync_ids):

for item in values["data"]:
value = item["value"]
if value is None:
# WARNING It is not possible to propage enumerate hierachical
# attributes with multiselection 100% right. Unseting all values
# will cause inheritance from parent.
if (
value is None
or (isinstance(value, (tuple, list)) and not value)
):
continue
entity_id = item["entity_id"]
key = attribute_key_by_id[item["configuration_id"]]
Expand Down Expand Up @@ -909,7 +916,7 @@ def set_hierarchical_attribute(self, hier_attrs, sync_ids):
while not hier_down_queue.empty():
hier_values, parent_id = hier_down_queue.get()
for child_id in self.entities_dict[parent_id]["children"]:
_hier_values = hier_values.copy()
_hier_values = copy.deepcopy(hier_values)
for key in attributes_by_key.keys():
if key.startswith("avalon_"):
store_key = "avalon_attrs"
Expand Down Expand Up @@ -1891,7 +1898,7 @@ def reload_parents(self, hierarchy_changing_ids):
parents_queue.put((self.ft_project_id, [], False))
while not parents_queue.empty():
ftrack_id, parent_parents, changed = parents_queue.get()
_parents = parent_parents.copy()
_parents = copy.deepcopy(parent_parents)
if ftrack_id not in hierarchy_changing_ids and not changed:
if ftrack_id != self.ft_project_id:
_parents.append(self.entities_dict[ftrack_id]["name"])
Expand Down