From 7bd067d5a5097def4a234f9d230ab9189f40cfc9 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Thu, 30 Nov 2023 15:29:47 +0100 Subject: [PATCH 01/10] 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 02/10] 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 4076968581beb2144a3dbb33b632bd116df28513 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Mon, 4 Dec 2023 21:23:59 +0800 Subject: [PATCH 03/10] rename openpype tools as custom tools --- server_addon/maya/server/settings/scriptsmenu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server_addon/maya/server/settings/scriptsmenu.py b/server_addon/maya/server/settings/scriptsmenu.py index 82c1c2e53c..4ac2263f7a 100644 --- a/server_addon/maya/server/settings/scriptsmenu.py +++ b/server_addon/maya/server/settings/scriptsmenu.py @@ -26,7 +26,7 @@ class ScriptsmenuModel(BaseSettingsModel): DEFAULT_SCRIPTSMENU_SETTINGS = { - "name": "OpenPype Tools", + "name": "Custom Tools", "definition": [ { "type": "action", From 0ce9af3f839ea056663bda3bc366f292e92f6a55 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Mon, 4 Dec 2023 21:25:38 +0800 Subject: [PATCH 04/10] increment version --- server_addon/maya/server/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server_addon/maya/server/version.py b/server_addon/maya/server/version.py index 805897cda3..b87834cc35 100644 --- a/server_addon/maya/server/version.py +++ b/server_addon/maya/server/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- """Package declaring addon version.""" -__version__ = "0.1.6" +__version__ = "0.1.7" From 120c0d0b608f684af947cb8d30781cd8c458f27d Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Mon, 4 Dec 2023 17:00:49 +0100 Subject: [PATCH 05/10] 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 06/10] 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 07/10] 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 08/10] `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 = { From a557b8b5e3fcd8d078c24fe981a054af49e99207 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Tue, 5 Dec 2023 13:04:32 +0100 Subject: [PATCH 09/10] Wrap: new integration (#5823) * Added Wrap to applications * Added icon * Added wrap to template pre hooks Needed to copy template as new workfile. Needed to open Wrap with workfile. --- openpype/hooks/pre_add_last_workfile_arg.py | 1 + openpype/hooks/pre_copy_template_workfile.py | 3 +- openpype/resources/app_icons/wrap.png | Bin 0 -> 1044 bytes .../applications/server/applications.json | 26 ++++++++++++++++++ server_addon/applications/server/settings.py | 2 ++ 5 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 openpype/resources/app_icons/wrap.png diff --git a/openpype/hooks/pre_add_last_workfile_arg.py b/openpype/hooks/pre_add_last_workfile_arg.py index 1418bc210b..6e255ae82a 100644 --- a/openpype/hooks/pre_add_last_workfile_arg.py +++ b/openpype/hooks/pre_add_last_workfile_arg.py @@ -27,6 +27,7 @@ class AddLastWorkfileToLaunchArgs(PreLaunchHook): "tvpaint", "substancepainter", "aftereffects", + "wrap" } launch_types = {LaunchTypes.local} diff --git a/openpype/hooks/pre_copy_template_workfile.py b/openpype/hooks/pre_copy_template_workfile.py index 2203ff4396..4d91d83c95 100644 --- a/openpype/hooks/pre_copy_template_workfile.py +++ b/openpype/hooks/pre_copy_template_workfile.py @@ -19,7 +19,8 @@ class CopyTemplateWorkfile(PreLaunchHook): # Before `AddLastWorkfileToLaunchArgs` order = 0 - app_groups = {"blender", "photoshop", "tvpaint", "aftereffects"} + app_groups = {"blender", "photoshop", "tvpaint", "aftereffects", + "wrap"} launch_types = {LaunchTypes.local} def execute(self): diff --git a/openpype/resources/app_icons/wrap.png b/openpype/resources/app_icons/wrap.png new file mode 100644 index 0000000000000000000000000000000000000000..34ae1d68ed9de874a612d94bf69804de2af01eea GIT binary patch literal 1044 zcmV+v1nc{WP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D1F1R6 zy`}G^1FGW7AMy2h&h=gpfo?ynGnqH}=C=7h=lPuToO7Q00sf;$fc<_y>~?$Fq=9WV z8zf0eo8E)drgsaxP0|TvNO~duy?W4UPxaTvWYGVul=|}v1oolVG){6v2megSYBTaE^{s;uk`(2u2!cz`G=Ex-!dg}?pv5~rg8j~2 zIB9aj4`mFxCvdQ~9vL)#Q!o$y{`6T5%(~Ij2gzVYR(>ID*KgsTF9bR9MDyj?A{v{T zu|+bV`fv^UY2plJ@gz#D%A`_)t>qQ)$CtFk;rT`678YZBX*uqW-pBB?3~zJ+k=K4S z`5e7{12E+j;N;o!aCp38#ZD@B=jCfKXIfH&Sp`K!xZ@ZRd&r67l=yJnF&t_C-2rVf-%Qfb~m*3Rk!p&X`GnDk__!JJ()~wFW+7N8c%tC8h2jZ{6F;egEPS|?- zX|<2wpq0310|+cEYv6~$IIi9vK%dJkO3YxcPBB$!b#B&%U`eOL=ha_hF1Da04*c~5 zLzA>x0&~*Ady^RR1`wfYu+MJ~Rlzx>_zb^6<goJcipBq*5y@Zfb53O=fNGO~Ki@`S{6pu20wc8I?*2dC%BLzNxMJ5{42?bzhl`Vj=@fhBqUgHbgB>MS5mVRLEKa=&mZ<`6 zuOBtXTi(j2Dka#GlMnl?KDwt$m*NBD4bP+bbUO@Y<N literal 0 HcmV?d00001 diff --git a/server_addon/applications/server/applications.json b/server_addon/applications/server/applications.json index f846b04215..825f50276a 100644 --- a/server_addon/applications/server/applications.json +++ b/server_addon/applications/server/applications.json @@ -1158,6 +1158,32 @@ } ] }, + "wrap": { + "enabled": true, + "label": "Wrap", + "icon": "{}/app_icons/wrap.png", + "host_name": "wrap", + "environment": "{\n \n}", + "variants": [ + { + "name": "2023", + "use_python_2": false, + "executables": { + "windows": [ + "c:\\Program Files\\Faceform\\Wrap 2023.10.2\\Wrap.exe" + ], + "darwin": [], + "linux": [] + }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, + "environment": "{\n \n}" + } + ] + }, "additional_apps": [] } } diff --git a/server_addon/applications/server/settings.py b/server_addon/applications/server/settings.py index 981d56c30f..224f999564 100644 --- a/server_addon/applications/server/settings.py +++ b/server_addon/applications/server/settings.py @@ -168,6 +168,8 @@ class ApplicationsSettings(BaseSettingsModel): default_factory=AppGroupWithPython, title="Substance Painter") unreal: AppGroup = Field( default_factory=AppGroupWithPython, title="Unreal Editor") + wrap: AppGroup = Field( + default_factory=AppGroupWithPython, title="Wrap") additional_apps: list[AdditionalAppGroup] = Field( default_factory=list, title="Additional Applications") From 5e59ffce81584f31eb3a1d7101d49a9dd3db1d59 Mon Sep 17 00:00:00 2001 From: Toke Jepsen Date: Tue, 5 Dec 2023 13:28:33 +0000 Subject: [PATCH 10/10] hou module should be within class code. (#5954) --- .../plugins/publish/submit_houdini_cache_deadline.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/openpype/modules/deadline/plugins/publish/submit_houdini_cache_deadline.py b/openpype/modules/deadline/plugins/publish/submit_houdini_cache_deadline.py index 2b6231e916..ada69575a8 100644 --- a/openpype/modules/deadline/plugins/publish/submit_houdini_cache_deadline.py +++ b/openpype/modules/deadline/plugins/publish/submit_houdini_cache_deadline.py @@ -2,8 +2,6 @@ import os import getpass from datetime import datetime -import hou - import attr import pyblish.api from openpype.lib import ( @@ -141,6 +139,9 @@ class HoudiniCacheSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline return job_info def get_plugin_info(self): + # Not all hosts can import this module. + import hou + instance = self._instance version = hou.applicationVersionString() version = ".".join(version.split(".")[:2]) @@ -167,6 +168,9 @@ class HoudiniCacheSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline instance.data["toBeRenderedOn"] = "deadline" def get_rop_node(self, instance): + # Not all hosts can import this module. + import hou + rop = instance.data.get("instance_node") rop_node = hou.node(rop)