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

When some instances are hidden there is a difference between the Scene #1186

Conversation

williamkrick
Copy link
Contributor

Delegate instance Id and the Maya instance Id. Store a mapping buffer from the Scene Delegate Id to the Maya Id so we can correctly draw selection highlights.

…e Delegate instance Id and the Maya instance Id. Store a mapping buffter from the Scene Delegate Id to the Maya Id so we can correctly draw selection highlights.
// Assign with the index to the active selection highlight color.
if (const auto state = drawScene.GetActiveSelectionState(id)) {
for (const auto& indexArray : state->instanceIndices) {
for (const auto index : indexArray) {
colorIndices[index] = 1;
if (index < delegateToVp2Map.size()) {
int vp2InstanceIndex = delegateToVp2Map[index];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to convert the scene delegate instance id into the Maya instance id to know which instance to draw.

}
} else {
instancerWithNoInstances = true;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is also necessary to not draw something at the origin when only hidden instances are selected.

@huidong-chen huidong-chen added vp2renderdelegate Related to VP2RenderDelegate bug Something isn't working labels Feb 16, 2021
@huidong-chen
Copy link

I guess we also have to mirror the change to basisCurves?

// vector.
VtIntArray delegateToVp2Map = static_cast<HdVP2Instancer*>(instancer)
->ComputeInstanceIdToVp2InstanceIdArray(id);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is very similar to the mesh version. The only difference is I don't have to track is any instances are visible here. In the basis curve case I know some instances are visible because of the earlier check, and we re-use a single render item to draw the dormant curves as well as the lead & active items. The only thing we have to get right is which items do we change the color of, and that is what the new changes do.

@williamkrick williamkrick added the ready-for-merge Development process is finished, PR is ready for merge label Feb 19, 2021
@kxl-adsk kxl-adsk removed the ready-for-merge Development process is finished, PR is ready for merge label Feb 19, 2021
Copy link

@kxl-adsk kxl-adsk left a comment

Choose a reason for hiding this comment

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

Following interactive tests are failing with this change

54 - testVP2RenderDelegatePointInstanceSelection (Failed)
55 - testVP2RenderDelegatePointInstancesPickMode (Failed)

@williamkrick
Copy link
Contributor Author

Logged PixarAnimationStudios/OpenUSD#1461. Will revisit once we have an answer.

@williamkrick williamkrick deleted the krickw/MAYA-109886/scene_delegate_to_maya_instance_id_mapping branch February 26, 2021 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working vp2renderdelegate Related to VP2RenderDelegate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MAYA-109886] Viewport highlighting does not work as expected for invisible instances
4 participants