From 233210025d874a4614a2e4b2e7dd6aeb45063704 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 30 Jun 2021 20:09:52 +0200 Subject: [PATCH] added change_order method to AvalonInstance class --- openpype/pipeline/creator_plugins.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/openpype/pipeline/creator_plugins.py b/openpype/pipeline/creator_plugins.py index 3361bb5013..9c2d349806 100644 --- a/openpype/pipeline/creator_plugins.py +++ b/openpype/pipeline/creator_plugins.py @@ -52,6 +52,16 @@ class AvalonInstance: if not new and "version" not in self.data: self.data["version"] = None + def change_order(self, keys_order): + data = collections.OrderedDict() + for key in keys_order: + if key in self.data: + data[key] = self.data.pop(key) + + for key in tuple(self.data.keys()): + data[key] = self.data.pop(key) + self.data = data + @staticmethod def from_existing(instance_data): """Convert instance data from workfile to AvalonInstance."""