diff --git a/lib/mayaUsd/resources/icons/CMakeLists.txt b/lib/mayaUsd/resources/icons/CMakeLists.txt index d89df9f1f6..9e7038eca2 100644 --- a/lib/mayaUsd/resources/icons/CMakeLists.txt +++ b/lib/mayaUsd/resources/icons/CMakeLists.txt @@ -2,39 +2,9 @@ # install # --------------------------------------------------------------------------------------------- -# Maya Outliner icons +# Maya Outliner icons (most come from UsdUfe) set(OUTLINER_ICONS - BlendShape - Camera - Capsule - CompArcBadge - CompArcBadgeV - Cone - Cube - Cylinder - Def - GeomSubset - LightFilter - LightPortal MayaReference - Mesh - NurbsPatch - PluginLight - PointInstancer - Points - Scope - SkelAnimation - Skeleton - SkelRoot - Sphere - UsdGeomCurves - UsdGeomXformable - UsdLuxBoundableLightBase - UsdLuxNonboundableLightBase - UsdTyped - Volume - Material - Shader ) foreach(ICON_BASE ${OUTLINER_ICONS}) # The _100.png files need to be installed without the _100. This is the diff --git a/lib/mayaUsd/ufe/CMakeLists.txt b/lib/mayaUsd/ufe/CMakeLists.txt index 8ea5ec938d..ba2ec61c0d 100644 --- a/lib/mayaUsd/ufe/CMakeLists.txt +++ b/lib/mayaUsd/ufe/CMakeLists.txt @@ -9,6 +9,7 @@ target_sources(${PROJECT_NAME} MayaUsdContextOpsHandler.cpp MayaUsdObject3d.cpp MayaUsdObject3dHandler.cpp + MayaUsdUIInfoHandler.cpp ProxyShapeContextOpsHandler.cpp ProxyShapeHandler.cpp ProxyShapeHierarchy.cpp @@ -39,7 +40,6 @@ target_sources(${PROJECT_NAME} UsdTransform3dSetObjectMatrix.cpp UsdTransform3dUndoableCommands.cpp UsdTranslateUndoableCommand.cpp - UsdUIInfoHandler.cpp UsdUIUfeObserver.cpp UsdUndoDeleteCommand.cpp UsdUndoDuplicateCommand.cpp @@ -171,6 +171,7 @@ set(HEADERS MayaUsdContextOpsHandler.h MayaUsdObject3d.h MayaUsdObject3dHandler.h + MayaUsdUIInfoHandler.h ProxyShapeContextOpsHandler.h ProxyShapeHandler.h ProxyShapeHierarchy.h @@ -203,7 +204,6 @@ set(HEADERS UsdTransform3dSetObjectMatrix.h UsdTransform3dUndoableCommands.h UsdTranslateUndoableCommand.h - UsdUIInfoHandler.h UsdUIUfeObserver.h UsdUndoDeleteCommand.h UsdUndoDuplicateCommand.h diff --git a/lib/mayaUsd/ufe/Global.cpp b/lib/mayaUsd/ufe/Global.cpp index 2012b95ac8..b11f93501d 100644 --- a/lib/mayaUsd/ufe/Global.cpp +++ b/lib/mayaUsd/ufe/Global.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -31,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -198,7 +198,7 @@ MStatus initialize() handlers.attributesHandler = UsdAttributesHandler::create(); usdUfeHandlers.object3dHandler = MayaUsdObject3dHandler::create(); usdUfeHandlers.contextOpsHandler = MayaUsdContextOpsHandler::create(); - handlers.uiInfoHandler = UsdUIInfoHandler::create(); + usdUfeHandlers.uiInfoHandler = MayaUsdUIInfoHandler::create(); #ifdef UFE_V4_FEATURES_AVAILABLE diff --git a/lib/mayaUsd/ufe/MayaUsdUIInfoHandler.cpp b/lib/mayaUsd/ufe/MayaUsdUIInfoHandler.cpp new file mode 100644 index 0000000000..93ad5c0836 --- /dev/null +++ b/lib/mayaUsd/ufe/MayaUsdUIInfoHandler.cpp @@ -0,0 +1,92 @@ +// +// Copyright 2023 Autodesk +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +#include "MayaUsdUIInfoHandler.h" + +#include +#include + +namespace MAYAUSD_NS_DEF { +namespace ufe { + +MayaUsdUIInfoHandler::MayaUsdUIInfoHandler() + : UsdUfe::UsdUIInfoHandler() +{ + // Register a callback to invalidate the invisible color. + fColorChangedCallbackId = MEventMessage::addEventCallback( + "DisplayRGBColorChanged", onColorChanged, reinterpret_cast(this)); + + // Immediately update the invisible color to get a starting current value. + updateInvisibleColor(); +} + +MayaUsdUIInfoHandler::~MayaUsdUIInfoHandler() +{ + // Unregister the callback used to invalidate the invisible color. + if (fColorChangedCallbackId) + MMessage::removeCallback(fColorChangedCallbackId); +} + +/*static*/ +MayaUsdUIInfoHandler::Ptr MayaUsdUIInfoHandler::create() +{ + return std::make_shared(); +} + +void MayaUsdUIInfoHandler::updateInvisibleColor() +{ + // Retrieve the invisible color of the Maya Outliner. + // + // We *cannot* intialize it in treeViewCellInfo() because + // that function gets called in a paint event and calling + // a command in a painting event can cause a recursive paint + // event if commands echoing is on, which can corrupt the + // Qt paint internal which lead to a crash. Typical symptom + // is that the state variable of the Qt paint engine becomes + // null midway through the repaint. + + MDoubleArray color; + MGlobal::executeCommand("displayRGBColor -q \"outlinerInvisibleColor\"", color); + + if (color.length() == 3) { + color.get(fInvisibleColor.data()); + } +} + +/*static*/ +void MayaUsdUIInfoHandler::onColorChanged(void* data) +{ + MayaUsdUIInfoHandler* infoHandler = reinterpret_cast(data); + if (!infoHandler) + return; + + infoHandler->updateInvisibleColor(); +} + +UsdUfe::UsdUIInfoHandler::SupportedTypesMap MayaUsdUIInfoHandler::getSupportedIconTypes() const +{ + auto supportedTypes = Parent::getSupportedIconTypes(); + + // We support these node types directly. + static const UsdUfe::UsdUIInfoHandler::SupportedTypesMap mayaSupportedTypes { + { "MayaReference", "out_USD_MayaReference.png" }, + { "ALMayaReference", "out_USD_MayaReference.png" }, // Same as mayaRef + }; + supportedTypes.insert(mayaSupportedTypes.begin(), mayaSupportedTypes.end()); + return supportedTypes; +} + +} // namespace ufe +} // namespace MAYAUSD_NS_DEF diff --git a/lib/mayaUsd/ufe/MayaUsdUIInfoHandler.h b/lib/mayaUsd/ufe/MayaUsdUIInfoHandler.h new file mode 100644 index 0000000000..94cb1a10b2 --- /dev/null +++ b/lib/mayaUsd/ufe/MayaUsdUIInfoHandler.h @@ -0,0 +1,63 @@ +#ifndef MAYAUSDUIINFOHANDLER_H +#define MAYAUSDUIINFOHANDLER_H + +// +// Copyright 2023 Autodesk +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#include + +#include + +#include + +namespace MAYAUSD_NS_DEF { +namespace ufe { + +//! \brief Implementation of Ufe::UIInfoHandler interface for USD objects. +class MAYAUSD_CORE_PUBLIC MayaUsdUIInfoHandler : public UsdUfe::UsdUIInfoHandler +{ +public: + typedef UsdUfe::UsdUIInfoHandler Parent; + typedef std::shared_ptr Ptr; + + MayaUsdUIInfoHandler(); + ~MayaUsdUIInfoHandler() override; + + // Delete the copy/move constructors assignment operators. + MayaUsdUIInfoHandler(const MayaUsdUIInfoHandler&) = delete; + MayaUsdUIInfoHandler& operator=(const MayaUsdUIInfoHandler&) = delete; + MayaUsdUIInfoHandler(MayaUsdUIInfoHandler&&) = delete; + MayaUsdUIInfoHandler& operator=(MayaUsdUIInfoHandler&&) = delete; + + //! Create a MayaUsdUIInfoHandler. + static MayaUsdUIInfoHandler::Ptr create(); + + UsdUfe::UsdUIInfoHandler::SupportedTypesMap getSupportedIconTypes() const override; + +private: + void updateInvisibleColor(); + + // Note: the on-color-changed callback function is declared taking a void pointer + // to be compatible with MMessage callback API. + static void onColorChanged(void*); + + MCallbackId fColorChangedCallbackId = 0; +}; // MayaUsdUIInfoHandler + +} // namespace ufe +} // namespace MAYAUSD_NS_DEF + +#endif // MAYAUSDUIINFOHANDLER_H diff --git a/lib/usdUfe/CMakeLists.txt b/lib/usdUfe/CMakeLists.txt index 2dddd4f844..c937d455fb 100644 --- a/lib/usdUfe/CMakeLists.txt +++ b/lib/usdUfe/CMakeLists.txt @@ -165,6 +165,7 @@ endif() # ----------------------------------------------------------------------------- add_subdirectory(base) add_subdirectory(python) +add_subdirectory(resources) add_subdirectory(ufe) add_subdirectory(undo) add_subdirectory(utils) diff --git a/lib/usdUfe/resources/CMakeLists.txt b/lib/usdUfe/resources/CMakeLists.txt new file mode 100644 index 0000000000..9357953132 --- /dev/null +++ b/lib/usdUfe/resources/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(icons) diff --git a/lib/usdUfe/resources/icons/CMakeLists.txt b/lib/usdUfe/resources/icons/CMakeLists.txt new file mode 100644 index 0000000000..6d03566e63 --- /dev/null +++ b/lib/usdUfe/resources/icons/CMakeLists.txt @@ -0,0 +1,49 @@ +# --------------------------------------------------------------------------------------------- +# install +# --------------------------------------------------------------------------------------------- + +# TreeView icons +set(TREEVIEW_ICONS + BlendShape + Camera + Capsule + CompArcBadge + CompArcBadgeV + Cone + Cube + Cylinder + Def + GeomSubset + LightFilter + LightPortal + Material + Mesh + NurbsPatch + PluginLight + PointInstancer + Points + Scope + Shader + SkelAnimation + Skeleton + SkelRoot + Sphere + UsdGeomCurves + UsdGeomXformable + UsdLuxBoundableLightBase + UsdLuxNonboundableLightBase + UsdTyped + Volume +) +foreach(ICON_BASE ${TREEVIEW_ICONS}) + # The _100.png files need to be installed without the _100. This is the + # base icon name that is used. A DCC (such as Maya) will automatically + # choose the _150/_200 image if neeeded. + 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" + ) +endforeach() diff --git a/lib/mayaUsd/resources/icons/out_USD_BlendShape_100.png b/lib/usdUfe/resources/icons/out_USD_BlendShape_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_BlendShape_100.png rename to lib/usdUfe/resources/icons/out_USD_BlendShape_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_BlendShape_150.png b/lib/usdUfe/resources/icons/out_USD_BlendShape_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_BlendShape_150.png rename to lib/usdUfe/resources/icons/out_USD_BlendShape_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_BlendShape_200.png b/lib/usdUfe/resources/icons/out_USD_BlendShape_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_BlendShape_200.png rename to lib/usdUfe/resources/icons/out_USD_BlendShape_200.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Camera_100.png b/lib/usdUfe/resources/icons/out_USD_Camera_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Camera_100.png rename to lib/usdUfe/resources/icons/out_USD_Camera_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Camera_150.png b/lib/usdUfe/resources/icons/out_USD_Camera_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Camera_150.png rename to lib/usdUfe/resources/icons/out_USD_Camera_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Camera_200.png b/lib/usdUfe/resources/icons/out_USD_Camera_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Camera_200.png rename to lib/usdUfe/resources/icons/out_USD_Camera_200.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Capsule_100.png b/lib/usdUfe/resources/icons/out_USD_Capsule_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Capsule_100.png rename to lib/usdUfe/resources/icons/out_USD_Capsule_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Capsule_150.png b/lib/usdUfe/resources/icons/out_USD_Capsule_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Capsule_150.png rename to lib/usdUfe/resources/icons/out_USD_Capsule_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Capsule_200.png b/lib/usdUfe/resources/icons/out_USD_Capsule_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Capsule_200.png rename to lib/usdUfe/resources/icons/out_USD_Capsule_200.png diff --git a/lib/mayaUsd/resources/icons/out_USD_CompArcBadgeV_100.png b/lib/usdUfe/resources/icons/out_USD_CompArcBadgeV_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_CompArcBadgeV_100.png rename to lib/usdUfe/resources/icons/out_USD_CompArcBadgeV_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_CompArcBadgeV_150.png b/lib/usdUfe/resources/icons/out_USD_CompArcBadgeV_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_CompArcBadgeV_150.png rename to lib/usdUfe/resources/icons/out_USD_CompArcBadgeV_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_CompArcBadgeV_200.png b/lib/usdUfe/resources/icons/out_USD_CompArcBadgeV_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_CompArcBadgeV_200.png rename to lib/usdUfe/resources/icons/out_USD_CompArcBadgeV_200.png diff --git a/lib/mayaUsd/resources/icons/out_USD_CompArcBadge_100.png b/lib/usdUfe/resources/icons/out_USD_CompArcBadge_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_CompArcBadge_100.png rename to lib/usdUfe/resources/icons/out_USD_CompArcBadge_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_CompArcBadge_150.png b/lib/usdUfe/resources/icons/out_USD_CompArcBadge_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_CompArcBadge_150.png rename to lib/usdUfe/resources/icons/out_USD_CompArcBadge_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_CompArcBadge_200.png b/lib/usdUfe/resources/icons/out_USD_CompArcBadge_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_CompArcBadge_200.png rename to lib/usdUfe/resources/icons/out_USD_CompArcBadge_200.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Cone_100.png b/lib/usdUfe/resources/icons/out_USD_Cone_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Cone_100.png rename to lib/usdUfe/resources/icons/out_USD_Cone_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Cone_150.png b/lib/usdUfe/resources/icons/out_USD_Cone_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Cone_150.png rename to lib/usdUfe/resources/icons/out_USD_Cone_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Cone_200.png b/lib/usdUfe/resources/icons/out_USD_Cone_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Cone_200.png rename to lib/usdUfe/resources/icons/out_USD_Cone_200.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Cube_100.png b/lib/usdUfe/resources/icons/out_USD_Cube_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Cube_100.png rename to lib/usdUfe/resources/icons/out_USD_Cube_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Cube_150.png b/lib/usdUfe/resources/icons/out_USD_Cube_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Cube_150.png rename to lib/usdUfe/resources/icons/out_USD_Cube_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Cube_200.png b/lib/usdUfe/resources/icons/out_USD_Cube_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Cube_200.png rename to lib/usdUfe/resources/icons/out_USD_Cube_200.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Cylinder_100.png b/lib/usdUfe/resources/icons/out_USD_Cylinder_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Cylinder_100.png rename to lib/usdUfe/resources/icons/out_USD_Cylinder_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Cylinder_150.png b/lib/usdUfe/resources/icons/out_USD_Cylinder_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Cylinder_150.png rename to lib/usdUfe/resources/icons/out_USD_Cylinder_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Cylinder_200.png b/lib/usdUfe/resources/icons/out_USD_Cylinder_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Cylinder_200.png rename to lib/usdUfe/resources/icons/out_USD_Cylinder_200.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Def_100.png b/lib/usdUfe/resources/icons/out_USD_Def_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Def_100.png rename to lib/usdUfe/resources/icons/out_USD_Def_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Def_150.png b/lib/usdUfe/resources/icons/out_USD_Def_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Def_150.png rename to lib/usdUfe/resources/icons/out_USD_Def_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Def_200.png b/lib/usdUfe/resources/icons/out_USD_Def_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Def_200.png rename to lib/usdUfe/resources/icons/out_USD_Def_200.png diff --git a/lib/mayaUsd/resources/icons/out_USD_GeomSubset_100.png b/lib/usdUfe/resources/icons/out_USD_GeomSubset_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_GeomSubset_100.png rename to lib/usdUfe/resources/icons/out_USD_GeomSubset_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_GeomSubset_150.png b/lib/usdUfe/resources/icons/out_USD_GeomSubset_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_GeomSubset_150.png rename to lib/usdUfe/resources/icons/out_USD_GeomSubset_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_GeomSubset_200.png b/lib/usdUfe/resources/icons/out_USD_GeomSubset_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_GeomSubset_200.png rename to lib/usdUfe/resources/icons/out_USD_GeomSubset_200.png diff --git a/lib/mayaUsd/resources/icons/out_USD_LightFilter_100.png b/lib/usdUfe/resources/icons/out_USD_LightFilter_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_LightFilter_100.png rename to lib/usdUfe/resources/icons/out_USD_LightFilter_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_LightFilter_150.png b/lib/usdUfe/resources/icons/out_USD_LightFilter_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_LightFilter_150.png rename to lib/usdUfe/resources/icons/out_USD_LightFilter_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_LightFilter_200.png b/lib/usdUfe/resources/icons/out_USD_LightFilter_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_LightFilter_200.png rename to lib/usdUfe/resources/icons/out_USD_LightFilter_200.png diff --git a/lib/mayaUsd/resources/icons/out_USD_LightPortal_100.png b/lib/usdUfe/resources/icons/out_USD_LightPortal_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_LightPortal_100.png rename to lib/usdUfe/resources/icons/out_USD_LightPortal_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_LightPortal_150.png b/lib/usdUfe/resources/icons/out_USD_LightPortal_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_LightPortal_150.png rename to lib/usdUfe/resources/icons/out_USD_LightPortal_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_LightPortal_200.png b/lib/usdUfe/resources/icons/out_USD_LightPortal_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_LightPortal_200.png rename to lib/usdUfe/resources/icons/out_USD_LightPortal_200.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Material_100.png b/lib/usdUfe/resources/icons/out_USD_Material_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Material_100.png rename to lib/usdUfe/resources/icons/out_USD_Material_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Material_150.png b/lib/usdUfe/resources/icons/out_USD_Material_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Material_150.png rename to lib/usdUfe/resources/icons/out_USD_Material_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Material_200.png b/lib/usdUfe/resources/icons/out_USD_Material_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Material_200.png rename to lib/usdUfe/resources/icons/out_USD_Material_200.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Mesh_100.png b/lib/usdUfe/resources/icons/out_USD_Mesh_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Mesh_100.png rename to lib/usdUfe/resources/icons/out_USD_Mesh_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Mesh_150.png b/lib/usdUfe/resources/icons/out_USD_Mesh_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Mesh_150.png rename to lib/usdUfe/resources/icons/out_USD_Mesh_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Mesh_200.png b/lib/usdUfe/resources/icons/out_USD_Mesh_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Mesh_200.png rename to lib/usdUfe/resources/icons/out_USD_Mesh_200.png diff --git a/lib/mayaUsd/resources/icons/out_USD_NurbsPatch_100.png b/lib/usdUfe/resources/icons/out_USD_NurbsPatch_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_NurbsPatch_100.png rename to lib/usdUfe/resources/icons/out_USD_NurbsPatch_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_NurbsPatch_150.png b/lib/usdUfe/resources/icons/out_USD_NurbsPatch_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_NurbsPatch_150.png rename to lib/usdUfe/resources/icons/out_USD_NurbsPatch_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_NurbsPatch_200.png b/lib/usdUfe/resources/icons/out_USD_NurbsPatch_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_NurbsPatch_200.png rename to lib/usdUfe/resources/icons/out_USD_NurbsPatch_200.png diff --git a/lib/mayaUsd/resources/icons/out_USD_PluginLight_100.png b/lib/usdUfe/resources/icons/out_USD_PluginLight_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_PluginLight_100.png rename to lib/usdUfe/resources/icons/out_USD_PluginLight_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_PluginLight_150.png b/lib/usdUfe/resources/icons/out_USD_PluginLight_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_PluginLight_150.png rename to lib/usdUfe/resources/icons/out_USD_PluginLight_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_PluginLight_200.png b/lib/usdUfe/resources/icons/out_USD_PluginLight_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_PluginLight_200.png rename to lib/usdUfe/resources/icons/out_USD_PluginLight_200.png diff --git a/lib/mayaUsd/resources/icons/out_USD_PointInstancer_100.png b/lib/usdUfe/resources/icons/out_USD_PointInstancer_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_PointInstancer_100.png rename to lib/usdUfe/resources/icons/out_USD_PointInstancer_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_PointInstancer_150.png b/lib/usdUfe/resources/icons/out_USD_PointInstancer_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_PointInstancer_150.png rename to lib/usdUfe/resources/icons/out_USD_PointInstancer_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_PointInstancer_200.png b/lib/usdUfe/resources/icons/out_USD_PointInstancer_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_PointInstancer_200.png rename to lib/usdUfe/resources/icons/out_USD_PointInstancer_200.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Points_100.png b/lib/usdUfe/resources/icons/out_USD_Points_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Points_100.png rename to lib/usdUfe/resources/icons/out_USD_Points_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Points_150.png b/lib/usdUfe/resources/icons/out_USD_Points_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Points_150.png rename to lib/usdUfe/resources/icons/out_USD_Points_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Points_200.png b/lib/usdUfe/resources/icons/out_USD_Points_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Points_200.png rename to lib/usdUfe/resources/icons/out_USD_Points_200.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Scope_100.png b/lib/usdUfe/resources/icons/out_USD_Scope_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Scope_100.png rename to lib/usdUfe/resources/icons/out_USD_Scope_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Scope_150.png b/lib/usdUfe/resources/icons/out_USD_Scope_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Scope_150.png rename to lib/usdUfe/resources/icons/out_USD_Scope_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Scope_200.png b/lib/usdUfe/resources/icons/out_USD_Scope_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Scope_200.png rename to lib/usdUfe/resources/icons/out_USD_Scope_200.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Shader_100.png b/lib/usdUfe/resources/icons/out_USD_Shader_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Shader_100.png rename to lib/usdUfe/resources/icons/out_USD_Shader_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Shader_150.png b/lib/usdUfe/resources/icons/out_USD_Shader_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Shader_150.png rename to lib/usdUfe/resources/icons/out_USD_Shader_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Shader_200.png b/lib/usdUfe/resources/icons/out_USD_Shader_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Shader_200.png rename to lib/usdUfe/resources/icons/out_USD_Shader_200.png diff --git a/lib/mayaUsd/resources/icons/out_USD_SkelAnimation_100.png b/lib/usdUfe/resources/icons/out_USD_SkelAnimation_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_SkelAnimation_100.png rename to lib/usdUfe/resources/icons/out_USD_SkelAnimation_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_SkelAnimation_150.png b/lib/usdUfe/resources/icons/out_USD_SkelAnimation_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_SkelAnimation_150.png rename to lib/usdUfe/resources/icons/out_USD_SkelAnimation_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_SkelAnimation_200.png b/lib/usdUfe/resources/icons/out_USD_SkelAnimation_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_SkelAnimation_200.png rename to lib/usdUfe/resources/icons/out_USD_SkelAnimation_200.png diff --git a/lib/mayaUsd/resources/icons/out_USD_SkelRoot_100.png b/lib/usdUfe/resources/icons/out_USD_SkelRoot_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_SkelRoot_100.png rename to lib/usdUfe/resources/icons/out_USD_SkelRoot_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_SkelRoot_150.png b/lib/usdUfe/resources/icons/out_USD_SkelRoot_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_SkelRoot_150.png rename to lib/usdUfe/resources/icons/out_USD_SkelRoot_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_SkelRoot_200.png b/lib/usdUfe/resources/icons/out_USD_SkelRoot_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_SkelRoot_200.png rename to lib/usdUfe/resources/icons/out_USD_SkelRoot_200.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Skeleton_100.png b/lib/usdUfe/resources/icons/out_USD_Skeleton_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Skeleton_100.png rename to lib/usdUfe/resources/icons/out_USD_Skeleton_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Skeleton_150.png b/lib/usdUfe/resources/icons/out_USD_Skeleton_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Skeleton_150.png rename to lib/usdUfe/resources/icons/out_USD_Skeleton_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Skeleton_200.png b/lib/usdUfe/resources/icons/out_USD_Skeleton_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Skeleton_200.png rename to lib/usdUfe/resources/icons/out_USD_Skeleton_200.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Sphere_100.png b/lib/usdUfe/resources/icons/out_USD_Sphere_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Sphere_100.png rename to lib/usdUfe/resources/icons/out_USD_Sphere_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Sphere_150.png b/lib/usdUfe/resources/icons/out_USD_Sphere_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Sphere_150.png rename to lib/usdUfe/resources/icons/out_USD_Sphere_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Sphere_200.png b/lib/usdUfe/resources/icons/out_USD_Sphere_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Sphere_200.png rename to lib/usdUfe/resources/icons/out_USD_Sphere_200.png diff --git a/lib/mayaUsd/resources/icons/out_USD_UsdGeomCurves_100.png b/lib/usdUfe/resources/icons/out_USD_UsdGeomCurves_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_UsdGeomCurves_100.png rename to lib/usdUfe/resources/icons/out_USD_UsdGeomCurves_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_UsdGeomCurves_150.png b/lib/usdUfe/resources/icons/out_USD_UsdGeomCurves_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_UsdGeomCurves_150.png rename to lib/usdUfe/resources/icons/out_USD_UsdGeomCurves_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_UsdGeomCurves_200.png b/lib/usdUfe/resources/icons/out_USD_UsdGeomCurves_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_UsdGeomCurves_200.png rename to lib/usdUfe/resources/icons/out_USD_UsdGeomCurves_200.png diff --git a/lib/mayaUsd/resources/icons/out_USD_UsdGeomXformable_100.png b/lib/usdUfe/resources/icons/out_USD_UsdGeomXformable_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_UsdGeomXformable_100.png rename to lib/usdUfe/resources/icons/out_USD_UsdGeomXformable_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_UsdGeomXformable_150.png b/lib/usdUfe/resources/icons/out_USD_UsdGeomXformable_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_UsdGeomXformable_150.png rename to lib/usdUfe/resources/icons/out_USD_UsdGeomXformable_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_UsdGeomXformable_200.png b/lib/usdUfe/resources/icons/out_USD_UsdGeomXformable_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_UsdGeomXformable_200.png rename to lib/usdUfe/resources/icons/out_USD_UsdGeomXformable_200.png diff --git a/lib/mayaUsd/resources/icons/out_USD_UsdLuxBoundableLightBase_100.png b/lib/usdUfe/resources/icons/out_USD_UsdLuxBoundableLightBase_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_UsdLuxBoundableLightBase_100.png rename to lib/usdUfe/resources/icons/out_USD_UsdLuxBoundableLightBase_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_UsdLuxBoundableLightBase_150.png b/lib/usdUfe/resources/icons/out_USD_UsdLuxBoundableLightBase_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_UsdLuxBoundableLightBase_150.png rename to lib/usdUfe/resources/icons/out_USD_UsdLuxBoundableLightBase_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_UsdLuxBoundableLightBase_200.png b/lib/usdUfe/resources/icons/out_USD_UsdLuxBoundableLightBase_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_UsdLuxBoundableLightBase_200.png rename to lib/usdUfe/resources/icons/out_USD_UsdLuxBoundableLightBase_200.png diff --git a/lib/mayaUsd/resources/icons/out_USD_UsdLuxNonboundableLightBase_100.png b/lib/usdUfe/resources/icons/out_USD_UsdLuxNonboundableLightBase_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_UsdLuxNonboundableLightBase_100.png rename to lib/usdUfe/resources/icons/out_USD_UsdLuxNonboundableLightBase_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_UsdLuxNonboundableLightBase_150.png b/lib/usdUfe/resources/icons/out_USD_UsdLuxNonboundableLightBase_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_UsdLuxNonboundableLightBase_150.png rename to lib/usdUfe/resources/icons/out_USD_UsdLuxNonboundableLightBase_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_UsdLuxNonboundableLightBase_200.png b/lib/usdUfe/resources/icons/out_USD_UsdLuxNonboundableLightBase_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_UsdLuxNonboundableLightBase_200.png rename to lib/usdUfe/resources/icons/out_USD_UsdLuxNonboundableLightBase_200.png diff --git a/lib/mayaUsd/resources/icons/out_USD_UsdTyped_100.png b/lib/usdUfe/resources/icons/out_USD_UsdTyped_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_UsdTyped_100.png rename to lib/usdUfe/resources/icons/out_USD_UsdTyped_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_UsdTyped_150.png b/lib/usdUfe/resources/icons/out_USD_UsdTyped_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_UsdTyped_150.png rename to lib/usdUfe/resources/icons/out_USD_UsdTyped_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_UsdTyped_200.png b/lib/usdUfe/resources/icons/out_USD_UsdTyped_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_UsdTyped_200.png rename to lib/usdUfe/resources/icons/out_USD_UsdTyped_200.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Volume_100.png b/lib/usdUfe/resources/icons/out_USD_Volume_100.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Volume_100.png rename to lib/usdUfe/resources/icons/out_USD_Volume_100.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Volume_150.png b/lib/usdUfe/resources/icons/out_USD_Volume_150.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Volume_150.png rename to lib/usdUfe/resources/icons/out_USD_Volume_150.png diff --git a/lib/mayaUsd/resources/icons/out_USD_Volume_200.png b/lib/usdUfe/resources/icons/out_USD_Volume_200.png similarity index 100% rename from lib/mayaUsd/resources/icons/out_USD_Volume_200.png rename to lib/usdUfe/resources/icons/out_USD_Volume_200.png diff --git a/lib/usdUfe/ufe/CMakeLists.txt b/lib/usdUfe/ufe/CMakeLists.txt index f1f864ea89..3553b81212 100644 --- a/lib/usdUfe/ufe/CMakeLists.txt +++ b/lib/usdUfe/ufe/CMakeLists.txt @@ -16,6 +16,7 @@ target_sources(${PROJECT_NAME} UsdObject3dHandler.cpp UsdRootChildHierarchy.cpp UsdSceneItem.cpp + UsdUIInfoHandler.cpp UsdUndoAddNewPrimCommand.cpp UsdUndoAddPayloadCommand.cpp UsdUndoAddRefOrPayloadCommand.cpp @@ -58,6 +59,7 @@ set(HEADERS UsdObject3dHandler.h UsdRootChildHierarchy.h UsdSceneItem.h + UsdUIInfoHandler.h UsdUndoAddNewPrimCommand.h UsdUndoAddPayloadCommand.h UsdUndoAddRefOrPayloadCommand.h diff --git a/lib/usdUfe/ufe/Global.cpp b/lib/usdUfe/ufe/Global.cpp index ff7f0d7b52..c691292ff1 100644 --- a/lib/usdUfe/ufe/Global.cpp +++ b/lib/usdUfe/ufe/Global.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include @@ -89,6 +90,8 @@ Ufe::Rtid initialize( = handlers.object3dHandler ? handlers.object3dHandler : UsdObject3dHandler::create(); rtHandlers.contextOpsHandler = handlers.contextOpsHandler ? handlers.contextOpsHandler : UsdContextOpsHandler::create(); + rtHandlers.uiInfoHandler + = handlers.uiInfoHandler ? handlers.uiInfoHandler : UsdUIInfoHandler::create(); rtHandlers.cameraHandler = handlers.cameraHandler ? handlers.cameraHandler : UsdCameraHandler::create(); diff --git a/lib/usdUfe/ufe/Global.h b/lib/usdUfe/ufe/Global.h index 1b38c53c7d..73fd2bb381 100644 --- a/lib/usdUfe/ufe/Global.h +++ b/lib/usdUfe/ufe/Global.h @@ -24,6 +24,7 @@ #include #include #include +#include #include @@ -65,8 +66,8 @@ struct USDUFE_PUBLIC Handlers // Ufe::AttributesHandler::Ptr attributesHandler; Ufe::Object3dHandler::Ptr object3dHandler; Ufe::ContextOpsHandler::Ptr contextOpsHandler; - // Ufe::UIInfoHandler::Ptr uiInfoHandler; - Ufe::CameraHandler::Ptr cameraHandler; + Ufe::UIInfoHandler::Ptr uiInfoHandler; + Ufe::CameraHandler::Ptr cameraHandler; #ifdef UFE_V3_FEATURES_AVAILABLE // Ufe::PathMappingHandler::Ptr pathMappingHandler; diff --git a/lib/mayaUsd/ufe/UsdUIInfoHandler.cpp b/lib/usdUfe/ufe/UsdUIInfoHandler.cpp similarity index 81% rename from lib/mayaUsd/ufe/UsdUIInfoHandler.cpp rename to lib/usdUfe/ufe/UsdUIInfoHandler.cpp index 456dca41bf..55d15e2b6c 100644 --- a/lib/mayaUsd/ufe/UsdUIInfoHandler.cpp +++ b/lib/usdUfe/ufe/UsdUIInfoHandler.cpp @@ -21,9 +21,6 @@ #include // SdfFieldKeys #include -#include -#include - #include #include @@ -71,8 +68,7 @@ void addMetadataCount( } // namespace -namespace MAYAUSD_NS_DEF { -namespace ufe { +namespace USDUFE_NS_DEF { UsdUIInfoHandler::UsdUIInfoHandler() : Ufe::UIInfoHandler() @@ -81,55 +77,13 @@ UsdUIInfoHandler::UsdUIInfoHandler() fInvisibleColor[0] = -1.; fInvisibleColor[1] = -1.; fInvisibleColor[2] = -1.; - - // Register a callback to invalidate the invisible color. - fColorChangedCallbackId = MEventMessage::addEventCallback( - "DisplayRGBColorChanged", onColorChanged, reinterpret_cast(this)); - - // Immediately update the invisible color to get a starting current value. - updateInvisibleColor(); } -UsdUIInfoHandler::~UsdUIInfoHandler() -{ - // Unregister the callback used to invalidate the invisible color. - if (fColorChangedCallbackId) - MMessage::removeCallback(fColorChangedCallbackId); -} +UsdUIInfoHandler::~UsdUIInfoHandler() { } /*static*/ UsdUIInfoHandler::Ptr UsdUIInfoHandler::create() { return std::make_shared(); } -void UsdUIInfoHandler::updateInvisibleColor() -{ - // Retrieve the invisible color of the outliner. - // - // We *cannot* intialize it in treeViewCellInfo() because - // that function gets called in a paint event and calling - // a command in a painting event can cause a recursive paint - // event if commands echoing is on, which can corrupt the - // Qt paint internal which lead to a crash. Typical symptom - // is that the state variable of the Qt paint engine becomes - // null midway through the repaint. - - MDoubleArray color; - MGlobal::executeCommand("displayRGBColor -q \"outlinerInvisibleColor\"", color); - - if (color.length() == 3) { - color.get(fInvisibleColor.data()); - } -} - -/*static*/ -void UsdUIInfoHandler::onColorChanged(void* data) -{ - UsdUIInfoHandler* infoHandler = reinterpret_cast(data); - if (!infoHandler) - return; - - infoHandler->updateInvisibleColor(); -} - //------------------------------------------------------------------------------ // Ufe::UIInfoHandler overrides //------------------------------------------------------------------------------ @@ -151,6 +105,7 @@ bool UsdUIInfoHandler::treeViewCellInfo(const Ufe::SceneItem::Ptr& item, Ufe::Ce static_cast(fInvisibleColor[1]), static_cast(fInvisibleColor[2])); } else { + // Default color (dark gray) if none provided. info.textFgColor.set(0.403922f, 0.403922f, 0.403922f); } } @@ -159,15 +114,10 @@ bool UsdUIInfoHandler::treeViewCellInfo(const Ufe::SceneItem::Ptr& item, Ufe::Ce return changed; } -Ufe::UIInfoHandler::Icon UsdUIInfoHandler::treeViewIcon(const Ufe::SceneItem::Ptr& item) const +UsdUIInfoHandler::SupportedTypesMap UsdUIInfoHandler::getSupportedIconTypes() const { - // Special case for nullptr input. - if (!item) { - return Ufe::UIInfoHandler::Icon("out_USD_UsdTyped.png"); // Default USD icon - } - // We support these node types directly. - static const std::map supportedTypes { + static const SupportedTypesMap supportedTypes { { "", "out_USD_Def.png" }, // No node type { "BlendShape", "out_USD_BlendShape.png" }, { "Camera", "out_USD_Camera.png" }, @@ -178,8 +128,6 @@ Ufe::UIInfoHandler::Icon UsdUIInfoHandler::treeViewIcon(const Ufe::SceneItem::Pt { "GeomSubset", "out_USD_GeomSubset.png" }, { "LightFilter", "out_USD_LightFilter.png" }, { "LightPortal", "out_USD_LightPortal.png" }, - { "MayaReference", "out_USD_MayaReference.png" }, - { "ALMayaReference", "out_USD_MayaReference.png" }, // Same as mayaRef { "Mesh", "out_USD_Mesh.png" }, { "NurbsPatch", "out_USD_NurbsPatch.png" }, { "PluginLight", "out_USD_PluginLight.png" }, @@ -195,7 +143,17 @@ Ufe::UIInfoHandler::Icon UsdUIInfoHandler::treeViewIcon(const Ufe::SceneItem::Pt { "NodeGraph", "out_USD_Shader.png" }, { "Shader", "out_USD_Shader.png" }, }; + return supportedTypes; +} + +Ufe::UIInfoHandler::Icon UsdUIInfoHandler::treeViewIcon(const Ufe::SceneItem::Ptr& item) const +{ + // Special case for nullptr input. + if (!item) { + return Ufe::UIInfoHandler::Icon("out_USD_UsdTyped.png"); // Default USD icon + } + auto supportedTypes = getSupportedIconTypes(); Ufe::UIInfoHandler::Icon icon; // Default is empty (no icon and no badge). const auto search = supportedTypes.find(item->nodeType()); if (search != supportedTypes.cend()) { @@ -272,5 +230,4 @@ std::string UsdUIInfoHandler::treeViewTooltip(const Ufe::SceneItem::Ptr& item) c std::string UsdUIInfoHandler::getLongRunTimeLabel() const { return "Universal Scene Description"; } -} // namespace ufe -} // namespace MAYAUSD_NS_DEF +} // namespace USDUFE_NS_DEF diff --git a/lib/mayaUsd/ufe/UsdUIInfoHandler.h b/lib/usdUfe/ufe/UsdUIInfoHandler.h similarity index 72% rename from lib/mayaUsd/ufe/UsdUIInfoHandler.h rename to lib/usdUfe/ufe/UsdUIInfoHandler.h index c4faa83c3c..d7090490f4 100644 --- a/lib/mayaUsd/ufe/UsdUIInfoHandler.h +++ b/lib/usdUfe/ufe/UsdUIInfoHandler.h @@ -17,18 +17,18 @@ // limitations under the License. // -#include +#include -#include #include #include +#include +#include -namespace MAYAUSD_NS_DEF { -namespace ufe { +namespace USDUFE_NS_DEF { //! \brief Implementation of Ufe::UIInfoHandler interface for USD objects. -class MAYAUSD_CORE_PUBLIC UsdUIInfoHandler : public Ufe::UIInfoHandler +class USDUFE_PUBLIC UsdUIInfoHandler : public Ufe::UIInfoHandler { public: typedef std::shared_ptr Ptr; @@ -51,18 +51,19 @@ class MAYAUSD_CORE_PUBLIC UsdUIInfoHandler : public Ufe::UIInfoHandler std::string treeViewTooltip(const Ufe::SceneItem::Ptr& item) const override; std::string getLongRunTimeLabel() const override; -private: - void updateInvisibleColor(); + // Helpers - // Note: the on-color-changed callback function is declared taking a void pointer - // to be compatible with MMessage callback API. - static void onColorChanged(void*); + // Called from treeViewIcon() method to find the correct icon based on node type. + // Get the map (node type -> icon filename) of the supported icon types. + // Can be overridden by derived class to add to the map. + typedef std::map SupportedTypesMap; + virtual SupportedTypesMap getSupportedIconTypes() const; +protected: + // Derived classes can set this color to override the default invisible color. std::array fInvisibleColor; - MCallbackId fColorChangedCallbackId = 0; }; // UsdUIInfoHandler -} // namespace ufe -} // namespace MAYAUSD_NS_DEF +} // namespace USDUFE_NS_DEF #endif // USDUIINFOHANDLER_H