mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
remove avalon style from maya look assigner
This commit is contained in:
parent
7c63ef68df
commit
bf3b9407cb
5 changed files with 55 additions and 49 deletions
|
|
@ -1,9 +1,9 @@
|
|||
from .app import (
|
||||
App,
|
||||
MayaLookAssignerWindow,
|
||||
show
|
||||
)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"App",
|
||||
"MayaLookAssignerWindow",
|
||||
"show"]
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ import logging
|
|||
|
||||
from Qt import QtWidgets, QtCore
|
||||
|
||||
from openpype.hosts.maya.api.lib import assign_look_by_version
|
||||
|
||||
from avalon import style, io
|
||||
from avalon import io
|
||||
from openpype import style
|
||||
from openpype.tools.utils.lib import qt_app_context
|
||||
from openpype.hosts.maya.api.lib import assign_look_by_version
|
||||
|
||||
from maya import cmds
|
||||
# old api for MFileIO
|
||||
|
|
@ -28,10 +28,10 @@ module = sys.modules[__name__]
|
|||
module.window = None
|
||||
|
||||
|
||||
class App(QtWidgets.QWidget):
|
||||
class MayaLookAssignerWindow(QtWidgets.QWidget):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QtWidgets.QWidget.__init__(self, parent=parent)
|
||||
super(MayaLookAssignerWindow, self).__init__(parent=parent)
|
||||
|
||||
self.log = logging.getLogger(__name__)
|
||||
|
||||
|
|
@ -56,30 +56,41 @@ class App(QtWidgets.QWidget):
|
|||
def setup_ui(self):
|
||||
"""Build the UI"""
|
||||
|
||||
main_splitter = QtWidgets.QSplitter(self)
|
||||
|
||||
# Assets (left)
|
||||
asset_outliner = AssetOutliner()
|
||||
asset_outliner = AssetOutliner(main_splitter)
|
||||
|
||||
# Looks (right)
|
||||
looks_widget = QtWidgets.QWidget()
|
||||
looks_layout = QtWidgets.QVBoxLayout(looks_widget)
|
||||
looks_widget = QtWidgets.QWidget(main_splitter)
|
||||
|
||||
look_outliner = LookOutliner() # Database look overview
|
||||
look_outliner = LookOutliner(looks_widget) # Database look overview
|
||||
|
||||
assign_selected = QtWidgets.QCheckBox("Assign to selected only")
|
||||
assign_selected = QtWidgets.QCheckBox(
|
||||
"Assign to selected only", looks_widget
|
||||
)
|
||||
assign_selected.setToolTip("Whether to assign only to selected nodes "
|
||||
"or to the full asset")
|
||||
remove_unused_btn = QtWidgets.QPushButton("Remove Unused Looks")
|
||||
remove_unused_btn = QtWidgets.QPushButton(
|
||||
"Remove Unused Looks", looks_widget
|
||||
)
|
||||
|
||||
looks_layout = QtWidgets.QVBoxLayout(looks_widget)
|
||||
looks_layout.addWidget(look_outliner)
|
||||
looks_layout.addWidget(assign_selected)
|
||||
looks_layout.addWidget(remove_unused_btn)
|
||||
|
||||
main_splitter.addWidget(asset_outliner)
|
||||
main_splitter.addWidget(looks_widget)
|
||||
main_splitter.setSizes([350, 200])
|
||||
|
||||
# Footer
|
||||
status = QtWidgets.QStatusBar()
|
||||
status = QtWidgets.QStatusBar(self)
|
||||
status.setSizeGripEnabled(False)
|
||||
status.setFixedHeight(25)
|
||||
warn_layer = QtWidgets.QLabel("Current Layer is not "
|
||||
"defaultRenderLayer")
|
||||
warn_layer = QtWidgets.QLabel(
|
||||
"Current Layer is not defaultRenderLayer", self
|
||||
)
|
||||
warn_layer.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
|
||||
warn_layer.setStyleSheet("color: #DD5555; font-weight: bold;")
|
||||
warn_layer.setFixedHeight(25)
|
||||
|
|
@ -92,11 +103,6 @@ class App(QtWidgets.QWidget):
|
|||
# Build up widgets
|
||||
main_layout = QtWidgets.QVBoxLayout(self)
|
||||
main_layout.setSpacing(0)
|
||||
main_splitter = QtWidgets.QSplitter()
|
||||
main_splitter.setStyleSheet("QSplitter{ border: 0px; }")
|
||||
main_splitter.addWidget(asset_outliner)
|
||||
main_splitter.addWidget(looks_widget)
|
||||
main_splitter.setSizes([350, 200])
|
||||
main_layout.addWidget(main_splitter)
|
||||
main_layout.addLayout(footer)
|
||||
|
||||
|
|
@ -124,6 +130,8 @@ class App(QtWidgets.QWidget):
|
|||
self.remove_unused = remove_unused_btn
|
||||
self.assign_selected = assign_selected
|
||||
|
||||
self._first_show = True
|
||||
|
||||
def setup_connections(self):
|
||||
"""Connect interactive widgets with actions"""
|
||||
if self._connections_set_up:
|
||||
|
|
@ -147,11 +155,14 @@ class App(QtWidgets.QWidget):
|
|||
|
||||
def showEvent(self, event):
|
||||
self.setup_connections()
|
||||
super(App, self).showEvent(event)
|
||||
super(MayaLookAssignerWindow, self).showEvent(event)
|
||||
if self._first_show:
|
||||
self._first_show = False
|
||||
self.setStyleSheet(style.load_stylesheet())
|
||||
|
||||
def closeEvent(self, event):
|
||||
self.remove_connection()
|
||||
super(App, self).closeEvent(event)
|
||||
super(MayaLookAssignerWindow, self).closeEvent(event)
|
||||
|
||||
def _on_renderlayer_switch(self, *args):
|
||||
"""Callback that updates on Maya renderlayer switch"""
|
||||
|
|
@ -267,7 +278,7 @@ def show():
|
|||
if widget.objectName() == "MayaWindow")
|
||||
|
||||
with qt_app_context():
|
||||
window = App(parent=mainwindow)
|
||||
window = MayaLookAssignerWindow(parent=mainwindow)
|
||||
window.setStyleSheet(style.load_stylesheet())
|
||||
window.show()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
from Qt import QtWidgets, QtCore
|
||||
|
||||
|
||||
DEFAULT_COLOR = "#fb9c15"
|
||||
|
||||
|
||||
class View(QtWidgets.QTreeView):
|
||||
data_changed = QtCore.Signal()
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ from .models import (
|
|||
LookModel
|
||||
)
|
||||
from . import commands
|
||||
from . import views
|
||||
from .views import View
|
||||
|
||||
from maya import cmds
|
||||
|
||||
|
|
@ -24,25 +24,28 @@ class AssetOutliner(QtWidgets.QWidget):
|
|||
selection_changed = QtCore.Signal()
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QtWidgets.QWidget.__init__(self, parent)
|
||||
super(AssetOutliner, self).__init__(parent)
|
||||
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
|
||||
title = QtWidgets.QLabel("Assets")
|
||||
title = QtWidgets.QLabel("Assets", self)
|
||||
title.setAlignment(QtCore.Qt.AlignCenter)
|
||||
title.setStyleSheet("font-weight: bold; font-size: 12px")
|
||||
|
||||
model = AssetModel()
|
||||
view = views.View()
|
||||
view = View(self)
|
||||
view.setModel(model)
|
||||
view.customContextMenuRequested.connect(self.right_mouse_menu)
|
||||
view.setSortingEnabled(False)
|
||||
view.setHeaderHidden(True)
|
||||
view.setIndentation(10)
|
||||
|
||||
from_all_asset_btn = QtWidgets.QPushButton("Get All Assets")
|
||||
from_selection_btn = QtWidgets.QPushButton("Get Assets From Selection")
|
||||
from_all_asset_btn = QtWidgets.QPushButton(
|
||||
"Get All Assets", self
|
||||
)
|
||||
from_selection_btn = QtWidgets.QPushButton(
|
||||
"Get Assets From Selection", self
|
||||
)
|
||||
|
||||
layout = QtWidgets.QVBoxLayout(self)
|
||||
layout.addWidget(title)
|
||||
layout.addWidget(from_all_asset_btn)
|
||||
layout.addWidget(from_selection_btn)
|
||||
|
|
@ -58,8 +61,6 @@ class AssetOutliner(QtWidgets.QWidget):
|
|||
self.view = view
|
||||
self.model = model
|
||||
|
||||
self.setLayout(layout)
|
||||
|
||||
self.log = logging.getLogger(__name__)
|
||||
|
||||
def clear(self):
|
||||
|
|
@ -188,15 +189,10 @@ class LookOutliner(QtWidgets.QWidget):
|
|||
menu_apply_action = QtCore.Signal()
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QtWidgets.QWidget.__init__(self, parent)
|
||||
|
||||
# look manager layout
|
||||
layout = QtWidgets.QVBoxLayout(self)
|
||||
layout.setContentsMargins(0, 0, 0, 0)
|
||||
layout.setSpacing(10)
|
||||
super(LookOutliner, self).__init__(parent)
|
||||
|
||||
# Looks from database
|
||||
title = QtWidgets.QLabel("Looks")
|
||||
title = QtWidgets.QLabel("Looks", self)
|
||||
title.setAlignment(QtCore.Qt.AlignCenter)
|
||||
title.setStyleSheet("font-weight: bold; font-size: 12px")
|
||||
title.setAlignment(QtCore.Qt.AlignCenter)
|
||||
|
|
@ -207,13 +203,17 @@ class LookOutliner(QtWidgets.QWidget):
|
|||
proxy = QtCore.QSortFilterProxyModel()
|
||||
proxy.setSourceModel(model)
|
||||
|
||||
view = views.View()
|
||||
view = View(self)
|
||||
view.setModel(proxy)
|
||||
view.setMinimumHeight(180)
|
||||
view.setToolTip("Use right mouse button menu for direct actions")
|
||||
view.customContextMenuRequested.connect(self.right_mouse_menu)
|
||||
view.sortByColumn(0, QtCore.Qt.AscendingOrder)
|
||||
|
||||
# look manager layout
|
||||
layout = QtWidgets.QVBoxLayout(self)
|
||||
layout.setContentsMargins(0, 0, 0, 0)
|
||||
layout.setSpacing(10)
|
||||
layout.addWidget(title)
|
||||
layout.addWidget(view)
|
||||
|
||||
|
|
|
|||
|
|
@ -224,20 +224,18 @@ class HostToolsHelper:
|
|||
def get_look_assigner_tool(self, parent):
|
||||
"""Create, cache and return look assigner tool window."""
|
||||
if self._look_assigner_tool is None:
|
||||
import mayalookassigner
|
||||
from openpype.tools.mayalookassigner import MayaLookAssignerWindow
|
||||
|
||||
mayalookassigner_window = mayalookassigner.App(parent)
|
||||
mayalookassigner_window = MayaLookAssignerWindow(parent)
|
||||
self._look_assigner_tool = mayalookassigner_window
|
||||
return self._look_assigner_tool
|
||||
|
||||
def show_look_assigner(self, parent=None):
|
||||
"""Look manager is Maya specific tool for look management."""
|
||||
from avalon import style
|
||||
|
||||
with qt_app_context():
|
||||
look_assigner_tool = self.get_look_assigner_tool(parent)
|
||||
look_assigner_tool.show()
|
||||
look_assigner_tool.setStyleSheet(style.load_stylesheet())
|
||||
|
||||
def get_experimental_tools_dialog(self, parent=None):
|
||||
"""Dialog of experimental tools.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue