Skip to content

Commit

Permalink
Merge pull request #1891 from Autodesk/krickw/MAYA-114247/update_ever…
Browse files Browse the repository at this point in the history
…y_repr

MAYA-114247 Mark everything dirty when display modes change.
  • Loading branch information
seando-adsk authored Jan 5, 2022
2 parents 7984f71 + e5625b5 commit 7e43868
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
7 changes: 6 additions & 1 deletion lib/mayaUsd/render/vp2RenderDelegate/mayaPrimCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,14 @@ struct MayaPrimCommon
{
enum DirtyBits : HdDirtyBits
{
// The rprim has been added, removed or otherwise changed such that the selection highlight
// for the item is dirty
DirtySelectionHighlight = HdChangeTracker::CustomBitsBegin,
// Maya's selection mode has changed, for example into point snapping mode
DirtySelectionMode = (DirtySelectionHighlight << 1),
DirtyBitLast = DirtySelectionMode
// Maya's display mode has changed, for example for shaded to wireframe
DirtyDisplayMode = (DirtySelectionMode << 1),
DirtyBitLast = DirtyDisplayMode
};
};

Expand Down
21 changes: 15 additions & 6 deletions lib/mayaUsd/render/vp2RenderDelegate/proxyRenderDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -829,13 +829,22 @@ void ProxyRenderDelegate::_Execute(const MHWRender::MFrameContext& frameContext)
}
}

if (_defaultCollection->GetReprSelector() != reprSelector) {
_defaultCollection->SetReprSelector(reprSelector);
_taskController->SetCollection(*_defaultCollection);
}

// if there are no repr's to update then don't even call sync.
if (reprSelector != HdReprSelector()) {
if (_defaultCollection->GetReprSelector() != reprSelector) {
_defaultCollection->SetReprSelector(reprSelector);
_taskController->SetCollection(*_defaultCollection);

// Mark everything "dirty" so that sync is called on everything
// If there are multiple views up with different viewport modes then
// this is slow.
auto& rprims = _renderIndex->GetRprimIds();
HdChangeTracker& changeTracker = _renderIndex->GetChangeTracker();
for (auto path : rprims) {
changeTracker.MarkRprimDirty(path, MayaPrimCommon::DirtyDisplayMode);
}
}

_engine.Execute(_renderIndex.get(), &_dummyTasks);
}
}
Expand Down Expand Up @@ -1267,7 +1276,7 @@ void ProxyRenderDelegate::_UpdateSelectionStates()

// now that the appropriate prims have been marked dirty trigger
// a sync so that they all update.
HdRprimCollection collection(HdTokens->geometry, kSmoothHullReprSelector);
HdRprimCollection collection(HdTokens->geometry, _defaultCollection->GetReprSelector());
collection.SetRootPaths(rootPaths);
_taskController->SetCollection(collection);
_engine.Execute(_renderIndex.get(), &_dummyTasks);
Expand Down

0 comments on commit 7e43868

Please sign in to comment.