-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Hiding one scenegraph intance causes a separate instance to be drawn as if it was selected #1516
Comments
Probably related: #444 |
Filed as internal issue #USD-6687 |
The Maya team has found another similar issue when modifying a prim's purpose: To reproduce, use a similar workflow to the above, except instead of modifying the prim's visibility modify it's purpose such that first the prim is hidden (say by switching the purpose from 'default' to 'render'. Then switch the visibility back to 'default'. The selection is incorrectly displayed. |
We have a workaround for this issue, which is to call populateSelection any time an instance has it's instance indices change. Changing the visibility of an instance changes the instance indices, but also changing if a given instance is instancable changes the instance indices. When I call populateSelection after the instance indices change then the behavior is correct. I do have a performance issue with the workaround. I don't know when the instance indices change on a selected rprim, so I always have to call populateSelection. If it was safe to call populateSelection during execute then I could do it from Sync, but I believe that is not allowed. If something similar get GetVisibilityChangeCount() was implemented for DirtyInstanceIndex that would help (the DirtyInstanceIndex could still be for something not selected, but at least it would occur infrequently). |
Yeah, this is all expected: changing visibility of native instances changes instance indices; similarly, changing purpose of native instances will repopulate a part of the scene (since we can't aggregate instances with different purposes), changing instance indices. In both cases, PopulateSelection needs to be called again: the selection buffer stores flattened indices (which change) instead of instance coordinates (which don't change, but can be many integers long). The idea of adding HdChangeTracker::GetInstanceIndicesChangeCount (to mirror the visibility count) and then using that to gate when you call PopulateSelection seems great to me. I think it's correct to recompute the selection buffer whenever that happens, and aside from visibility changes it should be rare. If it works for you, we'd happily take the PR. |
So it seems that something similar to |
GetInstancerIndexVersion confusingly tracks when instancers are added/removed from the render index. GetVisibilityChangeCount covers when we mark DirtyVisibility on geometry. I guess when the indices change, it's possible the same edits could mark DirtyVisibility on geometry, but in general I wouldn't expect those two counters to cover all of the cases; although I'm glad if they're working as an interim fix. |
A bit more investigation has revealed that This leads me be believe that One other question: functions like This came up with my implementation of |
I think it's safest to recreate the selection set whenever you add/remove prims. The visibility change count is used to cache some stuff internally in hydra, but likewise I think those caches get discarded whenever you add/remove prims. To follow the existing pattern you'd keep those calls separate and the app would call both, but I don't think there's a functional difference between combining them vs keeping them separate. |
Description of Issue
In USDView when I hide a scenegraph instance which is selected, a separate instance draws as selected even though it is not selected.
Steps to Reproduce
usdviewApi.property.Set('invisible')
usdviewApi.property.Set('invisible')
I can also reproduce this in MayaUSD using VP2RenderDelegate. If you choose to test MayaUSD & VP2RenderDelegate there are some additional issues (objects turn black) which I believe are a VP2RenderDelegate issue not a USD issue.
You've already fixed one similar issue #1461. This one differs in that the wrong selection is only requested immediately following the visibility change. If I change selection or otherwise refresh the object draw it gets the correct answer.
System Information (OS, Hardware)
Windows 10
Package Versions
USD v21.05
Python 3
Build Flags
The text was updated successfully, but these errors were encountered: