Merge branch 'develop' into enhancement/AY-1226_Use-AYON-entities

This commit is contained in:
Jakub Trllo 2024-03-14 18:47:52 +01:00
commit 19b350686b
5 changed files with 81 additions and 13 deletions

View file

@ -31,23 +31,26 @@ def viewport_layout_and_camera(camera, layout="layout_1"):
layout (str): layout to use in viewport, defaults to `layout_1`
Use None to not change viewport layout during context.
"""
needs_maximise = 0
# Set to first active non extended viewport
rt.viewport.activeViewportEx(1)
original_camera = rt.viewport.getCamera()
original_layout = rt.viewport.getLayout()
if not original_camera:
# if there is no original camera
# use the current camera as original
original_camera = rt.getNodeByName(camera)
original_type = rt.viewport.getType()
review_camera = rt.getNodeByName(camera)
try:
if layout is not None:
layout = rt.Name(layout)
if rt.viewport.getLayout() != layout:
rt.viewport.setLayout(layout)
if rt.viewport.getLayout() != rt.name(layout):
rt.execute("max tool maximize")
needs_maximise = 1
rt.viewport.setCamera(review_camera)
yield
finally:
rt.viewport.setLayout(original_layout)
rt.viewport.setCamera(original_camera)
if needs_maximise == 1:
rt.execute("max tool maximize")
if original_type == rt.Name("view_camera"):
rt.viewport.setCamera(original_camera)
else:
rt.viewport.setType(original_type)
@contextlib.contextmanager

View file

@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
import pyblish.api
from ayon_core.pipeline import PublishValidationError
from pymxs import runtime as rt
class ValidateExtendedViewport(pyblish.api.ContextPlugin):
"""Validate if the first viewport is an extended viewport."""
order = pyblish.api.ValidatorOrder
families = ["review"]
hosts = ["max"]
label = "Validate Extended Viewport"
def process(self, context):
try:
rt.viewport.activeViewportEx(1)
except RuntimeError:
raise PublishValidationError(
"Please make sure one viewport is not an extended viewport",
description = (
"Please make sure at least one viewport is not an "
"extended viewport but a 3dsmax supported viewport "
"i.e camera/persp/orthographic view.\n\n"
"To rectify it, please go to view in the top menubar, "
"go to Views -> Viewports Configuration -> Layout and "
"right click on one of the panels to change it."
))

@ -1 +1 @@
Subproject commit 6d2793170ed57187842f683a943593973abcc337
Subproject commit 04b35dbf5fc42d905281fc30d3a22b139c1855e5

View file

@ -1067,6 +1067,38 @@ PixmapButton:disabled {
font-size: 13pt;
}
#PublisherVerticalScrollArea QScrollBar {
background: transparent;
margin: 0;
border: none;
}
#PublisherVerticalScrollArea QScrollBar:horizontal {
height: 10px;
margin: 0;
}
#PublisherVerticalScrollArea QScrollBar:vertical {
width: 10px;
margin: 0;
}
#PublisherVerticalScrollArea QScrollBar::handle {
background: {color:bg-scroll-handle};
border-radius: 4px;
margin: 1px;
}
#PublisherVerticalScrollArea QScrollBar::handle:horizontal {
min-width: 20px;
min-height: 8px;
}
#PublisherVerticalScrollArea QScrollBar::handle:vertical {
min-height: 20px;
min-width: 8px;
}
ValidationArtistMessage QLabel {
font-size: 20pt;
font-weight: bold;

View file

@ -56,6 +56,8 @@ class VerticalScrollArea(QtWidgets.QScrollArea):
self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
self.setLayoutDirection(QtCore.Qt.RightToLeft)
self.setObjectName("PublisherVerticalScrollArea")
self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
# Background of scrollbar will be transparent
scrollbar_bg = self.verticalScrollBar().parent()
@ -500,7 +502,9 @@ class ValidationErrorsView(QtWidgets.QWidget):
errors_scroll.setWidget(errors_widget)
errors_layout = QtWidgets.QVBoxLayout(errors_widget)
errors_layout.setContentsMargins(0, 0, 0, 0)
# Add 5 margin to left so the is not directly on the edge of the
# scroll widget
errors_layout.setContentsMargins(5, 0, 0, 0)
layout = QtWidgets.QVBoxLayout(self)
layout.addWidget(errors_scroll, 1)