mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
feat(resolve): integration wip
This commit is contained in:
parent
1e6e6fd7c3
commit
d0aa618f1a
10 changed files with 38 additions and 187 deletions
|
|
@ -3,7 +3,6 @@ from .pipeline import (
|
|||
uninstall,
|
||||
ls,
|
||||
containerise,
|
||||
reload_pipeline,
|
||||
publish,
|
||||
launch_workfiles_app
|
||||
)
|
||||
|
|
@ -22,9 +21,11 @@ from .workio import (
|
|||
work_root
|
||||
)
|
||||
|
||||
# from .lib import (
|
||||
#
|
||||
# )
|
||||
from .lib import (
|
||||
get_project_manager
|
||||
)
|
||||
|
||||
from .menu import launch_pype_menu
|
||||
|
||||
__all__ = [
|
||||
"install",
|
||||
|
|
@ -38,6 +39,10 @@ __all__ = [
|
|||
"setup",
|
||||
"get_resolve_module",
|
||||
|
||||
"get_project_manager"
|
||||
|
||||
"launch_pype_menu",
|
||||
|
||||
"open_file",
|
||||
"save_file",
|
||||
"current_file",
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ class SelectInvalidAction(pyblish.api.Action):
|
|||
try:
|
||||
from pype.resolve.utils import get_resolve_module
|
||||
resolve = get_resolve_module()
|
||||
self.log.debug(resolve)
|
||||
except ImportError:
|
||||
raise ImportError("Current host is not Resolve")
|
||||
|
||||
|
|
|
|||
|
|
@ -5,9 +5,8 @@ from Qt import QtWidgets, QtCore
|
|||
|
||||
from .pipeline import (
|
||||
publish,
|
||||
launch_workfiles_app,
|
||||
reload_pipeline
|
||||
)
|
||||
launch_workfiles_app
|
||||
)
|
||||
|
||||
from avalon.tools import (
|
||||
creator,
|
||||
|
|
@ -16,6 +15,7 @@ from avalon.tools import (
|
|||
libraryloader
|
||||
)
|
||||
|
||||
|
||||
def load_stylesheet():
|
||||
path = os.path.join(os.path.dirname(__file__), "menu_style.qss")
|
||||
if not os.path.exists(path):
|
||||
|
|
@ -38,7 +38,7 @@ class Spacer(QtWidgets.QWidget):
|
|||
real_spacer.setFixedHeight(height)
|
||||
|
||||
layout = QtWidgets.QVBoxLayout(self)
|
||||
layout.setContentsMargins(0, 11, 0, 0)
|
||||
layout.setContentsMargins(0, 0, 0, 0)
|
||||
layout.addWidget(real_spacer)
|
||||
|
||||
self.setLayout(layout)
|
||||
|
|
@ -64,6 +64,7 @@ class PypeMenu(QtWidgets.QWidget):
|
|||
publish_btn = QtWidgets.QPushButton("Publish", self)
|
||||
load_btn = QtWidgets.QPushButton("Load", self)
|
||||
inventory_btn = QtWidgets.QPushButton("Inventory", self)
|
||||
libload_btn = QtWidgets.QPushButton("Library", self)
|
||||
rename_btn = QtWidgets.QPushButton("Rename", self)
|
||||
set_colorspace_btn = QtWidgets.QPushButton(
|
||||
"Set colorspace from presets", self
|
||||
|
|
@ -71,7 +72,6 @@ class PypeMenu(QtWidgets.QWidget):
|
|||
reset_resolution_btn = QtWidgets.QPushButton(
|
||||
"Reset Resolution from peresets", self
|
||||
)
|
||||
reload_pipeline_btn = QtWidgets.QPushButton("Reload pipeline", self)
|
||||
|
||||
layout = QtWidgets.QVBoxLayout(self)
|
||||
layout.setContentsMargins(10, 20, 10, 20)
|
||||
|
|
@ -82,16 +82,19 @@ class PypeMenu(QtWidgets.QWidget):
|
|||
layout.addWidget(load_btn)
|
||||
layout.addWidget(inventory_btn)
|
||||
|
||||
layout.addWidget(Spacer(11, self))
|
||||
layout.addWidget(Spacer(15, self))
|
||||
|
||||
layout.addWidget(libload_btn)
|
||||
|
||||
layout.addWidget(Spacer(15, self))
|
||||
|
||||
layout.addWidget(rename_btn)
|
||||
|
||||
layout.addWidget(Spacer(15, self))
|
||||
|
||||
layout.addWidget(set_colorspace_btn)
|
||||
layout.addWidget(reset_resolution_btn)
|
||||
|
||||
layout.addWidget(Spacer(11, self))
|
||||
|
||||
layout.addWidget(reload_pipeline_btn)
|
||||
|
||||
self.setLayout(layout)
|
||||
|
||||
workfiles_btn.clicked.connect(self.on_workfile_clicked)
|
||||
|
|
@ -99,10 +102,10 @@ class PypeMenu(QtWidgets.QWidget):
|
|||
publish_btn.clicked.connect(self.on_publish_clicked)
|
||||
load_btn.clicked.connect(self.on_load_clicked)
|
||||
inventory_btn.clicked.connect(self.on_inventory_clicked)
|
||||
libload_btn.clicked.connect(self.on_libload_clicked)
|
||||
rename_btn.clicked.connect(self.on_rename_clicked)
|
||||
set_colorspace_btn.clicked.connect(self.on_set_colorspace_clicked)
|
||||
reset_resolution_btn.clicked.connect(self.on_reset_resolution_clicked)
|
||||
reload_pipeline_btn.clicked.connect(self.on_reload_pipeline_clicked)
|
||||
|
||||
def on_workfile_clicked(self):
|
||||
print("Clicked Workfile")
|
||||
|
|
@ -124,6 +127,10 @@ class PypeMenu(QtWidgets.QWidget):
|
|||
print("Clicked Inventory")
|
||||
sceneinventory.show()
|
||||
|
||||
def on_libload_clicked(self):
|
||||
print("Clicked Library")
|
||||
libraryloader.show()
|
||||
|
||||
def on_rename_clicked(self):
|
||||
print("Clicked Rename")
|
||||
|
||||
|
|
@ -133,10 +140,6 @@ class PypeMenu(QtWidgets.QWidget):
|
|||
def on_reset_resolution_clicked(self):
|
||||
print("Clicked Reset Resolution")
|
||||
|
||||
def on_reload_pipeline_clicked(self):
|
||||
print("Clicked Reload Pipeline")
|
||||
reload_pipeline()
|
||||
|
||||
|
||||
def launch_pype_menu():
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
|
|
|
|||
|
|
@ -25,5 +25,5 @@ QPushButton:hover {
|
|||
}
|
||||
|
||||
#Spacer {
|
||||
background-color: #121212;
|
||||
background-color: #282828;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Basic avalon integration
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
# import sys
|
||||
from avalon.tools import workfiles
|
||||
from avalon import api as avalon
|
||||
from pyblish import api as pyblish
|
||||
|
|
@ -40,7 +40,6 @@ def install():
|
|||
See the Maya equivalent for inspiration on how to implement this.
|
||||
|
||||
"""
|
||||
from .menu import launch_pype_menu
|
||||
|
||||
# Disable all families except for the ones we explicitly want to see
|
||||
family_states = [
|
||||
|
|
@ -60,9 +59,6 @@ def install():
|
|||
avalon.register_plugin_path(avalon.Creator, CREATE_PATH)
|
||||
avalon.register_plugin_path(avalon.InventoryAction, INVENTORY_PATH)
|
||||
|
||||
# opening menu
|
||||
launch_pype_menu()
|
||||
|
||||
|
||||
def uninstall():
|
||||
"""Uninstall all tha was installed
|
||||
|
|
@ -140,39 +136,6 @@ def launch_workfiles_app(*args):
|
|||
workfiles.show(workdir)
|
||||
|
||||
|
||||
def reload_pipeline():
|
||||
"""Attempt to reload pipeline at run-time.
|
||||
|
||||
CAUTION: This is primarily for development and debugging purposes.
|
||||
|
||||
"""
|
||||
|
||||
import importlib
|
||||
import pype.resolve
|
||||
|
||||
# get avalon config name
|
||||
config = os.getenv("AVALON_CONFIG", "pype")
|
||||
|
||||
for module in ("avalon.io",
|
||||
"avalon.lib",
|
||||
"avalon.pipeline",
|
||||
"avalon.api",
|
||||
"avalon.tools",
|
||||
|
||||
"{}".format(config),
|
||||
"{}.resolve".format(config),
|
||||
"{}.resolve.lib".format(config),
|
||||
"{}.resolve.plugin".format(config),
|
||||
"{}.resolve.pipeline".format(config)
|
||||
):
|
||||
log.info("Reloading module: {}...".format(module))
|
||||
try:
|
||||
module = importlib.import_module(module)
|
||||
importlib.reload(module)
|
||||
except Exception as e:
|
||||
log.warning("Cannot reload module: {}".format(e))
|
||||
|
||||
|
||||
def publish(parent):
|
||||
"""Shorthand to publish from within host"""
|
||||
from avalon.tools import publish
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from avalon import api
|
||||
from pype.resolve import lib as drlib
|
||||
# from pype.resolve import lib as drlib
|
||||
from avalon.vendor import qargparse
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import os
|
||||
import sys
|
||||
import importlib
|
||||
import avalon
|
||||
import avalon.api as avalon
|
||||
import pype
|
||||
|
||||
from pypeapp import Logger
|
||||
|
|
@ -10,25 +9,16 @@ log = Logger().get_logger(__name__)
|
|||
|
||||
|
||||
def main(env):
|
||||
import pype.resolve as bmdvr
|
||||
# Registers pype's Global pyblish plugins
|
||||
pype.install()
|
||||
|
||||
# Register Host (and it's pyblish plugins)
|
||||
host_name = env["AVALON_APP"]
|
||||
host_import_str = "pype.resolve"
|
||||
# activate resolve from pype
|
||||
avalon.install(bmdvr)
|
||||
|
||||
try:
|
||||
host_module = importlib.import_module(host_import_str)
|
||||
except ModuleNotFoundError:
|
||||
log.error((
|
||||
f"Host \"{host_name}\" can't be imported."
|
||||
f" Import string \"{host_import_str}\" failed."
|
||||
))
|
||||
return False
|
||||
|
||||
avalon.api.install(host_module)
|
||||
avalon.api.register_host("resolve")
|
||||
log.info(f"Avalon registred hosts: {avalon.registered_host()}")
|
||||
|
||||
bmdvr.launch_pype_menu()
|
||||
|
||||
if __name__ == "__main__":
|
||||
result = main(os.environ)
|
||||
|
|
|
|||
|
|
@ -1,111 +0,0 @@
|
|||
#! python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# DaVinci Resolve scripting proof of concept. Resolve page external switcher.
|
||||
# Local or TCP/IP control mode.
|
||||
# Refer to Resolve V15 public beta 2 scripting API documentation for host setup.
|
||||
# Copyright 2018 Igor Riđanović, www.hdhead.com
|
||||
from Qt.QtGui import *
|
||||
from Qt.QtWidgets import *
|
||||
from Qt.QtCore import *
|
||||
|
||||
import sys
|
||||
|
||||
# If API module not found assume we"re working as a remote control
|
||||
try:
|
||||
import DaVinciResolveScript
|
||||
# Instantiate Resolve object
|
||||
resolve = DaVinciResolveScript.scriptapp("Resolve")
|
||||
checkboxState = False
|
||||
except ImportError:
|
||||
print("Resolve API not found.")
|
||||
checkboxState = True
|
||||
|
||||
try:
|
||||
_encoding = QApplication.UnicodeUTF8
|
||||
|
||||
def _translate(context, text, disambig):
|
||||
return QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QApplication.translate(context, text, disambig)
|
||||
|
||||
|
||||
class Ui_Form(object):
|
||||
def setupUi(self, Form):
|
||||
Form.setObjectName(str("Resolve Page Switcher"))
|
||||
Form.resize(561, 88)
|
||||
Form.setStyleSheet(str((
|
||||
"background-color: #282828;"
|
||||
"border-color: #555555;"
|
||||
"color: #929292;"
|
||||
"font-size: 13px;"
|
||||
)))
|
||||
self.horizontalLayout = QHBoxLayout(Form)
|
||||
self.horizontalLayout.setObjectName(str("horizontalLayout"))
|
||||
self.mediaButton = QPushButton(Form)
|
||||
self.mediaButton.setObjectName(str("mediaButton"))
|
||||
self.horizontalLayout.addWidget(self.mediaButton)
|
||||
self.editButton = QPushButton(Form)
|
||||
self.editButton.setObjectName(str("editButton"))
|
||||
self.horizontalLayout.addWidget(self.editButton)
|
||||
self.fusionButton = QPushButton(Form)
|
||||
self.fusionButton.setObjectName(str("fusionButton"))
|
||||
self.horizontalLayout.addWidget(self.fusionButton)
|
||||
self.colorButton = QPushButton(Form)
|
||||
self.colorButton.setObjectName(str("colorButton"))
|
||||
self.horizontalLayout.addWidget(self.colorButton)
|
||||
self.fairlightButton = QPushButton(Form)
|
||||
self.fairlightButton.setObjectName(str("fairlightButton"))
|
||||
self.horizontalLayout.addWidget(self.fairlightButton)
|
||||
self.deliverButton = QPushButton(Form)
|
||||
self.deliverButton.setObjectName(str("deliverButton"))
|
||||
self.horizontalLayout.addWidget(self.deliverButton)
|
||||
|
||||
self.mediaButton.clicked.connect(lambda: self.pageswitch("media"))
|
||||
self.editButton.clicked.connect(lambda: self.pageswitch("edit"))
|
||||
self.fusionButton.clicked.connect(lambda: self.pageswitch("fusion"))
|
||||
self.colorButton.clicked.connect(lambda: self.pageswitch("color"))
|
||||
self.fairlightButton.clicked.connect(
|
||||
lambda: self.pageswitch("fairlight"))
|
||||
self.deliverButton.clicked.connect(lambda: self.pageswitch("deliver"))
|
||||
|
||||
self.mediaButton.setStyleSheet(str("background-color: #181818;"))
|
||||
self.editButton.setStyleSheet(str("background-color: #181818;"))
|
||||
self.fusionButton.setStyleSheet(
|
||||
str("background-color: #181818;"))
|
||||
self.colorButton.setStyleSheet(str("background-color: #181818;"))
|
||||
self.fairlightButton.setStyleSheet(
|
||||
str("background-color: #181818;"))
|
||||
self.deliverButton.setStyleSheet(
|
||||
str("background-color: #181818;"))
|
||||
|
||||
self.retranslateUi(Form)
|
||||
QMetaObject.connectSlotsByName(Form)
|
||||
|
||||
def retranslateUi(self, Form):
|
||||
Form.setWindowTitle(_translate("Resolve Page Switcher",
|
||||
"Resolve Page Switcher", None))
|
||||
self.mediaButton.setText(_translate("Form", "Media", None))
|
||||
self.editButton.setText(_translate("Form", "Edit", None))
|
||||
self.fusionButton.setText(_translate("Form", "Fusion", None))
|
||||
self.colorButton.setText(_translate("Form", "Color", None))
|
||||
self.fairlightButton.setText(_translate("Form", "Fairlight", None))
|
||||
self.deliverButton.setText(_translate("Form", "Deliver", None))
|
||||
|
||||
def pageswitch(self, page):
|
||||
# Send page name to server to switch remote Resolve"s page
|
||||
try:
|
||||
resolve.OpenPage(page)
|
||||
print(f"Switched to {page}")
|
||||
except NameError:
|
||||
print("Resolve API not found. Run in remote mode instead?")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = QApplication(sys.argv)
|
||||
Form = QWidget()
|
||||
ui = Ui_Form()
|
||||
ui.setupUi(Form)
|
||||
Form.show()
|
||||
sys.exit(app.exec_())
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
#! python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
import sys
|
||||
from pypeapp import execute, Logger
|
||||
from pype.resolve.utils import get_resolve_module
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ log = Logger().get_logger(__name__, "resolve")
|
|||
self = sys.modules[__name__]
|
||||
self.bmd = None
|
||||
|
||||
|
||||
def get_resolve_module():
|
||||
# dont run if already loaded
|
||||
if self.bmd:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue