-
Notifications
You must be signed in to change notification settings - Fork 202
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-106630 - See which prims have a composition arc including a variant #816
Conversation
* Added two new composition arc badge icons for use by Maya Outliner. * Implemented new Ufe::UIInfoHandler::treeViewTooltip() method to display "Introduced Composition Arcs". * Updated override for Ufe::UIInfoHandler::treeViewIcon() to return badge icon (as well as base icon).
#if UFE_PREVIEW_VERSION_NUM >= 2024 | ||
Ufe::UIInfoHandler::Icon UsdUIInfoHandler::treeViewIcon(const Ufe::SceneItem::Ptr& item) const | ||
#else | ||
std::string UsdUIInfoHandler::treeViewIcon(const Ufe::SceneItem::Ptr& item) const | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In UFE v0.2.24, I changed the return type.
const auto search = supportedTypes.find(item->nodeType()); | ||
if (search != supportedTypes.cend()) { | ||
#if UFE_PREVIEW_VERSION_NUM >= 2024 | ||
icon.baseIcon = search->second; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Save the base icon but don't return yet. We'll look for a badge icon below.
if (!usdItem->prim().GetVariantSets().GetNames().empty()) | ||
{ | ||
icon.badgeIcon = "out_USD_CompArcBadgeV.png"; | ||
icon.pos = Ufe::UIInfoHandler::LowerRight; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have any variants, then use the composition arc icon with V.
// Composition related metadata. | ||
static const std::vector<PXR_NS::TfToken> compKeys = { | ||
PXR_NS::SdfFieldKeys->References, SdfFieldKeys->Payload, SdfFieldKeys->InheritPaths, SdfFieldKeys->Specializes}; | ||
for (const auto& k : compKeys) | ||
{ | ||
if (usdItem->prim().HasMetadata(k)) | ||
{ | ||
icon.badgeIcon = "out_USD_CompArcBadge.png"; | ||
icon.pos = Ufe::UIInfoHandler::LowerRight; | ||
break; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise look and see if we have any of the meta data types: references, payload, inheritpaths, specializes. If yes, then add the composition arc badge icon.
} | ||
|
||
#if UFE_PREVIEW_VERSION_NUM >= 2024 | ||
std::string UsdUIInfoHandler::treeViewTooltip(const Ufe::SceneItem::Ptr& item) const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Override this new method added in UFE v0.2.24.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We again check each of the types, but this time we must check them all and add a count of how many of each type we found. Here performance should not be a concern since this method is called "on-demand" when the user hovers for a tooltip.
if(os.getenv('UFE_PREVIEW_VERSION_NUM', '0000') >= '2024'): | ||
# Ball_3 should have a specific node type icon set and no badge. | ||
icon = ufeUIInfo.treeViewIcon(ball3Hier) | ||
self.assertEqual(icon.baseIcon, "out_USD_Sphere.png") | ||
self.assertFalse(icon.badgeIcon) # empty string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a test for the icon. I didn't bother testing the tooltip because the test would be meaningless - either there is or isn't a tooltip. I would not want to check the actual tooltip text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm! Thanks.
@kxl-adsk There was a test failure (testExportAsClip) on master python2 Linux build only. This is one of the known randomly failing tests (in parallel). |
MAYA-106630 - See which prims have a composition arc including a variant