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

MAYA-102266 Selection highlight color for lead and active selection #671

Merged
merged 3 commits into from
Jul 28, 2020

Conversation

huidong-chen
Copy link

To be consistent with Maya's convention, lead selection and active selection should be highlighted with different colors.

To be consistent with Maya's convention, lead selection and active
selection should be highlighted with different colors.
@cfmoore007
Copy link

cfmoore007 commented Jul 21, 2020

I tried compiling this, against f937f9c ( + this PR ) with Maya Beta PR116, and received this error :

F:\Repos\maya-usd\lib\mayaUsd\ufe\UsdContextOps.cpp(363): error C2653: 'UsdUndoAddNewPrimCommand': is not a class or namespace name [F:\APPLICATIONS\MayaUSD\f937f9c-selection_highlight\build\lib\mayaUsd\mayaUsd.vcxproj] F:\Repos\maya-usd\lib\mayaUsd\ufe\UsdContextOps.cpp(363): error C2660: 'MayaUsd_v0::ufe::UsdContextOps::create': function does not take 3 arguments [F:\APPLICATIONS\MayaUSD\f937f9c-selection_highlight\build\lib\mayaUsd\mayaUsd.vcxproj] F:\Repos\maya-usd\lib\mayaUsd\ufe\UsdContextOps.cpp(202): note: see declaration of 'MayaUsd_v0::ufe::UsdContextOps::create' utilFileSystem.cpp

Logged as : #674

I'm going to see if I can re-wind to my last successful build, and apply the PR there.

@cfmoore007
Copy link

Compiled against dev @f937f9c and now it works :

Spheres :
selectionHighlight

Basis Curves : ( mixed results )
basisCurves.zip
Referenced Shaded :
basisCurves

Instanced ones do not highlight properly in shaded mode, but work in wireframe :
basisCurves_shaded_instanced_broke

Wireframe OK :
basisCurves_wireframe

@huidong-chen
Copy link
Author

@cfmoore007 The selection highlight refresh issue of basisCurves should be a pre-existing one?

@cfmoore007 cfmoore007 mentioned this pull request Jul 21, 2020
@huidong-chen
Copy link
Author

Yes, it is a pre-existing issue: #259

To fix it, we need another PR that adds a dedicated selection highlight item which can cover the shaded item when being selected.

@cfmoore007
Copy link

@HdC-adsk - no problem, thanks!

Copy link

@cfmoore007 cfmoore007 left a comment

Choose a reason for hiding this comment

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

Approving functionality test based on feedback.

@huidong-chen
Copy link
Author

@cfmoore007 Thanks for super-quick validating.

return;
}

SdfPath usdPath(segments[1].string());

Choose a reason for hiding this comment

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

@ppt-adsk do we have a better way to validate the selected item and extract sdfpath?

Copy link
Collaborator

Choose a reason for hiding this comment

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

At this point, because of lines 131-133, we know the Ufe::SceneItem is a UsdSceneItem, so we can dynamic_pointer_cast to that and simply call prim() on it. In fact, dynamic_pointer_cast and item->runTimeId() != USD_UFE_RUNTIME_ID serve exactly the same purpose, so I would replace lines 131-133 with the dynamic_pointer_cast.

Copy link
Author

Choose a reason for hiding this comment

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

@ppt-adsk The new code looks nicer. However, we need to filter the UFE scene items which don't belong to the current proxy shape, see Line 135. Any suggestion how to handle this logic with the new code?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Changing a Ufe::SceneItem::Ptr to a UsdSceneItem::Ptr wouldn't change lines 135-138, it would only make line 140 less awkward, since you could ask the UsdPrim directly for its SdfPath without going through a string.

However, lines 135-138 might be more elegant as

if (!item->path().startsWith(proxyPath)) {
return;
}

if I'm not mistaken.

Copy link
Author

Choose a reason for hiding this comment

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

Great! Thanks.

Comment on lines 813 to 816
// Start reverse iteration from the second last item in UFE global selection
// and populate active selection.
for (; it != globalSelection->crend(); it++) {
PopulateSelection(*it, proxyPath, *_sceneDelegate, _activeSelection);

Choose a reason for hiding this comment

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

Nothing big, but since you are already checking if the global selection list is empty or not at line 808, you could pull this loop inside the condition.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, that makes sense.

@kxl-adsk kxl-adsk merged commit e504341 into dev Jul 28, 2020
@kxl-adsk kxl-adsk deleted the chenh/MAYA-102266/consistent-selection-highlight-color branch July 28, 2020 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MAYA-102266] VP2RenderDelegate: Selection Highlight Consistent ( No visual cue for last selected object )
6 participants