Skip to content
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

Reduced dirty notifications for isolate select. #239

Merged

Conversation

ppt-adsk
Copy link
Collaborator

@ppt-adsk ppt-adsk commented Jan 20, 2025

Makes isolate select notifications easier to understand, and potentially improves performance by avoiding pulling on data when not necessary. Performance has not been measured, only correctness.

@ppt-adsk ppt-adsk self-assigned this Jan 20, 2025
@ppt-adsk ppt-adsk requested a review from debloip-adsk January 20, 2025 18:13
@@ -174,6 +174,7 @@ void ViewportInformationAndSceneIndicesPerViewportDataManager::DisableIsolateSel
)
{
_isolateSelection[viewportId] = nullptr;
_isolateSelectSceneIndex->SetViewport(viewportId, nullptr);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed latent bug that was being compensated for in renderOverride.cpp. The Flow Viewport Toolkit should not rely on clients to manage the isolate select scene index properly when it can do so itself.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Core file in the review. Instancers that were completely excluded were being excluded by virtue of their prototype visibility being set false, which is wasteful. Now, we simply use the instancer mask to make all instances invisible.

inputPrim.dataSource = HdContainerDataSourceEditor(inputPrim.dataSource)
.Set(instancerMaskLocator, maskDs)
.Finish();
inputPrim.dataSource =
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Factored out to unnamed namespace.

@@ -179,6 +188,20 @@ HdSceneIndexPrim IsolateSelectSceneIndex::GetPrim(const SdfPath& primPath) const
// HYDRA-1242: setting visibility on GeomSubset prim causes hang in Hydra
// Storm.
if (!included && !isGeomSubset(inputPrim)) {
// If an instancer is not included, none of its instances are, so set
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mark all instances as invisible by using the instancer mask. We still set the instancer itself as invisible, even though for Hydra Storm this does not seem to have any effect.

auto prim = GetInputSceneIndex()->GetPrim(primPath);
if (prim.primType == HdPrimTypeTokens->material) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't set materials as invisible, and don't recurse.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deal with awkward Maya notification system that uses a boolean to distinguish between isolate select state changes and isolate select object changes, sending two notifications on first transition from on to off. We account for this and only dirty once.

if (TF_VERIFY(!viewSelectedObjectsChanged)) {
found->second = IsolateSelectState::IsolateSelectPendingObjects;
}
return;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Early out and don't notify, wait for the second notification.

IsolateSelectOn};

using VpIsolateSelectStates = std::map<std::string, IsolateSelectState>;
VpIsolateSelectStates _isolateSelectState;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per-viewport isolate select notification state tracking.

@ppt-adsk ppt-adsk assigned ppt-adsk and unassigned ppt-adsk Jan 20, 2025
Copy link
Collaborator

@debloip-adsk debloip-adsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One quick question, otherwise looking good, thanks!

// pendingObjects: message false --> illegal, warn, do not notify.
// pendingObjects: message true --> notify, go to on.
//
// on: message false --> go to off, notify.
Copy link
Collaborator

@debloip-adsk debloip-adsk Jan 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be sure, is line 1845 handling this case? Asking since "message" in this comment corresponds to viewSelectedObjectsChanged, but when IsolateSelectState is already on, I don't see any code that sets it to off based on the value of viewSelectedObjectsChanged, only based on view.viewSelected(). Maybe one implies the other but just want to make sure.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, I am assuming that view.viewSelected() false is consistent with a transition from isolate select on to a message with viewSelectedObjectsChanged false. Empirical validation says this is the case, so line 1845 is handling it.

@ppt-adsk ppt-adsk requested a review from debloip-adsk January 21, 2025 19:45
@ppt-adsk ppt-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Jan 21, 2025
@lilike-adsk lilike-adsk merged commit 8c28c16 into dev Jan 22, 2025
10 checks passed
@lilike-adsk lilike-adsk deleted the tremblp/HYDRA-1341/isolate_select_fewer_dirty_notifications branch January 22, 2025 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge Development process is finished, PR is ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants