mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
added aftereffects prelaunch hook
This commit is contained in:
parent
7e68d5b649
commit
c77946c181
3 changed files with 45 additions and 13 deletions
45
pype/hooks/aftereffects/pre_launch_args.py
Normal file
45
pype/hooks/aftereffects/pre_launch_args.py
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
import os
|
||||
|
||||
from pype.lib import PreLaunchHook
|
||||
|
||||
|
||||
class AfterEffectsPrelaunchHook(PreLaunchHook):
|
||||
"""Launch arguments preparation.
|
||||
|
||||
Hook add python executable and execute python script of AfterEffects
|
||||
implementation before AfterEffects executable.
|
||||
"""
|
||||
hosts = ["aftereffects"]
|
||||
|
||||
def execute(self):
|
||||
# Pop tvpaint executable
|
||||
photoshop_executable = 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.python_executable(),
|
||||
"-c",
|
||||
(
|
||||
"^\"import avalon.aftereffects;"
|
||||
"avalon.aftereffects.launch(\"{}\")^\"\""
|
||||
).format(photoshop_executable)
|
||||
]
|
||||
|
||||
# Append as whole list as these areguments should not be separated
|
||||
self.launch_context.launch_args.append(new_launch_args)
|
||||
|
||||
if remainders:
|
||||
self.log.warning((
|
||||
"There are unexpected launch arguments "
|
||||
"in AfterEffects launch. {}"
|
||||
).format(str(remainders)))
|
||||
self.launch_context.launch_args.extend(remainders)
|
||||
|
||||
def python_executable(self):
|
||||
"""Should lead to python executable."""
|
||||
# TODO change in Pype 3
|
||||
return os.environ["PYPE_PYTHON_EXE"]
|
||||
|
|
@ -28,12 +28,6 @@ class HarmonyPrelaunchHook(PreLaunchHook):
|
|||
"avalon.harmony.launch(\"{}\")^\"\""
|
||||
).format(photoshop_executable)
|
||||
]
|
||||
# if platform.system().lower() == "windows":
|
||||
# new_launch_args = [
|
||||
# "cmd.exe",
|
||||
# "/k",
|
||||
# "\"{}\"".format(" ".join(new_launch_args))
|
||||
# ]
|
||||
|
||||
# Append as whole list as these areguments should not be separated
|
||||
self.launch_context.launch_args.append(new_launch_args)
|
||||
|
|
|
|||
|
|
@ -29,13 +29,6 @@ class PhotoshopPrelaunchHook(PreLaunchHook):
|
|||
).format(photoshop_executable)
|
||||
]
|
||||
|
||||
# if platform.system().lower() == "windows":
|
||||
# new_launch_args = [
|
||||
# "cmd.exe",
|
||||
# "/k",
|
||||
# "\"{}\"".format(" ".join(new_launch_args))
|
||||
# ]
|
||||
|
||||
# Append as whole list as these areguments should not be separated
|
||||
self.launch_context.launch_args.append(new_launch_args)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue