From bff89080de6e5b21c651807351fe89acb26be4e9 Mon Sep 17 00:00:00 2001 From: Rakesh Roopavataram Date: Tue, 23 Jul 2024 18:09:51 -0400 Subject: [PATCH] Misc changes --- .../sceneIndex/fvpReprSelectorSceneIndex.cpp | 11 +++-------- lib/mayaHydra/mayaPlugin/renderOverride.cpp | 13 +++---------- lib/mayaHydra/mayaPlugin/renderOverride.h | 2 +- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.cpp b/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.cpp index 1b75b6916..745c24feb 100644 --- a/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.cpp +++ b/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.cpp @@ -26,8 +26,6 @@ #include #include -#include - // This class is a filtering scene index that that applies a different RepSelector on geometries (such as wireframe or wireframe on shaded) // and also applies an overrideWireframecolor for HdStorm @@ -84,7 +82,7 @@ ReprSelectorSceneIndex::ReprSelectorSceneIndex(const HdSceneIndexBaseRefPtr& inp } void ReprSelectorSceneIndex::SetReprType(RepSelectorType reprType, bool needsReprChanged) -{ +{ switch (reprType){ case RepSelectorType::WireframeRefined: _wireframeTypeDataSource = sWireframeDisplayStyleDataSource; @@ -102,9 +100,6 @@ void ReprSelectorSceneIndex::SetReprType(RepSelectorType reprType, bool needsRep HdPrimvarsSchema::GetDefaultLocator() }; _needsReprChanged = needsReprChanged; - - // Dirty notification only if required. - _DirtyAllPrims(locators); } @@ -122,8 +117,8 @@ ReprSelectorSceneIndex::_DirtyAllPrims( HdSceneIndexPrim ReprSelectorSceneIndex::GetPrim(const SdfPath& primPath) const { HdSceneIndexPrim prim = GetInputSceneIndex()->GetPrim(primPath); - if (prim.dataSource && !_isExcluded(primPath) && - (prim.primType == HdPrimTypeTokens->mesh) && _needsReprChanged){ + if ( (prim.dataSource && !_isExcluded(primPath)) && + (prim.primType == HdPrimTypeTokens->mesh) && _needsReprChanged ) { //Edit the dataSource as an overlay will not replace any existing attribute value. // So we need to edit the _primVarsTokens->overrideWireframeColor attribute as they may already exist in the prim diff --git a/lib/mayaHydra/mayaPlugin/renderOverride.cpp b/lib/mayaHydra/mayaPlugin/renderOverride.cpp index e4805c1fa..fcf772f2b 100644 --- a/lib/mayaHydra/mayaPlugin/renderOverride.cpp +++ b/lib/mayaHydra/mayaPlugin/renderOverride.cpp @@ -684,7 +684,6 @@ MStatus MtohRenderOverride::Render( delegateParams.displaySmoothMeshes = !(currentDisplayStyle & MHWRender::MFrameContext::kFlatShaded); const bool currentUseDefaultMaterial = (drawContext.getDisplayStyle() & MHWRender::MFrameContext::kDefaultMaterial); - const bool xRayEnabled = (drawContext.getDisplayStyle() & MHWRender::MFrameContext::kXray); if (_mayaHydraSceneIndex) { _mayaHydraSceneIndex->SetDefaultLightEnabled(_hasDefaultLighting); @@ -692,7 +691,7 @@ MStatus MtohRenderOverride::Render( _mayaHydraSceneIndex->SetParams(delegateParams); _mayaHydraSceneIndex->PreFrame(drawContext); - if (_NeedToRecreateTheSceneIndicesChain(currentDisplayStyle, xRayEnabled)){ + if (_NeedToRecreateTheSceneIndicesChain(currentDisplayStyle)){ _blockPrimRemovalPropagationSceneIndex->setPrimRemovalBlocked(true);//Prevent prim removal propagation to keep the current selection. //We need to recreate the filtering scene index chain after the merging scene index as there was a change such as in the BBox display style which has been turned on or off. _lastFilteringSceneIndexBeforeCustomFiltering = nullptr;//Release @@ -710,8 +709,6 @@ MStatus MtohRenderOverride::Render( } const Fvp::InformationInterface::ViewportInformation hydraViewportInformation(std::string(panelName.asChar()), cameraName); manager.AddViewportInformation(hydraViewportInformation, _renderIndexProxy, _lastFilteringSceneIndexBeforeCustomFiltering); - - _xRayEnabled = xRayEnabled; _blockPrimRemovalPropagationSceneIndex->setPrimRemovalBlocked(false);//Allow prim removal propagation again. } } @@ -1072,7 +1069,7 @@ void MtohRenderOverride::ClearHydraResources(bool fullReset) _selection.reset(); _wireframeColorInterfaceImp.reset(); _leadObjectPathTracker.reset(); - + _oldDisplayStyle = 0; // Cleanup internal context data that keep references to data that is now // invalid. _engine.ClearTaskContextData(); @@ -1628,16 +1625,12 @@ void MtohRenderOverride::_RenderOverrideChangedCallback( } // return true if we need to recreate the filtering scene indices chain because of a change, false otherwise. -bool MtohRenderOverride::_NeedToRecreateTheSceneIndicesChain(unsigned int currentDisplayStyle, bool xRayEnabled) +bool MtohRenderOverride::_NeedToRecreateTheSceneIndicesChain(unsigned int currentDisplayStyle) { if (areDifferentForOneOfTheseBits(currentDisplayStyle, _oldDisplayStyle, MHWRender::MFrameContext::kBoundingBox)){ return true; } - - if (_xRayEnabled != xRayEnabled){ - return true; - } return false; } diff --git a/lib/mayaHydra/mayaPlugin/renderOverride.h b/lib/mayaHydra/mayaPlugin/renderOverride.h index 180f2fd62..0e6cef430 100644 --- a/lib/mayaHydra/mayaPlugin/renderOverride.h +++ b/lib/mayaHydra/mayaPlugin/renderOverride.h @@ -209,7 +209,7 @@ class MtohRenderOverride : public MHWRender::MRenderOverride, void _AddPluginSelectionHighlighting(); - bool _NeedToRecreateTheSceneIndicesChain(unsigned int currentDisplayStyle, bool xRayEnabled); + bool _NeedToRecreateTheSceneIndicesChain(unsigned int currentDisplayStyle); // Determine the pick handler which should handle a pick hit, to transform // the pick hit into a selection.