From 7bd067d5a5097def4a234f9d230ab9189f40cfc9 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Thu, 30 Nov 2023 15:29:47 +0100 Subject: [PATCH 1/6] fusion: adding ayon menu --- openpype/hosts/fusion/api/menu.py | 9 ++- .../hosts/fusion/deploy_ayon/Config/menu.fu | 60 +++++++++++++++++++ .../fusion/deploy_ayon/MenuScripts/README.md | 6 ++ .../MenuScripts/install_pyside2.py | 29 +++++++++ .../fusion/deploy_ayon/MenuScripts/menu.py | 48 +++++++++++++++ .../fusion/deploy_ayon/fusion_shared.prefs | 19 ++++++ .../fusion/hooks/pre_fusion_profile_hook.py | 8 ++- .../hosts/fusion/hooks/pre_fusion_setup.py | 9 ++- 8 files changed, 183 insertions(+), 5 deletions(-) create mode 100644 openpype/hosts/fusion/deploy_ayon/Config/menu.fu create mode 100644 openpype/hosts/fusion/deploy_ayon/MenuScripts/README.md create mode 100644 openpype/hosts/fusion/deploy_ayon/MenuScripts/install_pyside2.py create mode 100644 openpype/hosts/fusion/deploy_ayon/MenuScripts/menu.py create mode 100644 openpype/hosts/fusion/deploy_ayon/fusion_shared.prefs diff --git a/openpype/hosts/fusion/api/menu.py b/openpype/hosts/fusion/api/menu.py index 50250a6656..0b9ad1a43b 100644 --- a/openpype/hosts/fusion/api/menu.py +++ b/openpype/hosts/fusion/api/menu.py @@ -1,3 +1,4 @@ +import os import sys from qtpy import QtWidgets, QtCore, QtGui @@ -18,6 +19,10 @@ from openpype.resources import get_openpype_icon_filepath from .pipeline import FusionEventHandler from .pulse import FusionPulse + +MENU_LABEL = os.environ["AVALON_LABEL"] + + self = sys.modules[__name__] self.menu = None @@ -26,7 +31,7 @@ class OpenPypeMenu(QtWidgets.QWidget): def __init__(self, *args, **kwargs): super(OpenPypeMenu, self).__init__(*args, **kwargs) - self.setObjectName("OpenPypeMenu") + self.setObjectName(f"{MENU_LABEL}Menu") icon_path = get_openpype_icon_filepath() icon = QtGui.QIcon(icon_path) @@ -41,7 +46,7 @@ class OpenPypeMenu(QtWidgets.QWidget): | QtCore.Qt.WindowStaysOnTopHint ) self.render_mode_widget = None - self.setWindowTitle("OpenPype") + self.setWindowTitle(MENU_LABEL) asset_label = QtWidgets.QLabel("Context", self) asset_label.setStyleSheet( diff --git a/openpype/hosts/fusion/deploy_ayon/Config/menu.fu b/openpype/hosts/fusion/deploy_ayon/Config/menu.fu new file mode 100644 index 0000000000..2846497a9e --- /dev/null +++ b/openpype/hosts/fusion/deploy_ayon/Config/menu.fu @@ -0,0 +1,60 @@ +{ + Action + { + ID = "AYON_Menu", + Category = "AYON", + Name = "AYON Menu", + + Targets = + { + Composition = + { + Execute = _Lua [=[ + local scriptPath = app:MapPath("AYON:MenuScripts/menu.py") + if bmd.fileexists(scriptPath) == false then + print("[AYON Error] Can't run file: " .. scriptPath) + else + target:RunScript(scriptPath) + end + ]=], + }, + }, + }, + Action + { + ID = "AYON_Install_PySide2", + Category = "AYON", + Name = "Install PySide2", + + Targets = + { + Composition = + { + Execute = _Lua [=[ + local scriptPath = app:MapPath("AYON:MenuScripts/install_pyside2.py") + if bmd.fileexists(scriptPath) == false then + print("[AYON Error] Can't run file: " .. scriptPath) + else + target:RunScript(scriptPath) + end + ]=], + }, + }, + }, + Menus + { + Target = "ChildFrame", + + Before "Help" + { + Sub "AYON" + { + "AYON_Menu{}", + "_", + Sub "Admin" { + "AYON_Install_PySide2{}" + } + } + }, + }, +} diff --git a/openpype/hosts/fusion/deploy_ayon/MenuScripts/README.md b/openpype/hosts/fusion/deploy_ayon/MenuScripts/README.md new file mode 100644 index 0000000000..9076f240ad --- /dev/null +++ b/openpype/hosts/fusion/deploy_ayon/MenuScripts/README.md @@ -0,0 +1,6 @@ +### Ayon deploy MenuScripts + +Note that this `MenuScripts` is not an official Fusion folder. +Ayon only uses this folder in `{fusion}/deploy/` to trigger the Ayon menu actions. + +They are used in the actions defined in `.fu` files in `{fusion}/deploy_ayon/Config`. diff --git a/openpype/hosts/fusion/deploy_ayon/MenuScripts/install_pyside2.py b/openpype/hosts/fusion/deploy_ayon/MenuScripts/install_pyside2.py new file mode 100644 index 0000000000..e1240fd677 --- /dev/null +++ b/openpype/hosts/fusion/deploy_ayon/MenuScripts/install_pyside2.py @@ -0,0 +1,29 @@ +# This is just a quick hack for users running Py3 locally but having no +# Qt library installed +import os +import subprocess +import importlib + + +try: + from qtpy import API_NAME + + print(f"Qt binding: {API_NAME}") + mod = importlib.import_module(API_NAME) + print(f"Qt path: {mod.__file__}") + print("Qt library found, nothing to do..") + +except ImportError: + print("Assuming no Qt library is installed..") + print('Installing PySide2 for Python 3.6: ' + f'{os.environ["FUSION16_PYTHON36_HOME"]}') + + # Get full path to python executable + exe = "python.exe" if os.name == 'nt' else "python" + python = os.path.join(os.environ["FUSION16_PYTHON36_HOME"], exe) + assert os.path.exists(python), f"Python doesn't exist: {python}" + + # Do python -m pip install PySide2 + args = [python, "-m", "pip", "install", "PySide2"] + print(f"Args: {args}") + subprocess.Popen(args) diff --git a/openpype/hosts/fusion/deploy_ayon/MenuScripts/menu.py b/openpype/hosts/fusion/deploy_ayon/MenuScripts/menu.py new file mode 100644 index 0000000000..1c58ee50e4 --- /dev/null +++ b/openpype/hosts/fusion/deploy_ayon/MenuScripts/menu.py @@ -0,0 +1,48 @@ +import os +import sys + +if sys.version_info < (3, 7): + # hack to handle discrepancy between distributed libraries and Python 3.6 + # mostly because wrong version of urllib3 + # TODO remove when not necessary + from openpype import PACKAGE_DIR + FUSION_HOST_DIR = os.path.join(PACKAGE_DIR, "hosts", "fusion") + + vendor_path = os.path.join(FUSION_HOST_DIR, "vendor") + if vendor_path not in sys.path: + sys.path.insert(0, vendor_path) + + print(f"Added vendorized libraries from {vendor_path}") + +from openpype.lib import Logger +from openpype.pipeline import ( + install_host, + registered_host, +) + + +def main(env): + # This script working directory starts in Fusion application folder. + # However the contents of that folder can conflict with Qt library dlls + # so we make sure to move out of it to avoid DLL Load Failed errors. + os.chdir("..") + from openpype.hosts.fusion.api import FusionHost + from openpype.hosts.fusion.api import menu + + # activate resolve from pype + install_host(FusionHost()) + + log = Logger.get_logger(__name__) + log.info(f"Registered host: {registered_host()}") + + menu.launch_openpype_menu() + + # Initiate a QTimer to check if Fusion is still alive every X interval + # If Fusion is not found - kill itself + # todo(roy): Implement timer that ensures UI doesn't remain when e.g. + # Fusion closes down + + +if __name__ == "__main__": + result = main(os.environ) + sys.exit(not bool(result)) diff --git a/openpype/hosts/fusion/deploy_ayon/fusion_shared.prefs b/openpype/hosts/fusion/deploy_ayon/fusion_shared.prefs new file mode 100644 index 0000000000..b5e8e3d024 --- /dev/null +++ b/openpype/hosts/fusion/deploy_ayon/fusion_shared.prefs @@ -0,0 +1,19 @@ +{ +Locked = true, +Global = { + Paths = { + Map = { + ["AYON:"] = "$(AYON_FUSION)/deploy_ayon", + ["Config:"] = "UserPaths:Config;AYON:Config", + ["Scripts:"] = "UserPaths:Scripts;Reactor:System/Scripts", + }, + }, + Script = { + PythonVersion = 3, + Python3Forced = true + }, + UserInterface = { + Language = "en_US" + }, + }, +} diff --git a/openpype/hosts/fusion/hooks/pre_fusion_profile_hook.py b/openpype/hosts/fusion/hooks/pre_fusion_profile_hook.py index 66b0f803aa..9e61d11e6e 100644 --- a/openpype/hosts/fusion/hooks/pre_fusion_profile_hook.py +++ b/openpype/hosts/fusion/hooks/pre_fusion_profile_hook.py @@ -2,6 +2,7 @@ import os import shutil import platform from pathlib import Path +from openpype import AYON_SERVER_ENABLED from openpype.hosts.fusion import ( FUSION_HOST_DIR, FUSION_VERSIONS_DICT, @@ -161,6 +162,11 @@ class FusionCopyPrefsPrelaunch(PreLaunchHook): # profile directory variables to customize Fusion # to define where it can read custom scripts and tools from master_prefs_variable = f"FUSION{profile_version}_MasterPrefs" - master_prefs = Path(FUSION_HOST_DIR, "deploy", "fusion_shared.prefs") + + if AYON_SERVER_ENABLED: + master_prefs = Path(FUSION_HOST_DIR, "deploy_ayon", "fusion_shared.prefs") + else: + master_prefs = Path(FUSION_HOST_DIR, "deploy", "fusion_shared.prefs") + self.log.info(f"Setting {master_prefs_variable}: {master_prefs}") self.launch_context.env[master_prefs_variable] = str(master_prefs) diff --git a/openpype/hosts/fusion/hooks/pre_fusion_setup.py b/openpype/hosts/fusion/hooks/pre_fusion_setup.py index 576628e876..bd7f35f900 100644 --- a/openpype/hosts/fusion/hooks/pre_fusion_setup.py +++ b/openpype/hosts/fusion/hooks/pre_fusion_setup.py @@ -1,4 +1,5 @@ import os +from openpype import AYON_SERVER_ENABLED from openpype.lib.applications import ( PreLaunchHook, LaunchTypes, @@ -64,5 +65,9 @@ class FusionPrelaunch(PreLaunchHook): self.launch_context.env[py3_var] = py3_dir - self.log.info(f"Setting OPENPYPE_FUSION: {FUSION_HOST_DIR}") - self.launch_context.env["OPENPYPE_FUSION"] = FUSION_HOST_DIR + if AYON_SERVER_ENABLED: + self.log.info(f"Setting AYON_FUSION: {FUSION_HOST_DIR}") + self.launch_context.env["AYON_FUSION"] = FUSION_HOST_DIR + else: + self.log.info(f"Setting OPENPYPE_FUSION: {FUSION_HOST_DIR}") + self.launch_context.env["OPENPYPE_FUSION"] = FUSION_HOST_DIR From 9246dfeec10dd80ab0b608a48517446fb64ce220 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Thu, 30 Nov 2023 15:44:34 +0100 Subject: [PATCH 2/6] hound --- openpype/hosts/fusion/hooks/pre_fusion_profile_hook.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openpype/hosts/fusion/hooks/pre_fusion_profile_hook.py b/openpype/hosts/fusion/hooks/pre_fusion_profile_hook.py index 9e61d11e6e..0b6626777e 100644 --- a/openpype/hosts/fusion/hooks/pre_fusion_profile_hook.py +++ b/openpype/hosts/fusion/hooks/pre_fusion_profile_hook.py @@ -164,9 +164,11 @@ class FusionCopyPrefsPrelaunch(PreLaunchHook): master_prefs_variable = f"FUSION{profile_version}_MasterPrefs" if AYON_SERVER_ENABLED: - master_prefs = Path(FUSION_HOST_DIR, "deploy_ayon", "fusion_shared.prefs") + master_prefs = Path( + FUSION_HOST_DIR, "deploy_ayon", "fusion_shared.prefs") else: - master_prefs = Path(FUSION_HOST_DIR, "deploy", "fusion_shared.prefs") + master_prefs = Path( + FUSION_HOST_DIR, "deploy", "fusion_shared.prefs") self.log.info(f"Setting {master_prefs_variable}: {master_prefs}") self.launch_context.env[master_prefs_variable] = str(master_prefs) From 120c0d0b608f684af947cb8d30781cd8c458f27d Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Mon, 4 Dec 2023 17:00:49 +0100 Subject: [PATCH 3/6] avoiding duplicity of code --- .../MenuScripts/menu.py | 0 .../deploy/MenuScripts/openpype_menu.py | 48 ------------------- .../ayon}/Config/menu.fu | 4 +- .../ayon}/fusion_shared.prefs | 3 +- .../Config/menu.fu} | 4 +- .../deploy/{ => openpype}/fusion_shared.prefs | 3 +- .../fusion/deploy_ayon/MenuScripts/README.md | 6 --- .../MenuScripts/install_pyside2.py | 29 ----------- .../fusion/hooks/pre_fusion_profile_hook.py | 4 +- .../hosts/fusion/hooks/pre_fusion_setup.py | 8 +--- 10 files changed, 12 insertions(+), 97 deletions(-) rename openpype/hosts/fusion/{deploy_ayon => deploy}/MenuScripts/menu.py (100%) delete mode 100644 openpype/hosts/fusion/deploy/MenuScripts/openpype_menu.py rename openpype/hosts/fusion/{deploy_ayon => deploy/ayon}/Config/menu.fu (88%) rename openpype/hosts/fusion/{deploy_ayon => deploy/ayon}/fusion_shared.prefs (75%) rename openpype/hosts/fusion/deploy/{Config/openpype_menu.fu => openpype/Config/menu.fu} (87%) rename openpype/hosts/fusion/deploy/{ => openpype}/fusion_shared.prefs (73%) delete mode 100644 openpype/hosts/fusion/deploy_ayon/MenuScripts/README.md delete mode 100644 openpype/hosts/fusion/deploy_ayon/MenuScripts/install_pyside2.py diff --git a/openpype/hosts/fusion/deploy_ayon/MenuScripts/menu.py b/openpype/hosts/fusion/deploy/MenuScripts/menu.py similarity index 100% rename from openpype/hosts/fusion/deploy_ayon/MenuScripts/menu.py rename to openpype/hosts/fusion/deploy/MenuScripts/menu.py diff --git a/openpype/hosts/fusion/deploy/MenuScripts/openpype_menu.py b/openpype/hosts/fusion/deploy/MenuScripts/openpype_menu.py deleted file mode 100644 index 1c58ee50e4..0000000000 --- a/openpype/hosts/fusion/deploy/MenuScripts/openpype_menu.py +++ /dev/null @@ -1,48 +0,0 @@ -import os -import sys - -if sys.version_info < (3, 7): - # hack to handle discrepancy between distributed libraries and Python 3.6 - # mostly because wrong version of urllib3 - # TODO remove when not necessary - from openpype import PACKAGE_DIR - FUSION_HOST_DIR = os.path.join(PACKAGE_DIR, "hosts", "fusion") - - vendor_path = os.path.join(FUSION_HOST_DIR, "vendor") - if vendor_path not in sys.path: - sys.path.insert(0, vendor_path) - - print(f"Added vendorized libraries from {vendor_path}") - -from openpype.lib import Logger -from openpype.pipeline import ( - install_host, - registered_host, -) - - -def main(env): - # This script working directory starts in Fusion application folder. - # However the contents of that folder can conflict with Qt library dlls - # so we make sure to move out of it to avoid DLL Load Failed errors. - os.chdir("..") - from openpype.hosts.fusion.api import FusionHost - from openpype.hosts.fusion.api import menu - - # activate resolve from pype - install_host(FusionHost()) - - log = Logger.get_logger(__name__) - log.info(f"Registered host: {registered_host()}") - - menu.launch_openpype_menu() - - # Initiate a QTimer to check if Fusion is still alive every X interval - # If Fusion is not found - kill itself - # todo(roy): Implement timer that ensures UI doesn't remain when e.g. - # Fusion closes down - - -if __name__ == "__main__": - result = main(os.environ) - sys.exit(not bool(result)) diff --git a/openpype/hosts/fusion/deploy_ayon/Config/menu.fu b/openpype/hosts/fusion/deploy/ayon/Config/menu.fu similarity index 88% rename from openpype/hosts/fusion/deploy_ayon/Config/menu.fu rename to openpype/hosts/fusion/deploy/ayon/Config/menu.fu index 2846497a9e..deecc0f806 100644 --- a/openpype/hosts/fusion/deploy_ayon/Config/menu.fu +++ b/openpype/hosts/fusion/deploy/ayon/Config/menu.fu @@ -10,7 +10,7 @@ Composition = { Execute = _Lua [=[ - local scriptPath = app:MapPath("AYON:MenuScripts/menu.py") + local scriptPath = app:MapPath("DEPLOY:MenuScripts/menu.py") if bmd.fileexists(scriptPath) == false then print("[AYON Error] Can't run file: " .. scriptPath) else @@ -31,7 +31,7 @@ Composition = { Execute = _Lua [=[ - local scriptPath = app:MapPath("AYON:MenuScripts/install_pyside2.py") + local scriptPath = app:MapPath("DEPLOY:MenuScripts/install_pyside2.py") if bmd.fileexists(scriptPath) == false then print("[AYON Error] Can't run file: " .. scriptPath) else diff --git a/openpype/hosts/fusion/deploy_ayon/fusion_shared.prefs b/openpype/hosts/fusion/deploy/ayon/fusion_shared.prefs similarity index 75% rename from openpype/hosts/fusion/deploy_ayon/fusion_shared.prefs rename to openpype/hosts/fusion/deploy/ayon/fusion_shared.prefs index b5e8e3d024..90296c898e 100644 --- a/openpype/hosts/fusion/deploy_ayon/fusion_shared.prefs +++ b/openpype/hosts/fusion/deploy/ayon/fusion_shared.prefs @@ -3,7 +3,8 @@ Locked = true, Global = { Paths = { Map = { - ["AYON:"] = "$(AYON_FUSION)/deploy_ayon", + ["DEPLOY:"] = "$(OPENPYPE_FUSION)/deploy", + ["AYON:"] = "$(OPENPYPE_FUSION)/deploy/ayon", ["Config:"] = "UserPaths:Config;AYON:Config", ["Scripts:"] = "UserPaths:Scripts;Reactor:System/Scripts", }, diff --git a/openpype/hosts/fusion/deploy/Config/openpype_menu.fu b/openpype/hosts/fusion/deploy/openpype/Config/menu.fu similarity index 87% rename from openpype/hosts/fusion/deploy/Config/openpype_menu.fu rename to openpype/hosts/fusion/deploy/openpype/Config/menu.fu index 8b8d448259..6b325917c6 100644 --- a/openpype/hosts/fusion/deploy/Config/openpype_menu.fu +++ b/openpype/hosts/fusion/deploy/openpype/Config/menu.fu @@ -10,7 +10,7 @@ Composition = { Execute = _Lua [=[ - local scriptPath = app:MapPath("OpenPype:MenuScripts/openpype_menu.py") + local scriptPath = app:MapPath("DEPLOY:MenuScripts/menu.py") if bmd.fileexists(scriptPath) == false then print("[OpenPype Error] Can't run file: " .. scriptPath) else @@ -31,7 +31,7 @@ Composition = { Execute = _Lua [=[ - local scriptPath = app:MapPath("OpenPype:MenuScripts/install_pyside2.py") + local scriptPath = app:MapPath("DEPLOY:MenuScripts/install_pyside2.py") if bmd.fileexists(scriptPath) == false then print("[OpenPype Error] Can't run file: " .. scriptPath) else diff --git a/openpype/hosts/fusion/deploy/fusion_shared.prefs b/openpype/hosts/fusion/deploy/openpype/fusion_shared.prefs similarity index 73% rename from openpype/hosts/fusion/deploy/fusion_shared.prefs rename to openpype/hosts/fusion/deploy/openpype/fusion_shared.prefs index 93b08aa886..8360423076 100644 --- a/openpype/hosts/fusion/deploy/fusion_shared.prefs +++ b/openpype/hosts/fusion/deploy/openpype/fusion_shared.prefs @@ -3,7 +3,8 @@ Locked = true, Global = { Paths = { Map = { - ["OpenPype:"] = "$(OPENPYPE_FUSION)/deploy", + ["DEPLOY:"] = "$(OPENPYPE_FUSION)/deploy", + ["OpenPype:"] = "$(OPENPYPE_FUSION)/deploy/openpype", ["Config:"] = "UserPaths:Config;OpenPype:Config", ["Scripts:"] = "UserPaths:Scripts;Reactor:System/Scripts", }, diff --git a/openpype/hosts/fusion/deploy_ayon/MenuScripts/README.md b/openpype/hosts/fusion/deploy_ayon/MenuScripts/README.md deleted file mode 100644 index 9076f240ad..0000000000 --- a/openpype/hosts/fusion/deploy_ayon/MenuScripts/README.md +++ /dev/null @@ -1,6 +0,0 @@ -### Ayon deploy MenuScripts - -Note that this `MenuScripts` is not an official Fusion folder. -Ayon only uses this folder in `{fusion}/deploy/` to trigger the Ayon menu actions. - -They are used in the actions defined in `.fu` files in `{fusion}/deploy_ayon/Config`. diff --git a/openpype/hosts/fusion/deploy_ayon/MenuScripts/install_pyside2.py b/openpype/hosts/fusion/deploy_ayon/MenuScripts/install_pyside2.py deleted file mode 100644 index e1240fd677..0000000000 --- a/openpype/hosts/fusion/deploy_ayon/MenuScripts/install_pyside2.py +++ /dev/null @@ -1,29 +0,0 @@ -# This is just a quick hack for users running Py3 locally but having no -# Qt library installed -import os -import subprocess -import importlib - - -try: - from qtpy import API_NAME - - print(f"Qt binding: {API_NAME}") - mod = importlib.import_module(API_NAME) - print(f"Qt path: {mod.__file__}") - print("Qt library found, nothing to do..") - -except ImportError: - print("Assuming no Qt library is installed..") - print('Installing PySide2 for Python 3.6: ' - f'{os.environ["FUSION16_PYTHON36_HOME"]}') - - # Get full path to python executable - exe = "python.exe" if os.name == 'nt' else "python" - python = os.path.join(os.environ["FUSION16_PYTHON36_HOME"], exe) - assert os.path.exists(python), f"Python doesn't exist: {python}" - - # Do python -m pip install PySide2 - args = [python, "-m", "pip", "install", "PySide2"] - print(f"Args: {args}") - subprocess.Popen(args) diff --git a/openpype/hosts/fusion/hooks/pre_fusion_profile_hook.py b/openpype/hosts/fusion/hooks/pre_fusion_profile_hook.py index 0b6626777e..59053ba62a 100644 --- a/openpype/hosts/fusion/hooks/pre_fusion_profile_hook.py +++ b/openpype/hosts/fusion/hooks/pre_fusion_profile_hook.py @@ -165,10 +165,10 @@ class FusionCopyPrefsPrelaunch(PreLaunchHook): if AYON_SERVER_ENABLED: master_prefs = Path( - FUSION_HOST_DIR, "deploy_ayon", "fusion_shared.prefs") + FUSION_HOST_DIR, "deploy", "ayon", "fusion_shared.prefs") else: master_prefs = Path( - FUSION_HOST_DIR, "deploy", "fusion_shared.prefs") + FUSION_HOST_DIR, "deploy", "openpype", "fusion_shared.prefs") self.log.info(f"Setting {master_prefs_variable}: {master_prefs}") self.launch_context.env[master_prefs_variable] = str(master_prefs) diff --git a/openpype/hosts/fusion/hooks/pre_fusion_setup.py b/openpype/hosts/fusion/hooks/pre_fusion_setup.py index bd7f35f900..073f551b6f 100644 --- a/openpype/hosts/fusion/hooks/pre_fusion_setup.py +++ b/openpype/hosts/fusion/hooks/pre_fusion_setup.py @@ -65,9 +65,5 @@ class FusionPrelaunch(PreLaunchHook): self.launch_context.env[py3_var] = py3_dir - if AYON_SERVER_ENABLED: - self.log.info(f"Setting AYON_FUSION: {FUSION_HOST_DIR}") - self.launch_context.env["AYON_FUSION"] = FUSION_HOST_DIR - else: - self.log.info(f"Setting OPENPYPE_FUSION: {FUSION_HOST_DIR}") - self.launch_context.env["OPENPYPE_FUSION"] = FUSION_HOST_DIR + self.log.info(f"Setting OPENPYPE_FUSION: {FUSION_HOST_DIR}") + self.launch_context.env["OPENPYPE_FUSION"] = FUSION_HOST_DIR From aedb7d13649fcb8a86ea4dc1db5be0f741e6abd8 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Mon, 4 Dec 2023 17:02:22 +0100 Subject: [PATCH 4/6] hound --- openpype/hosts/fusion/hooks/pre_fusion_setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/openpype/hosts/fusion/hooks/pre_fusion_setup.py b/openpype/hosts/fusion/hooks/pre_fusion_setup.py index 073f551b6f..576628e876 100644 --- a/openpype/hosts/fusion/hooks/pre_fusion_setup.py +++ b/openpype/hosts/fusion/hooks/pre_fusion_setup.py @@ -1,5 +1,4 @@ import os -from openpype import AYON_SERVER_ENABLED from openpype.lib.applications import ( PreLaunchHook, LaunchTypes, From 1b1d1ff1fe19125b7378dc40d828185f54c982ca Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Mon, 4 Dec 2023 17:24:58 +0100 Subject: [PATCH 5/6] suggestion to do relative path mapping rather then DEPLOY key --- openpype/hosts/fusion/deploy/ayon/Config/menu.fu | 4 ++-- openpype/hosts/fusion/deploy/ayon/fusion_shared.prefs | 3 +-- openpype/hosts/fusion/deploy/openpype/Config/menu.fu | 4 ++-- openpype/hosts/fusion/deploy/openpype/fusion_shared.prefs | 3 +-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/openpype/hosts/fusion/deploy/ayon/Config/menu.fu b/openpype/hosts/fusion/deploy/ayon/Config/menu.fu index deecc0f806..79ef4595d9 100644 --- a/openpype/hosts/fusion/deploy/ayon/Config/menu.fu +++ b/openpype/hosts/fusion/deploy/ayon/Config/menu.fu @@ -10,7 +10,7 @@ Composition = { Execute = _Lua [=[ - local scriptPath = app:MapPath("DEPLOY:MenuScripts/menu.py") + local scriptPath = app:MapPath("AYON:../MenuScripts/menu.py") if bmd.fileexists(scriptPath) == false then print("[AYON Error] Can't run file: " .. scriptPath) else @@ -31,7 +31,7 @@ Composition = { Execute = _Lua [=[ - local scriptPath = app:MapPath("DEPLOY:MenuScripts/install_pyside2.py") + local scriptPath = app:MapPath("AYON:../MenuScripts/install_pyside2.py") if bmd.fileexists(scriptPath) == false then print("[AYON Error] Can't run file: " .. scriptPath) else diff --git a/openpype/hosts/fusion/deploy/ayon/fusion_shared.prefs b/openpype/hosts/fusion/deploy/ayon/fusion_shared.prefs index 90296c898e..731f26682b 100644 --- a/openpype/hosts/fusion/deploy/ayon/fusion_shared.prefs +++ b/openpype/hosts/fusion/deploy/ayon/fusion_shared.prefs @@ -3,10 +3,9 @@ Locked = true, Global = { Paths = { Map = { - ["DEPLOY:"] = "$(OPENPYPE_FUSION)/deploy", ["AYON:"] = "$(OPENPYPE_FUSION)/deploy/ayon", ["Config:"] = "UserPaths:Config;AYON:Config", - ["Scripts:"] = "UserPaths:Scripts;Reactor:System/Scripts", + ["Scripts:"] = "UserPaths:Scripts;Reactor:System/Scripts;AYON:../Script", }, }, Script = { diff --git a/openpype/hosts/fusion/deploy/openpype/Config/menu.fu b/openpype/hosts/fusion/deploy/openpype/Config/menu.fu index 6b325917c6..715fa98aa3 100644 --- a/openpype/hosts/fusion/deploy/openpype/Config/menu.fu +++ b/openpype/hosts/fusion/deploy/openpype/Config/menu.fu @@ -10,7 +10,7 @@ Composition = { Execute = _Lua [=[ - local scriptPath = app:MapPath("DEPLOY:MenuScripts/menu.py") + local scriptPath = app:MapPath("OpenPype:../MenuScripts/menu.py") if bmd.fileexists(scriptPath) == false then print("[OpenPype Error] Can't run file: " .. scriptPath) else @@ -31,7 +31,7 @@ Composition = { Execute = _Lua [=[ - local scriptPath = app:MapPath("DEPLOY:MenuScripts/install_pyside2.py") + local scriptPath = app:MapPath("OpenPype:../MenuScripts/install_pyside2.py") if bmd.fileexists(scriptPath) == false then print("[OpenPype Error] Can't run file: " .. scriptPath) else diff --git a/openpype/hosts/fusion/deploy/openpype/fusion_shared.prefs b/openpype/hosts/fusion/deploy/openpype/fusion_shared.prefs index 8360423076..1425f8c317 100644 --- a/openpype/hosts/fusion/deploy/openpype/fusion_shared.prefs +++ b/openpype/hosts/fusion/deploy/openpype/fusion_shared.prefs @@ -3,10 +3,9 @@ Locked = true, Global = { Paths = { Map = { - ["DEPLOY:"] = "$(OPENPYPE_FUSION)/deploy", ["OpenPype:"] = "$(OPENPYPE_FUSION)/deploy/openpype", ["Config:"] = "UserPaths:Config;OpenPype:Config", - ["Scripts:"] = "UserPaths:Scripts;Reactor:System/Scripts", + ["Scripts:"] = "UserPaths:Scripts;Reactor:System/Scripts;OpenPype:../Script", }, }, Script = { From 21c9709a8ebbfb0e34d3ab5dcdc971214cfe5c99 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Mon, 4 Dec 2023 21:19:23 +0100 Subject: [PATCH 6/6] `menu.py` to `launch_menu.py` and removing script folder ref --- .../hosts/fusion/deploy/MenuScripts/{menu.py => launch_menu.py} | 0 openpype/hosts/fusion/deploy/ayon/Config/menu.fu | 2 +- openpype/hosts/fusion/deploy/ayon/fusion_shared.prefs | 2 +- openpype/hosts/fusion/deploy/openpype/Config/menu.fu | 2 +- openpype/hosts/fusion/deploy/openpype/fusion_shared.prefs | 2 +- 5 files changed, 4 insertions(+), 4 deletions(-) rename openpype/hosts/fusion/deploy/MenuScripts/{menu.py => launch_menu.py} (100%) diff --git a/openpype/hosts/fusion/deploy/MenuScripts/menu.py b/openpype/hosts/fusion/deploy/MenuScripts/launch_menu.py similarity index 100% rename from openpype/hosts/fusion/deploy/MenuScripts/menu.py rename to openpype/hosts/fusion/deploy/MenuScripts/launch_menu.py diff --git a/openpype/hosts/fusion/deploy/ayon/Config/menu.fu b/openpype/hosts/fusion/deploy/ayon/Config/menu.fu index 79ef4595d9..c968a1bb3d 100644 --- a/openpype/hosts/fusion/deploy/ayon/Config/menu.fu +++ b/openpype/hosts/fusion/deploy/ayon/Config/menu.fu @@ -10,7 +10,7 @@ Composition = { Execute = _Lua [=[ - local scriptPath = app:MapPath("AYON:../MenuScripts/menu.py") + local scriptPath = app:MapPath("AYON:../MenuScripts/launch_menu.py") if bmd.fileexists(scriptPath) == false then print("[AYON Error] Can't run file: " .. scriptPath) else diff --git a/openpype/hosts/fusion/deploy/ayon/fusion_shared.prefs b/openpype/hosts/fusion/deploy/ayon/fusion_shared.prefs index 731f26682b..9c67af7db9 100644 --- a/openpype/hosts/fusion/deploy/ayon/fusion_shared.prefs +++ b/openpype/hosts/fusion/deploy/ayon/fusion_shared.prefs @@ -5,7 +5,7 @@ Global = { Map = { ["AYON:"] = "$(OPENPYPE_FUSION)/deploy/ayon", ["Config:"] = "UserPaths:Config;AYON:Config", - ["Scripts:"] = "UserPaths:Scripts;Reactor:System/Scripts;AYON:../Script", + ["Scripts:"] = "UserPaths:Scripts;Reactor:System/Scripts", }, }, Script = { diff --git a/openpype/hosts/fusion/deploy/openpype/Config/menu.fu b/openpype/hosts/fusion/deploy/openpype/Config/menu.fu index 715fa98aa3..85134d2c62 100644 --- a/openpype/hosts/fusion/deploy/openpype/Config/menu.fu +++ b/openpype/hosts/fusion/deploy/openpype/Config/menu.fu @@ -10,7 +10,7 @@ Composition = { Execute = _Lua [=[ - local scriptPath = app:MapPath("OpenPype:../MenuScripts/menu.py") + local scriptPath = app:MapPath("OpenPype:../MenuScripts/launch_menu.py") if bmd.fileexists(scriptPath) == false then print("[OpenPype Error] Can't run file: " .. scriptPath) else diff --git a/openpype/hosts/fusion/deploy/openpype/fusion_shared.prefs b/openpype/hosts/fusion/deploy/openpype/fusion_shared.prefs index 1425f8c317..0035a38990 100644 --- a/openpype/hosts/fusion/deploy/openpype/fusion_shared.prefs +++ b/openpype/hosts/fusion/deploy/openpype/fusion_shared.prefs @@ -5,7 +5,7 @@ Global = { Map = { ["OpenPype:"] = "$(OPENPYPE_FUSION)/deploy/openpype", ["Config:"] = "UserPaths:Config;OpenPype:Config", - ["Scripts:"] = "UserPaths:Scripts;Reactor:System/Scripts;OpenPype:../Script", + ["Scripts:"] = "UserPaths:Scripts;Reactor:System/Scripts", }, }, Script = {