Merge pull request #571 from ynput/enhancement/AY-4919_Move-Resolve-client-code

Chore: Move resolve client code
This commit is contained in:
Jakub Trllo 2024-05-31 11:54:01 +02:00 committed by GitHub
commit 09f19ddc1c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
39 changed files with 57 additions and 40 deletions

View file

@ -60,6 +60,7 @@ MOVED_ADDON_MILESTONE_VERSIONS = {
"tvpaint": VersionInfo(0, 2, 0),
"maya": VersionInfo(0, 2, 0),
"nuke": VersionInfo(0, 2, 0),
"resolve": VersionInfo(0, 2, 0),
"substancepainter": VersionInfo(0, 2, 0),
}

View file

@ -1,6 +0,0 @@
from .addon import ResolveAddon
__all__ = (
"ResolveAddon",
)

View file

@ -0,0 +1,13 @@
from .version import __version__
from .addon import (
RESOLVE_ADDON_ROOT,
ResolveAddon,
)
__all__ = (
"__version__",
"RESOLVE_ADDON_ROOT",
"ResolveAddon",
)

View file

@ -2,18 +2,20 @@ import os
from ayon_core.addon import AYONAddon, IHostAddon
from .utils import RESOLVE_ROOT_DIR
from .version import __version__
from .utils import RESOLVE_ADDON_ROOT
class ResolveAddon(AYONAddon, IHostAddon):
name = "resolve"
version = __version__
host_name = "resolve"
def get_launch_hook_paths(self, app):
if app.host_name != self.host_name:
return []
return [
os.path.join(RESOLVE_ROOT_DIR, "hooks")
os.path.join(RESOLVE_ADDON_ROOT, "hooks")
]
def get_workfile_extensions(self):

View file

@ -57,7 +57,7 @@ class ResolveHost(HostBase, IWorkfileHost, ILoadHost):
"""
log.info("ayon_core.hosts.resolve installed")
log.info("ayon_resolve installed")
pyblish.register_host(self.name)
pyblish.register_plugin_path(PUBLISH_PATH)
@ -246,9 +246,7 @@ def on_pyblish_instance_toggled(instance, old_value, new_value):
log.info("instance toggle: {}, old_value: {}, new_value:{} ".format(
instance, old_value, new_value))
from ayon_core.hosts.resolve.api import (
set_publish_attribute
)
from ayon_resolve.api import set_publish_attribute
# Whether instances should be passthrough based on new value
timeline_item = instance.data["item"]

View file

@ -13,11 +13,11 @@ log = Logger.get_logger(__name__)
def get_resolve_module():
from ayon_core.hosts.resolve import api
from ayon_resolve import api
# dont run if already loaded
if api.bmdvr:
log.info(("resolve module is assigned to "
f"`ayon_core.hosts.resolve.api.bmdvr`: {api.bmdvr}"))
f"`ayon_resolve.api.bmdvr`: {api.bmdvr}"))
return api.bmdvr
try:
"""
@ -78,6 +78,6 @@ def get_resolve_module():
api.bmdvr = bmdvr
api.bmdvf = bmdvf
log.info(("Assigning resolve module to "
f"`ayon_core.hosts.resolve.api.bmdvr`: {api.bmdvr}"))
f"`ayon_resolve.api.bmdvr`: {api.bmdvr}"))
log.info(("Assigning resolve module to "
f"`ayon_core.hosts.resolve.api.bmdvf`: {api.bmdvf}"))
f"`ayon_resolve.api.bmdvf`: {api.bmdvf}"))

View file

@ -2,7 +2,7 @@ import os
from pathlib import Path
import platform
from ayon_applications import PreLaunchHook, LaunchTypes
from ayon_core.hosts.resolve.utils import setup
from ayon_resolve.utils import setup
class PreLaunchResolveSetup(PreLaunchHook):

View file

@ -1,7 +1,7 @@
import os
from ayon_applications import PreLaunchHook, LaunchTypes
import ayon_core.hosts.resolve
from ayon_resolve import RESOLVE_ADDON_ROOT
class PreLaunchResolveStartup(PreLaunchHook):
@ -15,8 +15,7 @@ class PreLaunchResolveStartup(PreLaunchHook):
def execute(self):
# Set the openpype prelaunch startup script path for easy access
# in the LUA .scriptlib code
op_resolve_root = os.path.dirname(ayon_core.hosts.resolve.__file__)
script_path = os.path.join(op_resolve_root, "startup.py")
script_path = os.path.join(RESOLVE_ADDON_ROOT, "startup.py")
key = "AYON_RESOLVE_STARTUP_SCRIPT"
self.launch_context.env[key] = script_path

View file

