From 88e4a159ca79424c156afd832d2f924985b2e46d Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Wed, 9 Oct 2024 14:25:50 +0200 Subject: [PATCH] fix clone --- client/ayon_core/lib/attribute_definitions.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/client/ayon_core/lib/attribute_definitions.py b/client/ayon_core/lib/attribute_definitions.py index 01f5606f17..dd467797f1 100644 --- a/client/ayon_core/lib/attribute_definitions.py +++ b/client/ayon_core/lib/attribute_definitions.py @@ -183,6 +183,11 @@ class AbstractAttrDef(metaclass=AbstractAttrDefMeta): def id(self) -> str: return self._id + def clone(self): + data = self.serialize() + data.pop("type") + return self.deserialize(data) + @property def hidden(self) -> bool: return not self.visible @@ -275,6 +280,9 @@ class AbstractAttrDef(metaclass=AbstractAttrDefMeta): Data can be received using 'serialize' method. """ + if "type" in data: + data = dict(data) + data.pop("type") return cls(**data)