mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
flame: fix passing env var and flame version dynamic filling
This commit is contained in:
parent
bc81bfefc0
commit
737a485530
3 changed files with 32 additions and 16 deletions
|
|
@ -10,14 +10,19 @@ import xml.dom.minidom as minidom
|
|||
from copy import deepcopy
|
||||
import datetime
|
||||
|
||||
FLAME_V = os.getenv("OPENPYPE_FLAME_VERSION")
|
||||
|
||||
if not FLAME_V:
|
||||
raise KeyError("Missing key in environment `OPENPYPE_FLAME_VERSION`")
|
||||
|
||||
try:
|
||||
from libwiretapPythonClientAPI import (
|
||||
WireTapClientInit)
|
||||
except ImportError:
|
||||
flame_python_path = "/opt/Autodesk/flame_2021/python"
|
||||
flame_python_path = "/opt/Autodesk/flame_{}/python".format(FLAME_V)
|
||||
flame_exe_path = (
|
||||
"/opt/Autodesk/flame_2021/bin/flame.app"
|
||||
"/Contents/MacOS/startApp")
|
||||
"/opt/Autodesk/flame_{}/bin/flame.app"
|
||||
"/Contents/MacOS/startApp").format(FLAME_V)
|
||||
|
||||
sys.path.append(flame_python_path)
|
||||
|
||||
|
|
@ -169,7 +174,7 @@ class WireTapCom(object):
|
|||
# check if volumes exists
|
||||
if self.volume_name not in volumes:
|
||||
raise AttributeError(
|
||||
("Volume '{}' does not exist '{}'").format(
|
||||
("Volume '{}' does not exist in '{}'").format(
|
||||
self.volume_name, volumes)
|
||||
)
|
||||
|
||||
|
|
@ -179,7 +184,7 @@ class WireTapCom(object):
|
|||
"/opt/Autodesk/",
|
||||
"wiretap",
|
||||
"tools",
|
||||
"2021",
|
||||
FLAME_V,
|
||||
"wiretap_create_node",
|
||||
),
|
||||
'-n',
|
||||
|
|
@ -434,7 +439,7 @@ class WireTapCom(object):
|
|||
"/opt/Autodesk/",
|
||||
"wiretap",
|
||||
"tools",
|
||||
"2021",
|
||||
FLAME_V,
|
||||
"wiretap_duplicate_node",
|
||||
),
|
||||
"-s",
|
||||
|
|
|
|||
|
|
@ -19,7 +19,10 @@ class FlamePrelaunch(PreLaunchHook):
|
|||
app_groups = ["flame"]
|
||||
|
||||
# todo: replace version number with avalon launch app version
|
||||
flame_python_exe = "/opt/Autodesk/python/2021/bin/python2.7"
|
||||
flame_python_exe = (
|
||||
"/opt/Autodesk/python/{OPENPYPE_FLAME_VERSION}"
|
||||
"/bin/python2.7"
|
||||
)
|
||||
|
||||
wtc_script_path = os.path.join(
|
||||
opflame.HOST_DIR, "api", "scripts", "wiretap_com.py")
|
||||
|
|
@ -30,6 +33,7 @@ class FlamePrelaunch(PreLaunchHook):
|
|||
self.signature = "( {} )".format(self.__class__.__name__)
|
||||
|
||||
def execute(self):
|
||||
_env = self.launch_context.env
|
||||
"""Hook entry method."""
|
||||
project_doc = self.data["project_doc"]
|
||||
user_name = get_openpype_username()
|
||||
|
|
@ -58,9 +62,9 @@ class FlamePrelaunch(PreLaunchHook):
|
|||
|
||||
data_to_script = {
|
||||
# from settings
|
||||
"host_name": os.getenv("FLAME_WIRETAP_HOSTNAME") or hostname,
|
||||
"volume_name": os.getenv("FLAME_WIRETAP_VOLUME"),
|
||||
"group_name": os.getenv("FLAME_WIRETAP_GROUP"),
|
||||
"host_name": _env.get("FLAME_WIRETAP_HOSTNAME") or hostname,
|
||||
"volume_name": _env.get("FLAME_WIRETAP_VOLUME"),
|
||||
"group_name": _env.get("FLAME_WIRETAP_GROUP"),
|
||||
"color_policy": "ACES 1.1",
|
||||
|
||||
# from project
|
||||
|
|
@ -68,9 +72,12 @@ class FlamePrelaunch(PreLaunchHook):
|
|||
"user_name": user_name,
|
||||
"project_data": project_data
|
||||
}
|
||||
|
||||
self.log.info(pformat(dict(_env)))
|
||||
self.log.info(pformat(data_to_script))
|
||||
|
||||
app_arguments = self._get_launch_arguments(data_to_script)
|
||||
|
||||
self.log.info(pformat(dict(self.launch_context.env)))
|
||||
|
||||
opflame.setup(self.launch_context.env)
|
||||
|
||||
|
|
@ -83,7 +90,9 @@ class FlamePrelaunch(PreLaunchHook):
|
|||
with make_temp_file(dumped_script_data) as tmp_json_path:
|
||||
# Prepare subprocess arguments
|
||||
args = [
|
||||
self.flame_python_exe,
|
||||
self.flame_python_exe.format(
|
||||
**self.launch_context.env
|
||||
),
|
||||
self.wtc_script_path,
|
||||
tmp_json_path
|
||||
]
|
||||
|
|
@ -91,7 +100,7 @@ class FlamePrelaunch(PreLaunchHook):
|
|||
|
||||
process_kwargs = {
|
||||
"logger": self.log,
|
||||
"env": {}
|
||||
"env": self.launch_context.env
|
||||
}
|
||||
|
||||
openpype.api.run_subprocess(args, **process_kwargs)
|
||||
|
|
|
|||
|
|
@ -118,10 +118,10 @@
|
|||
"executables": {
|
||||
"windows": [],
|
||||
"darwin": [
|
||||
"/opt/Autodesk/flame_2021/bin/flame.app/Contents/MacOS/startApp"
|
||||
"/opt/Autodesk/flame_{OPENPYPE_FLAME_VERSION}/bin/flame.app/Contents/MacOS/startApp"
|
||||
],
|
||||
"linux": [
|
||||
"/opt/Autodesk/flame_2021/bin/flame"
|
||||
"/opt/Autodesk/flame_{OPENPYPE_FLAME_VERSION}/bin/flame"
|
||||
]
|
||||
},
|
||||
"arguments": {
|
||||
|
|
@ -129,7 +129,9 @@
|
|||
"darwin": [],
|
||||
"linux": []
|
||||
},
|
||||
"environment": {}
|
||||
"environment": {
|
||||
"OPENPYPE_FLAME_VERSION": "2021"
|
||||
}
|
||||
},
|
||||
"__dynamic_keys_labels__": {
|
||||
"2021": "2021 (Testing Only)"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue