From ff6fe13e2a6049e61b829905f2e3bb9f1b0b4cc5 Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Tue, 17 Jan 2023 16:05:58 +0000 Subject: [PATCH] Code cosmetics --- openpype/hooks/pre_add_last_workfile_arg.py | 6 ++---- openpype/hosts/maya/startup/userSetup.py | 9 +++++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/openpype/hooks/pre_add_last_workfile_arg.py b/openpype/hooks/pre_add_last_workfile_arg.py index ffb116d2e4..ce59c0b706 100644 --- a/openpype/hooks/pre_add_last_workfile_arg.py +++ b/openpype/hooks/pre_add_last_workfile_arg.py @@ -43,11 +43,9 @@ class AddLastWorkfileToLaunchArgs(PreLaunchHook): return # Determine whether to open workfile post initialization. - if self.data["app"].host_name == "maya": - project_name = self.data["project_name"] - settings = get_project_settings(project_name) + if self.host_name == "maya": key = "open_workfile_post_initialization" - if settings["maya"][key]: + if self.data["project_settings"]["maya"][key]: self.log.debug("Opening workfile post initialization.") self.data["env"]["OPENPYPE_" + key.upper()] = "1" return diff --git a/openpype/hosts/maya/startup/userSetup.py b/openpype/hosts/maya/startup/userSetup.py index 5cd27500dc..87025637b6 100644 --- a/openpype/hosts/maya/startup/userSetup.py +++ b/openpype/hosts/maya/startup/userSetup.py @@ -1,5 +1,6 @@ import os import shutil +from functools import partial from openpype.settings import get_project_settings from openpype.pipeline import install_host @@ -18,8 +19,12 @@ print("Starting OpenPype usersetup...") key = "OPENPYPE_OPEN_WORKFILE_POST_INITIALIZATION" if bool(int(os.environ.get(key, "0"))): cmds.evalDeferred( - "cmds.file(os.environ[\"AVALON_LAST_WORKFILE\"], open=True," - " force=True)", + partial( + cmds.file, + os.environ["AVALON_LAST_WORKFILE"], + open=True, + force=True + ), lowestPriority=True )