Skip to content

Commit

Permalink
Merge pull request #3142 from Autodesk/vlasovi/MAYA-107000
Browse files Browse the repository at this point in the history
MAYA-107000 - [GitHub #1125]Show > Selection Highlighting in the Viewport doesn't work with USD Proxyshape
  • Loading branch information
seando-adsk authored Jun 7, 2023
2 parents 8b542ca + f0639e2 commit d523eed
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/mayaUsd/render/vp2RenderDelegate/mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ namespace {
const TfTokenVector sFallbackShaderPrimvars
= { HdTokens->displayColor, HdTokens->displayOpacity, HdTokens->normals };

// Proper support for selection highlighting on/off switch in
// MRenderItem starts only beyond Maya 2024.1
#if MAYA_API_VERSION > 20240100
constexpr int sDrawModeSelectionHighlighting = MHWRender::MGeometry::kSelectionHighlighting;
#else
constexpr int sDrawModeSelectionHighlighting = 0;
#endif

//! Helper utility function to fill primvar data to vertex buffer.
template <class DEST_TYPE, class SRC_TYPE>
void _FillPrimvarData(
Expand Down Expand Up @@ -2696,7 +2704,8 @@ MHWRender::MRenderItem* HdVP2Mesh::_CreateSelectionHighlightRenderItem(const MSt
name, MHWRender::MRenderItem::DecorationItem, MHWRender::MGeometry::kLines);

constexpr MHWRender::MGeometry::DrawMode drawMode = static_cast<MHWRender::MGeometry::DrawMode>(
MHWRender::MGeometry::kShaded | MHWRender::MGeometry::kTextured);
MHWRender::MGeometry::kShaded | MHWRender::MGeometry::kTextured
| sDrawModeSelectionHighlighting);
renderItem->setDrawMode(drawMode);
renderItem->depthPriority(MHWRender::MRenderItem::sActiveWireDepthPriority);
renderItem->castsShadows(false);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,15 @@ def testSelection(self):
cmds.modelEditor('modelPanel4', e=True, wireframeOnShaded=False, displayLights='default')
self._selectionTest('', usdCube, usdCylinder, proxyDagPath, 'smoothShaded')

# Test selection highlighting enabled/disabled
if (mayaUtils.mayaMajorMinorVersions() > (2024, 1)):
cmds.select(proxyDagPath)
self.assertSnapshotClose('selectionHighlightEnabled.png')
cmds.modelEditor('modelPanel4', e=True, selectionHiliteDisplay=False)
self.assertSnapshotClose('selectionHighlightDisabled.png')
cmds.modelEditor('modelPanel4', e=True, selectionHiliteDisplay=True)
cmds.select(clear=True)

# Test wireframe on shaded
cmds.modelEditor('modelPanel4', e=True, displayAppearance='smoothShaded', displayLights='default')
cmds.modelEditor('modelPanel4', e=True, wireframeOnShaded=True, displayLights='default')
Expand Down

0 comments on commit d523eed

Please sign in to comment.