From 650294b65657d7bbfa5b28b3bbcd2265e44926ce Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Thu, 20 Jan 2022 12:30:06 +0100 Subject: [PATCH] OP-1117 - fix for Adobe products --- openpype/hooks/pre_add_last_workfile_arg.py | 4 +++- openpype/hooks/pre_global_host_data.py | 2 +- openpype/hooks/pre_non_python_host_launch.py | 5 ++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/openpype/hooks/pre_add_last_workfile_arg.py b/openpype/hooks/pre_add_last_workfile_arg.py index 5ca2a42510..4ff5e17edc 100644 --- a/openpype/hooks/pre_add_last_workfile_arg.py +++ b/openpype/hooks/pre_add_last_workfile_arg.py @@ -6,6 +6,8 @@ class AddLastWorkfileToLaunchArgs(PreLaunchHook): """Add last workfile path to launch arguments. This is not possible to do for all applications the same way. + Checks 'start_last_workfile', if set to False, it will not open last + wokfile. This property is set explicitly in Launcher. """ # Execute after workfile template copy @@ -23,7 +25,7 @@ class AddLastWorkfileToLaunchArgs(PreLaunchHook): ] def execute(self): - if not self.data.get("start_last_workfile"): + if not self.data.get("start_last_workfile", True): self.log.info("It is set to not start last workfile on start.") return diff --git a/openpype/hooks/pre_global_host_data.py b/openpype/hooks/pre_global_host_data.py index bae967e25f..3f56c47a42 100644 --- a/openpype/hooks/pre_global_host_data.py +++ b/openpype/hooks/pre_global_host_data.py @@ -43,7 +43,7 @@ class GlobalHostDataHook(PreLaunchHook): "env": self.launch_context.env, - "start_last_workfile": self.data.get("start_last_workfile"), + "start_last_workfile": self.data.get("start_last_workfile", True), "last_workfile_path": self.data.get("last_workfile_path"), "log": self.log diff --git a/openpype/hooks/pre_non_python_host_launch.py b/openpype/hooks/pre_non_python_host_launch.py index 8aa61a9027..5bbc0a4834 100644 --- a/openpype/hooks/pre_non_python_host_launch.py +++ b/openpype/hooks/pre_non_python_host_launch.py @@ -40,7 +40,10 @@ class NonPythonHostHook(PreLaunchHook): ) # Add workfile path if exists workfile_path = self.data["last_workfile_path"] - if workfile_path and os.path.exists(workfile_path): + if ( + self.data.get("start_last_workfile", True) + and workfile_path + and os.path.exists(workfile_path)): new_launch_args.append(workfile_path) # Append as whole list as these areguments should not be separated