Skip to content

Commit

Permalink
Minor improvements requested by code review
Browse files Browse the repository at this point in the history
  • Loading branch information
vlasovi committed Mar 26, 2024
1 parent 38a3a43 commit 97b5c16
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions lib/mayaHydra/mayaPlugin/renderOverride.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ namespace {

PXR_NAMESPACE_USING_DIRECTIVE

static const SdfPath MAYA_NATIVE_ROOT = SdfPath("/MayaHydraViewportRenderer");

//! Pick resolution behavior to use when the picked object is a point instance.
enum UsdPointInstancesPickMode
{
Expand Down Expand Up @@ -563,8 +565,7 @@ MtohRenderOverride::MtohRenderOverride(const MtohRendererDescription& desc)
_rendererDesc.rendererName.GetText(),
_rendererDesc.overrideName.GetText(),
_rendererDesc.displayName.GetText());
_ID = SdfPath("/MayaHydraViewportRenderer")
.AppendChild(
_ID = MAYA_NATIVE_ROOT.AppendChild(
TfToken(TfStringPrintf("_MayaHydra_%s_%p", desc.rendererName.GetText(), this)));

MStatus status;
Expand Down Expand Up @@ -1174,7 +1175,7 @@ void MtohRenderOverride::_InitHydraResources(const MHWRender::MDrawContext& draw
_renderIndex,
_rendererPlugin,
_taskController,
SdfPath("/MayaHydraViewportRenderer"),
MAYA_NATIVE_ROOT,
_isUsingHdSt
);

Expand Down Expand Up @@ -1304,20 +1305,18 @@ void MtohRenderOverride::_CreateSceneIndicesChainAfterMergingSceneIndex(const MH
_sceneIndexRegistry.reset(new MayaHydraSceneIndexRegistry(_renderIndexProxy));
}

const SdfPath mayaNativeRoot("/MayaHydraViewportRenderer");

// Add display style scene index
_lastFilteringSceneIndexBeforeCustomFiltering = _displayStyleSceneIndex =
Fvp::DisplayStyleOverrideSceneIndex::New(_lastFilteringSceneIndexBeforeCustomFiltering);
_displayStyleSceneIndex->addExcludedSceneRoot(mayaNativeRoot); // Maya native prims don't use global refinement
_displayStyleSceneIndex->addExcludedSceneRoot(MAYA_NATIVE_ROOT); // Maya native prims don't use global refinement

auto wfSi = TfDynamic_cast<Fvp::WireframeSelectionHighlightSceneIndexRefPtr>(Fvp::WireframeSelectionHighlightSceneIndex::New(_lastFilteringSceneIndexBeforeCustomFiltering, _selection));
wfSi->SetDisplayName("Flow Viewport Wireframe Selection Highlight Scene Index");

// At time of writing, wireframe selection highlighting of Maya native data
// is done by Maya at render item creation time, so avoid double wireframe
// selection highlighting.
wfSi->addExcludedSceneRoot(mayaNativeRoot);
wfSi->addExcludedSceneRoot(MAYA_NATIVE_ROOT);
_lastFilteringSceneIndexBeforeCustomFiltering = wfSi;

const unsigned int currentDisplayStyle = drawContext.getDisplayStyle();
Expand Down
2 changes: 1 addition & 1 deletion lib/mayaHydra/mayaPlugin/renderOverride.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ class MtohRenderOverride : public MHWRender::MRenderOverride
*/
MAYAHYDRA_NS_DEF::SceneIndexDataFactoriesSetup _sceneIndexDataFactoriesSetup;

SdfPath _ID;
SdfPath _ID; // Root path to runtime data (like task controller)

GfVec4d _viewport;

Expand Down

0 comments on commit 97b5c16

Please sign in to comment.