Revert separation of Houdini last workfile code

This commit is contained in:
Roy Nieterau 2022-02-21 15:56:07 +01:00
parent 1cfdbcb2a1
commit 065c6a092f

View file

@ -17,6 +17,7 @@ class AddLastWorkfileToLaunchArgs(PreLaunchHook):
"nuke",
"nukex",
"hiero",
"houdini",
"nukestudio",
"blender",
"photoshop",
@ -24,7 +25,7 @@ class AddLastWorkfileToLaunchArgs(PreLaunchHook):
"afftereffects"
]
def get_last_workfile(self):
def execute(self):
if not self.data.get("start_last_workfile"):
self.log.info("It is set to not start last workfile on start.")
return
@ -38,38 +39,6 @@ class AddLastWorkfileToLaunchArgs(PreLaunchHook):
self.log.info("Current context does not have any workfile yet.")
return
return last_workfile
def execute(self):
last_workfile = self.get_last_workfile()
if last_workfile:
# Add path to workfile to arguments
self.launch_context.launch_args.append(last_workfile)
class AddLastWorkfileToLaunchArgsHoudini(AddLastWorkfileToLaunchArgs):
"""Add last workfile path to launch arguments - Houdini specific"""
app_groups = ["houdini"]
def execute(self):
last_workfile = self.get_last_workfile()
if last_workfile:
# Whenever a filepath is passed to Houdini then the startup
# scripts 123.py and houdinicore.py won't be triggered. Thus
# OpenPype will not initialize correctly. As such, whenever
# we pass a workfile we first explicitly pass a startup
# script to enforce it to run - which will load the last passed
# argument as workfile directly.
pype_root = os.environ["OPENPYPE_REPOS_ROOT"]
startup_path = os.path.join(
pype_root, "openpype", "hosts", "houdini", "startup"
)
startup_script = os.path.join(startup_path,
"scripts",
"openpype_launch.py")
self.launch_context.launch_args.append(startup_script)
# Add path to workfile to arguments
self.launch_context.launch_args.append(last_workfile)