From b0e9e35567cab4896e3577e5068f1dda98de19bf Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Tue, 13 Jul 2021 18:56:43 +0200 Subject: [PATCH] implemented basic changes method for AvalonInstance --- openpype/pipeline/creator_plugins.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/openpype/pipeline/creator_plugins.py b/openpype/pipeline/creator_plugins.py index 928a460e1e..83f669b7a6 100644 --- a/openpype/pipeline/creator_plugins.py +++ b/openpype/pipeline/creator_plugins.py @@ -191,6 +191,28 @@ class AvalonInstance: def data(self): return self._data + def changes(self): + changes = {} + new_keys = set() + for key, new_value in self._data.items(): + new_keys.add(key) + if key in ("family_attributes", "publish_attributes"): + continue + + old_value = self._orig_data.get(key) + if old_value != new_value: + changes[key] = (old_value, new_value) + + family_attributes = self.data["family_attributes"] + family_attr_changes = family_attributes.changes() + if family_attr_changes: + changes["family_attributes"] = family_attr_changes + + for key, old_value in self._orig_data.items(): + if key not in new_keys: + changes[key] = (old_value, None) + return changes + @property def family_attribute_defs(self): return self._data["family_attributes"].attr_defs