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-106630 - See which prims have a composition arc including a variant #816

Merged
merged 1 commit into from
Oct 6, 2020

Conversation

seando-adsk
Copy link
Collaborator

MAYA-106630 - See which prims have a composition arc including a variant

  • 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).

* 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).
Comment on lines +119 to +123
#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
Copy link
Collaborator Author

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;
Copy link
Collaborator Author

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.

Comment on lines +179 to +183
if (!usdItem->prim().GetVariantSets().GetNames().empty())
{
icon.badgeIcon = "out_USD_CompArcBadgeV.png";
icon.pos = Ufe::UIInfoHandler::LowerRight;
}
Copy link
Collaborator Author

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.

Comment on lines +186 to +197
// 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;
}
}
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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.

Comment on lines +79 to +83
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
Copy link
Collaborator Author

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.

@kxl-adsk kxl-adsk added ufe-usd Related to UFE-USD plugin in Maya-Usd workflows Related to in-context workflows labels Oct 5, 2020
Copy link
Contributor

@HamedSabri-adsk HamedSabri-adsk left a comment

Choose a reason for hiding this comment

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

Lgtm! Thanks.

@seando-adsk
Copy link
Collaborator Author

@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).

@seando-adsk seando-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Oct 6, 2020
@kxl-adsk kxl-adsk merged commit da9e9f9 into dev Oct 6, 2020
@kxl-adsk kxl-adsk deleted the donnels/MAYA-106630/support_for_icon_badges branch October 6, 2020 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge Development process is finished, PR is ready for merge ufe-usd Related to UFE-USD plugin in Maya-Usd workflows Related to in-context workflows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants