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

Fix the regression for selecting single instance objects. #620

Merged

Conversation

huidong-chen
Copy link

@huidong-chen huidong-chen commented Jul 3, 2020

The regression #153 was caused by not using instanced draw for single-instance objects and reproducible on Maya 2020 and before.

Recent Maya preview releases already support consolidation for instanced render items so the performance workaround has been removed, therefore the regression won't be reproduced for those preview releases.


const Ufe::PathSegment pathSegment(usdPath.GetText(), USD_UFE_RUNTIME_ID, USD_UFE_SEPARATOR);
const Ufe::SceneItem::Ptr& si = handler->createItem(_proxyShapeData->ProxyShape()->ufePath() + pathSegment);
if (!si) {
TF_WARN("UFE runtime is not updated for the USD stage. Please save scene and reopen.");
TF_WARN("Failed to create UFE scene item for Rprim '%s'", rprimId.GetText());
Copy link
Author

Choose a reason for hiding this comment

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

The previous warning message is no longer valid.


const SdfPath usdPath(_sceneDelegate->ConvertIndexPathToCachePath(rprimId));
Copy link
Author

Choose a reason for hiding this comment

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

ConvertIndexPathToCachePath() is only required when calling with GetPathForInstanceIndex().

const int drawInstID = intersection.instanceID();
const int usdInstID = drawInstID - 1;

#if defined(USD_IMAGING_API_VERSION) && USD_IMAGING_API_VERSION >= 13
Copy link
Author

Choose a reason for hiding this comment

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

I fixed the single instance selection issue for both conditional compilation branches.

@huidong-chen huidong-chen requested review from kxl-adsk and mattyjams and removed request for kxl-adsk July 3, 2020 15:16
#if defined(USD_IMAGING_API_VERSION) && USD_IMAGING_API_VERSION >= 13
rprimId = _sceneDelegate->GetScenePrimPath(rprimId, usdInstID);
const int usdInstID = drawInstID > 0 ? drawInstID - 1 : 0;
SdfPath usdPath = _sceneDelegate->GetScenePrimPath(rprimId, usdInstID);
Copy link
Author

Choose a reason for hiding this comment

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

@mattyjams I think this new API also handles nested instancing, selection for nested instancing case can work as expected (before this API we could only select the highest instancing group but not an exact instance from the viewport). Very nice!

@kxl-adsk kxl-adsk added the vp2renderdelegate Related to VP2RenderDelegate label Jul 6, 2020
@kxl-adsk kxl-adsk merged commit 6650ba3 into dev Jul 6, 2020
@kxl-adsk kxl-adsk deleted the chenh/MAYA-102530/fix-selection-regression-for-single-instance branch July 6, 2020 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vp2renderdelegate Related to VP2RenderDelegate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants