Skip to content

Commit

Permalink
easier to read payload arc on usdview
Browse files Browse the repository at this point in the history
  • Loading branch information
chrizzFTD committed Oct 28, 2023
1 parent 629509c commit b6de2e9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
2 changes: 2 additions & 0 deletions grill/views/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@
}
"""

_USDVIEW_STYLE = _USDVIEW_PUSH_BUTTON_STYLE + _USDVIEW_QTREEVIEW_STYLE

@cache
def _which(what):
return shutil.which(what)
Expand Down
2 changes: 1 addition & 1 deletion grill/views/description.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
Pcp.ArcTypeInherit: _color_attrs('mediumseagreen'),
Pcp.ArcTypeVariant: _color_attrs('orange'),
Pcp.ArcTypeReference: _color_attrs('crimson'), # ~red
Pcp.ArcTypePayload: _color_attrs('darkslateblue'), # ~purple
Pcp.ArcTypePayload: _color_attrs('#9370db'), # ~purple
Pcp.ArcTypeSpecialize: _color_attrs('sienna'), # ~brown
})
_BROWSE_CONTENTS_MENU_TITLE = 'Browse Contents'
Expand Down
26 changes: 15 additions & 11 deletions grill/views/usdview.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,6 @@
_description._PALETTE.set(0) # TODO 2: same question (0 == dark, 1 == light)


def _usdview_tree_init(self, *args, **kwargs):
super(type(self), self).__init__(*args, **kwargs)
self.setStyleSheet(_core._USDVIEW_QTREEVIEW_STYLE)

# Only when in USDView we want to extend the stylesheet of the _Tree class
# TODO: is there a better way?
_description._Tree.__init__ = _usdview_tree_init


def _findOrCreateMenu(parent, title):
return next((child for child in parent.findChildren(QtWidgets.QMenu) if child.title() == title), None) or parent.addMenu(title)

Expand Down Expand Up @@ -55,14 +46,12 @@ def _stage_on_widget(widget_creator):
def _launcher(usdviewApi):
widget = widget_creator(parent=usdviewApi.qMainWindow)
widget.setStage(usdviewApi.stage)
widget.setStyleSheet(_core._USDVIEW_PUSH_BUTTON_STYLE)
return widget
return _launcher


def _layer_stack_from_prims(usdviewApi):
widget = _description.LayerStackComposition(parent=usdviewApi.qMainWindow)
widget.setStyleSheet(_core._USDVIEW_PUSH_BUTTON_STYLE)
widget.setPrimPaths(usdviewApi.dataModel.selection.getPrimPaths())
widget.setStage(usdviewApi.stage)
return widget
Expand Down Expand Up @@ -326,3 +315,18 @@ def _extend_menu(_extender, original, *args):
# We need to do this since primContextMenu imports the function directly, so re-assign with our recently patched one
primContextMenu._GetContextMenuItems = primContextMenuItems._GetContextMenuItems
Tf.Type.Define(GrillPlugin)


def _patch_style(cls): # while a nicer way comes up
original = cls.__init__

def _init_with_usdview_style(self, *args, **kwargs):
original(self, *args, **kwargs)
self.setStyleSheet(_core._USDVIEW_STYLE)
cls.__init__ = _init_with_usdview_style


for cls in _description._Tree, _description.LayerStackComposition:
# Only when in USDView we want to extend the stylesheet of some of the classes tha require them
# TODO: find a better way to do this
_patch_style(cls)

0 comments on commit b6de2e9

Please sign in to comment.