-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When selection changes mark the prims which are added/removed from the list dirty. #1838
Merged
kxl-adsk
merged 4 commits into
dev
from
krickw/MAYA-114247/when_selection_changes_mark_changed_prims_dirty
Nov 23, 2021
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
306a1ce
When selection changes mark the prims which are added/removed from th…
4ea638b
Limit the number of prims which are dirtied when selection changes.
afef603
Clang format.
cccdc6f
The HdSceneDelegate passed to Sync is no longer a UsdImagingDelegate.…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -540,13 +540,6 @@ void HdVP2BasisCurves::Sync( | |
HdDirtyBits* dirtyBits, | ||
TfToken const& reprToken) | ||
{ | ||
// We don't create a repr for the selection token because this token serves | ||
// for selection state update only. Return early to reserve dirty bits so | ||
// they can be used to sync regular reprs later. | ||
if (reprToken == HdVP2ReprTokens->selection) { | ||
return; | ||
} | ||
|
||
// We don't update the repr if it is hidden by the render tags (purpose) | ||
// of the ProxyRenderDelegate. In additional, we need to hide any already | ||
// existing render items because they should not be drawn. | ||
|
@@ -572,6 +565,13 @@ void HdVP2BasisCurves::Sync( | |
|
||
const SdfPath& id = GetId(); | ||
|
||
// Update the selection status if it changed. | ||
if (*dirtyBits & DirtySelectionHighlight) { | ||
_selectionStatus = drawScene.GetSelectionStatus(id); | ||
} else { | ||
TF_VERIFY(_selectionStatus == drawScene.GetSelectionStatus(id)); | ||
} | ||
|
||
if (*dirtyBits & HdChangeTracker::DirtyMaterialId) { | ||
const SdfPath materialId = delegate->GetMaterialId(id); | ||
|
||
|
@@ -1525,11 +1525,6 @@ void HdVP2BasisCurves::_UpdateDrawItem( | |
*/ | ||
HdDirtyBits HdVP2BasisCurves::_PropagateDirtyBits(HdDirtyBits bits) const | ||
{ | ||
// Visibility and selection result in highlight changes: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. DirtySelection is gone, it was never really used properly. There is now only DirtySelectionHighlight and DirtySelectionMode. |
||
if ((bits & HdChangeTracker::DirtyVisibility) && (bits & DirtySelection)) { | ||
bits |= DirtySelectionHighlight; | ||
} | ||
|
||
if (bits & HdChangeTracker::AllDirty) { | ||
// RPrim is dirty, propagate dirty bits to all draw items. | ||
for (const std::pair<TfToken, HdReprSharedPtr>& pair : _reprs) { | ||
|
@@ -1594,26 +1589,19 @@ void HdVP2BasisCurves::_InitRepr(TfToken const& reprToken, HdDirtyBits* dirtyBit | |
if (ARCH_UNLIKELY(!subSceneContainer)) | ||
return; | ||
|
||
// Update selection state on demand or when it is a new Rprim. DirtySelection | ||
// Update selection state on demand or when it is a new Rprim. DirtySelectionHighlight | ||
// will be propagated to all draw items, to trigger sync for each repr. | ||
if (reprToken == HdVP2ReprTokens->selection || _reprs.empty()) { | ||
if (_reprs.empty()) { | ||
const HdVP2SelectionStatus selectionStatus | ||
= param->GetDrawScene().GetSelectionStatus(GetId()); | ||
if (_selectionStatus != selectionStatus) { | ||
_selectionStatus = selectionStatus; | ||
*dirtyBits |= DirtySelection; | ||
*dirtyBits |= DirtySelectionHighlight; | ||
} else if (_selectionStatus == kPartiallySelected) { | ||
*dirtyBits |= DirtySelection; | ||
*dirtyBits |= DirtySelectionHighlight; | ||
} | ||
|
||
// We don't create a repr for the selection token because it serves for | ||
// selection state update only. Return from here. | ||
if (reprToken == HdVP2ReprTokens->selection) | ||
return; | ||
} | ||
|
||
// If the repr has any draw item with the DirtySelection bit, mark the | ||
// DirtySelectionHighlight bit to invoke the synchronization call. | ||
_ReprVector::iterator it | ||
= std::find_if(_reprs.begin(), _reprs.end(), _ReprComparator(reprToken)); | ||
if (it != _reprs.end()) { | ||
|
@@ -1633,9 +1621,6 @@ void HdVP2BasisCurves::_InitRepr(TfToken const& reprToken, HdDirtyBits* dirtyBit | |
// items to ensure proper Sync | ||
drawItem->SetDirtyBits(HdChangeTracker::DirtyRepr); | ||
} | ||
if (drawItem->GetDirtyBits() & DirtySelection) { | ||
*dirtyBits |= DirtySelectionHighlight; | ||
} | ||
} | ||
} | ||
return; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code was in initRepr, but it is not really any different from other code that has dirty flags so there is not a reason for it to be there.