Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #307 from pypeclub/feature/239-resolve_tagging_for…
Browse files Browse the repository at this point in the history
…_publish

[draft] Resolve: tagging and renaming for publish
  • Loading branch information
mkolar authored Jul 17, 2020
2 parents 28bbffa + a26292b commit c6e586f
Show file tree
Hide file tree
Showing 26 changed files with 1,104 additions and 261 deletions.
29 changes: 29 additions & 0 deletions pype/hooks/premiere/prelaunch.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -55,6 +62,10 @@ def execute(self, *args, env: dict = None) -> bool:
# 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")
Expand All @@ -69,6 +80,24 @@ def execute(self, *args, env: dict = None) -> bool:

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"]
Expand Down
6 changes: 4 additions & 2 deletions pype/hooks/resolve/prelaunch.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ def execute(self, *args, env: dict = None) -> bool:
"`RESOLVE_UTILITY_SCRIPTS_DIR` or reinstall DaVinci Resolve. \n"
f"RESOLVE_UTILITY_SCRIPTS_DIR: `{us_dir}`"
)
self.log.debug(f"-- us_dir: `{us_dir}`")

# correctly format path for pre python script
pre_py_sc = os.path.normpath(env.get("PRE_PYTHON_SCRIPT", ""))
env["PRE_PYTHON_SCRIPT"] = pre_py_sc

self.log.debug(f"-- pre_py_sc: `{pre_py_sc}`...")
try:
__import__("pype.resolve")
__import__("pype.hosts.resolve")
__import__("pyblish")

except ImportError as e:
Expand All @@ -62,6 +63,7 @@ def execute(self, *args, env: dict = None) -> bool:
else:
# Resolve Setup integration
importlib.reload(utils)
self.log.debug(f"-- utils.__file__: `{utils.__file__}`")
utils.setup(env)

return True
50 changes: 39 additions & 11 deletions pype/hosts/resolve/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
from .utils import (
setup,
get_resolve_module
)

from .pipeline import (
install,
uninstall,
ls,
containerise,
publish,
launch_workfiles_app
launch_workfiles_app,
maintained_selection
)

from .utils import (
setup,
get_resolve_module
from .lib import (
get_project_manager,
get_current_project,
get_current_sequence,
get_current_track_items,
create_current_sequence_media_bin,
create_compound_clip,
swap_clips,
get_pype_clip_metadata,
set_project_manager_to_folder_name
)

from .menu import launch_pype_menu

from .plugin import Creator

from .workio import (
open_file,
save_file,
Expand All @@ -21,12 +38,8 @@
work_root
)

from .lib import (
get_project_manager,
set_project_manager_to_folder_name
)

from .menu import launch_pype_menu
bmdvr = None
bmdvf = None

__all__ = [
# pipeline
Expand All @@ -37,23 +50,38 @@
"reload_pipeline",
"publish",
"launch_workfiles_app",
"maintained_selection",

# utils
"setup",
"get_resolve_module",

# lib
"get_project_manager",
"get_current_project",
"get_current_sequence",
"get_current_track_items",
"create_current_sequence_media_bin",
"create_compound_clip",
"swap_clips",
"get_pype_clip_metadata",
"set_project_manager_to_folder_name",

# menu
"launch_pype_menu",

# plugin
"Creator",

# workio
"open_file",
"save_file",
"current_file",
"has_unsaved_changes",
"file_extensions",
"work_root"
"work_root",

# singleton with black magic resolve module
"bmdvr",
"bmdvf"
]
6 changes: 3 additions & 3 deletions pype/hosts/resolve/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ class SelectInvalidAction(pyblish.api.Action):
def process(self, context, plugin):

try:
from pype.hosts.resolve.utils import get_resolve_module
resolve = get_resolve_module()
self.log.debug(resolve)
from . import get_project_manager
pm = get_project_manager()
self.log.debug(pm)
except ImportError:
raise ImportError("Current host is not Resolve")

Expand Down
Loading

0 comments on commit c6e586f

Please sign in to comment.