Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAYA-107000 - [GitHub #1125]Show > Selection Highlighting in the Viewport doesn't work with USD Proxyshape #3142

Merged
merged 1 commit into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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