Skip to content

Commit

Permalink
Misc changes
Browse files Browse the repository at this point in the history
  • Loading branch information
roopavr-adsk committed Jul 23, 2024
1 parent eb7fcd1 commit bff8908
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 19 deletions.
11 changes: 3 additions & 8 deletions lib/flowViewport/sceneIndex/fvpReprSelectorSceneIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
#include <pxr/imaging/hd/primvarsSchema.h>
#include <pxr/imaging/hd/sceneIndexPrimView.h>

#include <iostream>

// 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

Expand Down Expand Up @@ -84,7 +82,7 @@ ReprSelectorSceneIndex::ReprSelectorSceneIndex(const HdSceneIndexBaseRefPtr& inp
}

void ReprSelectorSceneIndex::SetReprType(RepSelectorType reprType, bool needsReprChanged)
{
{
switch (reprType){
case RepSelectorType::WireframeRefined:
_wireframeTypeDataSource = sWireframeDisplayStyleDataSource;
Expand All @@ -102,9 +100,6 @@ void ReprSelectorSceneIndex::SetReprType(RepSelectorType reprType, bool needsRep
HdPrimvarsSchema::GetDefaultLocator()
};
_needsReprChanged = needsReprChanged;

// Dirty notification only if required.

_DirtyAllPrims(locators);
}

Expand All @@ -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
Expand Down
13 changes: 3 additions & 10 deletions lib/mayaHydra/mayaPlugin/renderOverride.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -684,15 +684,14 @@ 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);
_mayaHydraSceneIndex->SetDefaultLight(_defaultLight);
_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
Expand All @@ -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.
}
}
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
}
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 @@ -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.
Expand Down

0 comments on commit bff8908

Please sign in to comment.