From 45bb9f37a600ea914d7133239adf5cc391dd64b9 Mon Sep 17 00:00:00 2001 From: Rakesh Roopavataram Date: Tue, 23 Jul 2024 16:49:17 -0400 Subject: [PATCH 01/10] First commit to introduce changes to allow Hydra prim dirtying instead of repeated Add/Removal of prims --- .../sceneIndex/fvpReprSelectorSceneIndex.cpp | 34 ++++++++-- .../sceneIndex/fvpReprSelectorSceneIndex.h | 13 +++- lib/mayaHydra/mayaPlugin/renderOverride.cpp | 64 +++++++++---------- lib/mayaHydra/mayaPlugin/renderOverride.h | 2 + 4 files changed, 70 insertions(+), 43 deletions(-) diff --git a/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.cpp b/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.cpp index b4081fe418..b2a69cb720 100644 --- a/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.cpp +++ b/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.cpp @@ -24,7 +24,9 @@ #include #include #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 @@ -73,13 +75,17 @@ const HdRetainedContainerDataSourceHandle sWireframeDisplayStyleDataSource }//End of namespace -ReprSelectorSceneIndex::ReprSelectorSceneIndex(const HdSceneIndexBaseRefPtr& inputSceneIndex, RepSelectorType type, const std::shared_ptr& wireframeColorInterface) +ReprSelectorSceneIndex::ReprSelectorSceneIndex(const HdSceneIndexBaseRefPtr& inputSceneIndex, const std::shared_ptr& wireframeColorInterface) : ParentClass(inputSceneIndex), InputSceneIndexUtils(inputSceneIndex), _wireframeColorInterface(wireframeColorInterface) { TF_AXIOM(_wireframeColorInterface); - switch (type){ +} + +void ReprSelectorSceneIndex::SetReprType(RepSelectorType reprType, bool needsReprChanged) +{ + switch (reprType){ case RepSelectorType::WireframeRefined: _wireframeTypeDataSource = sWireframeDisplayStyleDataSource; break; @@ -90,13 +96,31 @@ ReprSelectorSceneIndex::ReprSelectorSceneIndex(const HdSceneIndexBaseRefPtr& inp _wireframeTypeDataSource = sRefinedWireframeOnShadedDisplayStyleDataSource; break; } + + const HdDataSourceLocatorSet locators{ + HdLegacyDisplayStyleSchema::GetDefaultLocator() + }; + _needsReprChanged = needsReprChanged; + _DirtyAllPrims(locators); +} + +void +ReprSelectorSceneIndex::_DirtyAllPrims( + const HdDataSourceLocatorSet locators) +{ + HdSceneIndexObserver::DirtiedPrimEntries entries; + for (const SdfPath &path : HdSceneIndexPrimView(GetInputSceneIndex())) { + entries.push_back({path, locators}); + } + _SendPrimsDirtied(entries); } HdSceneIndexPrim ReprSelectorSceneIndex::GetPrim(const SdfPath& primPath) const { HdSceneIndexPrim prim = GetInputSceneIndex()->GetPrim(primPath); - if (prim.dataSource && !_isExcluded(primPath) && (prim.primType == HdPrimTypeTokens->mesh) ){ - + 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 auto edited = HdContainerDataSourceEditor(prim.dataSource); @@ -111,10 +135,8 @@ HdSceneIndexPrim ReprSelectorSceneIndex::GetPrim(const SdfPath& primPath) const //Edit the cull style edited.Set(HdLegacyDisplayStyleSchema::GetCullStyleLocator(), HdRetainedTypedSampledDataSource::New(HdCullStyleTokens->nothing));//No culling - prim.dataSource = HdOverlayContainerDataSource::New({ edited.Finish(), _wireframeTypeDataSource}); } - return prim; } diff --git a/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.h b/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.h index 632ae2cb1e..4d05f7804b 100644 --- a/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.h +++ b/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.h @@ -47,11 +47,12 @@ class ReprSelectorSceneIndex : public PXR_NS::HdSingleInputFilteringSceneIndexBa WireframeRefined, //Refined wireframe (refined means that it supports a "refineLevel" attribute in the displayStyle to get a more refined drawing, valid range is from 0 to 8) WireframeOnSurface, //Wireframe on surface not refined WireframeOnSurfaceRefined,//Wireframe on surface refined + None, }; FVP_API - static ReprSelectorSceneIndexRefPtr New(const PXR_NS::HdSceneIndexBaseRefPtr& inputSceneIndex, RepSelectorType type, const std::shared_ptr& wireframeColorInterface){ - return PXR_NS::TfCreateRefPtr(new ReprSelectorSceneIndex(inputSceneIndex, type, wireframeColorInterface)); + static ReprSelectorSceneIndexRefPtr New(const PXR_NS::HdSceneIndexBaseRefPtr& inputSceneIndex, const std::shared_ptr& wireframeColorInterface){ + return PXR_NS::TfCreateRefPtr(new ReprSelectorSceneIndex(inputSceneIndex, wireframeColorInterface)); } // From HdSceneIndexBase @@ -70,10 +71,13 @@ class ReprSelectorSceneIndex : public PXR_NS::HdSingleInputFilteringSceneIndexBa void addExcludedSceneRoot(const PXR_NS::SdfPath& sceneRoot) { _excludedSceneRoots.emplace(sceneRoot); } + + FVP_API + void SetReprType(RepSelectorType, bool); protected: -ReprSelectorSceneIndex(const PXR_NS::HdSceneIndexBaseRefPtr& inputSceneIndex, RepSelectorType type, const std::shared_ptr& wireframeColorInterface); +ReprSelectorSceneIndex(const PXR_NS::HdSceneIndexBaseRefPtr& inputSceneIndex, const std::shared_ptr& wireframeColorInterface); //From HdSingleInputFilteringSceneIndexBase void _PrimsAdded(const PXR_NS::HdSceneIndexBase& sender, const PXR_NS::HdSceneIndexObserver::AddedPrimEntries& entries) override{ @@ -99,6 +103,9 @@ ReprSelectorSceneIndex(const PXR_NS::HdSceneIndexBaseRefPtr& inputSceneIndex, Re } std::set _excludedSceneRoots; + + void _DirtyAllPrims(const PXR_NS::HdDataSourceLocatorSet locators); + bool _needsReprChanged {false}; PXR_NS::HdRetainedContainerDataSourceHandle _wireframeTypeDataSource = nullptr; std::shared_ptr _wireframeColorInterface; diff --git a/lib/mayaHydra/mayaPlugin/renderOverride.cpp b/lib/mayaHydra/mayaPlugin/renderOverride.cpp index f614ce72e7..dfdae7a2c2 100644 --- a/lib/mayaHydra/mayaPlugin/renderOverride.cpp +++ b/lib/mayaHydra/mayaPlugin/renderOverride.cpp @@ -738,6 +738,27 @@ MStatus MtohRenderOverride::Render( _defaultMaterialSceneIndex->Enable(currentUseDefaultMaterial); _useDefaultMaterial = currentUseDefaultMaterial; } + + const MFrameContext::WireOnShadedMode wireOnShadedMode = MFrameContext::wireOnShadedMode();//Get the user preference + if ( _reprSelectorSceneIndex && (currentDisplayStyle !=_oldDisplayStyle)){ + if( (currentDisplayStyle & MHWRender::MFrameContext::kWireFrame) && + ((currentDisplayStyle & MHWRender::MFrameContext::kGouraudShaded) || + (currentDisplayStyle & MHWRender::MFrameContext::kTextured)) ) { + // Wireframe on top of shaded + // Reduced quality + if (MFrameContext::WireOnShadedMode::kWireFrameOnShadedReduced == wireOnShadedMode ){ + _reprSelectorSceneIndex->SetReprType(Fvp::ReprSelectorSceneIndex::RepSelectorType::WireframeOnSurface, true); + } else {//Full quality + _reprSelectorSceneIndex->SetReprType(Fvp::ReprSelectorSceneIndex::RepSelectorType::WireframeOnSurfaceRefined, true); + } + } + else if( (currentDisplayStyle & MHWRender::MFrameContext::kWireFrame) ){ + //wireframe only, not on top of shaded + _reprSelectorSceneIndex->SetReprType(Fvp::ReprSelectorSceneIndex::RepSelectorType::WireframeRefined, true); + } + else // Shaded mode + _reprSelectorSceneIndex->SetReprType(Fvp::ReprSelectorSceneIndex::RepSelectorType::Default, false); + } HdxRenderTaskParams params; params.enableLighting = true; @@ -1107,16 +1128,11 @@ void MtohRenderOverride::_CreateSceneIndicesChainAfterMergingSceneIndex(const MH _mayaHydraSceneIndex ? _mayaHydraSceneIndex->GetDefaultMaterialExclusionPaths(): SdfPathVector()); const unsigned int currentDisplayStyle = drawContext.getDisplayStyle(); - const MFrameContext::WireOnShadedMode wireOnShadedMode = MFrameContext::wireOnShadedMode();//Get the user preference auto mergingSceneIndex = _renderIndexProxy->GetMergingSceneIndex(); if(! _leadObjectPathTracker){ _leadObjectPathTracker = std::make_shared(mergingSceneIndex, _dirtyLeadObjectSceneIndex); } - - if (! _wireframeColorInterfaceImp){ - _wireframeColorInterfaceImp = std::make_shared(_selection, _leadObjectPathTracker); - } //Are we using Bounding Box display style ? if (currentDisplayStyle & MHWRender::MFrameContext::kBoundingBox){ @@ -1125,37 +1141,17 @@ void MtohRenderOverride::_CreateSceneIndicesChainAfterMergingSceneIndex(const MH bboxSceneIndex->addExcludedSceneRoot(MAYA_NATIVE_ROOT); // Maya native prims are already converted by OGS _lastFilteringSceneIndexBeforeCustomFiltering = bboxSceneIndex; } - else if (currentDisplayStyle & MHWRender::MFrameContext::kWireFrame){//Are we using wireframe somehow ? - - if( (currentDisplayStyle & MHWRender::MFrameContext::kGouraudShaded) || (currentDisplayStyle & MHWRender::MFrameContext::kTextured)){ - // Wireframe on top of shaded - //Reduced quality - if (MFrameContext::WireOnShadedMode::kWireFrameOnShadedReduced == wireOnShadedMode ){ - //Insert the reprselector filtering scene index which updates the repr selector on geometries - auto reprSelectorSceneIndex = Fvp::ReprSelectorSceneIndex::New(_lastFilteringSceneIndexBeforeCustomFiltering, - Fvp::ReprSelectorSceneIndex::RepSelectorType::WireframeOnSurface, _wireframeColorInterfaceImp); - reprSelectorSceneIndex->addExcludedSceneRoot(MAYA_NATIVE_ROOT); // Maya native prims are already converted by OGS - _lastFilteringSceneIndexBeforeCustomFiltering = reprSelectorSceneIndex; - } else {//Full quality - //Should we support kWireFrameOnShadedNone and do not display any wireframe ? - //Insert the reprselector filtering scene index which updates the repr selector on geometries - auto reprSelectorSceneIndex = Fvp::ReprSelectorSceneIndex::New(_lastFilteringSceneIndexBeforeCustomFiltering, - Fvp::ReprSelectorSceneIndex::RepSelectorType::WireframeOnSurfaceRefined, _wireframeColorInterfaceImp); - reprSelectorSceneIndex->addExcludedSceneRoot(MAYA_NATIVE_ROOT); // Maya native prims are already converted by OGS - _lastFilteringSceneIndexBeforeCustomFiltering = reprSelectorSceneIndex; - } - } - else{ - //wireframe only, not on top of shaded - - //Insert the reprselector filtering scene index which updates the repr selector on geometries - auto reprSelectorSceneIndex = Fvp::ReprSelectorSceneIndex::New(_lastFilteringSceneIndexBeforeCustomFiltering, - Fvp::ReprSelectorSceneIndex::RepSelectorType::WireframeRefined, _wireframeColorInterfaceImp); - reprSelectorSceneIndex->addExcludedSceneRoot(MAYA_NATIVE_ROOT); // Maya native prims are already converted by OGS - _lastFilteringSceneIndexBeforeCustomFiltering = reprSelectorSceneIndex; - } + + if (! _wireframeColorInterfaceImp){ + _wireframeColorInterfaceImp = std::make_shared(_selection, _leadObjectPathTracker); } + // Repr selector Scene Index + _lastFilteringSceneIndexBeforeCustomFiltering = _reprSelectorSceneIndex = + Fvp::ReprSelectorSceneIndex::New(_lastFilteringSceneIndexBeforeCustomFiltering, + _wireframeColorInterfaceImp); + _reprSelectorSceneIndex->SetReprType(Fvp::ReprSelectorSceneIndex::RepSelectorType::None,false); + auto wfSi = TfDynamic_cast(Fvp::WireframeSelectionHighlightSceneIndex::New(_lastFilteringSceneIndexBeforeCustomFiltering, _selection, _wireframeColorInterfaceImp)); wfSi->SetDisplayName("Flow Viewport Wireframe Selection Highlight Scene Index"); diff --git a/lib/mayaHydra/mayaPlugin/renderOverride.h b/lib/mayaHydra/mayaPlugin/renderOverride.h index fc45e924ab..180f2fd627 100644 --- a/lib/mayaHydra/mayaPlugin/renderOverride.h +++ b/lib/mayaHydra/mayaPlugin/renderOverride.h @@ -49,6 +49,7 @@ #include #include #include +#include #include #include @@ -259,6 +260,7 @@ class MtohRenderOverride : public MHWRender::MRenderOverride, HdSceneIndexBaseRefPtr _inputSceneIndexOfFilteringSceneIndicesChain {nullptr}; Fvp::DisplayStyleOverrideSceneIndexRefPtr _displayStyleSceneIndex; Fvp::PruneTexturesSceneIndexRefPtr _pruneTexturesSceneIndex; + Fvp::ReprSelectorSceneIndexRefPtr _reprSelectorSceneIndex; Fvp::DefaultMaterialSceneIndexRefPtr _defaultMaterialSceneIndex; HdRenderIndex* _renderIndex = nullptr; Fvp::SelectionTrackerSharedPtr _fvpSelectionTracker; From eb7fcd14f5c9e3ad93d8ebacf399d3f952e8131a Mon Sep 17 00:00:00 2001 From: Rakesh Roopavataram Date: Tue, 23 Jul 2024 17:19:53 -0400 Subject: [PATCH 02/10] minor tweaks --- .../sceneIndex/fvpReprSelectorSceneIndex.cpp | 6 +++++- lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.h | 2 +- lib/mayaHydra/mayaPlugin/renderOverride.cpp | 9 +++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.cpp b/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.cpp index b2a69cb720..1b75b6916f 100644 --- a/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.cpp +++ b/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.cpp @@ -98,9 +98,13 @@ void ReprSelectorSceneIndex::SetReprType(RepSelectorType reprType, bool needsRep } const HdDataSourceLocatorSet locators{ - HdLegacyDisplayStyleSchema::GetDefaultLocator() + HdLegacyDisplayStyleSchema::GetDefaultLocator(), + HdPrimvarsSchema::GetDefaultLocator() }; _needsReprChanged = needsReprChanged; + + // Dirty notification only if required. + _DirtyAllPrims(locators); } diff --git a/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.h b/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.h index 4d05f7804b..9f16e29c02 100644 --- a/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.h +++ b/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.h @@ -47,7 +47,7 @@ class ReprSelectorSceneIndex : public PXR_NS::HdSingleInputFilteringSceneIndexBa WireframeRefined, //Refined wireframe (refined means that it supports a "refineLevel" attribute in the displayStyle to get a more refined drawing, valid range is from 0 to 8) WireframeOnSurface, //Wireframe on surface not refined WireframeOnSurfaceRefined,//Wireframe on surface refined - None, + Default, }; FVP_API diff --git a/lib/mayaHydra/mayaPlugin/renderOverride.cpp b/lib/mayaHydra/mayaPlugin/renderOverride.cpp index dfdae7a2c2..e4805c1fa8 100644 --- a/lib/mayaHydra/mayaPlugin/renderOverride.cpp +++ b/lib/mayaHydra/mayaPlugin/renderOverride.cpp @@ -1150,7 +1150,7 @@ void MtohRenderOverride::_CreateSceneIndicesChainAfterMergingSceneIndex(const MH _lastFilteringSceneIndexBeforeCustomFiltering = _reprSelectorSceneIndex = Fvp::ReprSelectorSceneIndex::New(_lastFilteringSceneIndexBeforeCustomFiltering, _wireframeColorInterfaceImp); - _reprSelectorSceneIndex->SetReprType(Fvp::ReprSelectorSceneIndex::RepSelectorType::None,false); + _reprSelectorSceneIndex->SetReprType(Fvp::ReprSelectorSceneIndex::RepSelectorType::Default, false); auto wfSi = TfDynamic_cast(Fvp::WireframeSelectionHighlightSceneIndex::New(_lastFilteringSceneIndexBeforeCustomFiltering, _selection, _wireframeColorInterfaceImp)); wfSi->SetDisplayName("Flow Viewport Wireframe Selection Highlight Scene Index"); @@ -1630,11 +1630,8 @@ 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) { - if (areDifferentForOneOfTheseBits(currentDisplayStyle, _oldDisplayStyle, - MHWRender::MFrameContext::kGouraudShaded | - MHWRender::MFrameContext::kWireFrame | - MHWRender::MFrameContext::kBoundingBox ) - ){ + if (areDifferentForOneOfTheseBits(currentDisplayStyle, _oldDisplayStyle, + MHWRender::MFrameContext::kBoundingBox)){ return true; } From bff89080de6e5b21c651807351fe89acb26be4e9 Mon Sep 17 00:00:00 2001 From: Rakesh Roopavataram Date: Tue, 23 Jul 2024 18:09:51 -0400 Subject: [PATCH 03/10] 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 1b75b6916f..745c24feba 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 e4805c1fa8..fcf772f2ba 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 180f2fd627..0e6cef4304 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. From d9b1fa057a886c6650412719210c85a634798347 Mon Sep 17 00:00:00 2001 From: Rakesh Roopavataram Date: Wed, 24 Jul 2024 12:47:21 -0400 Subject: [PATCH 04/10] Improvement to repr switch logic. Added comments. Misc cleanup --- .../sceneIndex/fvpReprSelectorSceneIndex.h | 2 +- lib/mayaHydra/mayaPlugin/renderOverride.cpp | 20 +++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.h b/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.h index 9f16e29c02..d1383a21e9 100644 --- a/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.h +++ b/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.h @@ -47,7 +47,7 @@ class ReprSelectorSceneIndex : public PXR_NS::HdSingleInputFilteringSceneIndexBa WireframeRefined, //Refined wireframe (refined means that it supports a "refineLevel" attribute in the displayStyle to get a more refined drawing, valid range is from 0 to 8) WireframeOnSurface, //Wireframe on surface not refined WireframeOnSurfaceRefined,//Wireframe on surface refined - Default, + Default, // Default shaded }; FVP_API diff --git a/lib/mayaHydra/mayaPlugin/renderOverride.cpp b/lib/mayaHydra/mayaPlugin/renderOverride.cpp index fcf772f2ba..c42c7e25e8 100644 --- a/lib/mayaHydra/mayaPlugin/renderOverride.cpp +++ b/lib/mayaHydra/mayaPlugin/renderOverride.cpp @@ -736,25 +736,28 @@ MStatus MtohRenderOverride::Render( _useDefaultMaterial = currentUseDefaultMaterial; } + // Set Required Hydra Repr (Wireframe/WireframeOnShaded/Shaded) + // Hydra supports Wireframe and WireframeOnSurfaceRefined repr for wireframe on shaded mode. + // Refinement level for Hydra is set in Hydra Render Globals const MFrameContext::WireOnShadedMode wireOnShadedMode = MFrameContext::wireOnShadedMode();//Get the user preference if ( _reprSelectorSceneIndex && (currentDisplayStyle !=_oldDisplayStyle)){ if( (currentDisplayStyle & MHWRender::MFrameContext::kWireFrame) && ((currentDisplayStyle & MHWRender::MFrameContext::kGouraudShaded) || (currentDisplayStyle & MHWRender::MFrameContext::kTextured)) ) { // Wireframe on top of shaded - // Reduced quality - if (MFrameContext::WireOnShadedMode::kWireFrameOnShadedReduced == wireOnShadedMode ){ - _reprSelectorSceneIndex->SetReprType(Fvp::ReprSelectorSceneIndex::RepSelectorType::WireframeOnSurface, true); - } else {//Full quality - _reprSelectorSceneIndex->SetReprType(Fvp::ReprSelectorSceneIndex::RepSelectorType::WireframeOnSurfaceRefined, true); + if (MFrameContext::WireOnShadedMode::kWireframeOnShadedFull == wireOnShadedMode && + delegateParams.refineLevel > 1 ) { + _reprSelectorSceneIndex->SetReprType(Fvp::ReprSelectorSceneIndex::RepSelectorType::WireframeOnSurfaceRefined, /*needsReprChanged=*/true); + } else { + _reprSelectorSceneIndex->SetReprType(Fvp::ReprSelectorSceneIndex::RepSelectorType::WireframeOnSurface, /*needsReprChanged=*/true); } } - else if( (currentDisplayStyle & MHWRender::MFrameContext::kWireFrame) ){ + else if( (currentDisplayStyle & MHWRender::MFrameContext::kWireFrame) ) { //wireframe only, not on top of shaded - _reprSelectorSceneIndex->SetReprType(Fvp::ReprSelectorSceneIndex::RepSelectorType::WireframeRefined, true); + _reprSelectorSceneIndex->SetReprType(Fvp::ReprSelectorSceneIndex::RepSelectorType::WireframeRefined, /*needsReprChanged=*/true); } else // Shaded mode - _reprSelectorSceneIndex->SetReprType(Fvp::ReprSelectorSceneIndex::RepSelectorType::Default, false); + _reprSelectorSceneIndex->SetReprType(Fvp::ReprSelectorSceneIndex::RepSelectorType::Default, /*needsReprChanged=*/false); } HdxRenderTaskParams params; @@ -1147,6 +1150,7 @@ void MtohRenderOverride::_CreateSceneIndicesChainAfterMergingSceneIndex(const MH _lastFilteringSceneIndexBeforeCustomFiltering = _reprSelectorSceneIndex = Fvp::ReprSelectorSceneIndex::New(_lastFilteringSceneIndexBeforeCustomFiltering, _wireframeColorInterfaceImp); + _reprSelectorSceneIndex->addExcludedSceneRoot(MAYA_NATIVE_ROOT); _reprSelectorSceneIndex->SetReprType(Fvp::ReprSelectorSceneIndex::RepSelectorType::Default, false); auto wfSi = TfDynamic_cast(Fvp::WireframeSelectionHighlightSceneIndex::New(_lastFilteringSceneIndexBeforeCustomFiltering, _selection, _wireframeColorInterfaceImp)); From 328e95efbc12592e2ee32456575b68c89416e45c Mon Sep 17 00:00:00 2001 From: Rakesh Roopavataram Date: Wed, 24 Jul 2024 15:56:57 -0400 Subject: [PATCH 05/10] Add default case --- lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.cpp b/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.cpp index 745c24feba..2ec2bfe6a1 100644 --- a/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.cpp +++ b/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.cpp @@ -93,6 +93,8 @@ void ReprSelectorSceneIndex::SetReprType(RepSelectorType reprType, bool needsRep case RepSelectorType::WireframeOnSurfaceRefined: _wireframeTypeDataSource = sRefinedWireframeOnShadedDisplayStyleDataSource; break; + case RepSelectorType::Default: + break; } const HdDataSourceLocatorSet locators{ From fdaad906bc2ab3d519c08c1cf63679f2ee25a72e Mon Sep 17 00:00:00 2001 From: Rakesh Roopavataram Date: Mon, 29 Jul 2024 09:23:05 -0400 Subject: [PATCH 06/10] Addressed an issue where refinement adjustment was not captured --- .../sceneIndex/fvpReprSelectorSceneIndex.cpp | 10 ++++++--- .../sceneIndex/fvpReprSelectorSceneIndex.h | 2 +- lib/mayaHydra/mayaPlugin/renderOverride.cpp | 22 ++++++++++++------- lib/mayaHydra/mayaPlugin/renderOverride.h | 1 + 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.cpp b/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.cpp index 2ec2bfe6a1..7dca754557 100644 --- a/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.cpp +++ b/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.cpp @@ -81,7 +81,7 @@ ReprSelectorSceneIndex::ReprSelectorSceneIndex(const HdSceneIndexBaseRefPtr& inp TF_AXIOM(_wireframeColorInterface); } -void ReprSelectorSceneIndex::SetReprType(RepSelectorType reprType, bool needsReprChanged) +void ReprSelectorSceneIndex::SetReprType(RepSelectorType reprType, bool needsReprChanged, int refineLevel) { switch (reprType){ case RepSelectorType::WireframeRefined: @@ -91,7 +91,10 @@ void ReprSelectorSceneIndex::SetReprType(RepSelectorType reprType, bool needsRep _wireframeTypeDataSource = sdWireframeOnShadedDisplayStyleDataSource; break; case RepSelectorType::WireframeOnSurfaceRefined: - _wireframeTypeDataSource = sRefinedWireframeOnShadedDisplayStyleDataSource; + if (refineLevel > 0) + _wireframeTypeDataSource = sRefinedWireframeOnShadedDisplayStyleDataSource; + else + _wireframeTypeDataSource = sdWireframeOnShadedDisplayStyleDataSource; break; case RepSelectorType::Default: break; @@ -99,7 +102,8 @@ void ReprSelectorSceneIndex::SetReprType(RepSelectorType reprType, bool needsRep const HdDataSourceLocatorSet locators{ HdLegacyDisplayStyleSchema::GetDefaultLocator(), - HdPrimvarsSchema::GetDefaultLocator() + HdPrimvarsSchema::GetDefaultLocator(), + HdLegacyDisplayStyleSchema::GetDefaultLocator() }; _needsReprChanged = needsReprChanged; _DirtyAllPrims(locators); diff --git a/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.h b/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.h index d1383a21e9..6a50fe8ca7 100644 --- a/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.h +++ b/lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.h @@ -73,7 +73,7 @@ class ReprSelectorSceneIndex : public PXR_NS::HdSingleInputFilteringSceneIndexBa } FVP_API - void SetReprType(RepSelectorType, bool); + void SetReprType(RepSelectorType reprType, bool needsReprChanged, int refineLevel); protected: diff --git a/lib/mayaHydra/mayaPlugin/renderOverride.cpp b/lib/mayaHydra/mayaPlugin/renderOverride.cpp index c42c7e25e8..be14274dfe 100644 --- a/lib/mayaHydra/mayaPlugin/renderOverride.cpp +++ b/lib/mayaHydra/mayaPlugin/renderOverride.cpp @@ -740,24 +740,29 @@ MStatus MtohRenderOverride::Render( // Hydra supports Wireframe and WireframeOnSurfaceRefined repr for wireframe on shaded mode. // Refinement level for Hydra is set in Hydra Render Globals const MFrameContext::WireOnShadedMode wireOnShadedMode = MFrameContext::wireOnShadedMode();//Get the user preference - if ( _reprSelectorSceneIndex && (currentDisplayStyle !=_oldDisplayStyle)){ + if ( _reprSelectorSceneIndex && (currentDisplayStyle != _oldDisplayStyle) || delegateParams.refineLevel != _oldReprLevel){ if( (currentDisplayStyle & MHWRender::MFrameContext::kWireFrame) && ((currentDisplayStyle & MHWRender::MFrameContext::kGouraudShaded) || (currentDisplayStyle & MHWRender::MFrameContext::kTextured)) ) { // Wireframe on top of shaded - if (MFrameContext::WireOnShadedMode::kWireframeOnShadedFull == wireOnShadedMode && - delegateParams.refineLevel > 1 ) { - _reprSelectorSceneIndex->SetReprType(Fvp::ReprSelectorSceneIndex::RepSelectorType::WireframeOnSurfaceRefined, /*needsReprChanged=*/true); + if (MFrameContext::WireOnShadedMode::kWireframeOnShadedFull == wireOnShadedMode) { + _reprSelectorSceneIndex->SetReprType(Fvp::ReprSelectorSceneIndex::RepSelectorType::WireframeOnSurfaceRefined, + /*needsReprChanged=*/true, delegateParams.refineLevel); } else { - _reprSelectorSceneIndex->SetReprType(Fvp::ReprSelectorSceneIndex::RepSelectorType::WireframeOnSurface, /*needsReprChanged=*/true); + _reprSelectorSceneIndex->SetReprType(Fvp::ReprSelectorSceneIndex::RepSelectorType::WireframeOnSurface, + /*needsReprChanged=*/true, delegateParams.refineLevel); } } else if( (currentDisplayStyle & MHWRender::MFrameContext::kWireFrame) ) { //wireframe only, not on top of shaded - _reprSelectorSceneIndex->SetReprType(Fvp::ReprSelectorSceneIndex::RepSelectorType::WireframeRefined, /*needsReprChanged=*/true); + _reprSelectorSceneIndex->SetReprType(Fvp::ReprSelectorSceneIndex::RepSelectorType::WireframeRefined, + /*needsReprChanged=*/true, delegateParams.refineLevel); } else // Shaded mode - _reprSelectorSceneIndex->SetReprType(Fvp::ReprSelectorSceneIndex::RepSelectorType::Default, /*needsReprChanged=*/false); + _reprSelectorSceneIndex->SetReprType(Fvp::ReprSelectorSceneIndex::RepSelectorType::Default, + /*needsReprChanged=*/false, delegateParams.refineLevel); + + _oldReprLevel = delegateParams.refineLevel; } HdxRenderTaskParams params; @@ -1073,6 +1078,7 @@ void MtohRenderOverride::ClearHydraResources(bool fullReset) _wireframeColorInterfaceImp.reset(); _leadObjectPathTracker.reset(); _oldDisplayStyle = 0; + _oldReprLevel = 0; // Cleanup internal context data that keep references to data that is now // invalid. _engine.ClearTaskContextData(); @@ -1151,7 +1157,7 @@ void MtohRenderOverride::_CreateSceneIndicesChainAfterMergingSceneIndex(const MH Fvp::ReprSelectorSceneIndex::New(_lastFilteringSceneIndexBeforeCustomFiltering, _wireframeColorInterfaceImp); _reprSelectorSceneIndex->addExcludedSceneRoot(MAYA_NATIVE_ROOT); - _reprSelectorSceneIndex->SetReprType(Fvp::ReprSelectorSceneIndex::RepSelectorType::Default, false); + _reprSelectorSceneIndex->SetReprType(Fvp::ReprSelectorSceneIndex::RepSelectorType::Default, false, _globals.delegateParams.refineLevel); auto wfSi = TfDynamic_cast(Fvp::WireframeSelectionHighlightSceneIndex::New(_lastFilteringSceneIndexBeforeCustomFiltering, _selection, _wireframeColorInterfaceImp)); wfSi->SetDisplayName("Flow Viewport Wireframe Selection Highlight Scene Index"); diff --git a/lib/mayaHydra/mayaPlugin/renderOverride.h b/lib/mayaHydra/mayaPlugin/renderOverride.h index 0e6cef4304..58cbbebc48 100644 --- a/lib/mayaHydra/mayaPlugin/renderOverride.h +++ b/lib/mayaHydra/mayaPlugin/renderOverride.h @@ -312,6 +312,7 @@ class MtohRenderOverride : public MHWRender::MRenderOverride, bool _hasDefaultLighting = false; bool _currentlyTextured = false; unsigned int _oldDisplayStyle {0}; + unsigned int _oldReprLevel {0}; bool _useDefaultMaterial; bool _xRayEnabled; }; From c5efb9d86be8760c0e9af4644ec25eac262c78da Mon Sep 17 00:00:00 2001 From: Rakesh Roopavataram Date: Mon, 29 Jul 2024 13:55:08 -0400 Subject: [PATCH 07/10] Add test case --- .../mayaUsd/render/mayaToHydra/CMakeLists.txt | 1 + .../render/mayaToHydra/cpp/CMakeLists.txt | 1 + .../cpp/testSceneIndexDirtying.cpp | 46 +++++++++++++++++++ .../mayaToHydra/cpp/testSceneIndexDirtying.py | 35 ++++++++++++++ 4 files changed, 83 insertions(+) create mode 100644 test/lib/mayaUsd/render/mayaToHydra/cpp/testSceneIndexDirtying.cpp create mode 100644 test/lib/mayaUsd/render/mayaToHydra/cpp/testSceneIndexDirtying.py diff --git a/test/lib/mayaUsd/render/mayaToHydra/CMakeLists.txt b/test/lib/mayaUsd/render/mayaToHydra/CMakeLists.txt index c924f4c9ce..8354b94de0 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/CMakeLists.txt +++ b/test/lib/mayaUsd/render/mayaToHydra/CMakeLists.txt @@ -75,6 +75,7 @@ set(INTERACTIVE_TEST_SCRIPT_FILES cpp/testPointInstancingWireframeHighlight.py cpp/testGeomSubsetsPicking.py cpp/testSinglePicking.py + cpp/testSceneIndexDirtying.py ) #Add this test only if the MayaUsd_FOUND (so also MAYAUSDAPI_LIBRARY) has been found during compile time. diff --git a/test/lib/mayaUsd/render/mayaToHydra/cpp/CMakeLists.txt b/test/lib/mayaUsd/render/mayaToHydra/cpp/CMakeLists.txt index e021812896..e2bd9da295 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/cpp/CMakeLists.txt +++ b/test/lib/mayaUsd/render/mayaToHydra/cpp/CMakeLists.txt @@ -46,6 +46,7 @@ target_sources(${TARGET_NAME} testPointInstancingWireframeHighlight.cpp testGeomSubsetsPicking.cpp testSinglePicking.cpp + testSceneIndexDirtying.cpp ) # ----------------------------------------------------------------------------- diff --git a/test/lib/mayaUsd/render/mayaToHydra/cpp/testSceneIndexDirtying.cpp b/test/lib/mayaUsd/render/mayaToHydra/cpp/testSceneIndexDirtying.cpp new file mode 100644 index 0000000000..a2963a3c29 --- /dev/null +++ b/test/lib/mayaUsd/render/mayaToHydra/cpp/testSceneIndexDirtying.cpp @@ -0,0 +1,46 @@ +// Copyright 2024 Autodesk +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#include "testUtils.h" + +#include +#include + +#include + +#include + +PXR_NAMESPACE_USING_DIRECTIVE + +TEST(SceneIndexDirtying, testDirtyingNew) +{ + // Setup notifications accumulator for the first terminal scene index + const SceneIndicesVector& sceneIndices = GetTerminalSceneIndices(); + ASSERT_GT(sceneIndices.size(), 0u); + SceneIndexNotificationsAccumulator notifsAccumulator(sceneIndices.front()); + + // Set wireframeOnShaded mode + MString wireframeOnCmd = "select -cl; modelEditor -e -wireframeOnShaded 1 modelPanel4; refresh;"; + + MGlobal::executeCommand(wireframeOnCmd); + + const auto& dirtiedPrimEntries = notifsAccumulator.GetDirtiedPrimEntries(); + const auto& addedPrimEntries = notifsAccumulator.GetAddedPrimEntries(); + const auto& removedPrimEntries = notifsAccumulator.GetRemovedPrimEntries(); + + EXPECT_TRUE(dirtiedPrimEntries.size()); // Expect non-zero dirtied prims. + EXPECT_FALSE(addedPrimEntries.size()); // Changing Hydra reprs(via reprSelectorSceneIndex) + EXPECT_FALSE(removedPrimEntries.size()); // should not cause prim Addition or removal. +} diff --git a/test/lib/mayaUsd/render/mayaToHydra/cpp/testSceneIndexDirtying.py b/test/lib/mayaUsd/render/mayaToHydra/cpp/testSceneIndexDirtying.py new file mode 100644 index 0000000000..84b8749477 --- /dev/null +++ b/test/lib/mayaUsd/render/mayaToHydra/cpp/testSceneIndexDirtying.py @@ -0,0 +1,35 @@ +# Copyright 2024 Autodesk +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import maya.cmds as cmds +import fixturesUtils +import mtohUtils +from testUtils import PluginLoaded + +class TestSceneIndexDirtying(mtohUtils.MayaHydraBaseTestCase): + # MayaHydraBaseTestCase.setUpClass requirement. + _file = __file__ + + def setupScene(self): + self.setHdStormRenderer() + cmds.polySphere() + cmds.refresh() + + def test_Dirtying(self): + self.setupScene() + with PluginLoaded('mayaHydraCppTests'): + cmds.mayaHydraCppTest(f="SceneIndexDirtying.testDirtyingNew") + +if __name__ == '__main__': + fixturesUtils.runTests(globals()) From d763306365ed3a19be5e2b5db4a86e38a36c651e Mon Sep 17 00:00:00 2001 From: Rakesh Roopavataram Date: Mon, 29 Jul 2024 14:43:57 -0400 Subject: [PATCH 08/10] Change type from uint to int for Linux gcc compatibility --- lib/mayaHydra/mayaPlugin/renderOverride.cpp | 6 +++--- lib/mayaHydra/mayaPlugin/renderOverride.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/mayaHydra/mayaPlugin/renderOverride.cpp b/lib/mayaHydra/mayaPlugin/renderOverride.cpp index be14274dfe..62b7a2aa94 100644 --- a/lib/mayaHydra/mayaPlugin/renderOverride.cpp +++ b/lib/mayaHydra/mayaPlugin/renderOverride.cpp @@ -740,7 +740,7 @@ MStatus MtohRenderOverride::Render( // Hydra supports Wireframe and WireframeOnSurfaceRefined repr for wireframe on shaded mode. // Refinement level for Hydra is set in Hydra Render Globals const MFrameContext::WireOnShadedMode wireOnShadedMode = MFrameContext::wireOnShadedMode();//Get the user preference - if ( _reprSelectorSceneIndex && (currentDisplayStyle != _oldDisplayStyle) || delegateParams.refineLevel != _oldReprLevel){ + if ( _reprSelectorSceneIndex && (currentDisplayStyle != _oldDisplayStyle) || delegateParams.refineLevel != _oldRefineLevel){ if( (currentDisplayStyle & MHWRender::MFrameContext::kWireFrame) && ((currentDisplayStyle & MHWRender::MFrameContext::kGouraudShaded) || (currentDisplayStyle & MHWRender::MFrameContext::kTextured)) ) { @@ -762,7 +762,7 @@ MStatus MtohRenderOverride::Render( _reprSelectorSceneIndex->SetReprType(Fvp::ReprSelectorSceneIndex::RepSelectorType::Default, /*needsReprChanged=*/false, delegateParams.refineLevel); - _oldReprLevel = delegateParams.refineLevel; + _oldRefineLevel = delegateParams.refineLevel; } HdxRenderTaskParams params; @@ -1078,7 +1078,7 @@ void MtohRenderOverride::ClearHydraResources(bool fullReset) _wireframeColorInterfaceImp.reset(); _leadObjectPathTracker.reset(); _oldDisplayStyle = 0; - _oldReprLevel = 0; + _oldRefineLevel = 0; // Cleanup internal context data that keep references to data that is now // invalid. _engine.ClearTaskContextData(); diff --git a/lib/mayaHydra/mayaPlugin/renderOverride.h b/lib/mayaHydra/mayaPlugin/renderOverride.h index 58cbbebc48..6967b3f504 100644 --- a/lib/mayaHydra/mayaPlugin/renderOverride.h +++ b/lib/mayaHydra/mayaPlugin/renderOverride.h @@ -312,7 +312,7 @@ class MtohRenderOverride : public MHWRender::MRenderOverride, bool _hasDefaultLighting = false; bool _currentlyTextured = false; unsigned int _oldDisplayStyle {0}; - unsigned int _oldReprLevel {0}; + int _oldRefineLevel {0}; bool _useDefaultMaterial; bool _xRayEnabled; }; From 6d64741f7855d1b7e5df12bbc25c6f10db2eed92 Mon Sep 17 00:00:00 2001 From: Rakesh Roopavataram Date: Mon, 29 Jul 2024 15:55:18 -0400 Subject: [PATCH 09/10] style changes --- lib/mayaHydra/mayaPlugin/renderOverride.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mayaHydra/mayaPlugin/renderOverride.cpp b/lib/mayaHydra/mayaPlugin/renderOverride.cpp index 62b7a2aa94..406246ae38 100644 --- a/lib/mayaHydra/mayaPlugin/renderOverride.cpp +++ b/lib/mayaHydra/mayaPlugin/renderOverride.cpp @@ -740,7 +740,7 @@ MStatus MtohRenderOverride::Render( // Hydra supports Wireframe and WireframeOnSurfaceRefined repr for wireframe on shaded mode. // Refinement level for Hydra is set in Hydra Render Globals const MFrameContext::WireOnShadedMode wireOnShadedMode = MFrameContext::wireOnShadedMode();//Get the user preference - if ( _reprSelectorSceneIndex && (currentDisplayStyle != _oldDisplayStyle) || delegateParams.refineLevel != _oldRefineLevel){ + if ( _reprSelectorSceneIndex && (currentDisplayStyle != _oldDisplayStyle) || (delegateParams.refineLevel != _oldRefineLevel)){ if( (currentDisplayStyle & MHWRender::MFrameContext::kWireFrame) && ((currentDisplayStyle & MHWRender::MFrameContext::kGouraudShaded) || (currentDisplayStyle & MHWRender::MFrameContext::kTextured)) ) { From 437340f53f141d1dc85cb2231fe7528a730eeaea Mon Sep 17 00:00:00 2001 From: Rakesh Roopavataram Date: Mon, 29 Jul 2024 17:54:30 -0400 Subject: [PATCH 10/10] Style change for linux again --- lib/mayaHydra/mayaPlugin/renderOverride.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mayaHydra/mayaPlugin/renderOverride.cpp b/lib/mayaHydra/mayaPlugin/renderOverride.cpp index 406246ae38..a70d6307b2 100644 --- a/lib/mayaHydra/mayaPlugin/renderOverride.cpp +++ b/lib/mayaHydra/mayaPlugin/renderOverride.cpp @@ -740,7 +740,7 @@ MStatus MtohRenderOverride::Render( // Hydra supports Wireframe and WireframeOnSurfaceRefined repr for wireframe on shaded mode. // Refinement level for Hydra is set in Hydra Render Globals const MFrameContext::WireOnShadedMode wireOnShadedMode = MFrameContext::wireOnShadedMode();//Get the user preference - if ( _reprSelectorSceneIndex && (currentDisplayStyle != _oldDisplayStyle) || (delegateParams.refineLevel != _oldRefineLevel)){ + if ( (_reprSelectorSceneIndex && (currentDisplayStyle != _oldDisplayStyle) ) || (delegateParams.refineLevel != _oldRefineLevel)){ if( (currentDisplayStyle & MHWRender::MFrameContext::kWireFrame) && ((currentDisplayStyle & MHWRender::MFrameContext::kGouraudShaded) || (currentDisplayStyle & MHWRender::MFrameContext::kTextured)) ) {