From 97b5c16247066f642f63a5b07986b07ce95595b6 Mon Sep 17 00:00:00 2001 From: Ivan Vlasov Date: Tue, 26 Mar 2024 09:21:43 -0400 Subject: [PATCH] Minor improvements requested by code review --- lib/mayaHydra/mayaPlugin/renderOverride.cpp | 13 ++++++------- lib/mayaHydra/mayaPlugin/renderOverride.h | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/mayaHydra/mayaPlugin/renderOverride.cpp b/lib/mayaHydra/mayaPlugin/renderOverride.cpp index 72f41b76c5..8c9d6f019c 100644 --- a/lib/mayaHydra/mayaPlugin/renderOverride.cpp +++ b/lib/mayaHydra/mayaPlugin/renderOverride.cpp @@ -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 { @@ -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; @@ -1174,7 +1175,7 @@ void MtohRenderOverride::_InitHydraResources(const MHWRender::MDrawContext& draw _renderIndex, _rendererPlugin, _taskController, - SdfPath("/MayaHydraViewportRenderer"), + MAYA_NATIVE_ROOT, _isUsingHdSt ); @@ -1304,12 +1305,10 @@ 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::WireframeSelectionHighlightSceneIndex::New(_lastFilteringSceneIndexBeforeCustomFiltering, _selection)); wfSi->SetDisplayName("Flow Viewport Wireframe Selection Highlight Scene Index"); @@ -1317,7 +1316,7 @@ void MtohRenderOverride::_CreateSceneIndicesChainAfterMergingSceneIndex(const MH // 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(); diff --git a/lib/mayaHydra/mayaPlugin/renderOverride.h b/lib/mayaHydra/mayaPlugin/renderOverride.h index b0128c0882..b25fa83992 100644 --- a/lib/mayaHydra/mayaPlugin/renderOverride.h +++ b/lib/mayaHydra/mayaPlugin/renderOverride.h @@ -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;