diff --git a/CMakeLists.txt b/CMakeLists.txt index c8149a6808..e62cfe526b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,7 +34,6 @@ if(APPLE) option(BUILD_UB2 "Build Universal Binary 2 (UB2) Intel64+arm64" OFF) endif() set(BUILD_WITH_PYTHON_3_VERSION 3.7 CACHE STRING "The version of Python 3 to build with") -option(CMAKE_WANT_UFE_BUILD "Enable building with UFE (if found)." ON) option(CMAKE_WANT_MATERIALX_BUILD "Enable building with MaterialX (experimental)." OFF) option(BUILD_WITH_QT_6 "Build with QT 6." OFF) @@ -135,14 +134,11 @@ if (CMAKE_WANT_MATERIALX_BUILD) endif() include(cmake/usd.cmake) -if(CMAKE_WANT_UFE_BUILD) - find_package(UFE QUIET) - if(UFE_FOUND) - message(STATUS "Building with UFE ${UFE_VERSION} features enabled.") - else() - message(STATUS "UFE not found. UFE features will be disabled.") - endif() -endif() +find_package(UFE 0.2.0 REQUIRED) +message(STATUS "Build MayaUsd with UFE version ${UFE_VERSION}") +message(STATUS " UFE include dir: ${UFE_INCLUDE_DIR}") +message(STATUS " UFE library: ${UFE_LIBRARY}") +message(STATUS " UFE preview features: ${UFE_PREVIEW_FEATURES}") if(CMAKE_WANT_MATERIALX_BUILD AND MAYA_LIGHTAPI_VERSION LESS 2) set(CMAKE_WANT_MATERIALX_BUILD OFF) diff --git a/cmake/modules/FindUFE.cmake b/cmake/modules/FindUFE.cmake index 48324fe662..23454d3840 100644 --- a/cmake/modules/FindUFE.cmake +++ b/cmake/modules/FindUFE.cmake @@ -123,13 +123,6 @@ find_package_handle_standard_args(UFE UFE_VERSION ) -if(UFE_FOUND) - message(STATUS "UFE include dir: ${UFE_INCLUDE_DIR}") - message(STATUS "UFE library: ${UFE_LIBRARY}") - message(STATUS "UFE version: ${UFE_VERSION}") - message(STATUS "UFE preview features: ${UFE_PREVIEW_FEATURES}") -endif() - set(UFE_LIGHTS_SUPPORT FALSE CACHE INTERNAL "ufeLights") if (UFE_INCLUDE_DIR AND EXISTS "${UFE_INCLUDE_DIR}/ufe/lightHandler.h") set(UFE_LIGHTS_SUPPORT TRUE CACHE INTERNAL "ufeLights") diff --git a/doc/build.md b/doc/build.md index 4986ab9dc1..812bcd2012 100644 --- a/doc/build.md +++ b/doc/build.md @@ -129,7 +129,6 @@ BUILD_STRICT_MODE | enforces all warnings as errors. BUILD_WITH_PYTHON_3 | build with python 3. | OFF BUILD_SHARED_LIBS | build libraries as shared or static. | ON BUILD_UB2 | build universal binary 2 (UB2) Intel64+arm64 (apple only) | OFF -CMAKE_WANT_UFE_BUILD | enables building with UFE (if found). | ON CMAKE_WANT_MATERIALX_BUILD | enable building with MaterialX (experimental). | OFF ##### Stages diff --git a/doc/codingGuidelines.md b/doc/codingGuidelines.md index 2ae03bf6c6..abbbddf485 100644 --- a/doc/codingGuidelines.md +++ b/doc/codingGuidelines.md @@ -227,8 +227,8 @@ Headers should be included in the following order, with each section separated b #include -#if defined(WANT_UFE_BUILD) - #include +#ifdef UFE_V3_FEATURES_AVAILABLE +#include #endif ``` @@ -242,7 +242,7 @@ Headers should be included in the following order, with each section separated b * `MAYA_APP_VERSION` is a simple year number, so it is not allowed in C++ code. However it is set as a CMake variable and allowed in cmake files. **UFE** - * `WANT_UFE_BUILD` equals 1 if UFE is found and it should be used for conditional compilation on codes depending on UFE. + * Each version of Ufe contains a features available define (in ufe.h) such as `UFE_V4_FEATURES_AVAILABLE` that can be used for conditional compilation on code depending on Ufe Version. **USD** * `PXR_VERSION` is the macro to test USD version (`PXR_MAJOR_VERSION` * 10000 + `PXR_MINOR_VERSION` * 100 + `PXR_PATCH_VERSION`) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index b0507bdc59..d5fb2a2934 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -1,7 +1,4 @@ -if(UFE_FOUND) - add_subdirectory(usdUfe) -endif() - +add_subdirectory(usdUfe) if (BUILD_MAYAUSD_LIBRARY) add_subdirectory(mayaUsd) add_subdirectory(usd) diff --git a/lib/mayaUsd/CMakeLists.txt b/lib/mayaUsd/CMakeLists.txt index dee1e26653..7544dd8f38 100644 --- a/lib/mayaUsd/CMakeLists.txt +++ b/lib/mayaUsd/CMakeLists.txt @@ -36,7 +36,6 @@ target_compile_definitions(${PROJECT_NAME} $<$:TBB_USE_DEBUG> $<$:BOOST_DEBUG_PYTHON> $<$:BOOST_LINKING_PYTHON> - $<$:WANT_UFE_BUILD> $<$:MAYA_ENABLE_NEW_PRIM_DELETE> PRIVATE MAYAUSD_MACROS_EXPORT @@ -183,7 +182,7 @@ if (MAYA_LIGHTAPI_VERSION GREATER_EQUAL 2) endif() # Some of the UFE classes are exporting STL classes which causes this warning. -if(UFE_FOUND AND MSVC) +if(MSVC) target_compile_options(${PROJECT_NAME} PUBLIC /wd4251 @@ -215,7 +214,7 @@ target_include_directories(${PROJECT_NAME} PUBLIC ${MAYA_INCLUDE_DIRS} ${PXR_INCLUDE_DIRS} - $<$:${UFE_INCLUDE_DIR}> + ${UFE_INCLUDE_DIR} ${CMAKE_BINARY_DIR}/include PRIVATE @@ -251,7 +250,7 @@ target_link_libraries(${PROJECT_NAME} usdUtils $<$>:usdUI> vt - $<$:${UFE_LIBRARY}> + ${UFE_LIBRARY} ${MAYA_LIBRARIES} mayaUsdUtils usdUfe @@ -324,9 +323,7 @@ add_subdirectory(resources) if( PXR_VERSION GREATER_EQUAL 2211 ) add_subdirectory(sceneIndex) endif() -if(UFE_FOUND) - add_subdirectory(ufe) -endif() +add_subdirectory(ufe) add_subdirectory(undo) add_subdirectory(utils) diff --git a/lib/mayaUsd/commands/layerEditorCommand.cpp b/lib/mayaUsd/commands/layerEditorCommand.cpp index b7880314c9..8e63577ba8 100644 --- a/lib/mayaUsd/commands/layerEditorCommand.cpp +++ b/lib/mayaUsd/commands/layerEditorCommand.cpp @@ -16,6 +16,8 @@ #include "layerEditorCommand.h" +#include +#include #include #include @@ -25,14 +27,8 @@ #include #include #include - -#if defined(WANT_UFE_BUILD) -#include -#include - #include #include -#endif #include @@ -282,7 +278,6 @@ class InsertRemoveSubPathBase : public BaseCmd void saveSelection() { -#if defined(WANT_UFE_BUILD) // Make a copy of the global selection, to restore it on undo. auto globalSn = Ufe::GlobalSelection::get(); _savedSn.replaceWith(*globalSn); @@ -294,12 +289,10 @@ class InsertRemoveSubPathBase : public BaseCmd Ufe::Path path( Ufe::PathSegment("world" + _proxyShapePath, MayaUsd::ufe::getMayaRunTimeId(), '|')); globalSn->replaceWith(MayaUsd::ufe::removeDescendants(_savedSn, path)); -#endif } void restoreSelection() { -#if defined(WANT_UFE_BUILD) // Restore the saved selection to the global selection. If a saved // selection item started with the proxy shape path, re-create it. // We know the path to the proxy shape has a single segment. Not @@ -310,14 +303,11 @@ class InsertRemoveSubPathBase : public BaseCmd Ufe::PathSegment("world" + _proxyShapePath, MayaUsd::ufe::getMayaRunTimeId(), '|')); auto globalSn = Ufe::GlobalSelection::get(); globalSn->replaceWith(MayaUsd::ufe::recreateDescendants(_savedSn, path)); -#endif } protected: - std::string _editTargetPath; -#if defined(WANT_UFE_BUILD) + std::string _editTargetPath; Ufe::Selection _savedSn; -#endif UsdStageWeakPtr getStage() { @@ -665,7 +655,6 @@ class MuteLayer : public BaseCmd void saveSelection() { -#if defined(WANT_UFE_BUILD) // Make a copy of the global selection, to restore it on unmute. auto globalSn = Ufe::GlobalSelection::get(); _savedSn.replaceWith(*globalSn); @@ -677,12 +666,10 @@ class MuteLayer : public BaseCmd Ufe::Path path( Ufe::PathSegment("world" + _proxyShapePath, MayaUsd::ufe::getMayaRunTimeId(), '|')); globalSn->replaceWith(MayaUsd::ufe::removeDescendants(_savedSn, path)); -#endif } void restoreSelection() { -#if defined(WANT_UFE_BUILD) // Restore the saved selection to the global selection. If a saved // selection item started with the proxy shape path, re-create it. // We know the path to the proxy shape has a single segment. Not @@ -693,12 +680,9 @@ class MuteLayer : public BaseCmd Ufe::PathSegment("world" + _proxyShapePath, MayaUsd::ufe::getMayaRunTimeId(), '|')); auto globalSn = Ufe::GlobalSelection::get(); globalSn->replaceWith(MayaUsd::ufe::recreateDescendants(_savedSn, path)); -#endif } -#if defined(WANT_UFE_BUILD) - Ufe::Selection _savedSn; -#endif + Ufe::Selection _savedSn; PXR_NS::SdfLayerRefPtr _mutedLayer; }; diff --git a/lib/mayaUsd/nodes/CMakeLists.txt b/lib/mayaUsd/nodes/CMakeLists.txt index 86f2fa0fa9..19ec79e6fc 100644 --- a/lib/mayaUsd/nodes/CMakeLists.txt +++ b/lib/mayaUsd/nodes/CMakeLists.txt @@ -4,6 +4,7 @@ target_sources(${PROJECT_NAME} PRIVATE hdImagingShape.cpp + layerManager.cpp pointBasedDeformerNode.cpp proxyAccessor.cpp proxyShapeBase.cpp @@ -17,6 +18,7 @@ target_sources(${PROJECT_NAME} set(HEADERS hdImagingShape.h + layerManager.h pointBasedDeformerNode.h proxyAccessor.h proxyShapeBase.h @@ -29,16 +31,6 @@ set(HEADERS usdPrimProvider.h ) -if (UFE_FOUND) - target_sources(${PROJECT_NAME} - PRIVATE - layerManager.cpp - ) - list(APPEND HEADERS - layerManager.h - ) -endif() - # ----------------------------------------------------------------------------- # promoted headers # ----------------------------------------------------------------------------- diff --git a/lib/mayaUsd/nodes/layerManager.cpp b/lib/mayaUsd/nodes/layerManager.cpp index c9a85f7750..77015bb9d8 100644 --- a/lib/mayaUsd/nodes/layerManager.cpp +++ b/lib/mayaUsd/nodes/layerManager.cpp @@ -463,7 +463,7 @@ bool LayerDatabase::hasDirtyLayer() const bool LayerDatabase::getProxiesToSave(bool isExport) { bool checkSelection = isExport && (MFileIO::kExportTypeSelected == MFileIO::exportType()); - const UFE_NS::GlobalSelection::Ptr& ufeSelection = UFE_NS::GlobalSelection::get(); + const Ufe::GlobalSelection::Ptr& ufeSelection = Ufe::GlobalSelection::get(); clearProxies(); diff --git a/lib/mayaUsd/nodes/proxyAccessor.cpp b/lib/mayaUsd/nodes/proxyAccessor.cpp index b9be31f898..79fcb72256 100644 --- a/lib/mayaUsd/nodes/proxyAccessor.cpp +++ b/lib/mayaUsd/nodes/proxyAccessor.cpp @@ -16,11 +16,8 @@ #include "proxyAccessor.h" #include -#include - -#if defined(WANT_UFE_BUILD) #include -#endif +#include #include #include @@ -603,13 +600,10 @@ MStatus ProxyAccessor::computeOutput( dstArray.setAllClean(); } else if (item.property == combinedVisibilityToken) { // First, verify visibility of the proxy shape -#if defined(WANT_UFE_BUILD) Ufe::Path proxyShapeUfePath = MayaUsd::ufe::stagePath(stage); MDagPath proxyShapeDagPath = MayaUsd::ufe::ufeToDagPath(proxyShapeUfePath); bool visible = proxyShapeDagPath.isVisible(); -#else - bool visible = true; -#endif + // Next, verify visibility of the usd prim UsdGeomImageable imageable(itemPrim); if (visible && imageable) { diff --git a/lib/mayaUsd/nodes/proxyShapeBase.cpp b/lib/mayaUsd/nodes/proxyShapeBase.cpp index 522d0ff7da..e4012e8d85 100644 --- a/lib/mayaUsd/nodes/proxyShapeBase.cpp +++ b/lib/mayaUsd/nodes/proxyShapeBase.cpp @@ -20,8 +20,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -99,6 +101,8 @@ #include #include #include +#include +#include #include @@ -107,16 +111,6 @@ #include #include -#if defined(WANT_UFE_BUILD) -#include -#include - -#include -#ifdef UFE_V2_FEATURES_AVAILABLE -#include -#endif -#endif - using namespace MayaUsd; PXR_NAMESPACE_OPEN_SCOPE @@ -647,7 +641,6 @@ MStatus MayaUsdProxyShapeBase::compute(const MPlug& plug, MDataBlock& dataBlock) return MS::kUnknownParameter; } -#if defined(WANT_UFE_BUILD) /* virtual */ SdfLayerRefPtr MayaUsdProxyShapeBase::computeRootLayer(MDataBlock& dataBlock, const std::string&) { @@ -670,18 +663,6 @@ SdfLayerRefPtr MayaUsdProxyShapeBase::computeSessionLayer(MDataBlock& dataBlock) } } -#else -/* virtual */ -SdfLayerRefPtr MayaUsdProxyShapeBase::computeRootLayer(MDataBlock&, const std::string&) -{ - return nullptr; -} - -/* virtual */ -SdfLayerRefPtr MayaUsdProxyShapeBase::computeSessionLayer(MDataBlock&) { return nullptr; } - -#endif - namespace { void remapSublayerRecursive( @@ -805,7 +786,6 @@ MStatus MayaUsdProxyShapeBase::computeInStageDataCached(MDataBlock& dataBlock) bool sharableStage = isShareableStage(); -#if defined(WANT_UFE_BUILD) // Load the unshared comp from file // This is so that we can remap the anon layer identifiers that have been loaded from disk which // are saved in the unshared root layer @@ -835,7 +815,6 @@ MStatus MayaUsdProxyShapeBase::computeInStageDataCached(MDataBlock& dataBlock) } } } -#endif bool isIncomingStage = false; @@ -1528,7 +1507,6 @@ MBoundingBox MayaUsdProxyShapeBase::boundingBox() const UsdMayaUtil::AddMayaExtents(allBox, prim, currTime); -#if defined(WANT_UFE_BUILD) Ufe::BBox3d pulledUfeBBox = ufe::getPulledPrimsBoundingBox(ufePath()); if (!pulledUfeBBox.empty()) { GfBBox3d pulledBox(GfRange3d( @@ -1536,7 +1514,6 @@ MBoundingBox MayaUsdProxyShapeBase::boundingBox() const GfVec3d(pulledUfeBBox.max.x(), pulledUfeBBox.max.y(), pulledUfeBBox.max.z()))); allBox = GfBBox3d::Combine(allBox, pulledBox); } -#endif MBoundingBox& retval = nonConstThis->_boundingBoxCache[currTime]; @@ -2219,23 +2196,14 @@ void MayaUsdProxyShapeBase::onAncestorPlugDirty(MPlug& plug) _inAncestorCallback = false; } -#if defined(WANT_UFE_BUILD) Ufe::Path MayaUsdProxyShapeBase::ufePath() const { // Build a path segment to proxyShape MDagPath thisPath; MDagPath::getAPathTo(thisMObject(), thisPath); -#ifdef UFE_V2_FEATURES_AVAILABLE return Ufe::PathString::path(thisPath.fullPathName().asChar()); -#else - // MDagPath does not include |world to its full path name - MString fullpath = "|world" + thisPath.fullPathName(); - - return Ufe::Path(Ufe::PathSegment(fullpath.asChar(), MAYA_UFE_RUNTIME_ID, MAYA_UFE_SEPARATOR)); -#endif } -#endif std::atomic MayaUsdProxyShapeBase::in_compute { 0 }; diff --git a/lib/mayaUsd/nodes/proxyShapeBase.h b/lib/mayaUsd/nodes/proxyShapeBase.h index aed7793672..9f09a8cd6e 100644 --- a/lib/mayaUsd/nodes/proxyShapeBase.h +++ b/lib/mayaUsd/nodes/proxyShapeBase.h @@ -38,20 +38,12 @@ #include #include #include +#include #include -#if defined(WANT_UFE_BUILD) -#include - UFE_NS_DEF { class Path; } -constexpr int MAYA_UFE_RUNTIME_ID = 1; -constexpr char MAYA_UFE_SEPARATOR = '|'; -constexpr int USD_UFE_RUNTIME_ID = 2; -constexpr char USD_UFE_SEPARATOR = '/'; -#endif - #include #include #include @@ -273,10 +265,8 @@ class MayaUsdProxyShapeBase MDagPath parentTransform(); // Is this required if there is parentTransform? -#if defined(WANT_UFE_BUILD) MAYAUSD_CORE_PUBLIC Ufe::Path ufePath() const; -#endif /// Returns whether the proxy shape allows subpaths within its /// hierarchy to be selected independently when using the Viewport 2.0 diff --git a/lib/mayaUsd/nodes/proxyShapePlugin.cpp b/lib/mayaUsd/nodes/proxyShapePlugin.cpp index c5b9b1aae7..8f12704972 100644 --- a/lib/mayaUsd/nodes/proxyShapePlugin.cpp +++ b/lib/mayaUsd/nodes/proxyShapePlugin.cpp @@ -16,6 +16,7 @@ #include "proxyShapePlugin.h" #include +#include #include #include #include @@ -38,10 +39,6 @@ #include #include -#if defined(WANT_UFE_BUILD) -#include -#endif - PXR_NAMESPACE_USING_DIRECTIVE namespace { @@ -109,14 +106,12 @@ MStatus MayaUsdProxyShapePlugin::initialize(MFnPlugin& plugin) MPxNode::kDeformerNode); CHECK_MSTATUS_AND_RETURN_IT(status); -#if defined(WANT_UFE_BUILD) status = plugin.registerNode( MayaUsd::LayerManager::typeName, MayaUsd::LayerManager::typeId, MayaUsd::LayerManager::creator, MayaUsd::LayerManager::initialize); CHECK_MSTATUS(status); -#endif status = plugin.registerNode( MayaUsdProxyShapeListenerBase::typeName, @@ -223,10 +218,8 @@ MStatus MayaUsdProxyShapePlugin::finalize(MFnPlugin& plugin) status = plugin.deregisterNode(MayaUsdProxyShapeListenerBase::typeId); CHECK_MSTATUS(status); -#if defined(WANT_UFE_BUILD) status = plugin.deregisterNode(MayaUsd::LayerManager::typeId); CHECK_MSTATUS(status); -#endif status = plugin.deregisterNode(UsdMayaStageNode::typeId); CHECK_MSTATUS(status); diff --git a/lib/mayaUsd/python/module.cpp b/lib/mayaUsd/python/module.cpp index 021dc47e3f..2f8ed244fd 100644 --- a/lib/mayaUsd/python/module.cpp +++ b/lib/mayaUsd/python/module.cpp @@ -17,9 +17,7 @@ #include // UFE v3 used as an indicator of support for edit as Maya. -#if defined(WANT_UFE_BUILD) #include -#endif PXR_NAMESPACE_USING_DIRECTIVE diff --git a/lib/mayaUsd/render/mayaToHydra/renderOverride.cpp b/lib/mayaUsd/render/mayaToHydra/renderOverride.cpp index 77a429da90..f35a1a113d 100644 --- a/lib/mayaUsd/render/mayaToHydra/renderOverride.cpp +++ b/lib/mayaUsd/render/mayaToHydra/renderOverride.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -45,30 +46,23 @@ #include #include #include +#include #include #include #include #include #include #include - -#include -#include -#include -#include - -#if WANT_UFE_BUILD -#include - -#include #include #include #include -#ifdef UFE_V2_FEATURES_AVAILABLE #include -#endif #include -#endif // WANT_UFE_BUILD + +#include +#include +#include +#include PXR_NAMESPACE_OPEN_SCOPE @@ -80,22 +74,20 @@ namespace { std::mutex _allInstancesMutex; std::vector _allInstances; -#if WANT_UFE_BUILD - // Observe UFE scene items for transformation changed only when they are // selected. -class UfeSelectionObserver : public UFE_NS::Observer +class UfeSelectionObserver : public Ufe::Observer { public: UfeSelectionObserver(MtohRenderOverride& mtohRenderOverride) - : UFE_NS::Observer() + : Ufe::Observer() , _mtohRenderOverride(mtohRenderOverride) { } //~UfeSelectionObserver() override {} - void operator()(const UFE_NS::Notification& notification) override + void operator()(const Ufe::Notification& notification) override { // During Maya file read, each node will be selected in turn, so we get // notified for each node in the scene. Prune this out. @@ -103,7 +95,7 @@ class UfeSelectionObserver : public UFE_NS::Observer return; } - auto selectionChanged = dynamic_cast(¬ification); + auto selectionChanged = dynamic_cast(¬ification); if (selectionChanged == nullptr) { return; } @@ -118,8 +110,6 @@ class UfeSelectionObserver : public UFE_NS::Observer MtohRenderOverride& _mtohRenderOverride; }; -#endif // WANT_UFE_BUILD - //! \brief Get the index of the hit nearest to a given cursor point. int GetNearestHitIndex( const MHWRender::MFrameContext& frameContext, @@ -244,24 +234,20 @@ MtohRenderOverride::MtohRenderOverride(const MtohRendererDescription& desc) _allInstances.push_back(this); } -#if WANT_UFE_BUILD - const UFE_NS::GlobalSelection::Ptr& ufeSelection = UFE_NS::GlobalSelection::get(); + const Ufe::GlobalSelection::Ptr& ufeSelection = Ufe::GlobalSelection::get(); if (ufeSelection) { _ufeSelectionObserver = std::make_shared(*this); ufeSelection->addObserver(_ufeSelectionObserver); } -#endif // WANT_UFE_BUILD } MtohRenderOverride::~MtohRenderOverride() { -#if WANT_UFE_BUILD const Ufe::GlobalSelection::Ptr& ufeSelection = Ufe::GlobalSelection::get(); if (ufeSelection) { ufeSelection->removeObserver(_ufeSelectionObserver); _ufeSelectionObserver = nullptr; } -#endif // WANT_UFE_BUILD TF_DEBUG(HDMAYA_RENDEROVERRIDE_RESOURCES) .Msg( @@ -866,12 +852,9 @@ void MtohRenderOverride::_SelectionChanged() SdfPathVector selectedPaths; auto selection = std::make_shared(); -#if WANT_UFE_BUILD - const UFE_NS::GlobalSelection::Ptr& ufeSelection = UFE_NS::GlobalSelection::get(); -#endif // WANT_UFE_BUILD + const Ufe::GlobalSelection::Ptr& ufeSelection = Ufe::GlobalSelection::get(); for (auto& it : _delegates) { -#if WANT_UFE_BUILD if (it->SupportsUfeSelection()) { if (ufeSelection) { it->PopulateSelectedPaths(*ufeSelection, selectedPaths, selection); @@ -879,7 +862,6 @@ void MtohRenderOverride::_SelectionChanged() // skip non-ufe PopulateSelectedPaths call continue; } -#endif // WANT_UFE_BUILD it->PopulateSelectedPaths(sel, selectedPaths, selection); } _selectionCollection.SetRootPaths(selectedPaths); diff --git a/lib/mayaUsd/render/mayaToHydra/renderOverride.h b/lib/mayaUsd/render/mayaToHydra/renderOverride.h index 2ecb7a9411..56dd9fbbeb 100644 --- a/lib/mayaUsd/render/mayaToHydra/renderOverride.h +++ b/lib/mayaUsd/render/mayaToHydra/renderOverride.h @@ -16,6 +16,13 @@ #ifndef MTOH_VIEW_OVERRIDE_H #define MTOH_VIEW_OVERRIDE_H +#include "defaultLightDelegate.h" +#include "renderGlobals.h" +#include "utils.h" + +#include +#include + #include #include #include @@ -29,23 +36,13 @@ #include #include #include +#include #include #include #include #include -#if WANT_UFE_BUILD -#include -#endif // WANT_UFE_BUILD - -#include "defaultLightDelegate.h" -#include "renderGlobals.h" -#include "utils.h" - -#include -#include - PXR_NAMESPACE_OPEN_SCOPE using HgiUniquePtr = std::unique_ptr; @@ -191,9 +188,7 @@ class MtohRenderOverride : public MHWRender::MRenderOverride bool _hasDefaultLighting = false; bool _selectionChanged = true; -#if WANT_UFE_BUILD - UFE_NS::Observer::Ptr _ufeSelectionObserver; -#endif // WANT_UFE_BUILD + Ufe::Observer::Ptr _ufeSelectionObserver; }; PXR_NAMESPACE_CLOSE_SCOPE diff --git a/lib/mayaUsd/render/vp2RenderDelegate/proxyRenderDelegate.cpp b/lib/mayaUsd/render/vp2RenderDelegate/proxyRenderDelegate.cpp index 23eaf32150..13bce8d29b 100644 --- a/lib/mayaUsd/render/vp2RenderDelegate/proxyRenderDelegate.cpp +++ b/lib/mayaUsd/render/vp2RenderDelegate/proxyRenderDelegate.cpp @@ -72,16 +72,13 @@ #include #endif -#if defined(WANT_UFE_BUILD) #include #include #include #include -#ifdef UFE_V2_FEATURES_AVAILABLE #include -#endif #include #ifdef MAYA_HAS_DISPLAY_LAYER_API #include @@ -93,7 +90,6 @@ #include #include #include -#endif #if defined(BUILD_HDMAYA) #include @@ -106,7 +102,6 @@ namespace { //! Representation selector for point snapping const HdReprSelector kPointsReprSelector(TfToken(), TfToken(), HdReprTokens->points); -#if defined(WANT_UFE_BUILD) //! \brief Query the global selection list adjustment. MGlobal::ListAdjustment GetListAdjustment() { @@ -235,7 +230,6 @@ void PopulateSelection( sceneDelegate.PopulateSelection( HdSelection::HighlightModeSelect, usdPath, instanceIndex, result); } -#endif // defined(WANT_UFE_BUILD) //! \brief Append the selected prim paths to the result list. void AppendSelectedPrimPaths(const HdSelectionSharedPtr& selection, SdfPathVector& result) @@ -325,7 +319,6 @@ void _ConfigureReprs() HdPoints::ConfigureRepr(HdVP2ReprTokens->smoothHullUntextured, HdPointsGeomStylePoints); } -#if defined(WANT_UFE_BUILD) class UfeObserver : public Ufe::Observer { public: @@ -401,15 +394,6 @@ class UfeObserver : public Ufe::Observer private: ProxyRenderDelegate& _proxyRenderDelegate; }; -#else -void SelectionChangedCB(void* data) -{ - ProxyRenderDelegate* prd = static_cast(data); - if (prd) { - prd->SelectionChanged(); - } -} -#endif #ifdef MAYA_HAS_DISPLAY_LAYER_API #ifdef MAYA_HAS_NEW_DISPLAY_LAYER_MESSAGING_API @@ -589,11 +573,6 @@ ProxyRenderDelegate::~ProxyRenderDelegate() { _ClearRenderDelegate(); -#if !defined(WANT_UFE_BUILD) - if (_mayaSelectionCallbackId != 0) { - MMessage::removeCallback(_mayaSelectionCallbackId); - } -#endif #ifdef MAYA_HAS_DISPLAY_LAYER_API if (_mayaDisplayLayerAddedCallbackId != 0) MMessage::removeCallback(_mayaDisplayLayerAddedCallbackId); @@ -734,7 +713,6 @@ void ProxyRenderDelegate::_InitRenderDelegate() _defaultCollection.reset(new HdRprimCollection()); _defaultCollection->SetName(HdTokens->geometry); -#if defined(WANT_UFE_BUILD) if (!_observer) { _observer = std::make_shared(*this); @@ -743,19 +721,8 @@ void ProxyRenderDelegate::_InitRenderDelegate() globalSelection->addObserver(_observer); } -#ifdef UFE_V2_FEATURES_AVAILABLE Ufe::Scene::instance().addObserver(_observer); -#else - Ufe::Scene::instance().addObjectAddObserver(_observer); -#endif - } -#else - // Without UFE, support basic selection highlight at proxy shape level. - if (!_mayaSelectionCallbackId) { - _mayaSelectionCallbackId - = MEventMessage::addEventCallback("SelectionChanged", SelectionChangedCB, this); } -#endif #ifdef MAYA_HAS_DISPLAY_LAYER_API // Display layers maybe loaded before us, so make sure to track/cache them @@ -1115,11 +1082,8 @@ void ProxyRenderDelegate::_Execute(const MHWRender::MFrameContext& frameContext) // won't be prepared until point snapping is activated; otherwise the draw // data have to be prepared early for possible activation of point snapping. const bool inSelectionPass = (frameContext.getSelectionInfo() != nullptr); -#if !defined(MAYA_NEW_POINT_SNAPPING_SUPPORT) || defined(WANT_UFE_BUILD) const bool inPointSnapping = pointSnappingActive(); -#endif -#if defined(WANT_UFE_BUILD) // Query selection adjustment and kind only if the update is triggered in a selection pass. if (inSelectionPass && !inPointSnapping) { _globalListAdjustment = GetListAdjustment(); @@ -1130,7 +1094,6 @@ void ProxyRenderDelegate::_Execute(const MHWRender::MFrameContext& frameContext) _selectionKind = TfToken(); _pointInstancesPickMode = UsdPointInstancesPickMode::PointInstancer; } -#endif // defined(WANT_UFE_BUILD) // Work around USD issue #1516. There is a significant performance overhead caused by populating // selection, so only force the populate selection to occur when we detect a change which @@ -1363,7 +1326,6 @@ bool ProxyRenderDelegate::getInstancedSelectionPath( const MHWRender::MIntersection& intersection, MDagPath& dagPath) const { -#if defined(WANT_UFE_BUILD) // When point snapping, only the point position matters, so return the DAG path and avoid the // UFE global selection list to be updated. if (pointSnappingActive()) { @@ -1375,10 +1337,6 @@ bool ProxyRenderDelegate::getInstancedSelectionPath( return false; } - auto handler = Ufe::RunTimeMgr::instance().hierarchyHandler(USD_UFE_RUNTIME_ID); - if (handler == nullptr) - return false; - const SdfPath rprimId = HdVP2DrawItem::RenderItemToPrimPath(renderItem); // If drawInstID is positive, it means the selection hit comes from one instanced render item, @@ -1423,7 +1381,6 @@ bool ProxyRenderDelegate::getInstancedSelectionPath( // searching optionVars for each intersection. const TfToken& selectionKind = _selectionKind; const UsdPointInstancesPickMode& pointInstancesPickMode = _pointInstancesPickMode; - const MGlobal::ListAdjustment& listAdjustment = _globalListAdjustment; UsdPrim prim = _proxyShapeData->UsdStage()->GetPrimAtPath(usdPath); const UsdPrim topLevelPrim = _proxyShapeData->UsdStage()->GetPrimAtPath(topLevelPath); @@ -1494,42 +1451,14 @@ bool ProxyRenderDelegate::getInstancedSelectionPath( } const Ufe::PathSegment pathSegment = UsdUfe::usdPathToUfePathSegment(usdPath, instanceIndex); - const Ufe::SceneItem::Ptr& si - = handler->createItem(_proxyShapeData->ProxyShape()->ufePath() + pathSegment); + auto si = Ufe::Hierarchy::createItem(_proxyShapeData->ProxyShape()->ufePath() + pathSegment); if (!si) { TF_WARN("Failed to create UFE scene item for Rprim '%s'", rprimId.GetText()); return false; } -#ifdef UFE_V2_FEATURES_AVAILABLE - TF_UNUSED(listAdjustment); - auto ufeSel = Ufe::NamedSelection::get("MayaSelectTool"); ufeSel->append(si); -#else - auto globalSelection = Ufe::GlobalSelection::get(); - - switch (listAdjustment) { - case MGlobal::kReplaceList: - // The list has been cleared before viewport selection runs, so we - // can add the new hits directly. UFE selection list is a superset - // of Maya selection list, calling clear()/replaceWith() on UFE - // selection list would clear Maya selection list. - globalSelection->append(si); - break; - case MGlobal::kAddToList: globalSelection->append(si); break; - case MGlobal::kRemoveFromList: globalSelection->remove(si); break; - case MGlobal::kXORWithList: - if (!globalSelection->remove(si)) { - globalSelection->append(si); - } - break; - default: TF_WARN("Unexpected MGlobal::ListAdjustment enum for selection."); break; - } -#endif -#else - dagPath = _proxyShapeData->ProxyDagPath(); -#endif return true; } @@ -1790,7 +1719,6 @@ void ProxyRenderDelegate::ColorManagementRefresh() //! \brief Populate lead and active selection for Rprims under the proxy shape. void ProxyRenderDelegate::_PopulateSelection() { -#if defined(WANT_UFE_BUILD) if (_proxyShapeData->ProxyShape() == nullptr) { return; } @@ -1812,7 +1740,6 @@ void ProxyRenderDelegate::_PopulateSelection() PopulateSelection(*it, proxyPath, *_sceneDelegate, _activeSelection); } } -#endif } /*! \brief Notify selection change to rprims. diff --git a/lib/mayaUsd/render/vp2RenderDelegate/proxyRenderDelegate.h b/lib/mayaUsd/render/vp2RenderDelegate/proxyRenderDelegate.h index 8d758fd499..8159f85fd4 100644 --- a/lib/mayaUsd/render/vp2RenderDelegate/proxyRenderDelegate.h +++ b/lib/mayaUsd/render/vp2RenderDelegate/proxyRenderDelegate.h @@ -36,12 +36,10 @@ #include #include #include - -#include -#if defined(WANT_UFE_BUILD) #include #include -#endif + +#include // Use the latest MPxSubSceneOverride API #ifndef OPENMAYA_MPXSUBSCENEOVERRIDE_LATEST_NAMESPACE @@ -462,15 +460,9 @@ class ProxyRenderDelegate HdSelectionSharedPtr _leadSelection; //!< A collection of Rprims being lead selection HdSelectionSharedPtr _activeSelection; //!< A collection of Rprims being active selection -#if defined(WANT_UFE_BUILD) //! Observer to listen to UFE changes Ufe::Observer::Ptr _observer; -#else - //! Minimum support for proxy selection when UFE is not available. - MCallbackId _mayaSelectionCallbackId { 0 }; -#endif -#if defined(WANT_UFE_BUILD) //! Adjustment mode for global selection list: ADD, REMOVE, REPLACE, XOR MGlobal::ListAdjustment _globalListAdjustment; @@ -479,7 +471,6 @@ class ProxyRenderDelegate //! Pick resolution behavior to use when the picked object is a point instance. UsdPointInstancesPickMode _pointInstancesPickMode; -#endif }; /*! \brief Is this object properly initialized and can start receiving updates. Once this is done, diff --git a/lib/mayaUsd/resources/ae/CMakeLists.txt b/lib/mayaUsd/resources/ae/CMakeLists.txt index ea615e1006..57c00aa2ef 100644 --- a/lib/mayaUsd/resources/ae/CMakeLists.txt +++ b/lib/mayaUsd/resources/ae/CMakeLists.txt @@ -1,21 +1,20 @@ # --------------------------------------------------------------------------------------------- # install # --------------------------------------------------------------------------------------------- -if (CMAKE_UFE_V2_FEATURES_AVAILABLE) - # We need an empty __init__.py file in each subfolder so it is considered a python module. - install(FILES __init__.py DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/python/ufe_ae) - install(FILES __init__.py DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/python/ufe_ae/usd) - install(FILES ae_utils.py DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/python/ufe_ae/usd) - install(FILES __init__.py DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/python/ufe_ae/usd/nodes) - # Maya Attribute Editor python template - just uses a single schema base template file. - set(MAYAUSD_AE_TEMPLATES usdschemabase) +# We need an empty __init__.py file in each subfolder so it is considered a python module. +install(FILES __init__.py DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/python/ufe_ae) +install(FILES __init__.py DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/python/ufe_ae/usd) +install(FILES ae_utils.py DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/python/ufe_ae/usd) +install(FILES __init__.py DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/python/ufe_ae/usd/nodes) - foreach(_SUBDIR ${MAYAUSD_AE_TEMPLATES}) - install(FILES ${_SUBDIR}/__init__.py ${_SUBDIR}/custom_image_control.py ${_SUBDIR}/custom_enum_control.py ${_SUBDIR}/ae_template.py - DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/python/ufe_ae/usd/nodes/${_SUBDIR} - ) - endforeach() -endif() +# Maya Attribute Editor python template - just uses a single schema base template file. +set(MAYAUSD_AE_TEMPLATES usdschemabase) + +foreach(_SUBDIR ${MAYAUSD_AE_TEMPLATES}) + install(FILES ${_SUBDIR}/__init__.py ${_SUBDIR}/custom_image_control.py ${_SUBDIR}/custom_enum_control.py ${_SUBDIR}/ae_template.py + DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/python/ufe_ae/usd/nodes/${_SUBDIR} + ) +endforeach() install(FILES __init__.py DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/python/${PROJECT_NAME}) diff --git a/lib/mayaUsd/resources/icons/CMakeLists.txt b/lib/mayaUsd/resources/icons/CMakeLists.txt index aed6854030..d89df9f1f6 100644 --- a/lib/mayaUsd/resources/icons/CMakeLists.txt +++ b/lib/mayaUsd/resources/icons/CMakeLists.txt @@ -1,54 +1,53 @@ # --------------------------------------------------------------------------------------------- # install # --------------------------------------------------------------------------------------------- -if (CMAKE_UFE_V2_FEATURES_AVAILABLE) - # Maya Outliner icons - 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 + +# Maya Outliner icons +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 + # base icon name that is used. 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" ) - foreach(ICON_BASE ${OUTLINER_ICONS}) - # The _100.png files need to be installed without the _100. This is the - # base icon name that is used. 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() -endif() +endforeach() set(LIB_ICONS saveOption1 diff --git a/lib/mayaUsd/sceneIndex/proxyShapeSceneIndexPlugin.cpp b/lib/mayaUsd/sceneIndex/proxyShapeSceneIndexPlugin.cpp index f6bd4822aa..edf7c92cc8 100644 --- a/lib/mayaUsd/sceneIndex/proxyShapeSceneIndexPlugin.cpp +++ b/lib/mayaUsd/sceneIndex/proxyShapeSceneIndexPlugin.cpp @@ -18,9 +18,8 @@ #if PXR_VERSION >= 2211 -#if WANT_UFE_BUILD #include -#endif +#include #include @@ -48,13 +47,7 @@ #include #include #include -#if WANT_UFE_BUILD -#include - #include -#endif - -#include PXR_NAMESPACE_OPEN_SCOPE @@ -90,7 +83,6 @@ HdSceneIndexBaseRefPtr MayaUsdProxyShapeMayaNodeSceneIndexPlugin::_AppendSceneIn } if (auto dataSourceEntryNodePath = HdMObjectDataSource::Cast(dataSourceEntryPathHandle)) { -#if WANT_UFE_BUILD if (version >= 200) { // Retrieve interpret pick function from the scene index plugin, to be accessed by // mayaHydra interpretRprimPath @@ -117,7 +109,6 @@ HdSceneIndexBaseRefPtr MayaUsdProxyShapeMayaNodeSceneIndexPlugin::_AppendSceneIn TF_VERIFY(id != 0, "Invalid UFE runtime id"); } } -#endif MObject dagNode = dataSourceEntryNodePath->GetTypedValue(0.0f); MStatus status; MFnDependencyNode dependNodeFn(dagNode, &status); diff --git a/lib/mayaUsd/sceneIndex/proxyShapeSceneIndexPlugin.h b/lib/mayaUsd/sceneIndex/proxyShapeSceneIndexPlugin.h index 102670aa51..0765172fe2 100644 --- a/lib/mayaUsd/sceneIndex/proxyShapeSceneIndexPlugin.h +++ b/lib/mayaUsd/sceneIndex/proxyShapeSceneIndexPlugin.h @@ -31,9 +31,7 @@ #include #include -#if WANT_UFE_BUILD #include -#endif #include diff --git a/lib/mayaUsd/ufe/CMakeLists.txt b/lib/mayaUsd/ufe/CMakeLists.txt index f7490ba3a1..75e1fe4f85 100644 --- a/lib/mayaUsd/ufe/CMakeLists.txt +++ b/lib/mayaUsd/ufe/CMakeLists.txt @@ -5,10 +5,20 @@ target_sources(${PROJECT_NAME} PRIVATE Global.cpp MayaStagesSubject.cpp + MayaUsdObject3d.cpp + MayaUsdObject3dHandler.cpp + ProxyShapeContextOpsHandler.cpp ProxyShapeHandler.cpp ProxyShapeHierarchy.cpp ProxyShapeHierarchyHandler.cpp + RotationUtils.cpp SetVariantSelectionCommand.cpp + UsdAttribute.cpp + UsdAttributeHolder.cpp + UsdAttributes.cpp + UsdAttributesHandler.cpp + UsdContextOps.cpp + UsdContextOpsHandler.cpp UsdPointInstanceOrientationModifier.cpp UsdPointInstancePositionModifier.cpp UsdPointInstanceScaleModifier.cpp @@ -17,49 +27,31 @@ target_sources(${PROJECT_NAME} UsdScaleUndoableCommand.cpp UsdSceneItemOps.cpp UsdSceneItemOpsHandler.cpp + UsdSetXformOpUndoableCommandBase.cpp UsdStageMap.cpp UsdTRSUndoableCommandBase.cpp - UsdTransform3d.cpp + UsdTransform3dBase.cpp + UsdTransform3dCommonAPI.cpp + UsdTransform3dFallbackMayaXformStack.cpp + UsdTransform3dMatrixOp.cpp + UsdTransform3dMayaXformStack.cpp + UsdTransform3dPointInstance.cpp UsdTransform3dReadImpl.cpp - UsdTransform3dHandler.cpp + UsdTransform3dSetObjectMatrix.cpp + UsdTransform3dUndoableCommands.cpp UsdTranslateUndoableCommand.cpp + UsdUIInfoHandler.cpp + UsdUIUfeObserver.cpp UsdUndoDeleteCommand.cpp UsdUndoDuplicateCommand.cpp + UsdUndoMaterialCommands.cpp UsdUndoPayloadCommand.cpp UsdUndoRenameCommand.cpp Utils.cpp + XformOpUtils.cpp moduleDeps.cpp ) -if(CMAKE_UFE_V2_FEATURES_AVAILABLE) - target_sources(${PROJECT_NAME} - PRIVATE - MayaUsdObject3d.cpp - MayaUsdObject3dHandler.cpp - ProxyShapeContextOpsHandler.cpp - RotationUtils.cpp - UsdAttribute.cpp - UsdAttributeHolder.cpp - UsdAttributes.cpp - UsdAttributesHandler.cpp - UsdContextOps.cpp - UsdContextOpsHandler.cpp - UsdSetXformOpUndoableCommandBase.cpp - UsdTransform3dBase.cpp - UsdTransform3dCommonAPI.cpp - UsdTransform3dFallbackMayaXformStack.cpp - UsdTransform3dMatrixOp.cpp - UsdTransform3dMayaXformStack.cpp - UsdTransform3dPointInstance.cpp - UsdTransform3dSetObjectMatrix.cpp - UsdTransform3dUndoableCommands.cpp - UsdUIInfoHandler.cpp - UsdUIUfeObserver.cpp - UsdUndoMaterialCommands.cpp - XformOpUtils.cpp - ) -endif() - if(CMAKE_UFE_V3_FEATURES_AVAILABLE) target_sources(${PROJECT_NAME} PRIVATE @@ -177,61 +169,54 @@ endif() set(HEADERS Global.h MayaStagesSubject.h + MayaUsdObject3d.h + MayaUsdObject3dHandler.h + ProxyShapeContextOpsHandler.h ProxyShapeHandler.h ProxyShapeHierarchy.h ProxyShapeHierarchyHandler.h + RotationUtils.h SetVariantSelectionCommand.h + UsdAttribute.h + UsdAttributeHolder.h + UsdAttributes.h + UsdAttributesHandler.h + UsdContextOps.h + UsdContextOpsHandler.h UsdPointInstanceModifierBase.h UsdPointInstanceOrientationModifier.h UsdPointInstancePositionModifier.h UsdPointInstanceScaleModifier.h + UsdPointInstanceUndoableCommands.h UsdRotatePivotTranslateUndoableCommand.h UsdRotateUndoableCommand.h UsdScaleUndoableCommand.h UsdSceneItemOps.h UsdSceneItemOpsHandler.h + UsdSetXformOpUndoableCommandBase.h UsdStageMap.h UsdTRSUndoableCommandBase.h - UsdTransform3d.h + UsdTransform3dBase.h + UsdTransform3dCommonAPI.h + UsdTransform3dFallbackMayaXformStack.h + UsdTransform3dMatrixOp.h + UsdTransform3dMayaXformStack.h + UsdTransform3dPointInstance.h UsdTransform3dReadImpl.h - UsdTransform3dHandler.h + UsdTransform3dSetObjectMatrix.h + UsdTransform3dUndoableCommands.h UsdTranslateUndoableCommand.h + UsdUIInfoHandler.h + UsdUIUfeObserver.h UsdUndoDeleteCommand.h UsdUndoDuplicateCommand.h + UsdUndoMaterialCommands.h UsdUndoPayloadCommand.h UsdUndoRenameCommand.h Utils.h + XformOpUtils.h ) -if(CMAKE_UFE_V2_FEATURES_AVAILABLE) - list(APPEND HEADERS - MayaUsdObject3d.h - MayaUsdObject3dHandler.h - ProxyShapeContextOpsHandler.h - RotationUtils.h - UsdAttribute.h - UsdAttributeHolder.h - UsdAttributes.h - UsdAttributesHandler.h - UsdContextOps.h - UsdContextOpsHandler.h - UsdPointInstanceUndoableCommands.h - UsdSetXformOpUndoableCommandBase.h - UsdTransform3dBase.h - UsdTransform3dCommonAPI.h - UsdTransform3dFallbackMayaXformStack.h - UsdTransform3dMatrixOp.h - UsdTransform3dMayaXformStack.h - UsdTransform3dPointInstance.h - UsdTransform3dSetObjectMatrix.h - UsdTransform3dUndoableCommands.h - UsdUIInfoHandler.h - UsdUIUfeObserver.h - UsdUndoMaterialCommands.h - XformOpUtils.h - ) -endif() - if(CMAKE_UFE_V3_FEATURES_AVAILABLE) list(APPEND HEADERS # Not dependent on UFE v3, but used to draw orphaned pulled Maya nodes diff --git a/lib/mayaUsd/ufe/Global.cpp b/lib/mayaUsd/ufe/Global.cpp index 49dbaac8af..76474cff3a 100644 --- a/lib/mayaUsd/ufe/Global.cpp +++ b/lib/mayaUsd/ufe/Global.cpp @@ -18,18 +18,13 @@ #include "private/UfeNotifGuard.h" #include -#include -#include -#include -#include -#include -#include - -#ifdef UFE_V2_FEATURES_AVAILABLE #include #include +#include +#include #include #include +#include #include #include #include @@ -37,7 +32,8 @@ #include #include #include -#endif +#include +#include #ifdef UFE_V3_FEATURES_AVAILABLE #define HAVE_PATH_MAPPING @@ -83,11 +79,8 @@ #include #include -#include - -#ifdef UFE_V2_FEATURES_AVAILABLE #include -#endif +#include #include #include @@ -122,11 +115,9 @@ Ufe::Rtid g_MayaRtid = 0; // Keep a reference to it to restore on finalization. Ufe::HierarchyHandler::Ptr g_MayaHierarchyHandler; -#ifdef UFE_V2_FEATURES_AVAILABLE // The normal Maya context ops handler, which we decorate for ProxyShape support. // Keep a reference to it to restore on finalization. Ufe::ContextOpsHandler::Ptr g_MayaContextOpsHandler; -#endif #if UFE_SCENE_SEGMENT_SUPPORT // The normal Maya scene segment handler, which we decorate for ProxyShape support. @@ -184,13 +175,10 @@ MStatus initialize() runTimeMgr.setHierarchyHandler(g_MayaRtid, proxyShapeHierHandler); #endif -#ifdef UFE_V2_FEATURES_AVAILABLE g_MayaContextOpsHandler = runTimeMgr.contextOpsHandler(g_MayaRtid); auto proxyShapeContextOpsHandler = ProxyShapeContextOpsHandler::create(g_MayaContextOpsHandler); runTimeMgr.setContextOpsHandler(g_MayaRtid, proxyShapeContextOpsHandler); -#endif -#ifdef UFE_V2_FEATURES_AVAILABLE UsdUfe::Handlers usdUfeHandlers; Ufe::RunTimeMgr::Handlers handlers; #ifdef UFE_V3_FEATURES_AVAILABLE @@ -324,8 +312,6 @@ MStatus initialize() runTimeMgr.setUIInfoHandler(g_MayaRtid, uiInfoHandler); #endif -#endif /* UFE_V2_FEATURES_AVAILABLE */ - #if !defined(NDEBUG) assert(usdRtid != 0); #endif @@ -333,7 +319,7 @@ MStatus initialize() return MS::kFailure; // Register for UFE string to path service using path component separator '/' - UFE_V2(Ufe::PathString::registerPathComponentSeparator(usdRtid, '/');) + Ufe::PathString::registerPathComponentSeparator(usdRtid, '/'); // Initialize edit router registry with default routers. MayaUsd::registerMayaEditRouters(); @@ -354,14 +340,13 @@ MStatus finalize(bool exiting) // Restore the normal Maya hierarchy handler, and unregister. runTimeMgr.setHierarchyHandler(g_MayaRtid, g_MayaHierarchyHandler); -#ifdef UFE_V2_FEATURES_AVAILABLE // Restore the normal Maya context ops handler (can be empty). if (g_MayaContextOpsHandler) runTimeMgr.setContextOpsHandler(g_MayaRtid, g_MayaContextOpsHandler); g_MayaContextOpsHandler.reset(); MayaUsd::ufe::UsdUIUfeObserver::destroy(); -#endif + UsdUfe::finalize(exiting); g_MayaHierarchyHandler.reset(); diff --git a/lib/mayaUsd/ufe/ProxyShapeHierarchy.cpp b/lib/mayaUsd/ufe/ProxyShapeHierarchy.cpp index 97353ab33b..f1de0b016a 100644 --- a/lib/mayaUsd/ufe/ProxyShapeHierarchy.cpp +++ b/lib/mayaUsd/ufe/ProxyShapeHierarchy.cpp @@ -18,6 +18,10 @@ #include #include +#include +#include +#include + #include #include @@ -28,12 +32,6 @@ #include #include -#ifdef UFE_V2_FEATURES_AVAILABLE -#include -#include -#include -#endif - #ifdef UFE_V3_FEATURES_AVAILABLE #include @@ -179,7 +177,6 @@ Ufe::SceneItemList ProxyShapeHierarchy::children() const return createUFEChildList(getUSDFilteredChildren(rootPrim), true /*filterInactive*/); } -#ifdef UFE_V2_FEATURES_AVAILABLE Ufe::SceneItemList ProxyShapeHierarchy::filteredChildren(const ChildFilter& childFilter) const { // Return filtered children of the USD root. @@ -200,7 +197,6 @@ Ufe::SceneItemList ProxyShapeHierarchy::filteredChildren(const ChildFilter& chil UFE_LOG("Unknown child filter"); return Ufe::SceneItemList(); } -#endif // Return UFE child list from input USD child list. Ufe::SceneItemList @@ -237,16 +233,6 @@ ProxyShapeHierarchy::createUFEChildList(const UsdPrimSiblingRange& range, bool f Ufe::SceneItem::Ptr ProxyShapeHierarchy::parent() const { return fMayaHierarchy->parent(); } -#ifndef UFE_V2_FEATURES_AVAILABLE -// UFE v1 specific method -Ufe::AppendedChild ProxyShapeHierarchy::appendChild(const Ufe::SceneItem::Ptr& child) -{ - throw std::runtime_error("ProxyShapeHierarchy::appendChild() not implemented"); -} -#endif - -#ifdef UFE_V2_FEATURES_AVAILABLE - Ufe::InsertChildCommand::Ptr ProxyShapeHierarchy::insertChildCmd( const Ufe::SceneItem::Ptr& child, const Ufe::SceneItem::Ptr& pos) @@ -338,8 +324,6 @@ Ufe::SceneItem::Ptr ProxyShapeHierarchy::defaultParent() const return UsdSceneItem::create(sceneItem()->path(), getUsdRootPrim()); } -#endif // UFE_V2_FEATURES_AVAILABLE - #ifdef UFE_V3_FEATURES_AVAILABLE Ufe::UndoableCommand::Ptr ProxyShapeHierarchy::ungroupCmd() const { diff --git a/lib/mayaUsd/ufe/ProxyShapeHierarchy.h b/lib/mayaUsd/ufe/ProxyShapeHierarchy.h index 9b84d9c66a..42a9ac522f 100644 --- a/lib/mayaUsd/ufe/ProxyShapeHierarchy.h +++ b/lib/mayaUsd/ufe/ProxyShapeHierarchy.h @@ -59,13 +59,9 @@ class MAYAUSD_CORE_PUBLIC ProxyShapeHierarchy : public Ufe::Hierarchy bool hasChildren() const override; Ufe::SceneItemList children() const override; UFE_V4(bool hasFilteredChildren(const ChildFilter&) const override;) - UFE_V2(Ufe::SceneItemList filteredChildren(const ChildFilter&) const override;) + Ufe::SceneItemList filteredChildren(const ChildFilter&) const override; Ufe::SceneItem::Ptr parent() const override; -#ifndef UFE_V2_FEATURES_AVAILABLE - Ufe::AppendedChild appendChild(const Ufe::SceneItem::Ptr& child) override; -#endif -#ifdef UFE_V2_FEATURES_AVAILABLE #ifdef UFE_V3_FEATURES_AVAILABLE Ufe::SceneItem::Ptr createGroup(const Ufe::PathComponent& name) const override; Ufe::InsertChildCommand::Ptr createGroupCmd(const Ufe::PathComponent& name) const override; @@ -84,7 +80,6 @@ class MAYAUSD_CORE_PUBLIC ProxyShapeHierarchy : public Ufe::Hierarchy insertChildCmd(const Ufe::SceneItem::Ptr& child, const Ufe::SceneItem::Ptr& pos) override; Ufe::UndoableCommand::Ptr reorderCmd(const Ufe::SceneItemList& orderedList) const override; -#endif #ifdef UFE_V3_FEATURES_AVAILABLE Ufe::UndoableCommand::Ptr ungroupCmd() const override; diff --git a/lib/mayaUsd/ufe/ProxyShapeHierarchyHandler.cpp b/lib/mayaUsd/ufe/ProxyShapeHierarchyHandler.cpp index a8e0e00f37..3850869e7d 100644 --- a/lib/mayaUsd/ufe/ProxyShapeHierarchyHandler.cpp +++ b/lib/mayaUsd/ufe/ProxyShapeHierarchyHandler.cpp @@ -58,14 +58,12 @@ Ufe::SceneItem::Ptr ProxyShapeHierarchyHandler::createItem(const Ufe::Path& path return fMayaHierarchyHandler->createItem(path); } -#ifdef UFE_V2_FEATURES_AVAILABLE Ufe::Hierarchy::ChildFilter ProxyShapeHierarchyHandler::childFilter() const { // Use the same child filter as the USD hierarchy handler. auto usdHierHand = Ufe::RunTimeMgr::instance().hierarchyHandler(getUsdRunTimeId()); return usdHierHand->childFilter(); } -#endif } // namespace ufe } // namespace MAYAUSD_NS_DEF diff --git a/lib/mayaUsd/ufe/ProxyShapeHierarchyHandler.h b/lib/mayaUsd/ufe/ProxyShapeHierarchyHandler.h index 053c469125..624532a146 100644 --- a/lib/mayaUsd/ufe/ProxyShapeHierarchyHandler.h +++ b/lib/mayaUsd/ufe/ProxyShapeHierarchyHandler.h @@ -56,9 +56,9 @@ class MAYAUSD_CORE_PUBLIC ProxyShapeHierarchyHandler : public Ufe::HierarchyHand create(const Ufe::HierarchyHandler::Ptr& mayaHierarchyHandler); // Ufe::HierarchyHandler overrides - Ufe::Hierarchy::Ptr hierarchy(const Ufe::SceneItem::Ptr& item) const override; - Ufe::SceneItem::Ptr createItem(const Ufe::Path& path) const override; - UFE_V2(Ufe::Hierarchy::ChildFilter childFilter() const override;) + Ufe::Hierarchy::Ptr hierarchy(const Ufe::SceneItem::Ptr& item) const override; + Ufe::SceneItem::Ptr createItem(const Ufe::Path& path) const override; + Ufe::Hierarchy::ChildFilter childFilter() const override; private: Ufe::HierarchyHandler::Ptr fMayaHierarchyHandler; diff --git a/lib/mayaUsd/ufe/UsdPointInstanceOrientationModifier.cpp b/lib/mayaUsd/ufe/UsdPointInstanceOrientationModifier.cpp index 0e3fcab6d4..f15f71925b 100644 --- a/lib/mayaUsd/ufe/UsdPointInstanceOrientationModifier.cpp +++ b/lib/mayaUsd/ufe/UsdPointInstanceOrientationModifier.cpp @@ -28,12 +28,7 @@ #include #include #include - -#ifdef UFE_V2_FEATURES_AVAILABLE #include -#else -#include -#endif PXR_NAMESPACE_USING_DIRECTIVE diff --git a/lib/mayaUsd/ufe/UsdPointInstanceOrientationModifier.h b/lib/mayaUsd/ufe/UsdPointInstanceOrientationModifier.h index 3317a7356c..8a408b9205 100644 --- a/lib/mayaUsd/ufe/UsdPointInstanceOrientationModifier.h +++ b/lib/mayaUsd/ufe/UsdPointInstanceOrientationModifier.h @@ -24,11 +24,7 @@ #include #include -#ifdef UFE_V2_FEATURES_AVAILABLE #include -#else -#include -#endif namespace MAYAUSD_NS_DEF { namespace ufe { diff --git a/lib/mayaUsd/ufe/UsdPointInstancePositionModifier.h b/lib/mayaUsd/ufe/UsdPointInstancePositionModifier.h index 3d8ba6ec42..872b0e3565 100644 --- a/lib/mayaUsd/ufe/UsdPointInstancePositionModifier.h +++ b/lib/mayaUsd/ufe/UsdPointInstancePositionModifier.h @@ -24,11 +24,7 @@ #include #include -#ifdef UFE_V2_FEATURES_AVAILABLE #include -#else -#include -#endif namespace MAYAUSD_NS_DEF { namespace ufe { diff --git a/lib/mayaUsd/ufe/UsdPointInstanceScaleModifier.h b/lib/mayaUsd/ufe/UsdPointInstanceScaleModifier.h index f0e1a601dc..3dc2fa2e02 100644 --- a/lib/mayaUsd/ufe/UsdPointInstanceScaleModifier.h +++ b/lib/mayaUsd/ufe/UsdPointInstanceScaleModifier.h @@ -24,11 +24,7 @@ #include #include -#ifdef UFE_V2_FEATURES_AVAILABLE #include -#else -#include -#endif namespace MAYAUSD_NS_DEF { namespace ufe { diff --git a/lib/mayaUsd/ufe/UsdRotatePivotTranslateUndoableCommand.cpp b/lib/mayaUsd/ufe/UsdRotatePivotTranslateUndoableCommand.cpp index 4a6ca27bfd..e334a53d76 100644 --- a/lib/mayaUsd/ufe/UsdRotatePivotTranslateUndoableCommand.cpp +++ b/lib/mayaUsd/ufe/UsdRotatePivotTranslateUndoableCommand.cpp @@ -22,57 +22,30 @@ PXR_NAMESPACE_USING_DIRECTIVE namespace MAYAUSD_NS_DEF { namespace ufe { -#ifdef UFE_V2_FEATURES_AVAILABLE UsdRotatePivotTranslateUndoableCommand::UsdRotatePivotTranslateUndoableCommand( const Ufe::Path& path) : Ufe::TranslateUndoableCommand(path) , fPath(path) , fNoPivotOp(false) -#else -UsdRotatePivotTranslateUndoableCommand::UsdRotatePivotTranslateUndoableCommand( - const UsdPrim& prim, - const Ufe::Path& path, - const Ufe::SceneItem::Ptr& item) - : Ufe::TranslateUndoableCommand(item) - , fPrim(prim) - , fPath(path) - , fNoPivotOp(false) -#endif { -#ifdef UFE_V2_FEATURES_AVAILABLE // create a sceneItem on first access sceneItem(); -#endif // Prim does not have a pivot translate attribute const TfToken xpivot("xformOp:translate:pivot"); -#ifdef UFE_V2_FEATURES_AVAILABLE - if (!prim().HasAttribute(xpivot)) -#else - if (!fPrim.HasAttribute(xpivot)) -#endif - { + if (!prim().HasAttribute(xpivot)) { fNoPivotOp = true; -// Add an empty pivot translate. -#ifdef UFE_V2_FEATURES_AVAILABLE + + // Add an empty pivot translate. rotatePivotTranslateOp(prim(), fPath, 0, 0, 0); -#else - rotatePivotTranslateOp(fPrim, fPath, 0, 0, 0); -#endif } -#ifdef UFE_V2_FEATURES_AVAILABLE fPivotAttrib = prim().GetAttribute(xpivot); -#else - fPivotAttrib = fPrim.GetAttribute(xpivot); -#endif - fPivotAttrib.Get(&fPrevPivotValue); } UsdRotatePivotTranslateUndoableCommand::~UsdRotatePivotTranslateUndoableCommand() { } -#ifdef UFE_V2_FEATURES_AVAILABLE UsdSceneItem::Ptr UsdRotatePivotTranslateUndoableCommand::sceneItem() const { if (!fItem) { @@ -80,24 +53,13 @@ UsdSceneItem::Ptr UsdRotatePivotTranslateUndoableCommand::sceneItem() const } return fItem; } -#endif /*static*/ -#ifdef UFE_V2_FEATURES_AVAILABLE UsdRotatePivotTranslateUndoableCommand::Ptr UsdRotatePivotTranslateUndoableCommand::create(const Ufe::Path& path) { return std::make_shared(path); } -#else -UsdRotatePivotTranslateUndoableCommand::Ptr UsdRotatePivotTranslateUndoableCommand::create( - const UsdPrim& prim, - const Ufe::Path& ufePath, - const Ufe::SceneItem::Ptr& item) -{ - return std::make_shared(prim, ufePath, item); -} -#endif void UsdRotatePivotTranslateUndoableCommand::undo() { @@ -117,19 +79,11 @@ void UsdRotatePivotTranslateUndoableCommand::redo() // Ufe::TranslateUndoableCommand overrides //------------------------------------------------------------------------------ -#ifdef UFE_V2_FEATURES_AVAILABLE bool UsdRotatePivotTranslateUndoableCommand::set(double x, double y, double z) { rotatePivotTranslateOp(prim(), fPath, x, y, z); return true; } -#else -bool UsdRotatePivotTranslateUndoableCommand::translate(double x, double y, double z) -{ - rotatePivotTranslateOp(fPrim, fPath, x, y, z); - return true; -} -#endif } // namespace ufe } // namespace MAYAUSD_NS_DEF diff --git a/lib/mayaUsd/ufe/UsdRotatePivotTranslateUndoableCommand.h b/lib/mayaUsd/ufe/UsdRotatePivotTranslateUndoableCommand.h index 7c232d818d..0dff919f12 100644 --- a/lib/mayaUsd/ufe/UsdRotatePivotTranslateUndoableCommand.h +++ b/lib/mayaUsd/ufe/UsdRotatePivotTranslateUndoableCommand.h @@ -37,15 +37,7 @@ class MAYAUSD_CORE_PUBLIC UsdRotatePivotTranslateUndoableCommand public: typedef std::shared_ptr Ptr; -#ifdef UFE_V2_FEATURES_AVAILABLE UsdRotatePivotTranslateUndoableCommand(const Ufe::Path& path); -#else - UsdRotatePivotTranslateUndoableCommand( - const PXR_NS::UsdPrim& prim, - const Ufe::Path& ufePath, - const Ufe::SceneItem::Ptr& item); -#endif - ~UsdRotatePivotTranslateUndoableCommand() override; // Delete the copy/move constructors assignment operators. @@ -56,22 +48,14 @@ class MAYAUSD_CORE_PUBLIC UsdRotatePivotTranslateUndoableCommand UsdRotatePivotTranslateUndoableCommand& operator=(UsdRotatePivotTranslateUndoableCommand&&) = delete; -//! Create a UsdRotatePivotTranslateUndoableCommand from a USD prim, UFE path and UFE scene item. -#ifdef UFE_V2_FEATURES_AVAILABLE + //! Create a UsdRotatePivotTranslateUndoableCommand from a USD prim, UFE path and UFE scene + //! item. static UsdRotatePivotTranslateUndoableCommand::Ptr create(const Ufe::Path& path); -#else - static UsdRotatePivotTranslateUndoableCommand::Ptr - create(const PXR_NS::UsdPrim& prim, const Ufe::Path& ufePath, const Ufe::SceneItem::Ptr& item); -#endif // Ufe::TranslateUndoableCommand overrides void undo() override; void redo() override; -#ifdef UFE_V2_FEATURES_AVAILABLE bool set(double x, double y, double z) override; -#else - bool translate(double x, double y, double z) override; -#endif inline PXR_NS::UsdPrim prim() const { @@ -83,12 +67,9 @@ class MAYAUSD_CORE_PUBLIC UsdRotatePivotTranslateUndoableCommand } private: - UFE_V2(UsdSceneItem::Ptr sceneItem() const;) + UsdSceneItem::Ptr sceneItem() const; private: -#ifndef UFE_V2_FEATURES_AVAILABLE - PXR_NS::UsdPrim fPrim; -#endif Ufe::Path fPath; mutable UsdSceneItem::Ptr fItem { nullptr }; PXR_NS::UsdAttribute fPivotAttrib; diff --git a/lib/mayaUsd/ufe/UsdRotateUndoableCommand.cpp b/lib/mayaUsd/ufe/UsdRotateUndoableCommand.cpp index 839c391ae0..ca1f909d9f 100644 --- a/lib/mayaUsd/ufe/UsdRotateUndoableCommand.cpp +++ b/lib/mayaUsd/ufe/UsdRotateUndoableCommand.cpp @@ -22,7 +22,6 @@ namespace ufe { PXR_NS::TfToken UsdRotateUndoableCommand::rotXYZ("xformOp:rotateXYZ"); -#ifdef UFE_V2_FEATURES_AVAILABLE UsdRotateUndoableCommand::UsdRotateUndoableCommand( const Ufe::Path& path, double x, @@ -30,15 +29,6 @@ UsdRotateUndoableCommand::UsdRotateUndoableCommand( double z) : Ufe::RotateUndoableCommand(path) , UsdTRSUndoableCommandBase(x, y, z) -#else -UsdRotateUndoableCommand::UsdRotateUndoableCommand( - const UsdSceneItem::Ptr& item, - double x, - double y, - double z) - : Ufe::RotateUndoableCommand(item) - , UsdTRSUndoableCommandBase(item, x, y, z) -#endif { // Since we want to change xformOp:rotateXYZ, and we need to store the // prevRotate for undo purposes, we need to make sure we convert it to @@ -55,7 +45,6 @@ UsdRotateUndoableCommand::UsdRotateUndoableCommand( UsdRotateUndoableCommand::~UsdRotateUndoableCommand() { } -#ifdef UFE_V2_FEATURES_AVAILABLE UsdRotateUndoableCommand::Ptr UsdRotateUndoableCommand::create(const Ufe::Path& path, double x, double y, double z) { @@ -63,15 +52,6 @@ UsdRotateUndoableCommand::create(const Ufe::Path& path, double x, double y, doub cmd->initialize(); return cmd; } -#else -UsdRotateUndoableCommand::Ptr -UsdRotateUndoableCommand::create(const UsdSceneItem::Ptr& item, double x, double y, double z) -{ - auto cmd = std::make_shared>(item, x, y, z); - cmd->initialize(); - return cmd; -} -#endif void UsdRotateUndoableCommand::undo() { @@ -97,11 +77,7 @@ void UsdRotateUndoableCommand::performImp(double x, double y, double z) // Ufe::RotateUndoableCommand overrides //------------------------------------------------------------------------------ -#ifdef UFE_V2_FEATURES_AVAILABLE bool UsdRotateUndoableCommand::set(double x, double y, double z) -#else -bool UsdRotateUndoableCommand::rotate(double x, double y, double z) -#endif { // Fail early - Initialization did not go as expected. if (fFailedInit) { diff --git a/lib/mayaUsd/ufe/UsdRotateUndoableCommand.h b/lib/mayaUsd/ufe/UsdRotateUndoableCommand.h index 5279e7dcd6..897a6089f4 100644 --- a/lib/mayaUsd/ufe/UsdRotateUndoableCommand.h +++ b/lib/mayaUsd/ufe/UsdRotateUndoableCommand.h @@ -43,39 +43,22 @@ class MAYAUSD_CORE_PUBLIC UsdRotateUndoableCommand UsdRotateUndoableCommand(UsdRotateUndoableCommand&&) = delete; UsdRotateUndoableCommand& operator=(UsdRotateUndoableCommand&&) = delete; -#ifdef UFE_V2_FEATURES_AVAILABLE //! Create a UsdRotateUndoableCommand from a UFE scene path. The command is //! not executed. static UsdRotateUndoableCommand::Ptr create(const Ufe::Path& path, double x, double y, double z); -#else - //! Create a UsdRotateUndoableCommand from a UFE scene item. The command is - //! not executed. - static UsdRotateUndoableCommand::Ptr - create(const UsdSceneItem::Ptr& item, double x, double y, double z); -#endif // Ufe::RotateUndoableCommand overrides. set() sets the command's // rotation value and executes the command. void undo() override; void redo() override; -#ifdef UFE_V2_FEATURES_AVAILABLE bool set(double x, double y, double z) override; -#else - bool rotate(double x, double y, double z) override; -#endif -#ifdef UFE_V2_FEATURES_AVAILABLE Ufe::Path getPath() const override { return path(); } -#endif protected: //! Construct a UsdRotateUndoableCommand. The command is not executed. -#ifdef UFE_V2_FEATURES_AVAILABLE UsdRotateUndoableCommand(const Ufe::Path& path, double x, double y, double z); -#else - UsdRotateUndoableCommand(const UsdSceneItem::Ptr& item, double x, double y, double z); -#endif ~UsdRotateUndoableCommand() override; private: diff --git a/lib/mayaUsd/ufe/UsdScaleUndoableCommand.cpp b/lib/mayaUsd/ufe/UsdScaleUndoableCommand.cpp index 64e10b0ff3..f389f30f21 100644 --- a/lib/mayaUsd/ufe/UsdScaleUndoableCommand.cpp +++ b/lib/mayaUsd/ufe/UsdScaleUndoableCommand.cpp @@ -22,7 +22,6 @@ namespace ufe { PXR_NS::TfToken UsdScaleUndoableCommand::scaleTok("xformOp:scale"); -#ifdef UFE_V2_FEATURES_AVAILABLE UsdScaleUndoableCommand::UsdScaleUndoableCommand( const Ufe::Path& path, double x, @@ -32,22 +31,10 @@ UsdScaleUndoableCommand::UsdScaleUndoableCommand( , UsdTRSUndoableCommandBase(x, y, z) { } -#else -UsdScaleUndoableCommand::UsdScaleUndoableCommand( - const UsdSceneItem::Ptr& item, - double x, - double y, - double z) - : Ufe::ScaleUndoableCommand(item) - , UsdTRSUndoableCommandBase(item, x, y, z) -{ -} -#endif UsdScaleUndoableCommand::~UsdScaleUndoableCommand() { } /*static*/ -#ifdef UFE_V2_FEATURES_AVAILABLE UsdScaleUndoableCommand::Ptr UsdScaleUndoableCommand::create(const Ufe::Path& path, double x, double y, double z) { @@ -55,15 +42,6 @@ UsdScaleUndoableCommand::create(const Ufe::Path& path, double x, double y, doubl cmd->initialize(); return cmd; } -#else -UsdScaleUndoableCommand::Ptr -UsdScaleUndoableCommand::create(const UsdSceneItem::Ptr& item, double x, double y, double z) -{ - auto cmd = std::make_shared>(item, x, y, z); - cmd->initialize(); - return cmd; -} -#endif void UsdScaleUndoableCommand::undo() { undoImp(); } @@ -83,11 +61,7 @@ void UsdScaleUndoableCommand::performImp(double x, double y, double z) // Ufe::ScaleUndoableCommand overrides //------------------------------------------------------------------------------ -#ifdef UFE_V2_FEATURES_AVAILABLE bool UsdScaleUndoableCommand::set(double x, double y, double z) -#else -bool UsdScaleUndoableCommand::scale(double x, double y, double z) -#endif { perform(x, y, z); return true; diff --git a/lib/mayaUsd/ufe/UsdScaleUndoableCommand.h b/lib/mayaUsd/ufe/UsdScaleUndoableCommand.h index 399c8b2f77..b5c51c7f7b 100644 --- a/lib/mayaUsd/ufe/UsdScaleUndoableCommand.h +++ b/lib/mayaUsd/ufe/UsdScaleUndoableCommand.h @@ -41,38 +41,20 @@ class MAYAUSD_CORE_PUBLIC UsdScaleUndoableCommand UsdScaleUndoableCommand(UsdScaleUndoableCommand&&) = delete; UsdScaleUndoableCommand& operator=(UsdScaleUndoableCommand&&) = delete; -#ifdef UFE_V2_FEATURES_AVAILABLE //! Create a UsdScaleUndoableCommand from a UFE scene path. The command is //! not executed. static UsdScaleUndoableCommand::Ptr create(const Ufe::Path& path, double x, double y, double z); -#else - //! Create a UsdScaleUndoableCommand from a UFE scene item. The command is - //! not executed. - static UsdScaleUndoableCommand::Ptr - create(const UsdSceneItem::Ptr& item, double x, double y, double z); -#endif // Ufe::ScaleUndoableCommand overrides void undo() override; void redo() override; -#ifdef UFE_V2_FEATURES_AVAILABLE bool set(double x, double y, double z) override; -#else - bool scale(double x, double y, double z) override; -#endif -#ifdef UFE_V2_FEATURES_AVAILABLE Ufe::Path getPath() const override { return path(); } -#endif protected: //! Construct a UsdScaleUndoableCommand. The command is not executed. -#ifdef UFE_V2_FEATURES_AVAILABLE UsdScaleUndoableCommand(const Ufe::Path& path, double x, double y, double z); -#else - UsdScaleUndoableCommand(const UsdSceneItem::Ptr& item, double x, double y, double z); -#endif - ~UsdScaleUndoableCommand() override; private: diff --git a/lib/mayaUsd/ufe/UsdStageMap.cpp b/lib/mayaUsd/ufe/UsdStageMap.cpp index e16154042b..179583140a 100644 --- a/lib/mayaUsd/ufe/UsdStageMap.cpp +++ b/lib/mayaUsd/ufe/UsdStageMap.cpp @@ -22,9 +22,7 @@ #include #include -#ifdef UFE_V2_FEATURES_AVAILABLE #include -#endif #include @@ -76,16 +74,6 @@ UsdStageWeakPtr objToStage(MObject& obj) return ps->getUsdStage(); } -inline Ufe::Path::Segments::size_type nbPathSegments(const Ufe::Path& path) -{ - return -#ifdef UFE_V2_FEATURES_AVAILABLE - path.nbSegments(); -#else - path.getSegments().size(); -#endif -} - inline Ufe::Path toPath(const std::string& mayaPathString) { return Ufe::Path( @@ -110,7 +98,7 @@ UsdStageMap g_StageMap; void UsdStageMap::addItem(const Ufe::Path& path) { // We expect a path to the proxy shape node, therefore a single segment. - auto nbSegments = nbPathSegments(path); + auto nbSegments = path.nbSegments(); if (nbSegments != 1) { TF_CODING_ERROR( "A proxy shape node path can have only one segment, path '%s' has %lu", @@ -161,7 +149,7 @@ MObject UsdStageMap::proxyShape(const Ufe::Path& path) // there is a cache hit when there should not be. const auto& singleSegmentPath - = nbPathSegments(path) == 1 ? path : Ufe::Path(path.getSegments()[0]); + = path.nbSegments() == 1 ? path : Ufe::Path(path.getSegments()[0]); auto iter = fPathToObject.find(singleSegmentPath); diff --git a/lib/mayaUsd/ufe/UsdTRSUndoableCommandBase.cpp b/lib/mayaUsd/ufe/UsdTRSUndoableCommandBase.cpp index b652ceda7f..81666aa2f7 100644 --- a/lib/mayaUsd/ufe/UsdTRSUndoableCommandBase.cpp +++ b/lib/mayaUsd/ufe/UsdTRSUndoableCommandBase.cpp @@ -25,22 +25,11 @@ namespace MAYAUSD_NS_DEF { namespace ufe { template -#ifdef UFE_V2_FEATURES_AVAILABLE UsdTRSUndoableCommandBase::UsdTRSUndoableCommandBase(double x, double y, double z) : fNewValue(x, y, z) -#else -UsdTRSUndoableCommandBase::UsdTRSUndoableCommandBase( - const UsdSceneItem::Ptr& item, - double x, - double y, - double z) - : fItem(item) - , fNewValue(x, y, z) -#endif { } -#ifdef UFE_V2_FEATURES_AVAILABLE template void UsdTRSUndoableCommandBase::updateItem() const { if (!fItem) { @@ -48,7 +37,6 @@ template void UsdTRSUndoableCommandBase::updateItem() const fItem = std::dynamic_pointer_cast(ufeSceneItemPtr); } } -#endif template void UsdTRSUndoableCommandBase::initialize() { @@ -63,26 +51,10 @@ template void UsdTRSUndoableCommandBase::initialize() } attribute().Get(&fPrevValue); - -#ifndef UFE_V2_FEATURES_AVAILABLE - Ufe::Scene::instance().addObjectPathChangeObserver(this->shared_from_this()); -#endif -} - -#ifndef UFE_V2_FEATURES_AVAILABLE -template void UsdTRSUndoableCommandBase::operator()(const Ufe::Notification& n) -{ - if (auto renamed = dynamic_cast(&n)) { - checkNotification(renamed); - } else if (auto reparented = dynamic_cast(&n)) { - checkNotification(reparented); - } } -#endif template void UsdTRSUndoableCommandBase::undoImp() { -#ifdef UFE_V2_FEATURES_AVAILABLE // Set fItem to nullptr because the command does not know what can go on with the prim inside // its item after their own undo() or redo(). Setting it back to nullptr is safer because it // means that the next time the command is used, it will be forced to create a new item from the @@ -90,7 +62,6 @@ template void UsdTRSUndoableCommandBase::undoImp() fItem = nullptr; updateItem(); -#endif attribute().Set(fPrevValue); // Todo : We would want to remove the xformOp @@ -99,7 +70,6 @@ template void UsdTRSUndoableCommandBase::undoImp() template void UsdTRSUndoableCommandBase::redoImp() { -#ifdef UFE_V2_FEATURES_AVAILABLE // Set fItem to nullptr because the command does not know what can go on with the prim inside // its item after their own undo() or redo(). Setting it back to nullptr is safer because it // means that the next time the command is used, it will be forced to create a new item from the @@ -107,7 +77,6 @@ template void UsdTRSUndoableCommandBase::redoImp() fItem = nullptr; updateItem(); -#endif // We must go through conversion to the common transform API by calling // perform(), otherwise we get "Empty typeName" USD assertions for rotate @@ -120,17 +89,6 @@ template void UsdTRSUndoableCommandBase::redoImp() perform(fNewValue[0], fNewValue[1], fNewValue[2]); } -#ifndef UFE_V2_FEATURES_AVAILABLE -template -template -void UsdTRSUndoableCommandBase::checkNotification(const N* notification) -{ - if (notification->previousPath() == path()) { - fItem = std::dynamic_pointer_cast(notification->item()); - } -} -#endif - template void UsdTRSUndoableCommandBase::perform(double x, double y, double z) { fNewValue = V(x, y, z); diff --git a/lib/mayaUsd/ufe/UsdTRSUndoableCommandBase.h b/lib/mayaUsd/ufe/UsdTRSUndoableCommandBase.h index 8394eb0a42..536779b31d 100644 --- a/lib/mayaUsd/ufe/UsdTRSUndoableCommandBase.h +++ b/lib/mayaUsd/ufe/UsdTRSUndoableCommandBase.h @@ -46,22 +46,11 @@ namespace ufe { // becomes stale, and the prim in the updated scene item should be used. // template -#ifdef UFE_V2_FEATURES_AVAILABLE class MAYAUSD_CORE_PUBLIC UsdTRSUndoableCommandBase : public std::enable_shared_from_this> -#else -class MAYAUSD_CORE_PUBLIC UsdTRSUndoableCommandBase - : public Ufe::Observer - , public std::enable_shared_from_this> -#endif { protected: -#ifdef UFE_V2_FEATURES_AVAILABLE UsdTRSUndoableCommandBase(double x, double y, double z); -#else - UsdTRSUndoableCommandBase(const UsdSceneItem::Ptr& item, double x, double y, double z); -#endif - ~UsdTRSUndoableCommandBase() = default; // Initialize the command. @@ -77,17 +66,11 @@ class MAYAUSD_CORE_PUBLIC UsdTRSUndoableCommandBase // UFE item (and its USD prim) may change after creation time (e.g. // parenting change caused by undo / redo of other commands in the undo // stack), so always return current data. - -#ifdef UFE_V2_FEATURES_AVAILABLE inline PXR_NS::UsdPrim prim() const { updateItem(); return fItem->prim(); }; -#else - inline PXR_NS::UsdPrim prim() const { return fItem->prim(); } - inline Ufe::Path path() const { return fItem->path(); } -#endif // Hooks to be implemented by the derived class: name of the attribute set // by the command, implementation of perform(), and add empty attribute. @@ -97,22 +80,13 @@ class MAYAUSD_CORE_PUBLIC UsdTRSUndoableCommandBase virtual void addEmptyAttribute() = 0; virtual bool cannotInit() const; -#ifdef UFE_V2_FEATURES_AVAILABLE // Conditionally create a UsdSceneItem::Ptr from the Ufe::Path, if null. void updateItem() const; // Returns the new Ufe::Path overriden by derived classes (e.g TRS) virtual Ufe::Path getPath() const = 0; -#endif private: -#ifndef UFE_V2_FEATURES_AVAILABLE - // Overridden from Ufe::Observer - void operator()(const Ufe::Notification& notification) override; - - template void checkNotification(const N* notification); -#endif - inline PXR_NS::UsdAttribute attribute() const { return prim().GetAttribute(attributeName()); } mutable UsdSceneItem::Ptr fItem { nullptr }; @@ -126,25 +100,10 @@ class MAYAUSD_CORE_PUBLIC UsdTRSUndoableCommandBase // shared_ptr requires public ctor, dtor, so derive a class for it. template struct MakeSharedEnabler : public T { - MakeSharedEnabler( -#ifdef UFE_V2_FEATURES_AVAILABLE - const Ufe::Path& path, - double x, - double y, - double z) + MakeSharedEnabler(const Ufe::Path& path, double x, double y, double z) : T(path, x, y, z) { } }; -#else - const UsdSceneItem::Ptr& item, - double x, - double y, - double z) - : T(item, x, y, z) - { - } -}; -#endif } // namespace ufe } // namespace MAYAUSD_NS_DEF diff --git a/lib/mayaUsd/ufe/UsdTransform3d.cpp b/lib/mayaUsd/ufe/UsdTransform3d.cpp deleted file mode 100644 index 4b5a7d08a5..0000000000 --- a/lib/mayaUsd/ufe/UsdTransform3d.cpp +++ /dev/null @@ -1,360 +0,0 @@ -// -// Copyright 2020 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 "UsdTransform3d.h" - -#include "private/Utils.h" - -#include -#include -#include -#include - -#include - -#include -#include - -PXR_NAMESPACE_USING_DIRECTIVE - -namespace MAYAUSD_NS_DEF { -namespace ufe { - -namespace { -Ufe::Matrix4d convertFromUsd(const GfMatrix4d& matrix) -{ - // Even though memory layout of Ufe::Matrix4d and double[4][4] are identical - // we need to return a copy of the matrix so we cannot cast. - double m[4][4]; - matrix.Get(m); - Ufe::Matrix4d uMat; - uMat.matrix = { { { { m[0][0], m[0][1], m[0][2], m[0][3] } }, - { { m[1][0], m[1][1], m[1][2], m[1][3] } }, - { { m[2][0], m[2][1], m[2][2], m[2][3] } }, - { { m[3][0], m[3][1], m[3][2], m[3][3] } } } }; - return uMat; -} - -Ufe::Matrix4d primToUfeXform(const UsdPrim& prim, const UsdTimeCode& time) -{ - UsdGeomXformCache xformCache(time); - GfMatrix4d usdMatrix = xformCache.GetLocalToWorldTransform(prim); - Ufe::Matrix4d xform = convertFromUsd(usdMatrix); - return xform; -} - -Ufe::Matrix4d primToUfeExclusiveXform(const UsdPrim& prim, const UsdTimeCode& time) -{ - UsdGeomXformCache xformCache(time); - GfMatrix4d usdMatrix = xformCache.GetParentToWorldTransform(prim); - Ufe::Matrix4d xform = convertFromUsd(usdMatrix); - return xform; -} - -} // namespace - -UsdTransform3d::UsdTransform3d() - : Transform3d() -{ -} - -UsdTransform3d::UsdTransform3d(const UsdSceneItem::Ptr& item) - : Transform3d() - , fItem(item) -{ -} - -/*static*/ -UsdTransform3d::Ptr UsdTransform3d::create() { return std::make_shared(); } - -/* static */ -UsdTransform3d::Ptr UsdTransform3d::create(const UsdSceneItem::Ptr& item) -{ - return std::make_shared(item); -} - -void UsdTransform3d::setItem(const UsdSceneItem::Ptr& item) { fItem = item; } - -//------------------------------------------------------------------------------ -// Ufe::Transform3d overrides -//------------------------------------------------------------------------------ - -const Ufe::Path& UsdTransform3d::path() const { return fItem->path(); } - -Ufe::SceneItem::Ptr UsdTransform3d::sceneItem() const { return fItem; } - -#ifdef UFE_V2_FEATURES_AVAILABLE -Ufe::TranslateUndoableCommand::Ptr UsdTransform3d::translateCmd(double x, double y, double z) -{ - if (!UsdUfe::isAttributeEditAllowed(prim(), TfToken("xformOp:translate"))) { - return nullptr; - } - - return UsdTranslateUndoableCommand::create(path(), x, y, z); -} -#endif - -void UsdTransform3d::translate(double x, double y, double z) -{ - translateOp(prim(), fItem->path(), x, y, z); -} - -Ufe::Vector3d UsdTransform3d::translation() const -{ - double x { 0 }, y { 0 }, z { 0 }; - const TfToken xlate("xformOp:translate"); - if (prim().HasAttribute(xlate)) { - // Initially, attribute can be created, but have no value. - GfVec3d v; - if (prim().GetAttribute(xlate).Get(&v, getTime(path()))) { - x = v[0]; - y = v[1]; - z = v[2]; - } - } - return Ufe::Vector3d(x, y, z); -} - -#ifdef UFE_V2_FEATURES_AVAILABLE -Ufe::Vector3d UsdTransform3d::rotation() const -{ - double x { 0 }, y { 0 }, z { 0 }; - const TfToken rotXYZ("xformOp:rotateXYZ"); - if (prim().HasAttribute(rotXYZ)) { - // Initially, attribute can be created, but have no value. - GfVec3f v; - if (prim().GetAttribute(rotXYZ).Get(&v, getTime(path()))) { - x = v[0]; - y = v[1]; - z = v[2]; - } - } - return Ufe::Vector3d(x, y, z); -} - -Ufe::Vector3d UsdTransform3d::scale() const -{ - double x { 0 }, y { 0 }, z { 0 }; - const TfToken scaleTok("xformOp:scale"); - if (prim().HasAttribute(scaleTok)) { - // Initially, attribute can be created, but have no value. - GfVec3f v; - if (prim().GetAttribute(scaleTok).Get(&v, getTime(path()))) { - x = v[0]; - y = v[1]; - z = v[2]; - } - } - return Ufe::Vector3d(x, y, z); -} - -Ufe::RotateUndoableCommand::Ptr UsdTransform3d::rotateCmd(double x, double y, double z) -{ - if (!UsdUfe::isAttributeEditAllowed(prim(), TfToken("xformOp:rotateXYZ"))) { - return nullptr; - } - - return UsdRotateUndoableCommand::create(path(), x, y, z); -} -#endif - -void UsdTransform3d::rotate(double x, double y, double z) -{ - rotateOp(prim(), fItem->path(), x, y, z); -} - -#ifdef UFE_V2_FEATURES_AVAILABLE -Ufe::ScaleUndoableCommand::Ptr UsdTransform3d::scaleCmd(double x, double y, double z) -{ - if (!UsdUfe::isAttributeEditAllowed(prim(), TfToken("xformOp:scale"))) { - return nullptr; - } - - return UsdScaleUndoableCommand::create(path(), x, y, z); -} - -#else -Ufe::TranslateUndoableCommand::Ptr UsdTransform3d::translateCmd() -{ - if (!UsdUfe::isAttributeEditAllowed(prim(), TfToken("xformOp:translate"))) { - return nullptr; - } - - return UsdTranslateUndoableCommand::create(fItem, 0, 0, 0); -} - -Ufe::RotateUndoableCommand::Ptr UsdTransform3d::rotateCmd() -{ - if (!UsdUfe::isAttributeEditAllowed(prim(), TfToken("xformOp:rotateXYZ"))) { - return nullptr; - } - - return UsdRotateUndoableCommand::create(fItem, 0, 0, 0); -} - -Ufe::ScaleUndoableCommand::Ptr UsdTransform3d::scaleCmd() -{ - if (!UsdUfe::isAttributeEditAllowed(prim(), TfToken("xformOp:scale"))) { - return nullptr; - } - - return UsdScaleUndoableCommand::create(fItem, 1, 1, 1); -} -#endif - -#ifdef UFE_V2_FEATURES_AVAILABLE -Ufe::SetMatrix4dUndoableCommand::Ptr UsdTransform3d::setMatrixCmd(const Ufe::Matrix4d& m) -{ - // TODO: HS Aug25,2020 dummy code to pass the compiler errors - return nullptr; -} - -Ufe::Matrix4d UsdTransform3d::matrix() const -{ - UsdGeomXformable xformable(prim()); - bool unused; - auto ops = xformable.GetOrderedXformOps(&unused); - - // Note: Gf matrices are row-major. - // https://graphics.pixar.com/usd/docs/api/class_gf_matrix4d.html - GfMatrix4d m(1); - - // 4x4 local affine transformation matrix. 4th column of matrix is [0 0 0 1] - if (!UsdGeomXformable::GetLocalTransformation(&m, ops, getTime(path()))) { - std::string msg = TfStringPrintf( - "Local transformation computation for prim %s failed.", prim().GetPath().GetText()); - throw std::runtime_error(msg.c_str()); - } - - return convertFromUsd(m); -} -#endif - -void UsdTransform3d::scale(double x, double y, double z) -{ - scaleOp(prim(), fItem->path(), x, y, z); -} - -Ufe::TranslateUndoableCommand::Ptr -#ifdef UFE_V2_FEATURES_AVAILABLE -UsdTransform3d::rotatePivotCmd(double, double, double) -#else -UsdTransform3d::rotatePivotTranslateCmd() -#endif -{ - if (!UsdUfe::isAttributeEditAllowed(prim(), TfToken("xformOp:translate:pivot"))) { - return nullptr; - } - - // As of 12-Oct-2020, setting rotate pivot on command creation - // unsupported. Use translate() method on returned command. - return UsdRotatePivotTranslateUndoableCommand::create( -#ifdef UFE_V2_FEATURES_AVAILABLE - fItem->path() -#else - prim(), fItem->path(), fItem -#endif - ); -} - -void -#ifdef UFE_V2_FEATURES_AVAILABLE -UsdTransform3d::rotatePivot( -#else -UsdTransform3d::rotatePivotTranslate( -#endif - double x, double y, double z -) -{ - rotatePivotTranslateOp(prim(), path(), x, y, z); -} - -Ufe::Vector3d UsdTransform3d::rotatePivot() const -{ - double x { 0 }, y { 0 }, z { 0 }; - const TfToken xpivot("xformOp:translate:pivot"); - if (prim().HasAttribute(xpivot)) { - // Initially, attribute can be created, but have no value. - GfVec3f v; - if (prim().GetAttribute(xpivot).Get(&v, getTime(path()))) { - x = v[0]; - y = v[1]; - z = v[2]; - } - } - return Ufe::Vector3d(x, y, z); -} - -Ufe::TranslateUndoableCommand::Ptr -#ifdef UFE_V2_FEATURES_AVAILABLE -UsdTransform3d::scalePivotCmd(double, double, double) -#else -UsdTransform3d::scalePivotTranslateCmd() -#endif -{ - return nullptr; -} - -void -#ifdef UFE_V2_FEATURES_AVAILABLE -UsdTransform3d::scalePivot( -#else -UsdTransform3d::scalePivotTranslate( -#endif - double, double, double -) -{ -} - -Ufe::Vector3d UsdTransform3d::scalePivot() const { return rotatePivot(); } - -#ifdef UFE_V2_FEATURES_AVAILABLE -Ufe::TranslateUndoableCommand::Ptr UsdTransform3d::translateRotatePivotCmd(double, double, double) -{ - // USD common transform API does not support rotate pivot correction. - return nullptr; -} - -Ufe::Vector3d UsdTransform3d::rotatePivotTranslation() const -{ - // USD common transform API does not support rotate pivot correction. - return Ufe::Vector3d(0, 0, 0); -} - -Ufe::TranslateUndoableCommand::Ptr UsdTransform3d::translateScalePivotCmd(double, double, double) -{ - // USD common transform API does not support scale pivot correction. - return nullptr; -} - -Ufe::Vector3d UsdTransform3d::scalePivotTranslation() const -{ - // USD common transform API does not support scale pivot correction. - return Ufe::Vector3d(0, 0, 0); -} -#endif - -Ufe::Matrix4d UsdTransform3d::segmentInclusiveMatrix() const -{ - return primToUfeXform(prim(), getTime(path())); -} - -Ufe::Matrix4d UsdTransform3d::segmentExclusiveMatrix() const -{ - return primToUfeExclusiveXform(prim(), getTime(path())); -} - -} // namespace ufe -} // namespace MAYAUSD_NS_DEF diff --git a/lib/mayaUsd/ufe/UsdTransform3d.h b/lib/mayaUsd/ufe/UsdTransform3d.h deleted file mode 100644 index a930906c2c..0000000000 --- a/lib/mayaUsd/ufe/UsdTransform3d.h +++ /dev/null @@ -1,119 +0,0 @@ -// -// Copyright 2020 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. -// -#pragma once - -#include - -#include - -#include - -#include -#include - -namespace MAYAUSD_NS_DEF { -namespace ufe { - -//! \brief Interface to transform objects in 3D. -class MAYAUSD_CORE_PUBLIC UsdTransform3d : public Ufe::Transform3d -{ -public: - typedef std::shared_ptr Ptr; - - UsdTransform3d(); - UsdTransform3d(const UsdSceneItem::Ptr& item); - ~UsdTransform3d() override = default; - - // Delete the copy/move constructors assignment operators. - UsdTransform3d(const UsdTransform3d&) = delete; - UsdTransform3d& operator=(const UsdTransform3d&) = delete; - UsdTransform3d(UsdTransform3d&&) = delete; - UsdTransform3d& operator=(UsdTransform3d&&) = delete; - - //! Create a UsdTransform3d. - static UsdTransform3d::Ptr create(); - static UsdTransform3d::Ptr create(const UsdSceneItem::Ptr& item); - - void setItem(const UsdSceneItem::Ptr& item); - - // Ufe::Transform3d overrides - const Ufe::Path& path() const override; - Ufe::SceneItem::Ptr sceneItem() const override; - inline PXR_NS::UsdPrim prim() const - { - PXR_NAMESPACE_USING_DIRECTIVE - if (TF_VERIFY(fItem != nullptr)) - return fItem->prim(); - else - return PXR_NS::UsdPrim(); - } - - inline UsdSceneItem::Ptr usdSceneItem() const { return fItem; } - -#ifdef UFE_V2_FEATURES_AVAILABLE - Ufe::TranslateUndoableCommand::Ptr translateCmd(double x, double y, double z) override; - Ufe::RotateUndoableCommand::Ptr rotateCmd(double x, double y, double z) override; - Ufe::ScaleUndoableCommand::Ptr scaleCmd(double x, double y, double z) override; - Ufe::Vector3d rotation() const override; - Ufe::Vector3d scale() const override; -#else - Ufe::TranslateUndoableCommand::Ptr translateCmd() override; - Ufe::RotateUndoableCommand::Ptr rotateCmd() override; - Ufe::ScaleUndoableCommand::Ptr scaleCmd() override; -#endif - -#ifdef UFE_V2_FEATURES_AVAILABLE - Ufe::SetMatrix4dUndoableCommand::Ptr setMatrixCmd(const Ufe::Matrix4d& m) override; - Ufe::Matrix4d matrix() const override; -#endif - - void translate(double x, double y, double z) override; - Ufe::Vector3d translation() const override; - void rotate(double x, double y, double z) override; - void scale(double x, double y, double z) override; -#ifdef UFE_V2_FEATURES_AVAILABLE - Ufe::TranslateUndoableCommand::Ptr rotatePivotCmd(double x, double y, double z) override; - void rotatePivot(double x, double y, double z) override; - Ufe::TranslateUndoableCommand::Ptr scalePivotCmd(double x, double y, double z) override; - void scalePivot(double x, double y, double z) override; -#else - Ufe::TranslateUndoableCommand::Ptr rotatePivotTranslateCmd() override; - void rotatePivotTranslate(double x, double y, double z) override; - Ufe::TranslateUndoableCommand::Ptr scalePivotTranslateCmd() override; - void scalePivotTranslate(double x, double y, double z) override; -#endif - Ufe::Vector3d rotatePivot() const override; - Ufe::Vector3d scalePivot() const override; - -#ifdef UFE_V2_FEATURES_AVAILABLE - Ufe::TranslateUndoableCommand::Ptr - translateRotatePivotCmd(double x, double y, double z) override; - Ufe::Vector3d rotatePivotTranslation() const override; - Ufe::TranslateUndoableCommand::Ptr - translateScalePivotCmd(double x, double y, double z) override; - Ufe::Vector3d scalePivotTranslation() const override; -#endif - - Ufe::Matrix4d segmentInclusiveMatrix() const override; - Ufe::Matrix4d segmentExclusiveMatrix() const override; - -private: - UsdSceneItem::Ptr fItem; - -}; // UsdTransform3d - -} // namespace ufe -} // namespace MAYAUSD_NS_DEF diff --git a/lib/mayaUsd/ufe/UsdTransform3dBase.cpp b/lib/mayaUsd/ufe/UsdTransform3dBase.cpp index b75fe230b7..5665eae939 100644 --- a/lib/mayaUsd/ufe/UsdTransform3dBase.cpp +++ b/lib/mayaUsd/ufe/UsdTransform3dBase.cpp @@ -100,14 +100,12 @@ UsdTransform3dBase::translateScalePivotCmd(double, double, double) Ufe::Vector3d UsdTransform3dBase::scalePivotTranslation() const { return Ufe::Vector3d(0, 0, 0); } -#ifdef UFE_V2_FEATURES_AVAILABLE Ufe::SetMatrix4dUndoableCommand::Ptr UsdTransform3dBase::setMatrixCmd(const Ufe::Matrix4d& m) { return nullptr; } Ufe::Matrix4d UsdTransform3dBase::matrix() const { return UsdTransform3dReadImpl::matrix(); } -#endif Ufe::Matrix4d UsdTransform3dBase::segmentInclusiveMatrix() const { diff --git a/lib/mayaUsd/ufe/UsdTransform3dBase.h b/lib/mayaUsd/ufe/UsdTransform3dBase.h index b43990fd22..897169ee5b 100644 --- a/lib/mayaUsd/ufe/UsdTransform3dBase.h +++ b/lib/mayaUsd/ufe/UsdTransform3dBase.h @@ -76,10 +76,8 @@ class MAYAUSD_CORE_PUBLIC UsdTransform3dBase translateScalePivotCmd(double x, double y, double z) override; Ufe::Vector3d scalePivotTranslation() const override; -#ifdef UFE_V2_FEATURES_AVAILABLE Ufe::SetMatrix4dUndoableCommand::Ptr setMatrixCmd(const Ufe::Matrix4d& m) override; Ufe::Matrix4d matrix() const override; -#endif Ufe::Matrix4d segmentInclusiveMatrix() const override; Ufe::Matrix4d segmentExclusiveMatrix() const override; diff --git a/lib/mayaUsd/ufe/UsdTransform3dCommonAPI.cpp b/lib/mayaUsd/ufe/UsdTransform3dCommonAPI.cpp index 6f4e7e1403..5999ef47f2 100644 --- a/lib/mayaUsd/ufe/UsdTransform3dCommonAPI.cpp +++ b/lib/mayaUsd/ufe/UsdTransform3dCommonAPI.cpp @@ -301,7 +301,8 @@ UsdTransform3dCommonAPIHandler::transform3d(const Ufe::SceneItem::Ptr& item) con } Ufe::Transform3d::Ptr UsdTransform3dCommonAPIHandler::editTransform3d( - const Ufe::SceneItem::Ptr& item UFE_V2(, const Ufe::EditTransform3dHint& hint)) const + const Ufe::SceneItem::Ptr& item, + const Ufe::EditTransform3dHint& hint) const { UsdSceneItem::Ptr usdItem = std::dynamic_pointer_cast(item); @@ -315,7 +316,7 @@ Ufe::Transform3d::Ptr UsdTransform3dCommonAPIHandler::editTransform3d( auto commonAPI = UsdGeomXformCommonAPI(usdItem->prim()); return commonAPI ? UsdTransform3dCommonAPI::create(usdItem) - : _nextHandler->editTransform3d(item UFE_V2(, hint)); + : _nextHandler->editTransform3d(item, hint); } } // namespace ufe diff --git a/lib/mayaUsd/ufe/UsdTransform3dCommonAPI.h b/lib/mayaUsd/ufe/UsdTransform3dCommonAPI.h index 448dedcbd9..991868c068 100644 --- a/lib/mayaUsd/ufe/UsdTransform3dCommonAPI.h +++ b/lib/mayaUsd/ufe/UsdTransform3dCommonAPI.h @@ -89,9 +89,9 @@ class MAYAUSD_CORE_PUBLIC UsdTransform3dCommonAPIHandler : public Ufe::Transform // Ufe::Transform3dHandler overrides Ufe::Transform3d::Ptr transform3d(const Ufe::SceneItem::Ptr& item) const override; - Ufe::Transform3d::Ptr editTransform3d(const Ufe::SceneItem::Ptr& item UFE_V2( - , - const Ufe::EditTransform3dHint& hint)) const override; + Ufe::Transform3d::Ptr editTransform3d( + const Ufe::SceneItem::Ptr& item, + const Ufe::EditTransform3dHint& hint) const override; private: Ufe::Transform3dHandler::Ptr _nextHandler; diff --git a/lib/mayaUsd/ufe/UsdTransform3dFallbackMayaXformStack.cpp b/lib/mayaUsd/ufe/UsdTransform3dFallbackMayaXformStack.cpp index 8ad9145185..7f646fd1e5 100644 --- a/lib/mayaUsd/ufe/UsdTransform3dFallbackMayaXformStack.cpp +++ b/lib/mayaUsd/ufe/UsdTransform3dFallbackMayaXformStack.cpp @@ -367,7 +367,8 @@ UsdTransform3dFallbackMayaXformStackHandler::transform3d(const Ufe::SceneItem::P } Ufe::Transform3d::Ptr UsdTransform3dFallbackMayaXformStackHandler::editTransform3d( - const Ufe::SceneItem::Ptr& item UFE_V2(, const Ufe::EditTransform3dHint& hint)) const + const Ufe::SceneItem::Ptr& item, + const Ufe::EditTransform3dHint& hint) const { return createEditTransform3d(item); } diff --git a/lib/mayaUsd/ufe/UsdTransform3dFallbackMayaXformStack.h b/lib/mayaUsd/ufe/UsdTransform3dFallbackMayaXformStack.h index aa04f329d6..117fbf9b93 100644 --- a/lib/mayaUsd/ufe/UsdTransform3dFallbackMayaXformStack.h +++ b/lib/mayaUsd/ufe/UsdTransform3dFallbackMayaXformStack.h @@ -106,9 +106,9 @@ class MAYAUSD_CORE_PUBLIC UsdTransform3dFallbackMayaXformStackHandler // Ufe::Transform3dHandler overrides Ufe::Transform3d::Ptr transform3d(const Ufe::SceneItem::Ptr& item) const override; - Ufe::Transform3d::Ptr editTransform3d(const Ufe::SceneItem::Ptr& item UFE_V2( - , - const Ufe::EditTransform3dHint& hint)) const override; + Ufe::Transform3d::Ptr editTransform3d( + const Ufe::SceneItem::Ptr& item, + const Ufe::EditTransform3dHint& hint) const override; }; // UsdTransform3dFallbackMayaXformStackHandler diff --git a/lib/mayaUsd/ufe/UsdTransform3dHandler.cpp b/lib/mayaUsd/ufe/UsdTransform3dHandler.cpp deleted file mode 100644 index 908c433267..0000000000 --- a/lib/mayaUsd/ufe/UsdTransform3dHandler.cpp +++ /dev/null @@ -1,92 +0,0 @@ -// -// Copyright 2019 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 "UsdTransform3dHandler.h" - -#include - -#include -#include - -#include - -#ifdef UFE_V2_FEATURES_AVAILABLE -#include -#endif - -namespace MAYAUSD_NS_DEF { -namespace ufe { - -UsdTransform3dHandler::UsdTransform3dHandler() - : Ufe::Transform3dHandler() -{ -} - -UsdTransform3dHandler::~UsdTransform3dHandler() { } - -/*static*/ -UsdTransform3dHandler::Ptr UsdTransform3dHandler::create() -{ - return std::make_shared(); -} - -//------------------------------------------------------------------------------ -// Ufe::Transform3dHandler overrides -//------------------------------------------------------------------------------ - -Ufe::Transform3d::Ptr UsdTransform3dHandler::transform3d(const Ufe::SceneItem::Ptr& item) const -{ - UsdSceneItem::Ptr usdItem = std::dynamic_pointer_cast(item); -#if !defined(NDEBUG) - assert(usdItem); -#endif - - if (!usdItem) { - return nullptr; - } - - if (usdItem->isPointInstance()) { - // Point instance manipulation using this handler is only supported - // with UFE v2. Otherwise, we disallow any manipulation for point - // instance scene items. -#ifdef UFE_V2_FEATURES_AVAILABLE - return UsdTransform3dPointInstance::create(usdItem); -#else - return nullptr; -#endif - } - - // According to USD docs, editing scene description via instance proxies and their properties is - // not allowed. - // https://graphics.pixar.com/usd/docs/api/_usd__page__scenegraph_instancing.html#Usd_ScenegraphInstancing_InstanceProxies - if (usdItem->prim().IsInstanceProxy()) { - MGlobal::displayError( - MString("Authoring to the descendant of an instance [") - + MString(usdItem->prim().GetName().GetString().c_str()) + MString("] is not allowed.") - + MString("Please mark 'instanceable=false' to author edits to instance proxies.")); - return nullptr; - } - - std::string errMsg; - if (!UsdUfe::isEditTargetLayerModifiable(usdItem->prim().GetStage(), &errMsg)) { - MGlobal::displayError(errMsg.c_str()); - return nullptr; - } - - return UsdTransform3d::create(usdItem); -} - -} // namespace ufe -} // namespace MAYAUSD_NS_DEF diff --git a/lib/mayaUsd/ufe/UsdTransform3dHandler.h b/lib/mayaUsd/ufe/UsdTransform3dHandler.h deleted file mode 100644 index 13b0d5e047..0000000000 --- a/lib/mayaUsd/ufe/UsdTransform3dHandler.h +++ /dev/null @@ -1,50 +0,0 @@ -// -// Copyright 2019 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. -// -#pragma once - -#include -#include - -#include - -namespace MAYAUSD_NS_DEF { -namespace ufe { - -//! \brief Interface to create a UsdTransform3d interface object. -class MAYAUSD_CORE_PUBLIC UsdTransform3dHandler : public Ufe::Transform3dHandler -{ -public: - typedef std::shared_ptr Ptr; - - UsdTransform3dHandler(); - ~UsdTransform3dHandler(); - - // Delete the copy/move constructors assignment operators. - UsdTransform3dHandler(const UsdTransform3dHandler&) = delete; - UsdTransform3dHandler& operator=(const UsdTransform3dHandler&) = delete; - UsdTransform3dHandler(UsdTransform3dHandler&&) = delete; - UsdTransform3dHandler& operator=(UsdTransform3dHandler&&) = delete; - - //! Create a UsdTransform3dHandler. - static UsdTransform3dHandler::Ptr create(); - - // Ufe::Transform3dHandler overrides - Ufe::Transform3d::Ptr transform3d(const Ufe::SceneItem::Ptr& item) const override; - -}; // UsdTransform3dHandler - -} // namespace ufe -} // namespace MAYAUSD_NS_DEF diff --git a/lib/mayaUsd/ufe/UsdTransform3dMatrixOp.cpp b/lib/mayaUsd/ufe/UsdTransform3dMatrixOp.cpp index b56bb9c00e..eb7711cda9 100644 --- a/lib/mayaUsd/ufe/UsdTransform3dMatrixOp.cpp +++ b/lib/mayaUsd/ufe/UsdTransform3dMatrixOp.cpp @@ -413,7 +413,8 @@ UsdTransform3dMatrixOpHandler::transform3d(const Ufe::SceneItem::Ptr& item) cons } Ufe::Transform3d::Ptr UsdTransform3dMatrixOpHandler::editTransform3d( - const Ufe::SceneItem::Ptr& item UFE_V2(, const Ufe::EditTransform3dHint& hint)) const + const Ufe::SceneItem::Ptr& item, + const Ufe::EditTransform3dHint& hint) const { UsdSceneItem::Ptr usdItem = std::dynamic_pointer_cast(item); @@ -442,7 +443,7 @@ Ufe::Transform3d::Ptr UsdTransform3dMatrixOpHandler::editTransform3d( // If no matrix was found, pass on to the next handler. if (i == xformOps.cend()) { - return _nextHandler->editTransform3d(item UFE_V2(, hint)); + return _nextHandler->editTransform3d(item, hint); } // If we've found a matrix op, but there is a more local non-matrix op in @@ -453,7 +454,7 @@ Ufe::Transform3d::Ptr UsdTransform3dMatrixOpHandler::editTransform3d( // on to the next handler, since we can't handle them. return (findNonMatrix(i, xformOps) || (hint.type() == Ufe::EditTransform3dHint::RotatePivot) || (hint.type() == Ufe::EditTransform3dHint::ScalePivot)) - ? _nextHandler->editTransform3d(item UFE_V2(, hint)) + ? _nextHandler->editTransform3d(item, hint) : UsdTransform3dMatrixOp::create(usdItem, *i); } diff --git a/lib/mayaUsd/ufe/UsdTransform3dMatrixOp.h b/lib/mayaUsd/ufe/UsdTransform3dMatrixOp.h index c6f661d6ad..3b857a7813 100644 --- a/lib/mayaUsd/ufe/UsdTransform3dMatrixOp.h +++ b/lib/mayaUsd/ufe/UsdTransform3dMatrixOp.h @@ -89,9 +89,9 @@ class MAYAUSD_CORE_PUBLIC UsdTransform3dMatrixOpHandler : public Ufe::Transform3 // Ufe::Transform3dHandler overrides Ufe::Transform3d::Ptr transform3d(const Ufe::SceneItem::Ptr& item) const override; - Ufe::Transform3d::Ptr editTransform3d(const Ufe::SceneItem::Ptr& item UFE_V2( - , - const Ufe::EditTransform3dHint& hint)) const override; + Ufe::Transform3d::Ptr editTransform3d( + const Ufe::SceneItem::Ptr& item, + const Ufe::EditTransform3dHint& hint) const override; private: Ufe::Transform3dHandler::Ptr _nextHandler; diff --git a/lib/mayaUsd/ufe/UsdTransform3dMayaXformStack.cpp b/lib/mayaUsd/ufe/UsdTransform3dMayaXformStack.cpp index bcc1e93113..76a0fae5c8 100644 --- a/lib/mayaUsd/ufe/UsdTransform3dMayaXformStack.cpp +++ b/lib/mayaUsd/ufe/UsdTransform3dMayaXformStack.cpp @@ -839,7 +839,8 @@ UsdTransform3dMayaXformStackHandler::transform3d(const Ufe::SceneItem::Ptr& item } Ufe::Transform3d::Ptr UsdTransform3dMayaXformStackHandler::editTransform3d( - const Ufe::SceneItem::Ptr& item UFE_V2(, const Ufe::EditTransform3dHint& hint)) const + const Ufe::SceneItem::Ptr& item, + const Ufe::EditTransform3dHint& hint) const { // MAYA-109190: Moved the IsInstanceProxy() check here since it was causing the // camera framing not properly be applied. @@ -865,8 +866,7 @@ Ufe::Transform3d::Ptr UsdTransform3dMayaXformStackHandler::editTransform3d( return nullptr; } - return createTransform3d( - item, [&]() { return _nextHandler->editTransform3d(item UFE_V2(, hint)); }); + return createTransform3d(item, [&]() { return _nextHandler->editTransform3d(item, hint); }); } } // namespace ufe diff --git a/lib/mayaUsd/ufe/UsdTransform3dMayaXformStack.h b/lib/mayaUsd/ufe/UsdTransform3dMayaXformStack.h index 1940e27a0c..144abf1462 100644 --- a/lib/mayaUsd/ufe/UsdTransform3dMayaXformStack.h +++ b/lib/mayaUsd/ufe/UsdTransform3dMayaXformStack.h @@ -137,9 +137,9 @@ class MAYAUSD_CORE_PUBLIC UsdTransform3dMayaXformStackHandler : public Ufe::Tran // Ufe::Transform3dHandler overrides Ufe::Transform3d::Ptr transform3d(const Ufe::SceneItem::Ptr& item) const override; - Ufe::Transform3d::Ptr editTransform3d(const Ufe::SceneItem::Ptr& item UFE_V2( - , - const Ufe::EditTransform3dHint& hint)) const override; + Ufe::Transform3d::Ptr editTransform3d( + const Ufe::SceneItem::Ptr& item, + const Ufe::EditTransform3dHint& hint) const override; private: Ufe::Transform3dHandler::Ptr _nextHandler; diff --git a/lib/mayaUsd/ufe/UsdTransform3dReadImpl.cpp b/lib/mayaUsd/ufe/UsdTransform3dReadImpl.cpp index 46b88bcb75..15c8a348f9 100644 --- a/lib/mayaUsd/ufe/UsdTransform3dReadImpl.cpp +++ b/lib/mayaUsd/ufe/UsdTransform3dReadImpl.cpp @@ -30,7 +30,6 @@ UsdTransform3dReadImpl::UsdTransform3dReadImpl(const UsdSceneItem::Ptr& item) { } -#ifdef UFE_V2_FEATURES_AVAILABLE Ufe::Matrix4d UsdTransform3dReadImpl::matrix() const { GfMatrix4d m(1); @@ -47,7 +46,6 @@ Ufe::Matrix4d UsdTransform3dReadImpl::matrix() const return toUfe(m); } -#endif Ufe::Matrix4d UsdTransform3dReadImpl::segmentInclusiveMatrix() const { diff --git a/lib/mayaUsd/ufe/UsdTransform3dReadImpl.h b/lib/mayaUsd/ufe/UsdTransform3dReadImpl.h index 90b8a7b3de..92305f7ff6 100644 --- a/lib/mayaUsd/ufe/UsdTransform3dReadImpl.h +++ b/lib/mayaUsd/ufe/UsdTransform3dReadImpl.h @@ -51,9 +51,7 @@ class MAYAUSD_CORE_PUBLIC UsdTransform3dReadImpl inline UsdSceneItem::Ptr usdSceneItem() const { return fItem; } inline PXR_NS::UsdPrim prim() const { return fPrim; } -#ifdef UFE_V2_FEATURES_AVAILABLE Ufe::Matrix4d matrix() const; -#endif Ufe::Matrix4d segmentInclusiveMatrix() const; Ufe::Matrix4d segmentExclusiveMatrix() const; diff --git a/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.cpp b/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.cpp index daa1cb156a..1146503db2 100644 --- a/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.cpp +++ b/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.cpp @@ -22,7 +22,6 @@ namespace ufe { PXR_NS::TfToken UsdTranslateUndoableCommand::xlate("xformOp:translate"); -#ifdef UFE_V2_FEATURES_AVAILABLE UsdTranslateUndoableCommand::UsdTranslateUndoableCommand( const Ufe::Path& path, double x, @@ -32,22 +31,10 @@ UsdTranslateUndoableCommand::UsdTranslateUndoableCommand( , UsdTRSUndoableCommandBase(x, y, z) { } -#else -UsdTranslateUndoableCommand::UsdTranslateUndoableCommand( - const UsdSceneItem::Ptr& item, - double x, - double y, - double z) - : Ufe::TranslateUndoableCommand(item) - , UsdTRSUndoableCommandBase(item, x, y, z) -{ -} -#endif UsdTranslateUndoableCommand::~UsdTranslateUndoableCommand() { } /*static*/ -#ifdef UFE_V2_FEATURES_AVAILABLE UsdTranslateUndoableCommand::Ptr UsdTranslateUndoableCommand::create(const Ufe::Path& path, double x, double y, double z) { @@ -55,15 +42,6 @@ UsdTranslateUndoableCommand::create(const Ufe::Path& path, double x, double y, d cmd->initialize(); return cmd; } -#else -UsdTranslateUndoableCommand::Ptr -UsdTranslateUndoableCommand::create(const UsdSceneItem::Ptr& item, double x, double y, double z) -{ - auto cmd = std::make_shared>(item, x, y, z); - cmd->initialize(); - return cmd; -} -#endif void UsdTranslateUndoableCommand::undo() { undoImp(); } @@ -83,11 +61,7 @@ void UsdTranslateUndoableCommand::performImp(double x, double y, double z) // Ufe::TranslateUndoableCommand overrides //------------------------------------------------------------------------------ -#ifdef UFE_V2_FEATURES_AVAILABLE bool UsdTranslateUndoableCommand::set(double x, double y, double z) -#else -bool UsdTranslateUndoableCommand::translate(double x, double y, double z) -#endif { perform(x, y, z); return true; diff --git a/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.h b/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.h index df34931239..00ea79642e 100644 --- a/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.h +++ b/lib/mayaUsd/ufe/UsdTranslateUndoableCommand.h @@ -41,40 +41,22 @@ class MAYAUSD_CORE_PUBLIC UsdTranslateUndoableCommand UsdTranslateUndoableCommand(UsdTranslateUndoableCommand&&) = delete; UsdTranslateUndoableCommand& operator=(UsdTranslateUndoableCommand&&) = delete; -#ifdef UFE_V2_FEATURES_AVAILABLE //! Create a UsdTranslateUndoableCommand from a UFE scene path. The //! command is not executed. static UsdTranslateUndoableCommand::Ptr create(const Ufe::Path& path, double x, double y, double z); -#else - //! Create a UsdTranslateUndoableCommand from a UFE scene item. The - //! command is not executed. - static UsdTranslateUndoableCommand::Ptr - create(const UsdSceneItem::Ptr& item, double x, double y, double z); -#endif // Ufe::TranslateUndoableCommand overrides. set() sets the command's // translation value and executes the command. void undo() override; void redo() override; -#ifdef UFE_V2_FEATURES_AVAILABLE bool set(double x, double y, double z) override; -#else - bool translate(double x, double y, double z) override; -#endif -#ifdef UFE_V2_FEATURES_AVAILABLE Ufe::Path getPath() const override { return path(); } -#endif protected: //! Construct a UsdTranslateUndoableCommand. The command is not executed. -#ifdef UFE_V2_FEATURES_AVAILABLE UsdTranslateUndoableCommand(const Ufe::Path& path, double x, double y, double z); -#else - UsdTranslateUndoableCommand(const UsdSceneItem::Ptr& item, double x, double y, double z); -#endif - ~UsdTranslateUndoableCommand() override; private: diff --git a/lib/mayaUsd/ufe/UsdUndoDeleteCommand.cpp b/lib/mayaUsd/ufe/UsdUndoDeleteCommand.cpp index 4c85192fe7..215c5bbdcf 100644 --- a/lib/mayaUsd/ufe/UsdUndoDeleteCommand.cpp +++ b/lib/mayaUsd/ufe/UsdUndoDeleteCommand.cpp @@ -18,16 +18,13 @@ #include "private/UfeNotifGuard.h" #include +#include #include #include #include #include -#ifdef UFE_V2_FEATURES_AVAILABLE -#include -#endif - #ifdef UFE_V4_FEATURES_AVAILABLE #include #endif @@ -48,7 +45,6 @@ UsdUndoDeleteCommand::Ptr UsdUndoDeleteCommand::create(const PXR_NS::UsdPrim& pr return std::make_shared(prim); } -#ifdef UFE_V2_FEATURES_AVAILABLE void UsdUndoDeleteCommand::execute() { if (!_prim.IsValid()) @@ -106,17 +102,6 @@ void UsdUndoDeleteCommand::redo() _undoableItem.redo(); } -#else -void UsdUndoDeleteCommand::perform(bool state) -{ - UsdUfe::InAddOrDeleteOperation ad; - _prim.SetActive(state); -} - -void UsdUndoDeleteCommand::undo() { perform(true); } - -void UsdUndoDeleteCommand::redo() { perform(false); } -#endif } // namespace ufe } // namespace MAYAUSD_NS_DEF diff --git a/lib/mayaUsd/ufe/UsdUndoDeleteCommand.h b/lib/mayaUsd/ufe/UsdUndoDeleteCommand.h index 077d6a475e..f2139d2d92 100644 --- a/lib/mayaUsd/ufe/UsdUndoDeleteCommand.h +++ b/lib/mayaUsd/ufe/UsdUndoDeleteCommand.h @@ -19,10 +19,7 @@ #include #include - -#ifdef UFE_V2_FEATURES_AVAILABLE #include -#endif #include @@ -49,17 +46,13 @@ class MAYAUSD_CORE_PUBLIC UsdUndoDeleteCommand : public Ufe::UndoableCommand //! Create a UsdUndoDeleteCommand from a USD prim. static UsdUndoDeleteCommand::Ptr create(const PXR_NS::UsdPrim& prim); - UFE_V2(void execute() override;) + void execute() override; void undo() override; void redo() override; private: PXR_NS::UsdPrim _prim; - UFE_V2(UsdUndoableItem _undoableItem;) - -#ifndef UFE_V2_FEATURES_AVAILABLE - void perform(bool state); -#endif + UsdUndoableItem _undoableItem; }; // UsdUndoDeleteCommand diff --git a/lib/mayaUsd/ufe/UsdUndoDuplicateCommand.cpp b/lib/mayaUsd/ufe/UsdUndoDuplicateCommand.cpp index c0beceafb6..fe27a4141d 100644 --- a/lib/mayaUsd/ufe/UsdUndoDuplicateCommand.cpp +++ b/lib/mayaUsd/ufe/UsdUndoDuplicateCommand.cpp @@ -20,17 +20,13 @@ #include #include #include - -#include -#ifdef UFE_V2_FEATURES_AVAILABLE #include -#include -#endif - #include +#include #include #include +#include #include #include @@ -81,7 +77,6 @@ UsdSceneItem::Ptr UsdUndoDuplicateCommand::duplicatedItem() const return createSiblingSceneItem(_ufeSrcPath, _usdDstPath.GetElementString()); } -#ifdef UFE_V2_FEATURES_AVAILABLE void UsdUndoDuplicateCommand::execute() { UsdUfe::InAddOrDeleteOperation ad; @@ -151,61 +146,6 @@ void UsdUndoDuplicateCommand::redo() _undoableItem.redo(); } -#else -bool UsdUndoDuplicateCommand::duplicateUndo() -{ - // USD sends a ResyncedPaths notification after the prim is removed, but - // at that point the prim is no longer valid, and thus a UFE post delete - // notification is no longer possible. To respect UFE object delete - // notification semantics, which require the object to be alive when - // the notification is sent, we send a pre delete notification here. - auto ufeDstItem = duplicatedItem(); - Ufe::ObjectPreDelete notification(ufeDstItem); - -#ifdef UFE_V2_FEATURES_AVAILABLE - Ufe::Scene::instance().notify(notification); -#else - Ufe::Scene::notifyObjectDelete(notification); -#endif - auto prim = ufePathToPrim(_ufeSrcPath); - prim.GetStage()->RemovePrim(_usdDstPath); - - return true; -} - -bool UsdUndoDuplicateCommand::duplicateRedo() -{ - auto prim = ufePathToPrim(_ufeSrcPath); - SdfJustCreatePrimInLayer(_dstLayer, _usdDstPath.GetParentPath()); - return SdfCopySpec(_srcLayer, prim.GetPath(), _dstLayer, _usdDstPath); -} - -void UsdUndoDuplicateCommand::undo() -{ - try { - UsdUfe::InAddOrDeleteOperation ad; - if (!duplicateUndo()) { - UFE_LOG("duplicate undo failed"); - } - } catch (const std::exception& e) { - UFE_LOG(e.what()); - throw; // re-throw the same exception - } -} - -void UsdUndoDuplicateCommand::redo() -{ - try { - UsdUfe::InAddOrDeleteOperation ad; - if (!duplicateRedo()) { - UFE_LOG("duplicate redo failed"); - } - } catch (const std::exception& e) { - UFE_LOG(e.what()); - throw; // re-throw the same exception - } -} -#endif } // namespace ufe } // namespace MAYAUSD_NS_DEF diff --git a/lib/mayaUsd/ufe/UsdUndoDuplicateCommand.h b/lib/mayaUsd/ufe/UsdUndoDuplicateCommand.h index ae5dba6393..36461f8ad6 100644 --- a/lib/mayaUsd/ufe/UsdUndoDuplicateCommand.h +++ b/lib/mayaUsd/ufe/UsdUndoDuplicateCommand.h @@ -19,10 +19,7 @@ #include #include - -#ifdef UFE_V2_FEATURES_AVAILABLE #include -#endif #include @@ -68,18 +65,12 @@ class MAYAUSD_CORE_PUBLIC UsdUndoDuplicateCommand : public Ufe::UndoableCommand UsdSceneItem::Ptr duplicatedItem() const; UFE_V4(Ufe::SceneItem::Ptr sceneItem() const override { return duplicatedItem(); }) - UFE_V2(void execute() override;) + void execute() override; void undo() override; void redo() override; private: - UFE_V2(UsdUndoableItem _undoableItem;) - -#ifndef UFE_V2_FEATURES_AVAILABLE - bool duplicateUndo(); - bool duplicateRedo(); -#endif - + UsdUndoableItem _undoableItem; Ufe::Path _ufeSrcPath; PXR_NS::SdfPath _usdDstPath; diff --git a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp index b46ee8768d..20ffdfeb10 100644 --- a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp +++ b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp @@ -41,12 +41,8 @@ #include #include -#ifdef UFE_V2_FEATURES_AVAILABLE #define UFE_ENABLE_ASSERTS #include -#else -#include -#endif #include diff --git a/lib/mayaUsd/ufe/Utils.cpp b/lib/mayaUsd/ufe/Utils.cpp index 9d25df6afe..367c332140 100644 --- a/lib/mayaUsd/ufe/Utils.cpp +++ b/lib/mayaUsd/ufe/Utils.cpp @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -67,10 +68,6 @@ #include #include -#ifdef UFE_V2_FEATURES_AVAILABLE -#include -#endif - PXR_NAMESPACE_USING_DIRECTIVE namespace { @@ -237,23 +234,10 @@ Ufe::PathSegment dagPathToPathSegment(const MDagPath& dagPath) MDagPath ufeToDagPath(const Ufe::Path& ufePath) { - if (ufePath.runTimeId() != g_MayaRtid || -#ifdef UFE_V2_FEATURES_AVAILABLE - ufePath.nbSegments() -#else - ufePath.getSegments().size() -#endif - > 1) { + if (ufePath.runTimeId() != g_MayaRtid || ufePath.nbSegments() > 1) { return MDagPath(); } - return UsdMayaUtil::nameToDagPath( -#ifdef UFE_V2_FEATURES_AVAILABLE - Ufe::PathString::string(ufePath) -#else - // We have a single segment, so no path segment separator to consider. - ufePath.popHead().string() -#endif - ); + return UsdMayaUtil::nameToDagPath(Ufe::PathString::string(ufePath)); } bool isMayaWorldPath(const Ufe::Path& ufePath) @@ -430,8 +414,6 @@ bool canRemoveDstProperty(const PXR_NS::UsdAttribute& dstAttr) return false; } -#ifdef UFE_V2_FEATURES_AVAILABLE - namespace { // Do not expose that function. The input parameter does not provide enough information to // distinguish between kEnum and kEnumString. @@ -731,8 +713,6 @@ VtValue vtValueFromString(const SdfValueTypeName& typeName, const std::string& s return {}; } -#endif - Ufe::Selection removeDescendants(const Ufe::Selection& src, const Ufe::Path& filterPath) { // Filter the src selection, removing items below the filterPath diff --git a/lib/mayaUsd/ufe/Utils.h b/lib/mayaUsd/ufe/Utils.h index 2ee31f61f7..21c62d6b61 100644 --- a/lib/mayaUsd/ufe/Utils.h +++ b/lib/mayaUsd/ufe/Utils.h @@ -16,14 +16,10 @@ #pragma once #include - -#include - -#include -#ifdef UFE_V2_FEATURES_AVAILABLE #include -#endif + #include +#include #include #include @@ -36,11 +32,7 @@ #include #include #include -#ifdef UFE_V2_FEATURES_AVAILABLE #include -#else -#include -#endif #include // memcpy @@ -145,7 +137,6 @@ bool canRemoveSrcProperty(const PXR_NS::UsdAttribute& srcAttr); MAYAUSD_CORE_PUBLIC bool canRemoveDstProperty(const PXR_NS::UsdAttribute& dstAttr); -#ifdef UFE_V2_FEATURES_AVAILABLE MAYAUSD_CORE_PUBLIC Ufe::Attribute::Type usdTypeToUfe(const PXR_NS::UsdAttribute& usdAttr); @@ -157,7 +148,6 @@ PXR_NS::SdfValueTypeName ufeTypeToUsd(const Ufe::Attribute::Type ufeType); PXR_NS::VtValue vtValueFromString(const PXR_NS::SdfValueTypeName& typeName, const std::string& strValue); -#endif //! Readability function to downcast a SceneItem::Ptr to a UsdSceneItem::Ptr. inline UsdSceneItem::Ptr downcast(const Ufe::SceneItem::Ptr& item) diff --git a/lib/mayaUsd/ufe/wrapUtils.cpp b/lib/mayaUsd/ufe/wrapUtils.cpp index fa585054e9..a10e67de16 100644 --- a/lib/mayaUsd/ufe/wrapUtils.cpp +++ b/lib/mayaUsd/ufe/wrapUtils.cpp @@ -26,13 +26,10 @@ #include #include +#include #include #include -#ifdef UFE_V2_FEATURES_AVAILABLE -#include -#endif - #ifdef UFE_V4_FEATURES_AVAILABLE #include @@ -47,7 +44,6 @@ using namespace MayaUsd; using namespace boost::python; -#ifdef UFE_V2_FEATURES_AVAILABLE PXR_NS::UsdPrim getPrimFromRawItem(uint64_t rawItem) { Ufe::SceneItem* item = reinterpret_cast(rawItem); @@ -77,7 +73,6 @@ std::string getNodeTypeFromRawItem(uint64_t rawItem) } return type; } -#endif std::vector _getAllStages() { @@ -90,48 +85,9 @@ std::vector _getAllStages() return output; } -#ifndef UFE_V2_FEATURES_AVAILABLE -// Helper function for UFE versions before version 2 for converting a path -// string to a UFE path. -static Ufe::Path _UfeV1StringToUsdPath(const std::string& ufePathString) -{ - Ufe::Path path; - - // The path string is a list of segment strings separated by ',' comma - // separator. - auto segmentStrings = PXR_NS::TfStringTokenize(ufePathString, ","); - - // If there are fewer than two segments, there cannot be a USD segment, so - // return an invalid path. - if (segmentStrings.size() < 2u) { - return path; - } - - // We have the path string split into segments. Build up the Ufe::Path one - // segment at a time. The path segment separator is the first character - // of each segment. We know that USD's separator is '/' and Maya's - // separator is '|', so use a map to get the corresponding UFE run-time ID. - static std::map sepToRtid - = { { '/', ufe::getUsdRunTimeId() }, { '|', ufe::getMayaRunTimeId() } }; - for (size_t i = 0u; i < segmentStrings.size(); ++i) { - const auto& segmentString = segmentStrings[i]; - char sep = segmentString[0u]; - path = path + Ufe::PathSegment(segmentString, sepToRtid.at(sep), sep); - } - - return path; -} -#endif - PXR_NS::TfTokenVector _getProxyShapePurposes(const std::string& ufePathString) { - auto path = -#ifdef UFE_V2_FEATURES_AVAILABLE - Ufe::PathString::path( -#else - _UfeV1StringToUsdPath( -#endif - ufePathString); + auto path = Ufe::PathString::path(ufePathString); return ufe::getProxyShapePurposes(path); } @@ -156,11 +112,9 @@ std::string createStageWithNewLayer(const std::string& parentPathString) void wrapUtils() { -#ifdef UFE_V2_FEATURES_AVAILABLE def("getPrimFromRawItem", getPrimFromRawItem); def("getNodeNameFromRawItem", getNodeNameFromRawItem); def("getNodeTypeFromRawItem", getNodeTypeFromRawItem); -#endif #ifdef UFE_V4_FEATURES_AVAILABLE def("createStageWithNewLayer", createStageWithNewLayer); diff --git a/lib/mayaUsd/undo/OpUndoItems.cpp b/lib/mayaUsd/undo/OpUndoItems.cpp index e37afea013..ecd795384b 100644 --- a/lib/mayaUsd/undo/OpUndoItems.cpp +++ b/lib/mayaUsd/undo/OpUndoItems.cpp @@ -15,19 +15,15 @@ // #include "OpUndoItems.h" -#include -#ifdef WANT_UFE_BUILD #include -#endif +#include #include #include #include -#ifdef WANT_UFE_BUILD #include #include #include -#endif namespace MAYAUSD_NS_DEF { @@ -368,8 +364,6 @@ bool SelectionUndoItem::redo() return status == MS::kSuccess; } -#ifdef WANT_UFE_BUILD - //------------------------------------------------------------------------------ // UfeSelectionUndoItem //------------------------------------------------------------------------------ @@ -506,8 +500,6 @@ bool UfeCommandUndoItem::redo() return true; } -#endif - //------------------------------------------------------------------------------ // LockNodesUndoItem //------------------------------------------------------------------------------ diff --git a/lib/mayaUsd/undo/OpUndoItems.h b/lib/mayaUsd/undo/OpUndoItems.h index 4db3bdaf23..e1ce61027c 100644 --- a/lib/mayaUsd/undo/OpUndoItems.h +++ b/lib/mayaUsd/undo/OpUndoItems.h @@ -26,10 +26,8 @@ #include #include #include -#ifdef WANT_UFE_BUILD #include #include -#endif #include #include @@ -407,8 +405,6 @@ class SelectionUndoItem : public OpUndoItem MGlobal::ListAdjustment _selMode; }; -#ifdef WANT_UFE_BUILD - //------------------------------------------------------------------------------ // UfeSelectionUndoItem //------------------------------------------------------------------------------ @@ -525,8 +521,6 @@ class UfeCommandUndoItem : public OpUndoItem std::shared_ptr _command; }; -#endif - //------------------------------------------------------------------------------ // LockNodesUndoItem //------------------------------------------------------------------------------ diff --git a/lib/mayaUsd/utils/CMakeLists.txt b/lib/mayaUsd/utils/CMakeLists.txt index 94a774ef40..07b7d4d260 100644 --- a/lib/mayaUsd/utils/CMakeLists.txt +++ b/lib/mayaUsd/utils/CMakeLists.txt @@ -10,6 +10,7 @@ target_sources(${PROJECT_NAME} diagnosticDelegate.cpp dynamicAttribute.cpp editability.cpp + json.cpp layerMuting.cpp layers.cpp loadRulesText.cpp @@ -17,6 +18,7 @@ target_sources(${PROJECT_NAME} mayaEditRouter.cpp query.cpp plugRegistryHelper.cpp + primActivation.cpp progressBarScope.cpp selectability.cpp stageCache.cpp @@ -30,14 +32,6 @@ target_sources(${PROJECT_NAME} variants.cpp ) -if(CMAKE_UFE_V2_FEATURES_AVAILABLE) - target_sources(${PROJECT_NAME} - PRIVATE - json.cpp - primActivation.cpp - ) -endif() - set(HEADERS blockSceneModificationContext.h colorSpace.h @@ -47,12 +41,14 @@ set(HEADERS dynamicAttribute.h editability.h hash.h + json.h layerMuting.h layers.h loadRules.h mayaEditRouter.h query.h plugRegistryHelper.h + primActivation.h progressBarScope.h selectability.h stageCache.h @@ -66,12 +62,6 @@ set(HEADERS utilSerialization.h variants.h ) -if(CMAKE_UFE_V2_FEATURES_AVAILABLE) - list(APPEND HEADERS - json.h - primActivation.h - ) -endif() set(PLUGINFO plugInfo.json) diff --git a/lib/usd/hdMaya/adapters/proxyAdapter.cpp b/lib/usd/hdMaya/adapters/proxyAdapter.cpp index 67546731f2..a705246cb0 100644 --- a/lib/usd/hdMaya/adapters/proxyAdapter.cpp +++ b/lib/usd/hdMaya/adapters/proxyAdapter.cpp @@ -23,11 +23,8 @@ #include #include - -#if WANT_UFE_BUILD #include #include -#endif // WANT_UFE_BUILD PXR_NAMESPACE_OPEN_SCOPE diff --git a/lib/usd/hdMaya/delegates/delegate.h b/lib/usd/hdMaya/delegates/delegate.h index b880873be6..0a4eb17c48 100644 --- a/lib/usd/hdMaya/delegates/delegate.h +++ b/lib/usd/hdMaya/delegates/delegate.h @@ -36,13 +36,10 @@ #include #include #include +#include #include -#if WANT_UFE_BUILD -#include -#endif // WANT_UFE_BUILD - PXR_NAMESPACE_OPEN_SCOPE class HdMayaDelegate @@ -101,16 +98,14 @@ class HdMayaDelegate { } -#if WANT_UFE_BUILD virtual void PopulateSelectedPaths( - const UFE_NS::Selection& ufeSelection, + const Ufe::Selection& ufeSelection, SdfPathVector& selectedSdfPaths, const HdSelectionSharedPtr& selection) { } virtual bool SupportsUfeSelection() { return false; } -#endif // WANT_UFE_BUILD virtual void PopulateSelectionList( const HdxPickHitVector& hits, diff --git a/lib/usd/hdMaya/delegates/proxyDelegate.cpp b/lib/usd/hdMaya/delegates/proxyDelegate.cpp index 841d7d0b98..d4b36a1fd2 100644 --- a/lib/usd/hdMaya/delegates/proxyDelegate.cpp +++ b/lib/usd/hdMaya/delegates/proxyDelegate.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -31,21 +32,14 @@ #include #include #include - -#include -#include -#include - -#if WANT_UFE_BUILD -#include - #include -#ifdef UFE_V2_FEATURES_AVAILABLE #include -#endif #include #include -#endif // WANT_UFE_BUILD + +#include +#include +#include PXR_NAMESPACE_OPEN_SCOPE @@ -138,35 +132,6 @@ void SetupPluginCallbacks() TF_VERIFY(status, "Could not set pluginUnloaded callback"); } -#ifndef UFE_V2_FEATURES_AVAILABLE -#if WANT_UFE_BUILD -MGlobal::ListAdjustment GetListAdjustment() -{ - // Keyboard modifiers can be queried from QApplication::keyboardModifiers() - // in case running MEL command leads to performance hit. On the other hand - // the advantage of using MEL command is the platform-agnostic state of the - // CONTROL key that it provides for aligning to Maya's implementation. - int modifiers = 0; - MGlobal::executeCommand("getModifiers", modifiers); - - const bool shiftHeld = (modifiers % 2); - const bool ctrlHeld = (modifiers / 4 % 2); - - MGlobal::ListAdjustment listAdjustment = MGlobal::kReplaceList; - - if (shiftHeld && ctrlHeld) { - listAdjustment = MGlobal::kAddToList; - } else if (ctrlHeld) { - listAdjustment = MGlobal::kRemoveFromList; - } else if (shiftHeld) { - listAdjustment = MGlobal::kXORWithList; - } - - return listAdjustment; -} -#endif -#endif - } // namespace HdMayaProxyDelegate::HdMayaProxyDelegate(const InitData& initData) @@ -221,10 +186,9 @@ void HdMayaProxyDelegate::PreFrame(const MHWRender::MDrawContext& context) } } -#if WANT_UFE_BUILD void HdMayaProxyDelegate::PopulateSelectedPaths( - const UFE_NS::Selection& ufeSelection, + const Ufe::Selection& ufeSelection, SdfPathVector& selectedSdfPaths, const HdSelectionSharedPtr& selection) { @@ -325,8 +289,6 @@ void HdMayaProxyDelegate::PopulateSelectedPaths( bool HdMayaProxyDelegate::SupportsUfeSelection() { return MayaUsd::ufe::getUsdRunTimeId() != 0; } -#endif // WANT_UFE_BUILD - void HdMayaProxyDelegate::PopulateSelectionList( const HdxPickHitVector& hits, const MHWRender::MSelectionInfo& selectInfo, @@ -353,16 +315,7 @@ void HdMayaProxyDelegate::PopulateSelectionList( return; } -#if WANT_UFE_BUILD - auto handler = Ufe::RunTimeMgr::instance().hierarchyHandler(USD_UFE_RUNTIME_ID); - if (handler == nullptr) - return; - -#ifdef UFE_V2_FEATURES_AVAILABLE auto ufeSel = Ufe::NamedSelection::get("MayaSelectTool"); -#else - const MGlobal::ListAdjustment listAdjustment = GetListAdjustment(); -#endif std::lock_guard lock(_allAdaptersMutex); @@ -390,43 +343,18 @@ void HdMayaProxyDelegate::PopulateSelectionList( usdPath = adapter->ConvertIndexPathToCachePath(usdPath); #endif - const Ufe::PathSegment pathSegment( - usdPath.GetText(), USD_UFE_RUNTIME_ID, USD_UFE_SEPARATOR); - const Ufe::SceneItem::Ptr& si - = handler->createItem(adapter->GetProxy()->ufePath() + pathSegment); + const Ufe::PathSegment pathSegment + = MayaUsd::ufe::usdPathToUfePathSegment(usdPath); + auto si = Ufe::Hierarchy::createItem(adapter->GetProxy()->ufePath() + pathSegment); if (!si) { TF_WARN("Failed to create UFE scene item for '%s'", objectId.GetText()); break; } -#ifdef UFE_V2_FEATURES_AVAILABLE ufeSel->append(si); -#else - auto globalSelection = Ufe::GlobalSelection::get(); - - switch (listAdjustment) { - case MGlobal::kReplaceList: - // The list has been cleared before viewport selection runs, so we - // can add the new hits directly. UFE selection list is a superset - // of Maya selection list, calling clear()/replaceWith() on UFE - // selection list would clear Maya selection list. - globalSelection->append(si); - break; - case MGlobal::kAddToList: globalSelection->append(si); break; - case MGlobal::kRemoveFromList: globalSelection->remove(si); break; - case MGlobal::kXORWithList: - if (!globalSelection->remove(si)) { - globalSelection->append(si); - } - break; - default: TF_WARN("Unexpected MGlobal::ListAdjustment enum for selection."); break; - } -#endif - break; } } -#endif // WANT_UFE_BUILD } PXR_NAMESPACE_CLOSE_SCOPE diff --git a/lib/usd/hdMaya/delegates/proxyDelegate.h b/lib/usd/hdMaya/delegates/proxyDelegate.h index 566949f7cd..5be0589f78 100644 --- a/lib/usd/hdMaya/delegates/proxyDelegate.h +++ b/lib/usd/hdMaya/delegates/proxyDelegate.h @@ -25,13 +25,10 @@ #include #include +#include #include -#if WANT_UFE_BUILD -#include -#endif // WANT_UFE_BUILD - PXR_NAMESPACE_OPEN_SCOPE class HdMayaProxyAdapter; @@ -58,13 +55,11 @@ class HdMayaProxyDelegate : public HdMayaDelegate // const MSelectionList& mayaSelection, SdfPathVector& selectedSdfPaths, // const HdSelectionSharedPtr& selection) override; -#if WANT_UFE_BUILD void PopulateSelectedPaths( - const UFE_NS::Selection& ufeSelection, + const Ufe::Selection& ufeSelection, SdfPathVector& selectedSdfPaths, const HdSelectionSharedPtr& selection) override; bool SupportsUfeSelection() override; -#endif // WANT_UFE_BUILD void PopulateSelectionList( const HdxPickHitVector& hits, diff --git a/lib/usd/ui/layerEditor/CMakeLists.txt b/lib/usd/ui/layerEditor/CMakeLists.txt index ac39aebbbb..e5d7d951b9 100644 --- a/lib/usd/ui/layerEditor/CMakeLists.txt +++ b/lib/usd/ui/layerEditor/CMakeLists.txt @@ -17,6 +17,7 @@ target_sources(${PROJECT_NAME} PRIVATE + batchSaveLayersUIDelegate.cpp dirtyLayersCountBadge.cpp generatedIconButton.cpp layerEditorWidget.cpp @@ -64,30 +65,23 @@ target_link_libraries(${PROJECT_NAME} ghc_filesystem ) -if (UFE_FOUND) - target_sources(${PROJECT_NAME} - PRIVATE - batchSaveLayersUIDelegate.cpp - ) - - # ----------------------------------------------------------------------------- - # promoted headers - # ----------------------------------------------------------------------------- - set(HEADERS - batchSaveLayersUIDelegate.h - ) +# ----------------------------------------------------------------------------- +# promoted headers +# ----------------------------------------------------------------------------- +set(HEADERS + batchSaveLayersUIDelegate.h +) - mayaUsd_promoteHeaderList( - HEADERS - ${HEADERS} - BASEDIR - ${PROJECT_NAME}/ui - ) +mayaUsd_promoteHeaderList( + HEADERS + ${HEADERS} + BASEDIR + ${PROJECT_NAME}/ui +) - # ----------------------------------------------------------------------------- - # install - # ----------------------------------------------------------------------------- - install(FILES ${HEADERS} - DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME}/ui - ) -endif() +# ----------------------------------------------------------------------------- +# install +# ----------------------------------------------------------------------------- +install(FILES ${HEADERS} + DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME}/ui +) diff --git a/lib/usd/ui/layerEditor/mayaSessionState.cpp b/lib/usd/ui/layerEditor/mayaSessionState.cpp index 99fea4642d..0bc1822371 100644 --- a/lib/usd/ui/layerEditor/mayaSessionState.cpp +++ b/lib/usd/ui/layerEditor/mayaSessionState.cpp @@ -19,9 +19,7 @@ #include "saveLayersDialog.h" #include "stringResources.h" -#if defined(WANT_UFE_BUILD) #include -#endif #include #include @@ -76,10 +74,8 @@ void MayaSessionState::setStageEntry(StageEntry const& inEntry) _currentStageEntry.clear(); } -#if defined(WANT_UFE_BUILD) if (!_inLoad) MayaUsd::LayerManager::setSelectedStage(_currentStageEntry._proxyShapePath); -#endif } bool MayaSessionState::getStageEntry(StageEntry* out_stageEntry, const MString& shapePath) @@ -308,13 +304,11 @@ void MayaSessionState::sceneLoadedCB(void* clientData) void MayaSessionState::loadSelectedStage() { -#if defined(WANT_UFE_BUILD) const std::string shapePath = MayaUsd::LayerManager::getSelectedStage(); StageEntry entry; if (!shapePath.empty() && getStageEntry(&entry, shapePath.c_str())) { setStageEntry(entry); } -#endif } bool MayaSessionState::saveLayerUI( diff --git a/lib/usd/ui/layerEditor/saveLayersDialog.cpp b/lib/usd/ui/layerEditor/saveLayersDialog.cpp index 944315a584..00f9122c9d 100644 --- a/lib/usd/ui/layerEditor/saveLayersDialog.cpp +++ b/lib/usd/ui/layerEditor/saveLayersDialog.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -33,10 +34,6 @@ #include -#if defined(WANT_UFE_BUILD) -#include -#endif - PXR_NAMESPACE_USING_DIRECTIVE namespace { @@ -391,7 +388,6 @@ class SaveLayerPathRowArea : public QScrollArea // namespace UsdLayerEditor { -#if defined(WANT_UFE_BUILD) SaveLayersDialog::SaveLayersDialog( QWidget* in_parent, const std::vector& infos) @@ -418,7 +414,6 @@ SaveLayersDialog::SaveLayersDialog( static_cast(infos.size()), static_cast(_anonLayerInfos.size()), msg1, msg2); buildDialog(msg1, msg2); } -#endif SaveLayersDialog::SaveLayersDialog(SessionState* in_sessionState, QWidget* in_parent) : QDialog(in_parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint) diff --git a/lib/usd/ui/layerEditor/saveLayersDialog.h b/lib/usd/ui/layerEditor/saveLayersDialog.h index bbc5ef2430..297ddf966e 100644 --- a/lib/usd/ui/layerEditor/saveLayersDialog.h +++ b/lib/usd/ui/layerEditor/saveLayersDialog.h @@ -1,9 +1,7 @@ #ifndef SAVELAYERSDIALOG_H #define SAVELAYERSDIALOG_H -#if defined(WANT_UFE_BUILD) #include -#endif #include #include @@ -33,10 +31,8 @@ class SaveLayersDialog : public QDialog // Create dialog using single stage (from session state). SaveLayersDialog(SessionState* in_sessionState, QWidget* in_parent); -#if defined(WANT_UFE_BUILD) // Create dialog for bulk save using all provided proxy shapes and their owned stages. SaveLayersDialog(QWidget* in_parent, const std::vector& infos); -#endif ~SaveLayersDialog(); diff --git a/lib/usd/ui/layerEditor/stageSelectorWidget.cpp b/lib/usd/ui/layerEditor/stageSelectorWidget.cpp index ca8c5e0e97..7caec3b921 100644 --- a/lib/usd/ui/layerEditor/stageSelectorWidget.cpp +++ b/lib/usd/ui/layerEditor/stageSelectorWidget.cpp @@ -20,11 +20,8 @@ #include "stringResources.h" #include - -#if defined(WANT_UFE_BUILD) #include #include -#endif #include #include @@ -33,18 +30,15 @@ #include #include #include - -#include -#include -#include - -#if defined(WANT_UFE_BUILD) #include #include #include #include #include -#endif + +#include +#include +#include Q_DECLARE_METATYPE(UsdLayerEditor::SessionState::StageEntry); @@ -86,7 +80,6 @@ void saveStagePinnedOption(bool isPinned) } //---------------------------------------------------------------------------------------------------------------------- -#if defined(WANT_UFE_BUILD) // Observe the global UFE selection to update the stage selector widgets. class StageSelectorSelectionObserver @@ -176,8 +169,6 @@ void StageSelectorSelectionObserver::removeStageSelector(StageSelectorWidget& se _stageSelectors.erase(&selector); } -#endif - } // namespace namespace UsdLayerEditor { @@ -187,9 +178,7 @@ StageSelectorWidget::StageSelectorWidget(SessionState* in_sessionState, QWidget* { createUI(); setSessionState(in_sessionState); -#if defined(WANT_UFE_BUILD) StageSelectorSelectionObserver::instance()->addStageSelector(*this); -#endif _pinStageSelection = loadStagePinnedOption(); updatePinnedStage(); @@ -197,9 +186,7 @@ StageSelectorWidget::StageSelectorWidget(SessionState* in_sessionState, QWidget* StageSelectorWidget::~StageSelectorWidget() { -#if defined(WANT_UFE_BUILD) StageSelectorSelectionObserver::instance()->removeStageSelector(*this); -#endif } void StageSelectorWidget::createUI() @@ -289,7 +276,6 @@ void StageSelectorWidget::selectedIndexChanged(int index) _internalChange = false; } -#if defined(WANT_UFE_BUILD) static MayaUsdProxyShapeBase* getChildProxyShape(const Ufe::SceneItem::Ptr& item) { Ufe::Hierarchy::Ptr hierarchy = Ufe::Hierarchy::hierarchy(item); @@ -306,11 +292,9 @@ static MayaUsdProxyShapeBase* getChildProxyShape(const Ufe::SceneItem::Ptr& item return nullptr; } -#endif void StageSelectorWidget::selectionChanged() { -#if defined(WANT_UFE_BUILD) // When the stage selection is pinned, don't follow the selection. if (_pinStageSelection) return; @@ -340,7 +324,6 @@ void StageSelectorWidget::selectionChanged() _dropDown->setCurrentIndex(index); break; } -#endif } void StageSelectorWidget::stagePinClicked() diff --git a/lib/usdUfe/CMakeLists.txt b/lib/usdUfe/CMakeLists.txt index c731397de4..2dddd4f844 100644 --- a/lib/usdUfe/CMakeLists.txt +++ b/lib/usdUfe/CMakeLists.txt @@ -37,7 +37,6 @@ target_compile_definitions(${PROJECT_NAME} PUBLIC $<$:BOOST_DEBUG_PYTHON> $<$:BOOST_LINKING_PYTHON> - WANT_UFE_BUILD $<$:MAYA_ENABLE_NEW_PRIM_DELETE> PRIVATE USDUFE_EXPORT diff --git a/lib/usdUfe/ufe/CMakeLists.txt b/lib/usdUfe/ufe/CMakeLists.txt index c72363a481..7d0937aced 100644 --- a/lib/usdUfe/ufe/CMakeLists.txt +++ b/lib/usdUfe/ufe/CMakeLists.txt @@ -5,38 +5,32 @@ target_sources(${PROJECT_NAME} PRIVATE Global.cpp StagesSubject.cpp + UsdCamera.cpp + UsdCameraHandler.cpp UsdHierarchy.cpp UsdHierarchyHandler.cpp + UsdObject3d.cpp + UsdObject3dHandler.cpp UsdRootChildHierarchy.cpp UsdSceneItem.cpp + UsdUndoAddNewPrimCommand.cpp + UsdUndoAddPayloadCommand.cpp + UsdUndoAddRefOrPayloadCommand.cpp + UsdUndoAddReferenceCommand.cpp + UsdUndoClearPayloadsCommand.cpp + UsdUndoClearReferencesCommand.cpp + UsdUndoCreateGroupCommand.cpp + UsdUndoInsertChildCommand.cpp + UsdUndoReorderCommand.cpp + UsdUndoSelectAfterCommand.cpp + UsdUndoSetKindCommand.cpp + UsdUndoToggleActiveCommand.cpp + UsdUndoToggleInstanceableCommand.cpp + UsdUndoVisibleCommand.cpp + UsdUndoableCommand.cpp Utils.cpp ) -if(CMAKE_UFE_V2_FEATURES_AVAILABLE) - target_sources(${PROJECT_NAME} - PRIVATE - UsdCamera.cpp - UsdCameraHandler.cpp - UsdObject3d.cpp - UsdObject3dHandler.cpp - UsdUndoableCommand.cpp - UsdUndoAddNewPrimCommand.cpp - UsdUndoAddPayloadCommand.cpp - UsdUndoAddReferenceCommand.cpp - UsdUndoAddRefOrPayloadCommand.cpp - UsdUndoClearPayloadsCommand.cpp - UsdUndoClearReferencesCommand.cpp - UsdUndoCreateGroupCommand.cpp - UsdUndoInsertChildCommand.cpp - UsdUndoReorderCommand.cpp - UsdUndoSelectAfterCommand.cpp - UsdUndoSetKindCommand.cpp - UsdUndoToggleActiveCommand.cpp - UsdUndoToggleInstanceableCommand.cpp - UsdUndoVisibleCommand.cpp - ) -endif() - if(CMAKE_UFE_V3_FEATURES_AVAILABLE) target_sources(${PROJECT_NAME} PRIVATE @@ -48,38 +42,33 @@ endif() set(HEADERS Global.h StagesSubject.h + UfeVersionCompat.h + UsdCamera.h + UsdCameraHandler.h UsdHierarchy.h UsdHierarchyHandler.h + UsdObject3d.h + UsdObject3dHandler.h UsdRootChildHierarchy.h UsdSceneItem.h + UsdUndoAddNewPrimCommand.h + UsdUndoAddPayloadCommand.h + UsdUndoAddRefOrPayloadCommand.h + UsdUndoAddReferenceCommand.h + UsdUndoClearPayloadsCommand.h + UsdUndoClearReferencesCommand.h + UsdUndoCreateGroupCommand.h + UsdUndoInsertChildCommand.h + UsdUndoReorderCommand.h + UsdUndoSelectAfterCommand.h + UsdUndoSetKindCommand.h + UsdUndoToggleActiveCommand.h + UsdUndoToggleInstanceableCommand.h + UsdUndoVisibleCommand.h + UsdUndoableCommand.h Utils.h - UfeVersionCompat.h ) -if(CMAKE_UFE_V2_FEATURES_AVAILABLE) - list(APPEND HEADERS - UsdCamera.h - UsdCameraHandler.h - UsdObject3d.h - UsdObject3dHandler.h - UsdUndoableCommand.h - UsdUndoAddNewPrimCommand.h - UsdUndoAddPayloadCommand.h - UsdUndoAddReferenceCommand.h - UsdUndoAddRefOrPayloadCommand.h - UsdUndoClearPayloadsCommand.h - UsdUndoClearReferencesCommand.h - UsdUndoCreateGroupCommand.h - UsdUndoInsertChildCommand.h - UsdUndoReorderCommand.h - UsdUndoSelectAfterCommand.h - UsdUndoSetKindCommand.h - UsdUndoToggleActiveCommand.h - UsdUndoToggleInstanceableCommand.h - UsdUndoVisibleCommand.h - ) -endif() - if(CMAKE_UFE_V3_FEATURES_AVAILABLE) list(APPEND HEADERS UsdUndoUngroupCommand.h diff --git a/lib/usdUfe/ufe/StagesSubject.cpp b/lib/usdUfe/ufe/StagesSubject.cpp index e0d76c3d3e..d34b0b5ac9 100644 --- a/lib/usdUfe/ufe/StagesSubject.cpp +++ b/lib/usdUfe/ufe/StagesSubject.cpp @@ -395,7 +395,7 @@ void StagesSubject::stageChanged( notifyWithoutExceptions(ufePath); } } - UFE_V2(processAttributeChanges(ufePath, changedPath, it.base()->second);) + processAttributeChanges(ufePath, changedPath, it.base()->second); // No further processing for this prim property path is required. continue; } @@ -521,7 +521,7 @@ void StagesSubject::stageChanged( const TfToken nameToken = changedPath.GetNameToken(); if (isTransformChange(nameToken)) { notifyWithoutExceptions(ufePath); - UFE_V2(sendValueChangedFallback = false;) + sendValueChangedFallback = false; } else if (prim && prim.IsA()) { // If the prim at the changed path is a PointInstancer, check // whether the modified path is one of the attributes authored @@ -556,7 +556,7 @@ void StagesSubject::stageChanged( + usdPathToUfePathSegment(changedPath.GetPrimPath(), instanceIndex); notifyWithoutExceptions(instanceUfePath); } - UFE_V2(sendValueChangedFallback = false;) + sendValueChangedFallback = false; } } } diff --git a/lib/usdUfe/ufe/Utils.h b/lib/usdUfe/ufe/Utils.h index dc272205e4..d44b7d3768 100644 --- a/lib/usdUfe/ufe/Utils.h +++ b/lib/usdUfe/ufe/Utils.h @@ -139,11 +139,7 @@ template void sendNotification(const Ufe::SceneItem::Ptr& item, const Ufe::Path& previousPath) { T notification(item, previousPath); -#ifdef UFE_V2_FEATURES_AVAILABLE Ufe::Scene::instance().notify(notification); -#else - Ufe::Scene::notifyObjectPathChange(notification); -#endif } //! Readability function to downcast a SceneItem::Ptr to a UsdSceneItem::Ptr. diff --git a/plugin/adsk/plugin/CMakeLists.txt b/plugin/adsk/plugin/CMakeLists.txt index c46bca3eb5..657a9ccbf9 100644 --- a/plugin/adsk/plugin/CMakeLists.txt +++ b/plugin/adsk/plugin/CMakeLists.txt @@ -65,7 +65,7 @@ mayaUsd_compile_config(${TARGET_NAME}) # ----------------------------------------------------------------------------- target_include_directories(${TARGET_NAME} PRIVATE - $<$:${UFE_INCLUDE_DIR}> + ${UFE_INCLUDE_DIR} ) # ----------------------------------------------------------------------------- @@ -73,7 +73,7 @@ target_include_directories(${TARGET_NAME} # ----------------------------------------------------------------------------- target_link_libraries(${TARGET_NAME} PRIVATE - $<$:${UFE_LIBRARY}> + ${UFE_LIBRARY} basePxrUsdPreviewSurface ) diff --git a/plugin/adsk/plugin/plugin.cpp b/plugin/adsk/plugin/plugin.cpp index 8c79f8501a..37fa5c1d7c 100644 --- a/plugin/adsk/plugin/plugin.cpp +++ b/plugin/adsk/plugin/plugin.cpp @@ -32,11 +32,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -48,6 +50,7 @@ #include #include #include +#include #include @@ -58,21 +61,6 @@ #include #endif -#if defined(WANT_UFE_BUILD) -#include -#include - -#ifdef UFE_V2_FEATURES_AVAILABLE -#include - -#include - -// For Maya preview release 121 enabling and disabling of new Transform3d -// functionality. PPT, 1-Dec-2020. -#include -#include -#endif - #ifdef UFE_V3_FEATURES_AVAILABLE #include "adskMaterialCommands.h" @@ -84,8 +72,6 @@ #include #endif -#endif - #if defined(MAYAUSD_VERSION) #define STRINGIFY(x) #x #define TOSTRING(x) STRINGIFY(x) @@ -101,52 +87,6 @@ const MTypeId MayaUsdPreviewSurface_typeId(0x58000096); const MString MayaUsdPreviewSurface_typeName("usdPreviewSurface"); const MString MayaUsdPreviewSurface_registrantId("mayaUsdPlugin"); -#if defined(WANT_UFE_BUILD) && defined(UFE_V2_FEATURES_AVAILABLE) -// Keep a reference to the existing USD Transform3d handler, to restore on -// finalization. -Ufe::Transform3dHandler::Ptr g_OldTransform3dHandler; -Ufe::Transform3dHandler::Ptr g_NewTransform3dHandler; - -class ToggleTransform3d : public MPxCommand -{ -public: - ToggleTransform3d() { } - static void* creator() { return new ToggleTransform3d(); } - - static const MString commandName; - - MStatus doIt(const MArgList&) override { return redoIt(); } - - void toggle() const - { - bool toNew - = (Ufe::RunTimeMgr::instance().transform3dHandler(MayaUsd::ufe::getUsdRunTimeId()) - == g_OldTransform3dHandler); - Ufe::RunTimeMgr::instance().setTransform3dHandler( - MayaUsd::ufe::getUsdRunTimeId(), - toNew ? g_NewTransform3dHandler : g_OldTransform3dHandler); - MGlobal::displayInfo( - toNew ? MString("Using chain of responsibility Transform3d handlers.") - : MString("Using legacy Transform3d handler.")); - } - - MStatus redoIt() override - { - toggle(); - return MS::kSuccess; - } - MStatus undoIt() override - { - toggle(); - return MS::kSuccess; - } - bool isUndoable() const override { return true; } -}; - -const MString ToggleTransform3d::commandName { "toggleTransform3d" }; - -#endif - template void registerCommandCheck(MFnPlugin& plugin) { auto status = plugin.registerCommand(T::commandName, T::creator, T::createSyntax); @@ -244,31 +184,11 @@ MStatus initializePlugin(MObject obj) status = MayaUsdProxyShapePlugin::initialize(plugin); CHECK_MSTATUS(status); -#if defined(WANT_UFE_BUILD) status = MayaUsd::ufe::initialize(); if (!status) { status.perror("mayaUsdPlugin: unable to initialize ufe."); } -#ifdef UFE_V2_FEATURES_AVAILABLE - // For backward compatibility, provide a command to revert to UFE v1 (Maya - // 2020) Ufe::Transform3d handling, which is based on the USD common - // transform API: - // https://graphics.pixar.com/usd/docs/api/class_usd_geom_xform_common_a_p_i.html - auto& runTimeMgr = Ufe::RunTimeMgr::instance(); - auto usdRtid = MayaUsd::ufe::getUsdRunTimeId(); - g_NewTransform3dHandler = runTimeMgr.transform3dHandler(usdRtid); - g_OldTransform3dHandler = MayaUsd::ufe::UsdTransform3dHandler::create(); - - status = plugin.registerCommand(ToggleTransform3d::commandName, ToggleTransform3d::creator); - if (!status) { - status.perror( - MString("mayaUsdPlugin: unable to register command ") + ToggleTransform3d::commandName); - } -#endif - -#endif - status = plugin.registerShape( MayaUsd::ProxyShape::typeName, MayaUsd::ProxyShape::typeId, @@ -346,12 +266,10 @@ MStatus initializePlugin(MObject obj) } } -#if defined(WANT_UFE_BUILD) MayaUsd::LayerManager::addSupportForNodeType(MayaUsd::ProxyShape::typeId); #if defined(WANT_QT_BUILD) UsdLayerEditor::initialize(); MayaUsd::LayerManager::SetBatchSaveDelegate(UsdLayerEditor::batchSaveLayersUIDelegate); -#endif #endif UsdMayaSceneResetNotice::InstallListener(); @@ -443,32 +361,12 @@ MStatus uninitializePlugin(MObject obj) status = plugin.deregisterCommand(MayaUsd::MayaUsdUndoBlockCmd::commandName); CHECK_MSTATUS(status); -#if defined(WANT_UFE_BUILD) -#ifdef UFE_V2_FEATURES_AVAILABLE - status = plugin.deregisterCommand(ToggleTransform3d::commandName); - if (!status) { - status.perror( - MString("mayaUsdPlugin: unable to deregister command ") - + ToggleTransform3d::commandName); - } - - // Restore the initial maya-usd Transform3d handler. - Ufe::RunTimeMgr::instance().setTransform3dHandler( - MayaUsd::ufe::getUsdRunTimeId(), g_OldTransform3dHandler); - - g_OldTransform3dHandler = nullptr; - g_NewTransform3dHandler = nullptr; -#endif - status = MayaUsd::ufe::finalize(); CHECK_MSTATUS(status); -#endif -#if defined(WANT_UFE_BUILD) MayaUsd::LayerManager::removeSupportForNodeType(MayaUsd::ProxyShape::typeId); #if defined(WANT_QT_BUILD) MayaUsd::LayerManager::SetBatchSaveDelegate(nullptr); -#endif #endif UsdMayaSceneResetNotice::RemoveListener(); diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/Global.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/Global.cpp index 0dc38440a0..470023cbd5 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/Global.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/Global.cpp @@ -18,21 +18,12 @@ #include "AL/usd/transaction/TransactionManager.h" #include "AL/usdmaya/DebugCodes.h" #include "AL/usdmaya/StageCache.h" +#include "AL/usdmaya/TypeIDs.h" #include "AL/usdmaya/nodes/LayerManager.h" #include "AL/usdmaya/nodes/ProxyShape.h" #include "AL/usdmaya/nodes/Scope.h" #include "AL/usdmaya/nodes/Transform.h" #include "AL/usdmaya/nodes/TransformationMatrix.h" - -#include - -#include -#include -#include -#include - -#if defined(WANT_UFE_BUILD) -#include "AL/usdmaya/TypeIDs.h" #include "ufe/globalSelection.h" #include "ufe/observableSelection.h" #include "ufe/observer.h" @@ -41,7 +32,14 @@ #include "ufe/selectionNotification.h" #include "ufe/transform3d.h" #include "ufe/transform3dNotification.h" -#endif + +#include +#include + +#include +#include +#include +#include #include #include @@ -60,7 +58,6 @@ namespace { // per import, or once per reference). std::atomic readDepth; -#if defined(WANT_UFE_BUILD) // The proxy shape has an internal cache which needs to update when any of // its UFE scene items are selected and transformed. class UfeTransformObserver : public Ufe::Observer @@ -81,7 +78,7 @@ class UfeTransformObserver : public Ufe::Observer // Action for USD scene items only. Ufe::SceneItem::Ptr sceneItem = xformChanged->item(); - if (!sceneItem || (sceneItem->runTimeId() != AL::usdmaya::USD_UFE_RUNTIME_ID)) + if (!sceneItem || (sceneItem->runTimeId() != MayaUsd::ufe::getUsdRunTimeId())) return; std::string mayaPath = sceneItem->path().popSegment().popHead().string(); @@ -106,14 +103,14 @@ class UfeTransformObserver : public Ufe::Observer } } }; -#endif + } // namespace namespace AL { namespace usdmaya { //---------------------------------------------------------------------------------------------------------------------- -#if defined(WANT_UFE_BUILD) + // Observe UFE scene items for transformation changed only when they are selected. class Global::UfeSelectionObserver : public Ufe::Observer { @@ -138,7 +135,7 @@ class Global::UfeSelectionObserver : public Ufe::Observer void observe(const Ufe::SceneItem::Ptr& si) { - if (si && (si->runTimeId() == USD_UFE_RUNTIME_ID) + if (si && (si->runTimeId() == MayaUsd::ufe::getUsdRunTimeId()) && Ufe::Transform3d::addObserver(si, m_ufeTransformObserver)) { m_observedSceneItems.push_back(si); } @@ -178,7 +175,7 @@ class Global::UfeSelectionObserver : public Ufe::Observer } else if ( auto removed = dynamic_cast(selectionChanged)) { Ufe::SceneItem::Ptr si = removed->item(); - if (si && (si->runTimeId() == USD_UFE_RUNTIME_ID) + if (si && (si->runTimeId() == MayaUsd::ufe::getUsdRunTimeId()) && Ufe::Transform3d::removeObserver(si, m_ufeTransformObserver)) { m_observedSceneItems.remove(si); } @@ -196,7 +193,6 @@ class Global::UfeSelectionObserver : public Ufe::Observer }; std::shared_ptr Global::m_ufeSelectionObserver; -#endif //---------------------------------------------------------------------------------------------------------------------- AL::event::CallbackId Global::m_preSave; @@ -473,13 +469,11 @@ void Global::onPluginLoad() TfStringCatPaths(TfGetenv(AL_USDMAYA_LOCATION_NAME), "share/usd/plugins")); PlugRegistry::GetInstance().RegisterPlugins(pluginLocation); -#if defined(WANT_UFE_BUILD) const Ufe::GlobalSelection::Ptr& ufeSelection = Ufe::GlobalSelection::get(); if (ufeSelection) { m_ufeSelectionObserver = std::make_shared(); ufeSelection->addObserver(m_ufeSelectionObserver); } -#endif UsdMayaSceneResetNotice::InstallListener(); UsdMayaBeforeSceneResetNotice::InstallListener(); @@ -506,13 +500,11 @@ void Global::onPluginUnload() AL::maya::event::MayaEventManager::freeInstance(); AL::event::EventScheduler::freeScheduler(); -#if defined(WANT_UFE_BUILD) const Ufe::GlobalSelection::Ptr& ufeSelection = Ufe::GlobalSelection::get(); if (ufeSelection) { ufeSelection->removeObserver(m_ufeSelectionObserver); m_ufeSelectionObserver = nullptr; } -#endif UsdMayaSceneResetNotice::RemoveListener(); UsdMayaBeforeSceneResetNotice::RemoveListener(); @@ -521,11 +513,9 @@ void Global::onPluginUnload() void Global::openingFile(bool val) { -#if defined(WANT_UFE_BUILD) if (m_ufeSelectionObserver) { m_ufeSelectionObserver->openingFile(val); } -#endif } //---------------------------------------------------------------------------------------------------------------------- diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/Global.h b/plugin/al/lib/AL_USDMaya/AL/usdmaya/Global.h index ee02e3ac50..0573dc587d 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/Global.h +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/Global.h @@ -73,10 +73,8 @@ class Global m_preExport; ///< callback prior to exporting the scene (so we can store the session layer) static AL::event::CallbackId m_postExport; ///< callback after exporting -#if defined(WANT_UFE_BUILD) class UfeSelectionObserver; static std::shared_ptr m_ufeSelectionObserver; -#endif }; //---------------------------------------------------------------------------------------------------------------------- diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/PluginRegister.h b/plugin/al/lib/AL_USDMaya/AL/usdmaya/PluginRegister.h index 7ab524edfb..ab0b9d8ac9 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/PluginRegister.h +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/PluginRegister.h @@ -46,6 +46,7 @@ #include #include +#include #include #include @@ -56,10 +57,6 @@ #include #include -#if defined(WANT_UFE_BUILD) -#include -#endif - PXR_NAMESPACE_USING_DIRECTIVE namespace AL { @@ -275,12 +272,10 @@ template MStatus registerPlugin(AFnPlugin& plugin) &ProxyRenderDelegate::drawDbClassification); CHECK_MSTATUS(status); -#if defined(WANT_UFE_BUILD) status = MayaUsd::ufe::initialize(); if (!status) { status.perror("Unable to initialize ufe."); } -#endif AL_REGISTER_TRANSFORM_NODE( plugin, AL::usdmaya::nodes::Scope, AL::usdmaya::nodes::BasicTransformationMatrix); @@ -384,10 +379,8 @@ template MStatus unregisterPlugin(AFnPlugin& plugin) { MStatus status; -#if defined(WANT_UFE_BUILD) status = MayaUsd::ufe::finalize(); CHECK_MSTATUS(status); -#endif // gpuCachePluginMain used as an example. if (MGlobal::kInteractive == MGlobal::mayaState()) { diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/TypeIDs.h b/plugin/al/lib/AL_USDMaya/AL/usdmaya/TypeIDs.h index 2bb6e9bb76..ffb37cefdd 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/TypeIDs.h +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/TypeIDs.h @@ -31,12 +31,5 @@ const MTypeId AL_USDMAYA_USDGEOMCAMERAPROXY(0x00112A2B); const MTypeId AL_USDMAYA_SCOPE(0x00112A31); const MTypeId AL_USDMAYA_IDENTITY_MATRIX(0x00112A32); -#if defined(WANT_UFE_BUILD) -const int MAYA_UFE_RUNTIME_ID(1); -const char MAYA_UFE_SEPARATOR('|'); -const int USD_UFE_RUNTIME_ID(2); -const char USD_UFE_SEPARATOR('/'); -#endif - } // namespace usdmaya } // namespace AL diff --git a/plugin/al/lib/AL_USDMaya/CMakeLists.txt b/plugin/al/lib/AL_USDMaya/CMakeLists.txt index 54f13cccb7..0794381f26 100644 --- a/plugin/al/lib/AL_USDMaya/CMakeLists.txt +++ b/plugin/al/lib/AL_USDMaya/CMakeLists.txt @@ -169,7 +169,7 @@ target_include_directories( PUBLIC ${PXR_INCLUDE_DIRS} ${MAYA_INCLUDE_DIRS} - $<$:${UFE_INCLUDE_DIR}> + ${UFE_INCLUDE_DIR} ) # There were bugs in both cmake and findboost with the boost version string. So in @@ -206,7 +206,7 @@ target_link_libraries(${LIBRARY_NAME} ${MAYA_OpenMaya_LIBRARY} ${MAYA_OpenMayaRender_LIBRARY} mayaUsd - $<$:${UFE_LIBRARY}> + ${UFE_LIBRARY} ghc_filesystem ) diff --git a/plugin/pxr/maya/lib/usdMaya/CMakeLists.txt b/plugin/pxr/maya/lib/usdMaya/CMakeLists.txt index 35fe3249e9..843bf295a8 100644 --- a/plugin/pxr/maya/lib/usdMaya/CMakeLists.txt +++ b/plugin/pxr/maya/lib/usdMaya/CMakeLists.txt @@ -17,11 +17,11 @@ pxr_shared_library(${PXR_PACKAGE} ${MAYA_OpenMayaRender_LIBRARY} ${MAYA_OpenMayaUI_LIBRARY} mayaUsd - $<$:${UFE_LIBRARY}> + ${UFE_LIBRARY} INCLUDE_DIRS ${MAYA_INCLUDE_DIRS} - $<$:${UFE_INCLUDE_DIR}> + ${UFE_INCLUDE_DIR} PUBLIC_HEADERS api.h @@ -66,10 +66,6 @@ pxr_shared_library(${PXR_PACKAGE} DISABLE_PRECOMPILED_HEADERS ) -if (UFE_FOUND) - target_compile_definitions(${PXR_PACKAGE} PRIVATE WANT_UFE_BUILD) -endif() - pxr_test_scripts( testenv/testUsdExportAssembly.py testenv/testUsdExportAssemblyEdits.py diff --git a/plugin/pxr/maya/plugin/pxrUsd/CMakeLists.txt b/plugin/pxr/maya/plugin/pxrUsd/CMakeLists.txt index e9f2f08d66..f8259f9770 100644 --- a/plugin/pxr/maya/plugin/pxrUsd/CMakeLists.txt +++ b/plugin/pxr/maya/plugin/pxrUsd/CMakeLists.txt @@ -13,9 +13,11 @@ pxr_plugin(${PXR_PACKAGE} ${MAYA_Foundation_LIBRARY} ${MAYA_OpenMaya_LIBRARY} ${MAYA_OpenMayaRender_LIBRARY} + ${UFE_LIBRARY} INCLUDE_DIRS ${MAYA_INCLUDE_DIRS} + ${UFE_INCLUDE_DIR} CPPFILES alembicChaser.cpp @@ -31,12 +33,6 @@ pxr_plugin(${PXR_PACKAGE} DISABLE_PRECOMPILED_HEADERS ) -if (UFE_FOUND) - target_link_libraries(${PXR_PACKAGE} ${UFE_LIBRARY}) - target_compile_definitions(${PXR_PACKAGE} PRIVATE WANT_UFE_BUILD) - target_include_directories(${PXR_PACKAGE} PRIVATE ${UFE_INCLUDE_DIR}) -endif() - pxr_test_scripts( testenv/testPxrUsdAlembicChaser.py ) diff --git a/plugin/pxr/maya/plugin/pxrUsd/plugin.cpp b/plugin/pxr/maya/plugin/pxrUsd/plugin.cpp index fd76d0c214..31d97a4e51 100644 --- a/plugin/pxr/maya/plugin/pxrUsd/plugin.cpp +++ b/plugin/pxr/maya/plugin/pxrUsd/plugin.cpp @@ -13,6 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. // +#include "api.h" #include "usdMaya/exportCommand.h" #include "usdMaya/exportTranslator.h" #include "usdMaya/importCommand.h" @@ -24,9 +25,12 @@ #include #include #include +#include #include #include +#include +#include #include #include @@ -35,15 +39,6 @@ #include #include -#if defined(WANT_UFE_BUILD) -#include -#endif - -#include "api.h" - -#include -#include - PXR_NAMESPACE_USING_DIRECTIVE static const MString _RegistrantId("pxrUsdPlugin"); @@ -54,12 +49,10 @@ MStatus initializePlugin(MObject obj) MStatus status; MFnPlugin plugin(obj, "Pixar", "1.0", "Any"); -#if defined(WANT_UFE_BUILD) status = MayaUsd::ufe::initialize(); if (!status) { status.perror("Unable to initialize ufe."); } -#endif status = MayaUsdProxyShapePlugin::initialize(plugin); CHECK_MSTATUS_AND_RETURN_IT(status); @@ -197,10 +190,8 @@ MStatus uninitializePlugin(MObject obj) MStatus status; MFnPlugin plugin(obj); -#if defined(WANT_UFE_BUILD) status = MayaUsd::ufe::finalize(); CHECK_MSTATUS(status); -#endif status = plugin.deregisterCommand("usdImport"); if (!status) { diff --git a/test/lib/CMakeLists.txt b/test/lib/CMakeLists.txt index e878de94f6..ace8e85038 100644 --- a/test/lib/CMakeLists.txt +++ b/test/lib/CMakeLists.txt @@ -2,17 +2,12 @@ set(TEST_SCRIPT_FILES testMayaUsdConverter.py testMayaUsdCreateStageCommands.py + testMayaUsdDirtyScene.py testMayaUsdLayerEditorCommands.py + testMayaUsdProxyAccessor.py testMayaUsdCacheId.py ) -if (UFE_FOUND) - list(APPEND TEST_SCRIPT_FILES - testMayaUsdDirtyScene.py - testMayaUsdProxyAccessor.py - ) -endif() - # Interactive Unit test scripts. set(INTERACTIVE_TEST_SCRIPT_FILES testMayaUsdInteractiveLayerEditorCommands.py @@ -100,9 +95,6 @@ foreach(script ${TEST_PLUG_FILES}) endforeach() # ----------------------------------------------------------------------------- -if (UFE_FOUND) - add_subdirectory(ufe) - add_subdirectory(mayaUsd) -endif() - +add_subdirectory(ufe) +add_subdirectory(mayaUsd) add_subdirectory(usd) diff --git a/test/lib/mayaUsd/render/vp2RenderDelegate/CMakeLists.txt b/test/lib/mayaUsd/render/vp2RenderDelegate/CMakeLists.txt index 8b3ce69eee..6ffe939d03 100644 --- a/test/lib/mayaUsd/render/vp2RenderDelegate/CMakeLists.txt +++ b/test/lib/mayaUsd/render/vp2RenderDelegate/CMakeLists.txt @@ -6,30 +6,20 @@ list(APPEND TEST_SCRIPT_FILES testVP2RenderDelegateGeomSubset.py testVP2RenderDelegatePointInstanceOrientation.py testVP2RenderDelegateTextureLoading.py + testVP2RenderDelegateDuplicateProxy.py + testVP2RenderDelegateInteractiveWorkflows.py + testVP2RenderDelegatePointInstanceSelection.py + testVP2RenderDelegatePointInstancesPickMode.py + testVP2RenderDelegatePrimPath.py + testVP2RenderDelegateUSDPreviewSurface.py + testVP2RenderDelegateConsolidation.py + testVP2RenderDelegatePerInstanceInheritedData.py + testVP2RenderDelegateBasisCurves.py + testVP2RenderDelegateDrawModes.py + testVP2RenderDelegatePoints.py + testVP2RenderDelegateUsdCamera.py ) -if(CMAKE_UFE_V2_FEATURES_AVAILABLE) - list(APPEND TEST_SCRIPT_FILES - testVP2RenderDelegateDuplicateProxy.py - testVP2RenderDelegateInteractiveWorkflows.py - testVP2RenderDelegatePointInstanceSelection.py - testVP2RenderDelegatePointInstancesPickMode.py - testVP2RenderDelegatePrimPath.py - testVP2RenderDelegateUSDPreviewSurface.py - testVP2RenderDelegateConsolidation.py - testVP2RenderDelegatePerInstanceInheritedData.py - testVP2RenderDelegateBasisCurves.py - testVP2RenderDelegateDrawModes.py - testVP2RenderDelegatePoints.py - ) -endif() - -if (CMAKE_UFE_V2_FEATURES_AVAILABLE) - list(APPEND TEST_SCRIPT_FILES - testVP2RenderDelegateUsdCamera.py - ) -endif() - if (MAYA_APP_VERSION VERSION_GREATER 2022) list(APPEND TEST_SCRIPT_FILES testVP2RenderDelegateSelection.py diff --git a/test/lib/mayaUsd/utils/CMakeLists.txt b/test/lib/mayaUsd/utils/CMakeLists.txt index 91b32aa756..dcaad8de1c 100644 --- a/test/lib/mayaUsd/utils/CMakeLists.txt +++ b/test/lib/mayaUsd/utils/CMakeLists.txt @@ -5,6 +5,7 @@ set(TEST_SCRIPT_FILES testBlockSceneModificationContext.py testDiagnosticDelegate.py + testUtilsEditability.py ) if(CMAKE_WANT_MATERIALX_BUILD AND CMAKE_UFE_V3_FEATURES_AVAILABLE) @@ -13,20 +14,10 @@ if(CMAKE_WANT_MATERIALX_BUILD AND CMAKE_UFE_V3_FEATURES_AVAILABLE) ) endif() -if(CMAKE_UFE_V2_FEATURES_AVAILABLE) - list(APPEND TEST_SCRIPT_FILES - testUtilsEditability.py - ) -endif() - -set(INTERACTIVE_TEST_SCRIPT_FILES "") - -if(CMAKE_UFE_V2_FEATURES_AVAILABLE) - list(APPEND INTERACTIVE_TEST_SCRIPT_FILES - testUtilsSelectability.py - testUtilsSelectabilityPointInstanceSelection.py - ) -endif() +set(INTERACTIVE_TEST_SCRIPT_FILES + testUtilsSelectability.py + testUtilsSelectabilityPointInstanceSelection.py +) foreach(script ${TEST_SCRIPT_FILES}) mayaUsd_get_unittest_target(target ${script}) diff --git a/test/lib/ufe/CMakeLists.txt b/test/lib/ufe/CMakeLists.txt index 3b0da7a0ed..3152bf0242 100644 --- a/test/lib/ufe/CMakeLists.txt +++ b/test/lib/ufe/CMakeLists.txt @@ -1,65 +1,59 @@ # unit test scripts. Note that testTRSBase.py is not a test case, but rather # a module providing a base class for other tests. set(TEST_SCRIPT_FILES + testAttribute.py + testAttributeBlock.py + testAttributes.py + testBlockedLayerEdit.py + testChildFilter.py + testComboCmd.py + testContextOps.py + testDuplicateCmd.py + testEditRouting.py + testGroupCmd.py testMatrices.py testMayaPickwalk.py + testMoveCmd.py + testObject3d.py + testObservableScene.py + testParentCmd.py + testPayloadCommands.py + testPointInstances.py testPythonWrappers.py + testReferenceCommands.py + testRename.py + testReorderCmd.py + testRotateCmd.py + testRotateCmdUndoRedo.py + testRotatePivot.py + testScaleCmd.py + testSceneItem.py testSelection.py testSelectionNotification.py testSelectionByArray.py + testToggleCommands.py + testTransform3dChainOfResponsibility.py + testTransform3dTranslate.py + testUIInfoHandler.py testUfePythonImport.py - testAttributeBlock.py - testBlockedLayerEdit.py + testVisibilityCmd.py ) set(TEST_SUPPORT_FILES testTRSBase.py ) -set(INTERACTIVE_TEST_SCRIPT_FILES "") +set(INTERACTIVE_TEST_SCRIPT_FILES + testPixelMoveCmd.py + testUIIcons.py +) -if(UFE_FOUND AND MAYA_APP_VERSION VERSION_GREATER_EQUAL 2023) +if(MAYA_APP_VERSION VERSION_GREATER_EQUAL 2023) list(APPEND TEST_SCRIPT_FILES testCenterPivot.py ) endif() -if(CMAKE_UFE_V2_FEATURES_AVAILABLE) - list(APPEND TEST_SCRIPT_FILES - testAttribute.py - testAttributes.py - testChildFilter.py - testComboCmd.py - testContextOps.py - testDuplicateCmd.py - testEditRouting.py - testGroupCmd.py - testMoveCmd.py - testObject3d.py - testRename.py - testParentCmd.py - testPayloadCommands.py - testPointInstances.py - testReferenceCommands.py - testReorderCmd.py - testRotateCmd.py - testRotateCmdUndoRedo.py - testRotatePivot.py - testScaleCmd.py - testSceneItem.py - testToggleCommands.py - testTransform3dChainOfResponsibility.py - testTransform3dTranslate.py - testUIInfoHandler.py - testVisibilityCmd.py - testObservableScene.py - ) - - list(APPEND INTERACTIVE_TEST_SCRIPT_FILES - testPixelMoveCmd.py - testUIIcons.py - ) -endif() if(CMAKE_UFE_V3_FEATURES_AVAILABLE) list(APPEND TEST_SCRIPT_FILES