From ad9087e3983fb1d9ce7082d5459be8f181a2f971 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Tue, 18 May 2021 13:36:13 +0200 Subject: [PATCH] add maya's environments to add_implementation_envs --- openpype/hosts/maya/__init__.py | 29 +++++++++++++++++++ .../system_settings/applications.json | 15 +--------- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/openpype/hosts/maya/__init__.py b/openpype/hosts/maya/__init__.py index e69de29bb2..10a128583e 100644 --- a/openpype/hosts/maya/__init__.py +++ b/openpype/hosts/maya/__init__.py @@ -0,0 +1,29 @@ +import os + + +def add_implementation_envs(env): + # Add requirements to PYTHONPATH + pype_root = os.environ["OPENPYPE_REPOS_ROOT"] + new_python_path = os.pathsep.join([ + os.path.join(pype_root, "openpype", "hosts", "maya", "startup"), + os.path.join(pype_root, "repos", "avalon-core", "setup", "maya"), + os.path.join(pype_root, "tools", "mayalookassigner") + ]) + old_python_path = env.get("PYTHONPATH") + if old_python_path: + new_python_path = os.pathsep.join([new_python_path, old_python_path]) + env["PYTHONPATH"] = new_python_path + + # Set default values if are not already set via settings + defaults = { + "MAYA_DISABLE_CLIC_IPM": "Yes", + "MAYA_DISABLE_CIP": "Yes", + "MAYA_DISABLE_CER": "Yes", + "PYMEL_SKIP_MEL_INIT": "Yes", + "LC_ALL": "C", + "OPENPYPE_LOG_NO_COLORS": "Yes" + } + for key, value in defaults.items(): + if env.get(key): + continue + env[key] = value diff --git a/openpype/settings/defaults/system_settings/applications.json b/openpype/settings/defaults/system_settings/applications.json index d439ae35d9..2904530cad 100644 --- a/openpype/settings/defaults/system_settings/applications.json +++ b/openpype/settings/defaults/system_settings/applications.json @@ -4,20 +4,7 @@ "label": "Maya", "icon": "{}/app_icons/maya.png", "host_name": "maya", - "environment": { - "PYTHONPATH": [ - "{OPENPYPE_REPOS_ROOT}/openpype/hosts/maya/startup", - "{OPENPYPE_REPOS_ROOT}/repos/avalon-core/setup/maya", - "{OPENPYPE_REPOS_ROOT}/repos/maya-look-assigner", - "{PYTHONPATH}" - ], - "MAYA_DISABLE_CLIC_IPM": "Yes", - "MAYA_DISABLE_CIP": "Yes", - "MAYA_DISABLE_CER": "Yes", - "PYMEL_SKIP_MEL_INIT": "Yes", - "LC_ALL": "C", - "OPENPYPE_LOG_NO_COLORS": "Yes" - }, + "environment": {}, "variants": { "2022": { "use_python_2": false,