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-106190 - Prim type icons #782

Merged
merged 1 commit into from
Sep 22, 2020
Merged

Conversation

seando-adsk
Copy link
Collaborator

MAYA-106190 - Prim type icons

MAYA-106684 - ProxyShape icon

MAYA-106805 - Icons in the Create USD sub-menu

MAYA-106628 - Icons in the UFE menu and a DEF icon in the Outliner

MAYA-106629 - Generic USD icon in the main menu

  • Moved "ae" templates folder (from "lib/mayaUsd/") to new "resources" folder.
  • Added new "resources/icons" folder with all the prim Outliner icons. The icons are part of the MayaUsd_LIB so added icon folder in module path.
  • In UFE context menu added icon for "USD Layer Editor menu item.
  • In UFE context "Add New Prim" submenu added icons for all the prim types.
  • Implemented "treeViewIcon" override in UsdUIInfoHandler interface.
  • Added a few icons to the adsk MayaUsd plugin.
    • mayaUsdProxyShape - outliner icon
    • USD_stage/USD_generic used in menus
  • Removed "_usd" from proxy shape name, when creating a stage from file.

MAYA-106684 - ProxyShape icon
MAYA-106805 - Icons in the Create USD sub-menu
MAYA-106628 - Icons in the UFE menu and a DEF icon in the Outliner
MAYA-106629 - Generic USD icon in the main menu

* Moved "ae" templates folder (from "lib/mayaUsd/") to new "resources" folder.
* Added new "resources/icons" folder with all the prim Outliner icons. The icons
  are part of the MayaUsd_LIB so added icon folder in module path.
* In UFE context menu added icon for "USD Layer Editor menu item.
* In UFE context "Add New Prim" submenu added icons for all the prim types.
* Implemented "treeViewIcon" override in UsdUIInfoHandler interface.
* Added a few icons to the adsk MayaUsd plugin.
** mayaUsdProxyShape - outliner icon
** USD_stage/USD_generic used in menus
* Removed "_usd" from proxy shape name, when creating a stage from file.
lib/mayaUsd/CMakeLists.txt Show resolved Hide resolved
Comment on lines +37 to +43
install(FILES "out_USD_${ICON_BASE}_100.png"
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/icons"
RENAME "out_USD_${ICON_BASE}.png"
)
install(FILES "out_USD_${ICON_BASE}_150.png" "out_USD_${ICON_BASE}_200.png"
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/icons"
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Install all the Outliner icon files (for the various prim types).

@@ -275,7 +287,11 @@ Ufe::ContextOps::Items UsdContextOps::getItems(
int hasLayerEditorCmd{0};
MGlobal::executeCommand("runTimeCommand -exists UsdLayerEditor", hasLayerEditorCmd);
if (hasLayerEditorCmd) {
#if UFE_PREVIEW_VERSION_NUM >= 2023
items.emplace_back(kUSDLayerEditorItem, kUSDLayerEditorLabel, kUSDLayerEditorImage);
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 icon for the "USD Layer Editor" context menu item. And for the "Add New Prim" types below.

Comment on lines -65 to -66
TF_CODING_ERROR("Could not find prim type '%s' for prim %s",
fPrim.GetTypeName().GetText(), UsdDescribe(fPrim).c_str());
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This error was too extreme. There are nodes which don't have a schema type, so just silently return empty ancestor types.

@@ -71,6 +73,48 @@ bool UsdUIInfoHandler::treeViewCellInfo(const Ufe::SceneItem::Ptr& item, Ufe::Ce
return changed;
}

std::string UsdUIInfoHandler::treeViewIcon(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 UFE method to provide an image for specific node types. Avoids the ancestor types call.

Comment on lines +79 to +81
if (!item) {
return "out_USD_UsdTyped.png"; // Default USD icon
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can call with nullptr to get a default USD icon.

lib/mayaUsd/ufe/UsdUIInfoHandler.cpp Show resolved Hide resolved
@@ -8,7 +8,7 @@ PYTHONPATH+:=lib/python
USD_LOCATION:=

+ MayaUSD_LIB ${MAYAUSD_VERSION} ${CMAKE_INSTALL_PREFIX}
icons:
icons: lib/icons
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

All the outliner icons above were added to this folder (as part of the base lib). So that any of the 3 plugins will get them.

Comment on lines +5 to +9
set(PLUGIN_ICONS
out_mayaUsdProxyShape
USD_generic
USD_stage
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These icons are specific to the adsk mayausd plugin.

Comment on lines -84 to -85
if( isValidObjectName($baseName) )
$baseName += "_usd";
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As per spec from Nat, remove this _usd from proxy shape name.

@seando-adsk seando-adsk added adsk Related to Autodesk plugin core Related to core library enhancement New feature or request requires maya This issue requires changes in Maya ufe-usd Related to UFE-USD plugin in Maya-Usd labels Sep 18, 2020
lib/mayaUsd/ufe/UsdUIInfoHandler.cpp Show resolved Hide resolved
}

// We support these node types directly.
static const std::map<std::string, std::string> supportedTypes{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just to avoid repetition, could we have a really small map with the exceptions (empty string and "AL_MayaReference"), and a set for the rest? I.e.

static const std::map<std::string, std::string> exceptionsTypes {
{"", "out_USD_Def.png"},
{"AL_MayaReference", "out_USD_mayaReference.png"}};
if (inTheExceptionsTypes) {
return that;
}
static const std::setstd::string supportedTypes {"BlendShape", "Camera", ...};
if (inSupportedTypes) {
return "out_USD_" + theType + ".png";
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is not really repetition as the map key is node type, which are never repeated. I see your point, but I like the current table. It is very clear what icon filename is associated with each node type. What benefit do you see from your suggestion? It actually requires a 2nd search.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't think the second search is a big deal. The repetition is in having the type twice, once in the key type, once in the mapped type, when the mapped type is simply the key type with a fixed prefix and a fixed suffix. Therefore, the set feels more appropriate, because there really is just one value in the associative data structure, the key type.

If you like the way it is now, I don't have that strong an opinion on it, so I'll leave it up to you.

}

// We support these node types directly.
static const std::map<std::string, std::string> supportedTypes{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't think the second search is a big deal. The repetition is in having the type twice, once in the key type, once in the mapped type, when the mapped type is simply the key type with a fixed prefix and a fixed suffix. Therefore, the set feels more appropriate, because there really is just one value in the associative data structure, the key type.

If you like the way it is now, I don't have that strong an opinion on it, so I'll leave it up to you.

@seando-adsk seando-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Sep 22, 2020
@kxl-adsk kxl-adsk merged commit 77ff438 into dev Sep 22, 2020
@kxl-adsk kxl-adsk deleted the donnels/MAYA-106190/prim_type_icons branch September 22, 2020 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adsk Related to Autodesk plugin core Related to core library enhancement New feature or request ready-for-merge Development process is finished, PR is ready for merge requires maya This issue requires changes in Maya ufe-usd Related to UFE-USD plugin in Maya-Usd
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants