mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
feat(ppro): prelaunch finalized wrapping
This commit is contained in:
parent
e34d21c244
commit
352ec7db21
1 changed files with 17 additions and 25 deletions
|
|
@ -2,13 +2,17 @@ import os
|
||||||
import traceback
|
import traceback
|
||||||
from pype.lib import PypeHook
|
from pype.lib import PypeHook
|
||||||
from pypeapp import Logger
|
from pypeapp import Logger
|
||||||
|
import importlib
|
||||||
|
import avalon.api
|
||||||
|
import pype.premiere
|
||||||
|
from pype.premiere import lib as prlib
|
||||||
|
|
||||||
|
|
||||||
class PremierePrelaunch(PypeHook):
|
class PremierePrelaunch(PypeHook):
|
||||||
"""
|
"""
|
||||||
This hook will check if current workfile path has Unreal
|
This hook will check if current workfile path has Adobe Premiere
|
||||||
project inside. IF not, it initialize it and finally it pass
|
project inside. IF not, it initialize it and finally it pass
|
||||||
path to the project by environment variable to Unreal launcher
|
path to the project by environment variable to Premiere launcher
|
||||||
shell script.
|
shell script.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
@ -21,21 +25,26 @@ class PremierePrelaunch(PypeHook):
|
||||||
self.signature = "( {} )".format(self.__class__.__name__)
|
self.signature = "( {} )".format(self.__class__.__name__)
|
||||||
|
|
||||||
def execute(self, *args, env: dict = None) -> bool:
|
def execute(self, *args, env: dict = None) -> bool:
|
||||||
from pype.services.rest_api.base_class import register_statics
|
|
||||||
|
|
||||||
if not env:
|
if not env:
|
||||||
env = os.environ
|
env = os.environ
|
||||||
|
|
||||||
PYPE_MODULE_ROOT = env.get("PYPE_MODULE_ROOT", None)
|
|
||||||
|
|
||||||
asset = env["AVALON_ASSET"]
|
asset = env["AVALON_ASSET"]
|
||||||
task = env["AVALON_TASK"]
|
task = env["AVALON_TASK"]
|
||||||
workdir = env["AVALON_WORKDIR"]
|
workdir = env["AVALON_WORKDIR"]
|
||||||
project_name = f"{asset}_{task}"
|
project_name = f"{asset}_{task}"
|
||||||
|
project_path = os.path.join(workdir, project_name)
|
||||||
|
os.makedirs(project_path, exist_ok=True)
|
||||||
|
|
||||||
import importlib
|
project_file = os.path.join(project_path, f"{project_name}.pproj")
|
||||||
import avalon.api
|
env["PYPE_ADOBE_PREMIERE_PROJECT_FILE"] = project_file
|
||||||
import pype.premiere
|
|
||||||
|
# TODO: try to set workfile for premiere if it is possible
|
||||||
|
# set workdir to the current path for premiere to open in it
|
||||||
|
self.log.debug("_ project_path: `{}`".format(project_path))
|
||||||
|
self.log.debug("_ project_file: `{}`".format(project_file))
|
||||||
|
|
||||||
|
# install premiere to avalon
|
||||||
avalon.api.install(pype.premiere)
|
avalon.api.install(pype.premiere)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
@ -47,25 +56,8 @@ class PremierePrelaunch(PypeHook):
|
||||||
print("pyblish: Could not load integration: %s " % e)
|
print("pyblish: Could not load integration: %s " % e)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# start rest api static server
|
|
||||||
static_site_dir_path = os.path.join(
|
|
||||||
PYPE_MODULE_ROOT,
|
|
||||||
"pype",
|
|
||||||
"premiere",
|
|
||||||
"static_ppro").replace("\\", "/")
|
|
||||||
self.log.debug(
|
|
||||||
"_ static_site_dir_path: `{}`".format(static_site_dir_path))
|
|
||||||
register_statics("/ppro", static_site_dir_path)
|
|
||||||
|
|
||||||
# Premiere Setup integration
|
# Premiere Setup integration
|
||||||
from pype.premiere import lib as prlib
|
|
||||||
importlib.reload(prlib)
|
importlib.reload(prlib)
|
||||||
prlib.setup(env)
|
prlib.setup(env)
|
||||||
|
|
||||||
self.log.debug("_ self.signature: `{}`".format(self.signature))
|
|
||||||
self.log.debug("_ asset: `{}`".format(asset))
|
|
||||||
self.log.debug("_ task: `{}`".format(task))
|
|
||||||
self.log.debug("_ workdir: `{}`".format(workdir))
|
|
||||||
self.log.debug("_ project_name: `{}`".format(project_name))
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue