mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 21:32:15 +01:00
Set explicit startup script path
This commit is contained in:
parent
00e89719dd
commit
279b3dc767
2 changed files with 14 additions and 4 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import os
|
||||
|
||||
from openpype.lib import PreLaunchHook
|
||||
import openpype.hosts.resolve
|
||||
|
||||
|
||||
class ResolveLaunchLastWorkfile(PreLaunchHook):
|
||||
|
|
@ -33,3 +34,13 @@ class ResolveLaunchLastWorkfile(PreLaunchHook):
|
|||
f"last workfile: {last_workfile}")
|
||||
key = "OPENPYPE_RESOLVE_OPEN_ON_LAUNCH"
|
||||
self.launch_context.env[key] = last_workfile
|
||||
|
||||
# Set the openpype prelaunch startup script path for easy access
|
||||
# in the LUA .scriptlib code
|
||||
op_resolve_root = os.path.dirname(openpype.hosts.resolve.__file__)
|
||||
script_path = os.path.join(op_resolve_root, "startup.py")
|
||||
key = "OPENPYPE_RESOLVE_STARTUP_SCRIPT"
|
||||
self.launch_context.env[key] = script_path
|
||||
self.log.info("Setting OPENPYPE_RESOLVE_STARTUP_SCRIPT to: "
|
||||
f"{script_path}")
|
||||
|
||||
|
|
|
|||
|
|
@ -5,10 +5,9 @@ function file_exists(name)
|
|||
end
|
||||
|
||||
|
||||
openpype_root = os.getenv("OPENPYPE_ROOT")
|
||||
if openpype_root ~= nil then
|
||||
script = openpype_root .. "/openpype/hosts/resolve/startup.py"
|
||||
script = fusion:MapPath(script)
|
||||
openpype_startup_script = os.getenv("OPENPYPE_RESOLVE_STARTUP_SCRIPT")
|
||||
if openpype_startup_script ~= nil then
|
||||
script = fusion:MapPath(openpype_startup_script)
|
||||
|
||||
if file_exists(script) then
|
||||
-- We must use RunScript to ensure it runs in a separate
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue