diff --git a/pype/hooks/maya/pre_launch_args.py b/pype/hooks/maya/pre_launch_args.py new file mode 100644 index 0000000000..6aed54a3c3 --- /dev/null +++ b/pype/hooks/maya/pre_launch_args.py @@ -0,0 +1,17 @@ +import os +from pype.lib import PreLaunchHook + + +class MayaLaunchArguments(PreLaunchHook): + """Add path to last workfile to launch arguments.""" + order = 0 + hosts = ["maya"] + + def execute(self): + """Prepare suprocess launch arguments for NukeX.""" + if self.data.get("start_last_workfile"): + last_workfile = self.data.get("last_workfile_path") + if os.path.exists(last_workfile): + self.launch_context.launch_args.append( + "\"{}\"".format(last_workfile) + )