Merge pull request #346 from pypeclub/feature/premiere_hook_with_registry

premiere workflow fixes
This commit is contained in:
Milan Kolar 2020-07-10 10:09:13 +02:00 committed by GitHub
commit 17a21df597
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 10 deletions

View file

@ -1,5 +1,6 @@
import os
import traceback
import winreg
from avalon import api, io, lib
from pype.lib import PypeHook
from pype.api import Logger, Anatomy
@ -14,6 +15,12 @@ class PremierePrelaunch(PypeHook):
shell script.
"""
project_code = None
reg_string_value = [{
"path": r"Software\Adobe\CSXS.9",
"name": "PlayerDebugMode",
"type": winreg.REG_SZ,
"value": "1"
}]
def __init__(self, logger=None):
if not logger:
@ -55,6 +62,10 @@ class PremierePrelaunch(PypeHook):
# adding project code to env
env["AVALON_PROJECT_CODE"] = self.project_code
# add keys to registry
self.modify_registry()
# start avalon
try:
__import__("pype.hosts.premiere")
__import__("pyblish")
@ -69,6 +80,24 @@ class PremierePrelaunch(PypeHook):
return True
def modify_registry(self):
# adding key to registry
for key in self.reg_string_value:
winreg.CreateKey(winreg.HKEY_CURRENT_USER, key["path"])
rg_key = winreg.OpenKey(
key=winreg.HKEY_CURRENT_USER,
sub_key=key["path"],
reserved=0,
access=winreg.KEY_ALL_ACCESS)
winreg.SetValueEx(
rg_key,
key["name"],
0,
key["type"],
key["value"]
)
def get_anatomy_filled(self):
root_path = api.registered_root()
project_name = self._S["AVALON_PROJECT"]

View file

@ -11,7 +11,7 @@ class CollectFrameranges(pyblish.api.InstancePlugin):
"""
label = "Collect Clip Frameranges"
order = pyblish.api.CollectorOrder
order = pyblish.api.CollectorOrder - 0.01
families = ['clip']
def process(self, instance):

View file

@ -12,7 +12,7 @@ class CollectClipRepresentations(pyblish.api.InstancePlugin):
"""
label = "Collect Clip Representations"
order = pyblish.api.CollectorOrder
order = pyblish.api.CollectorOrder + 0.1
families = ['clip']
def process(self, instance):

View file

@ -37,13 +37,7 @@ class ValidateAutoSyncOff(pyblish.api.ContextPlugin):
query = 'Project where full_name is "{}"'.format(project_name)
project = session.query(query).one()
invalid = None
if project.get('custom_attributes', {}).get(
'avalon_auto_sync', False):
invalid = project
return invalid
return project
@classmethod
def repair(cls, context):
@ -55,4 +49,4 @@ class ValidateAutoSyncOff(pyblish.api.ContextPlugin):
except Exception:
tp, value, tb = sys.exc_info()
session.rollback()
six.reraise(tp, value, tb)
raise