Merge pull request #1112 from pypeclub/bugfix/tvpaint_prelaunch_hook

TVPaint prelaunch hook fix
This commit is contained in:
Milan Kolar 2021-03-11 11:18:08 +01:00 committed by GitHub
commit c8eba1a181
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,7 +2,10 @@ import os
import shutil
from pype.hosts import tvpaint
from pype.lib import PreLaunchHook
from pype.lib import (
PreLaunchHook,
get_pype_execute_args
)
import avalon
@ -20,18 +23,16 @@ class TvpaintPrelaunchHook(PreLaunchHook):
def execute(self):
# Pop tvpaint executable
tvpaint_executable = self.launch_context.launch_args.pop(0)
executable_path = self.launch_context.launch_args.pop(0)
# Pop rest of launch arguments - There should not be other arguments!
remainders = []
while self.launch_context.launch_args:
remainders.append(self.launch_context.launch_args.pop(0))
new_launch_args = [
self.main_executable(),
self.launch_script_path(),
tvpaint_executable
]
new_launch_args = get_pype_execute_args(
"run", self.launch_script_path(), executable_path
)
# Add workfile to launch arguments
workfile_path = self.workfile_path()
@ -56,11 +57,6 @@ class TvpaintPrelaunchHook(PreLaunchHook):
).format(str(remainders)))
self.launch_context.launch_args.extend(remainders)
def main_executable(self):
"""Should lead to python executable."""
# TODO change in Pype 3
return os.path.normpath(os.environ["PYPE_PYTHON_EXE"])
def launch_script_path(self):
avalon_dir = os.path.dirname(os.path.abspath(avalon.__file__))
script_path = os.path.join(