@ -1,6 +1,6 @@
# from pprint import pformat
from ayon_core.hosts.resolve.api import plugin, lib
from ayon_core.hosts.resolve.api.lib import (
from ayon_resolve.api import plugin, lib
from ayon_resolve.api.lib import (
get_video_track_names,
create_bin,
)

View file

@ -1,7 +1,7 @@
import ayon_api
from ayon_core.hosts.resolve.api import lib, plugin
from ayon_core.hosts.resolve.api.pipeline import (
from ayon_resolve.api import lib, plugin
from ayon_resolve.api.pipeline import (
containerise,
update_container,
)

View file

@ -5,7 +5,7 @@ from ayon_core.pipeline import (
get_representation_path,
)
from ayon_core.hosts.resolve.api import lib
from ayon_resolve.api import lib
class LoadEditorialPackage(load.LoaderPlugin):

View file

@ -2,7 +2,7 @@ import os
import pyblish.api
from ayon_core.pipeline import publish
from ayon_core.hosts.resolve.api.lib import get_project_manager
from ayon_resolve.api.lib import get_project_manager
class ExtractWorkfile(publish.Extractor):

View file

@ -3,7 +3,7 @@ from pprint import pformat
import pyblish
from ayon_core.pipeline import AYON_INSTANCE_ID, AVALON_INSTANCE_ID
from ayon_core.hosts.resolve.api.lib import (
from ayon_resolve.api.lib import (
get_current_timeline_items,
get_timeline_item_pype_tag,
publish_clip_color,

View file

@ -3,8 +3,8 @@ from pprint import pformat
from ayon_core.pipeline import get_current_folder_path
from ayon_core.hosts.resolve import api as rapi
from ayon_core.hosts.resolve.otio import davinci_export
from ayon_resolve import api as rapi
from ayon_resolve.otio import davinci_export
class PrecollectWorkfile(pyblish.api.ContextPlugin):

View file

@ -11,7 +11,7 @@ This code runs in a separate process to the main Resolve process.
"""
import os
from ayon_core.lib import Logger
import ayon_core.hosts.resolve.api
import ayon_resolve.api
log = Logger.get_logger(__name__)
@ -27,7 +27,7 @@ def ensure_installed_host():
if host:
return host
host = ayon_core.hosts.resolve.api.ResolveHost()
host = ayon_resolve.api.ResolveHost()
install_host(host)
return registered_host()
@ -35,7 +35,7 @@ def ensure_installed_host():
def launch_menu():
print("Launching Resolve AYON menu..")
ensure_installed_host()
ayon_core.hosts.resolve.api.launch_ayon_menu()
ayon_resolve.api.launch_ayon_menu()
def open_workfile(path):

View file

@ -8,7 +8,7 @@ log = Logger.get_logger(__name__)
def main(env):
from ayon_core.hosts.resolve.api import ResolveHost, launch_ayon_menu
from ayon_resolve.api import ResolveHost, launch_ayon_menu
# activate resolve from openpype
host = ResolveHost()

View file

@ -1,6 +1,6 @@
#!/usr/bin/env python
import os
from ayon_core.hosts.resolve.otio import davinci_export as otio_export
from ayon_resolve.otio import davinci_export as otio_export
resolve = bmd.scriptapp("Resolve") # noqa
fu = resolve.Fusion()

View file

@ -1,6 +1,6 @@
#!/usr/bin/env python
import os
from ayon_core.hosts.resolve.otio import davinci_import as otio_import
from ayon_resolve.otio import davinci_import as otio_import
resolve = bmd.scriptapp("Resolve") # noqa
fu = resolve.Fusion()

View file

@ -6,8 +6,8 @@ from ayon_core.pipeline import install_host
def main(env):
from ayon_core.hosts.resolve.utils import setup
import ayon_core.hosts.resolve.api as bmdvr
from ayon_resolve.utils import setup
import ayon_resolve.api as bmdvr
# Registers openpype's Global pyblish plugins
install_host(bmdvr)
setup(env)

View file

@ -2,7 +2,7 @@ import os
import shutil
from ayon_core.lib import Logger, is_running_from_build
RESOLVE_ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
RESOLVE_ADDON_ROOT = os.path.dirname(os.path.abspath(__file__))
def setup(env):
@ -12,7 +12,7 @@ def setup(env):
util_scripts_dir = env["RESOLVE_UTILITY_SCRIPTS_DIR"]
util_scripts_paths = [os.path.join(
RESOLVE_ROOT_DIR,
RESOLVE_ADDON_ROOT,
"utility_scripts"
)]

View file

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
"""Package declaring AYON addon 'resolve' version."""
__version__ = "0.2.0"

View file

@ -1,3 +1,10 @@
name = "resolve"
title = "DaVinci Resolve"
version = "0.1.0"
version = "0.2.0"
client_dir = "ayon_resolve"
ayon_required_addons = {
"core": ">0.3.2",
}
ayon_compatible_addons = {}