From 57fb76098d915fd243cfe50cd40f39e61fd7210d Mon Sep 17 00:00:00 2001 From: Arda Kutlu Date: Sun, 24 Sep 2023 00:44:04 +0100 Subject: [PATCH] hotfix for importing scenes --- tik_manager4/objects/work.py | 8 ++++++++ tik_manager4/ui/main.py | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tik_manager4/objects/work.py b/tik_manager4/objects/work.py index a132b010..478d20d8 100644 --- a/tik_manager4/objects/work.py +++ b/tik_manager4/objects/work.py @@ -166,6 +166,14 @@ def load_version(self, version_number): abs_path = self.get_abs_project_path(relative_path) self._dcc_handler.open(abs_path) + def import_version(self, version_number): + """Import the given version of the work to the scene.""" + version_obj = self.get_version(version_number) + if version_obj: + relative_path = version_obj.get("scene_path") + abs_path = self.get_abs_project_path(relative_path) + self._dcc_handler.import_file(abs_path) + def delete_work(self): """Delete the work.""" # TODO: implement this. This should move the work to the purgatory. diff --git a/tik_manager4/ui/main.py b/tik_manager4/ui/main.py index ca13fa58..46aaa8c5 100644 --- a/tik_manager4/ui/main.py +++ b/tik_manager4/ui/main.py @@ -233,7 +233,7 @@ def initialize_mcv(self): self.categories_mcv.work_tree_view.version_created.connect(self._ingest_success) self.categories_mcv.work_tree_view.doubleClicked.connect(self.load_work) self.categories_mcv.work_tree_view.load_event.connect(self.load_work) - self.categories_mcv.work_tree_view.import_event.connect(self.load_work) + self.categories_mcv.work_tree_view.import_event.connect(self.import_work) def set_last_state(self): """Set the last selections for the user""" @@ -416,7 +416,7 @@ def import_work(self): return # get the version selected_version = self.versions_mcv.get_selected_version() - + selected_work_item.work.import_version(selected_version) print(selected_work_item) print(selected_version) print("Not implemented yet.")