From c9100f74adef097f2f5dbfbb7d6ff305c7d56f98 Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Wed, 29 Apr 2020 15:57:35 -0400 Subject: [PATCH 01/28] MAYA-104215: Trying to rename an object that was not defined on the target layer errors out: Unable to rename [object name] on current target layer, please set [Layername] as target layer to proceed. --- lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp | 53 ++++++++++++++---------- lib/mayaUsd/ufe/UsdUndoRenameCommand.h | 12 +++--- lib/mayaUsd/ufe/Utils.cpp | 34 ++++++++++++++- lib/mayaUsd/ufe/Utils.h | 8 ++++ 4 files changed, 78 insertions(+), 29 deletions(-) diff --git a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp index bfc1e50c6c..cfda8ea878 100644 --- a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp +++ b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp @@ -42,18 +42,29 @@ UsdUndoRenameCommand::UsdUndoRenameCommand(const UsdSceneItem::Ptr& srcItem, con : Ufe::UndoableCommand() { const UsdPrim& prim = srcItem->prim(); - fStage = prim.GetStage(); - fUfeSrcItem = srcItem; - fUsdSrcPath = prim.GetPath(); - // Every call to rename() (through execute(), undo() or redo()) removes + m_fStage = prim.GetStage(); + m_fUfeSrcItem = srcItem; + m_fUsdSrcPath = prim.GetPath(); + + // Every call to rename() (through execute(), undo() or redo()) removes // a prim, which becomes expired. Since USD UFE scene items contain a // prim, we must recreate them after every call to rename. - fUsdDstPath = prim.GetParent().GetPath().AppendChild(TfToken(newName.string())); - fLayer = defPrimSpecLayer(prim); - if (!fLayer) { + m_fUsdDstPath = prim.GetParent().GetPath().AppendChild(TfToken(newName.string())); + m_fLayer = defPrimSpecLayer(prim); + if (!m_fLayer) { std::string err = TfStringPrintf("No prim found at %s", prim.GetPath().GetString().c_str()); throw std::runtime_error(err.c_str()); } + + // check if the target layer has any opinions that affects selected prim + if (!isTargetLayerHaveOpinion(prim)) { + auto possibleTargetLayer = targetLayerWithOpion(prim); + std::string err = TfStringPrintf("Unable to rename [%s] on current target layer, " + "Please set [%s] as the target layer to proceed", + prim.GetName().GetString(), + possibleTargetLayer->GetDisplayName()); + throw std::runtime_error(err.c_str()); + } } UsdUndoRenameCommand::~UsdUndoRenameCommand() @@ -68,7 +79,7 @@ UsdUndoRenameCommand::Ptr UsdUndoRenameCommand::create(const UsdSceneItem::Ptr& UsdSceneItem::Ptr UsdUndoRenameCommand::renamedItem() const { - return fUfeDstItem; + return m_fUfeDstItem; } bool UsdUndoRenameCommand::renameRedo() @@ -78,10 +89,10 @@ bool UsdUndoRenameCommand::renameRedo() // We use the source layer as the destination. An alternate workflow // would be the edit target layer be the destination: // layer = self.fStage.GetEditTarget().GetLayer() - bool status = SdfCopySpec(fLayer, fUsdSrcPath, fLayer, fUsdDstPath); + bool status = SdfCopySpec(m_fLayer, m_fUsdSrcPath, m_fLayer, m_fUsdDstPath); if (status) { - auto srcPrim = fStage->GetPrimAtPath(fUsdSrcPath); + auto srcPrim = m_fStage->GetPrimAtPath(m_fUsdSrcPath); #ifdef UFE_V2_FEATURES_AVAILABLE UFE_ASSERT_MSG(srcPrim, "Invalid prim cannot be inactivated."); #else @@ -91,17 +102,17 @@ bool UsdUndoRenameCommand::renameRedo() if (status) { // The renamed scene item is a "sibling" of its original name. - auto ufeSrcPath = fUfeSrcItem->path(); - fUfeDstItem = createSiblingSceneItem( - ufeSrcPath, fUsdDstPath.GetElementString()); + auto ufeSrcPath = m_fUfeSrcItem->path(); + m_fUfeDstItem = createSiblingSceneItem( + ufeSrcPath, m_fUsdDstPath.GetElementString()); - Ufe::ObjectRename notification(fUfeDstItem, ufeSrcPath); + Ufe::ObjectRename notification(m_fUfeDstItem, ufeSrcPath); Ufe::Scene::notifyObjectPathChange(notification); } } else { UFE_LOG(std::string("Warning: SdfCopySpec(") + - fUsdSrcPath.GetString() + std::string(") failed.")); + m_fUsdSrcPath.GetString() + std::string(") failed.")); } return status; @@ -114,11 +125,11 @@ bool UsdUndoRenameCommand::renameUndo() // Regardless of where the edit target is currently set, switch to the // layer where we copied the source prim into the destination, then // restore the edit target. - UsdEditContext ctx(fStage, fLayer); - status = fStage->RemovePrim(fUsdDstPath); + UsdEditContext ctx(m_fStage, m_fLayer); + status = m_fStage->RemovePrim(m_fUsdDstPath); } if (status) { - auto srcPrim = fStage->GetPrimAtPath(fUsdSrcPath); + auto srcPrim = m_fStage->GetPrimAtPath(m_fUsdSrcPath); #ifdef UFE_V2_FEATURES_AVAILABLE UFE_ASSERT_MSG(srcPrim, "Invalid prim cannot be activated."); #else @@ -127,14 +138,14 @@ bool UsdUndoRenameCommand::renameUndo() status = srcPrim.SetActive(true); if (status) { - Ufe::ObjectRename notification(fUfeSrcItem, fUfeDstItem->path()); + Ufe::ObjectRename notification(m_fUfeSrcItem, m_fUfeDstItem->path()); Ufe::Scene::notifyObjectPathChange(notification); - fUfeDstItem = nullptr; + m_fUfeDstItem = nullptr; } } else { UFE_LOG(std::string("Warning: RemovePrim(") + - fUsdDstPath.GetString() + std::string(") failed.")); + m_fUsdDstPath.GetString() + std::string(") failed.")); } return status; diff --git a/lib/mayaUsd/ufe/UsdUndoRenameCommand.h b/lib/mayaUsd/ufe/UsdUndoRenameCommand.h index cac5ebaa49..3b3b71457b 100644 --- a/lib/mayaUsd/ufe/UsdUndoRenameCommand.h +++ b/lib/mayaUsd/ufe/UsdUndoRenameCommand.h @@ -59,12 +59,12 @@ class MAYAUSD_CORE_PUBLIC UsdUndoRenameCommand : public Ufe::UndoableCommand bool renameRedo(); bool renameUndo(); - UsdStageWeakPtr fStage; - SdfLayerHandle fLayer; - UsdSceneItem::Ptr fUfeSrcItem; - SdfPath fUsdSrcPath; - UsdSceneItem::Ptr fUfeDstItem; - SdfPath fUsdDstPath; + UsdStageWeakPtr m_fStage; + SdfLayerHandle m_fLayer; + UsdSceneItem::Ptr m_fUfeSrcItem; + SdfPath m_fUsdSrcPath; + UsdSceneItem::Ptr m_fUfeDstItem; + SdfPath m_fUsdDstPath; }; // UsdUndoRenameCommand diff --git a/lib/mayaUsd/ufe/Utils.cpp b/lib/mayaUsd/ufe/Utils.cpp index 88fad56afa..e3f08d2d22 100644 --- a/lib/mayaUsd/ufe/Utils.cpp +++ b/lib/mayaUsd/ufe/Utils.cpp @@ -109,8 +109,6 @@ SdfLayerHandle defPrimSpecLayer(const UsdPrim& prim) SdfLayerHandle defLayer; auto layerStack = prim.GetStage()->GetLayerStack(); - auto stage = prim.GetStage(); - auto primFromPath = stage->GetPrimAtPath(prim.GetPath()); for (auto layer : layerStack) { @@ -124,6 +122,38 @@ SdfLayerHandle defPrimSpecLayer(const UsdPrim& prim) return defLayer; } +bool isTargetLayerHaveOpinion(const UsdPrim& prim) +{ + auto editTarget = prim.GetStage()->GetEditTarget(); + auto layer = editTarget.GetLayer(); + auto primSpec = layer->GetPrimAtPath(prim.GetPath()); + + // to know whether the target layer contains any opinions that + // affect a particular prim, there must be a primSpec for that prim + if (!primSpec) { + return false; + } + + return true; +} + +SdfLayerHandle targetLayerWithOpion(const UsdPrim& prim) +{ + SdfLayerHandle targetLayer; + auto layerStack = prim.GetStage()->GetLayerStack(); + for (auto layer : layerStack) + { + // to know whether the target layer contains any opinions that + // affect a particular prim, there must be a primSpec for that prim + auto primSpec = layer->GetPrimAtPath(prim.GetPath()); + if (primSpec) { + targetLayer = layer; + break; + } + } + return targetLayer; +} + UsdSceneItem::Ptr createSiblingSceneItem(const Ufe::Path& ufeSrcPath, const std::string& siblingName) { auto ufeSiblingPath = ufeSrcPath.sibling(Ufe::PathComponent(siblingName)); diff --git a/lib/mayaUsd/ufe/Utils.h b/lib/mayaUsd/ufe/Utils.h index c152a5ec26..a103c5a5f5 100644 --- a/lib/mayaUsd/ufe/Utils.h +++ b/lib/mayaUsd/ufe/Utils.h @@ -56,6 +56,14 @@ bool isRootChild(const Ufe::Path& path); MAYAUSD_CORE_PUBLIC SdfLayerHandle defPrimSpecLayer(const UsdPrim& prim); +//! Check if the target layer has any opinions that affects a particular prim +MAYAUSD_CORE_PUBLIC +bool isTargetLayerHaveOpinion(const UsdPrim& prim); + +//! Return the target layer that has any opinions on a particular prim +MAYAUSD_CORE_PUBLIC +SdfLayerHandle targetLayerWithOpion(const UsdPrim& prim); + MAYAUSD_CORE_PUBLIC UsdSceneItem::Ptr createSiblingSceneItem(const Ufe::Path& ufeSrcPath, const std::string& siblingName); From 54166d2b6bc28cef8e7dcf35f78958174e5e51ca Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Thu, 30 Apr 2020 14:01:31 -0400 Subject: [PATCH 02/28] Address feedbacks: - renamed usd utility functions related to "usd" and "sdf" operations - moved usd utility functions from mayaUsd\ufe\Utils.h to usd\utils\util.h under MayaUsdUtils namespace. - cleaned up variable names according to c++ guideline. --- lib/mayaUsd/CMakeLists.txt | 1 + lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp | 48 +++++++------- lib/mayaUsd/ufe/UsdUndoRenameCommand.h | 14 ++-- lib/mayaUsd/ufe/Utils.cpp | 53 ---------------- lib/mayaUsd/ufe/Utils.h | 12 ---- lib/usd/utils/CMakeLists.txt | 3 + lib/usd/utils/util.cpp | 81 ++++++++++++++++++++++++ lib/usd/utils/util.h | 42 ++++++++++++ 8 files changed, 160 insertions(+), 94 deletions(-) create mode 100644 lib/usd/utils/util.cpp create mode 100644 lib/usd/utils/util.h diff --git a/lib/mayaUsd/CMakeLists.txt b/lib/mayaUsd/CMakeLists.txt index b0bb455236..3dbb8ec6b9 100644 --- a/lib/mayaUsd/CMakeLists.txt +++ b/lib/mayaUsd/CMakeLists.txt @@ -109,6 +109,7 @@ target_link_libraries(${PROJECT_NAME} vt $<$:${UFE_LIBRARY}> ${MAYA_LIBRARIES} + mayaUsdUtils PRIVATE Boost::filesystem Boost::system diff --git a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp index cfda8ea878..5b1f387a54 100644 --- a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp +++ b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp @@ -26,6 +26,8 @@ #include +#include + #include "private/InPathChange.h" #ifdef UFE_V2_FEATURES_AVAILABLE @@ -42,23 +44,23 @@ UsdUndoRenameCommand::UsdUndoRenameCommand(const UsdSceneItem::Ptr& srcItem, con : Ufe::UndoableCommand() { const UsdPrim& prim = srcItem->prim(); - m_fStage = prim.GetStage(); - m_fUfeSrcItem = srcItem; - m_fUsdSrcPath = prim.GetPath(); + _stage = prim.GetStage(); + _ufeSrcItem = srcItem; + _usdSrcPath = prim.GetPath(); // Every call to rename() (through execute(), undo() or redo()) removes // a prim, which becomes expired. Since USD UFE scene items contain a // prim, we must recreate them after every call to rename. - m_fUsdDstPath = prim.GetParent().GetPath().AppendChild(TfToken(newName.string())); - m_fLayer = defPrimSpecLayer(prim); - if (!m_fLayer) { + _usdDstPath = prim.GetParent().GetPath().AppendChild(TfToken(newName.string())); + _layer = MayaUsdUtils::defPrimSpecLayer(prim); + if (!_layer) { std::string err = TfStringPrintf("No prim found at %s", prim.GetPath().GetString().c_str()); throw std::runtime_error(err.c_str()); } - // check if the target layer has any opinions that affects selected prim - if (!isTargetLayerHaveOpinion(prim)) { - auto possibleTargetLayer = targetLayerWithOpion(prim); + // check if a layer has any opinions that affects selected prim + if (!MayaUsdUtils::doesLayerHavePrimSpec(prim)) { + auto possibleTargetLayer = MayaUsdUtils::strongestLayerWithPrimSpec(prim); std::string err = TfStringPrintf("Unable to rename [%s] on current target layer, " "Please set [%s] as the target layer to proceed", prim.GetName().GetString(), @@ -79,7 +81,7 @@ UsdUndoRenameCommand::Ptr UsdUndoRenameCommand::create(const UsdSceneItem::Ptr& UsdSceneItem::Ptr UsdUndoRenameCommand::renamedItem() const { - return m_fUfeDstItem; + return _ufeDstItem; } bool UsdUndoRenameCommand::renameRedo() @@ -89,10 +91,10 @@ bool UsdUndoRenameCommand::renameRedo() // We use the source layer as the destination. An alternate workflow // would be the edit target layer be the destination: // layer = self.fStage.GetEditTarget().GetLayer() - bool status = SdfCopySpec(m_fLayer, m_fUsdSrcPath, m_fLayer, m_fUsdDstPath); + bool status = SdfCopySpec(_layer, _usdSrcPath, _layer, _usdDstPath); if (status) { - auto srcPrim = m_fStage->GetPrimAtPath(m_fUsdSrcPath); + auto srcPrim = _stage->GetPrimAtPath(_usdSrcPath); #ifdef UFE_V2_FEATURES_AVAILABLE UFE_ASSERT_MSG(srcPrim, "Invalid prim cannot be inactivated."); #else @@ -102,17 +104,17 @@ bool UsdUndoRenameCommand::renameRedo() if (status) { // The renamed scene item is a "sibling" of its original name. - auto ufeSrcPath = m_fUfeSrcItem->path(); - m_fUfeDstItem = createSiblingSceneItem( - ufeSrcPath, m_fUsdDstPath.GetElementString()); + auto ufeSrcPath = _ufeSrcItem->path(); + _ufeDstItem = createSiblingSceneItem( + ufeSrcPath, _usdDstPath.GetElementString()); - Ufe::ObjectRename notification(m_fUfeDstItem, ufeSrcPath); + Ufe::ObjectRename notification(_ufeDstItem, ufeSrcPath); Ufe::Scene::notifyObjectPathChange(notification); } } else { UFE_LOG(std::string("Warning: SdfCopySpec(") + - m_fUsdSrcPath.GetString() + std::string(") failed.")); + _usdSrcPath.GetString() + std::string(") failed.")); } return status; @@ -125,11 +127,11 @@ bool UsdUndoRenameCommand::renameUndo() // Regardless of where the edit target is currently set, switch to the // layer where we copied the source prim into the destination, then // restore the edit target. - UsdEditContext ctx(m_fStage, m_fLayer); - status = m_fStage->RemovePrim(m_fUsdDstPath); + UsdEditContext ctx(_stage, _layer); + status = _stage->RemovePrim(_usdDstPath); } if (status) { - auto srcPrim = m_fStage->GetPrimAtPath(m_fUsdSrcPath); + auto srcPrim = _stage->GetPrimAtPath(_usdSrcPath); #ifdef UFE_V2_FEATURES_AVAILABLE UFE_ASSERT_MSG(srcPrim, "Invalid prim cannot be activated."); #else @@ -138,14 +140,14 @@ bool UsdUndoRenameCommand::renameUndo() status = srcPrim.SetActive(true); if (status) { - Ufe::ObjectRename notification(m_fUfeSrcItem, m_fUfeDstItem->path()); + Ufe::ObjectRename notification(_ufeSrcItem, _ufeDstItem->path()); Ufe::Scene::notifyObjectPathChange(notification); - m_fUfeDstItem = nullptr; + _ufeDstItem = nullptr; } } else { UFE_LOG(std::string("Warning: RemovePrim(") + - m_fUsdDstPath.GetString() + std::string(") failed.")); + _usdDstPath.GetString() + std::string(") failed.")); } return status; diff --git a/lib/mayaUsd/ufe/UsdUndoRenameCommand.h b/lib/mayaUsd/ufe/UsdUndoRenameCommand.h index 3b3b71457b..17a5a60635 100644 --- a/lib/mayaUsd/ufe/UsdUndoRenameCommand.h +++ b/lib/mayaUsd/ufe/UsdUndoRenameCommand.h @@ -59,12 +59,14 @@ class MAYAUSD_CORE_PUBLIC UsdUndoRenameCommand : public Ufe::UndoableCommand bool renameRedo(); bool renameUndo(); - UsdStageWeakPtr m_fStage; - SdfLayerHandle m_fLayer; - UsdSceneItem::Ptr m_fUfeSrcItem; - SdfPath m_fUsdSrcPath; - UsdSceneItem::Ptr m_fUfeDstItem; - SdfPath m_fUsdDstPath; + UsdStageWeakPtr _stage; + SdfLayerHandle _layer; + + UsdSceneItem::Ptr _ufeSrcItem; + SdfPath _usdSrcPath; + + UsdSceneItem::Ptr _ufeDstItem; + SdfPath _usdDstPath; }; // UsdUndoRenameCommand diff --git a/lib/mayaUsd/ufe/Utils.cpp b/lib/mayaUsd/ufe/Utils.cpp index e3f08d2d22..a370845578 100644 --- a/lib/mayaUsd/ufe/Utils.cpp +++ b/lib/mayaUsd/ufe/Utils.cpp @@ -101,59 +101,6 @@ bool isRootChild(const Ufe::Path& path) return(segments[1].size() == 1); } -SdfLayerHandle defPrimSpecLayer(const UsdPrim& prim) -{ - // Iterate over the layer stack, starting at the highest-priority layer. - // The source layer is the one in which there exists a def primSpec, not - // an over. - - SdfLayerHandle defLayer; - auto layerStack = prim.GetStage()->GetLayerStack(); - - for (auto layer : layerStack) - { - auto primSpec = layer->GetPrimAtPath(prim.GetPath()); - if (primSpec && (primSpec->GetSpecifier() == SdfSpecifierDef)) - { - defLayer = layer; - break; - } - } - return defLayer; -} - -bool isTargetLayerHaveOpinion(const UsdPrim& prim) -{ - auto editTarget = prim.GetStage()->GetEditTarget(); - auto layer = editTarget.GetLayer(); - auto primSpec = layer->GetPrimAtPath(prim.GetPath()); - - // to know whether the target layer contains any opinions that - // affect a particular prim, there must be a primSpec for that prim - if (!primSpec) { - return false; - } - - return true; -} - -SdfLayerHandle targetLayerWithOpion(const UsdPrim& prim) -{ - SdfLayerHandle targetLayer; - auto layerStack = prim.GetStage()->GetLayerStack(); - for (auto layer : layerStack) - { - // to know whether the target layer contains any opinions that - // affect a particular prim, there must be a primSpec for that prim - auto primSpec = layer->GetPrimAtPath(prim.GetPath()); - if (primSpec) { - targetLayer = layer; - break; - } - } - return targetLayer; -} - UsdSceneItem::Ptr createSiblingSceneItem(const Ufe::Path& ufeSrcPath, const std::string& siblingName) { auto ufeSiblingPath = ufeSrcPath.sibling(Ufe::PathComponent(siblingName)); diff --git a/lib/mayaUsd/ufe/Utils.h b/lib/mayaUsd/ufe/Utils.h index a103c5a5f5..74d3814dd9 100644 --- a/lib/mayaUsd/ufe/Utils.h +++ b/lib/mayaUsd/ufe/Utils.h @@ -52,18 +52,6 @@ UsdPrim ufePathToPrim(const Ufe::Path& path); MAYAUSD_CORE_PUBLIC bool isRootChild(const Ufe::Path& path); -//! Return the highest-priority layer where the prim has a def primSpec. -MAYAUSD_CORE_PUBLIC -SdfLayerHandle defPrimSpecLayer(const UsdPrim& prim); - -//! Check if the target layer has any opinions that affects a particular prim -MAYAUSD_CORE_PUBLIC -bool isTargetLayerHaveOpinion(const UsdPrim& prim); - -//! Return the target layer that has any opinions on a particular prim -MAYAUSD_CORE_PUBLIC -SdfLayerHandle targetLayerWithOpion(const UsdPrim& prim); - MAYAUSD_CORE_PUBLIC UsdSceneItem::Ptr createSiblingSceneItem(const Ufe::Path& ufeSrcPath, const std::string& siblingName); diff --git a/lib/usd/utils/CMakeLists.txt b/lib/usd/utils/CMakeLists.txt index b850617749..7a7af59f15 100644 --- a/lib/usd/utils/CMakeLists.txt +++ b/lib/usd/utils/CMakeLists.txt @@ -9,6 +9,7 @@ target_sources(${TARGET_NAME} PRIVATE DebugCodes.cpp DiffCore.cpp + util.cpp ) # ----------------------------------------------------------------------------- @@ -38,6 +39,7 @@ target_link_libraries(${TARGET_NAME} PUBLIC gf usd + sdf ) # ----------------------------------------------------------------------------- @@ -50,6 +52,7 @@ set(headers DiffCore.h ForwardDeclares.h SIMD.h + util.h ) mayaUsd_promoteHeaderList( diff --git a/lib/usd/utils/util.cpp b/lib/usd/utils/util.cpp new file mode 100644 index 0000000000..90a055e61d --- /dev/null +++ b/lib/usd/utils/util.cpp @@ -0,0 +1,81 @@ +// +// 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 "util.h" + +#include +#include +#include + +PXR_NAMESPACE_USING_DIRECTIVE + +namespace MayaUsdUtils { + +SdfLayerHandle +defPrimSpecLayer(const UsdPrim& prim) +{ + // Iterate over the layer stack, starting at the highest-priority layer. + // The source layer is the one in which there exists a def primSpec, not + // an over. + + SdfLayerHandle defLayer; + auto layerStack = prim.GetStage()->GetLayerStack(); + + for (auto layer : layerStack) { + auto primSpec = layer->GetPrimAtPath(prim.GetPath()); + if (primSpec && (primSpec->GetSpecifier() == SdfSpecifierDef)) { + defLayer = layer; + break; + } + } + return defLayer; +} + +bool +MayaUsdUtils::doesLayerHavePrimSpec(const UsdPrim& prim) +{ + auto editTarget = prim.GetStage()->GetEditTarget(); + auto layer = editTarget.GetLayer(); + auto primSpec = layer->GetPrimAtPath(prim.GetPath()); + + // to know whether the target layer contains any opinions that + // affect a particular prim, there must be a primSpec for that prim + if (!primSpec) { + return false; + } + + return true; +} + +SdfLayerHandle +MayaUsdUtils::strongestLayerWithPrimSpec(const UsdPrim& prim) +{ + SdfLayerHandle targetLayer; + auto layerStack = prim.GetStage()->GetLayerStack(); + for (auto layer : layerStack) + { + // to know whether the target layer contains any opinions that + // affect a particular prim, there must be a primSpec for that prim + auto primSpec = layer->GetPrimAtPath(prim.GetPath()); + if (primSpec) { + targetLayer = layer; + break; + } + } + return targetLayer; +} + +} // MayaUsdUtils \ No newline at end of file diff --git a/lib/usd/utils/util.h b/lib/usd/utils/util.h new file mode 100644 index 0000000000..88d05df0a9 --- /dev/null +++ b/lib/usd/utils/util.h @@ -0,0 +1,42 @@ +// +// 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. +// + +#ifndef MAYAUSDUTILS_UTIL_H +#define MAYAUSDUTILS_UTIL_H + +#include + +#include + +PXR_NAMESPACE_USING_DIRECTIVE + +namespace MayaUsdUtils { + + //! Return the highest-priority layer where the prim has a def primSpec. + MAYA_USD_UTILS_PUBLIC + SdfLayerHandle defPrimSpecLayer(const UsdPrim&); + + //! Check if a layer has any opinions that affects a particular prim + MAYA_USD_UTILS_PUBLIC + bool doesLayerHavePrimSpec(const UsdPrim&); + + //! Return the layer that has any opinions on a particular prim + MAYA_USD_UTILS_PUBLIC + SdfLayerHandle strongestLayerWithPrimSpec(const UsdPrim&); + +} // namespace MayaUsdUtils + +#endif // MAYAUSDUTILS_UTIL_H \ No newline at end of file From 8f8295f3b85742d4a9e112570c81cff72d62a6cd Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Fri, 1 May 2020 15:45:38 -0400 Subject: [PATCH 03/28] First attempt to handle following scenario: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Error if object to rename has ANY definitions or overs on ANY stronger or weaker layers. This is the most restrictive we can be. We will revisit how much we loosen this up later. Cannot rename a prim with definitions or opinions on other layers. Opinions exist in [layer name 1], [layer name 2], [layer name 3], [layer name 4],etc...” --- lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp | 21 ++++++++++++++++++--- lib/usd/utils/util.cpp | 23 ++++++++++++++++++++--- lib/usd/utils/util.h | 4 ++++ 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp index 5b1f387a54..77d3491d14 100644 --- a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp +++ b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp @@ -47,7 +47,7 @@ UsdUndoRenameCommand::UsdUndoRenameCommand(const UsdSceneItem::Ptr& srcItem, con _stage = prim.GetStage(); _ufeSrcItem = srcItem; _usdSrcPath = prim.GetPath(); - + // Every call to rename() (through execute(), undo() or redo()) removes // a prim, which becomes expired. Since USD UFE scene items contain a // prim, we must recreate them after every call to rename. @@ -58,15 +58,30 @@ UsdUndoRenameCommand::UsdUndoRenameCommand(const UsdSceneItem::Ptr& srcItem, con throw std::runtime_error(err.c_str()); } - // check if a layer has any opinions that affects selected prim + // if the current layer doesn't have any opinions that affects selected prim if (!MayaUsdUtils::doesLayerHavePrimSpec(prim)) { auto possibleTargetLayer = MayaUsdUtils::strongestLayerWithPrimSpec(prim); - std::string err = TfStringPrintf("Unable to rename [%s] on current target layer, " + std::string err = TfStringPrintf("Cannot rename [%s] defined on another layer. " "Please set [%s] as the target layer to proceed", prim.GetName().GetString(), possibleTargetLayer->GetDisplayName()); throw std::runtime_error(err.c_str()); } + else + { + auto layers = MayaUsdUtils::layersWithOpinion(prim); + + if (layers.size() > 1) { + std::string layerNames; + for (auto layer : layers) { + layerNames.append("[" + layer->GetDisplayName() + "]" + ","); + } + layerNames.pop_back(); + std::string err = TfStringPrintf("Cannot rename [%s] with definitions or opinions on other layers. " + "Opinions exist in %s", prim.GetName().GetString(), layerNames); + throw std::runtime_error(err.c_str()); + } + } } UsdUndoRenameCommand::~UsdUndoRenameCommand() diff --git a/lib/usd/utils/util.cpp b/lib/usd/utils/util.cpp index 90a055e61d..5b1a5bf931 100644 --- a/lib/usd/utils/util.cpp +++ b/lib/usd/utils/util.cpp @@ -20,6 +20,8 @@ #include #include +#include + PXR_NAMESPACE_USING_DIRECTIVE namespace MayaUsdUtils { @@ -44,8 +46,23 @@ defPrimSpecLayer(const UsdPrim& prim) return defLayer; } +std::vector +layersWithOpinion(const UsdPrim& prim) +{ + // get the list of PrimSpecs that provide opinions for this prim + // ordered from strongest to weakest opinion. + const auto& primStack = prim.GetPrimStack(); + + std::vector layersWithOpion; + for (auto primSpec : primStack) { + layersWithOpion.emplace_back(primSpec->GetLayer()); + } + + return layersWithOpion; +} + bool -MayaUsdUtils::doesLayerHavePrimSpec(const UsdPrim& prim) +doesLayerHavePrimSpec(const UsdPrim& prim) { auto editTarget = prim.GetStage()->GetEditTarget(); auto layer = editTarget.GetLayer(); @@ -61,7 +78,7 @@ MayaUsdUtils::doesLayerHavePrimSpec(const UsdPrim& prim) } SdfLayerHandle -MayaUsdUtils::strongestLayerWithPrimSpec(const UsdPrim& prim) +strongestLayerWithPrimSpec(const UsdPrim& prim) { SdfLayerHandle targetLayer; auto layerStack = prim.GetStage()->GetLayerStack(); @@ -78,4 +95,4 @@ MayaUsdUtils::strongestLayerWithPrimSpec(const UsdPrim& prim) return targetLayer; } -} // MayaUsdUtils \ No newline at end of file +} // MayaUsdUtils diff --git a/lib/usd/utils/util.h b/lib/usd/utils/util.h index 88d05df0a9..0720332a1b 100644 --- a/lib/usd/utils/util.h +++ b/lib/usd/utils/util.h @@ -29,6 +29,10 @@ namespace MayaUsdUtils { MAYA_USD_UTILS_PUBLIC SdfLayerHandle defPrimSpecLayer(const UsdPrim&); + //! Return a list of layers in strength order that have opinions on a prim + MAYA_USD_UTILS_PUBLIC + std::vector layersWithOpinion(const UsdPrim&); + //! Check if a layer has any opinions that affects a particular prim MAYA_USD_UTILS_PUBLIC bool doesLayerHavePrimSpec(const UsdPrim&); From e21a13037dd02855ab78a09316ada2d0fcef8faf Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Mon, 4 May 2020 08:39:36 -0400 Subject: [PATCH 04/28] Fix compiler errors. --- lib/mayaUsd/ufe/UsdHierarchy.cpp | 4 +++- lib/mayaUsd/ufe/UsdUndoDuplicateCommand.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/mayaUsd/ufe/UsdHierarchy.cpp b/lib/mayaUsd/ufe/UsdHierarchy.cpp index 8978a2553e..d4fad0d284 100644 --- a/lib/mayaUsd/ufe/UsdHierarchy.cpp +++ b/lib/mayaUsd/ufe/UsdHierarchy.cpp @@ -30,6 +30,8 @@ #include +#include + #include "private/InPathChange.h" #include "private/Utils.h" @@ -134,7 +136,7 @@ Ufe::AppendedChild UsdHierarchy::appendChild(const Ufe::SceneItem::Ptr& child) auto usdSrcPath = prim.GetPath(); auto ufeDstPath = fItem->path() + childName; auto usdDstPath = fPrim.GetPath().AppendChild(TfToken(childName)); - SdfLayerHandle layer = defPrimSpecLayer(prim); + SdfLayerHandle layer = MayaUsdUtils::defPrimSpecLayer(prim); if (!layer) { std::string err = TfStringPrintf("No prim found at %s", usdSrcPath.GetString().c_str()); throw std::runtime_error(err.c_str()); diff --git a/lib/mayaUsd/ufe/UsdUndoDuplicateCommand.cpp b/lib/mayaUsd/ufe/UsdUndoDuplicateCommand.cpp index d394118523..f1f28e01ac 100644 --- a/lib/mayaUsd/ufe/UsdUndoDuplicateCommand.cpp +++ b/lib/mayaUsd/ufe/UsdUndoDuplicateCommand.cpp @@ -25,6 +25,8 @@ #include +#include + MAYAUSD_NS_DEF { namespace ufe { @@ -73,7 +75,7 @@ void UsdUndoDuplicateCommand::primInfo(const UsdPrim& srcPrim, SdfPath& usdDstPa // each layer in which there is an over or a def, until we reach the // layer with a def primSpec. This would preserve the visual appearance // of the duplicate. PPT, 12-Jun-2018. - srcLayer = defPrimSpecLayer(srcPrim); + srcLayer = MayaUsdUtils::defPrimSpecLayer(srcPrim); if (!srcLayer) { std::string err = TfStringPrintf("No prim found at %s", srcPrim.GetPath().GetString().c_str()); throw std::runtime_error(err.c_str()); From 4c67b698066f1e18b8c40caf6e3a1158066c52d2 Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Mon, 4 May 2020 11:28:55 -0400 Subject: [PATCH 05/28] Address Feedbacks: rename functions and variables to read better. --- lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp | 14 +++++++------- lib/usd/utils/util.cpp | 12 ++++++------ lib/usd/utils/util.h | 10 +++++----- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp index 77d3491d14..72f0a958a7 100644 --- a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp +++ b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp @@ -48,7 +48,7 @@ UsdUndoRenameCommand::UsdUndoRenameCommand(const UsdSceneItem::Ptr& srcItem, con _ufeSrcItem = srcItem; _usdSrcPath = prim.GetPath(); - // Every call to rename() (through execute(), undo() or redo()) removes + // Every call to rename() (through execute(), undo() or redo()) removes // a prim, which becomes expired. Since USD UFE scene items contain a // prim, we must recreate them after every call to rename. _usdDstPath = prim.GetParent().GetPath().AppendChild(TfToken(newName.string())); @@ -59,7 +59,7 @@ UsdUndoRenameCommand::UsdUndoRenameCommand(const UsdSceneItem::Ptr& srcItem, con } // if the current layer doesn't have any opinions that affects selected prim - if (!MayaUsdUtils::doesLayerHavePrimSpec(prim)) { + if (!MayaUsdUtils::doesEditTargetLayerHavePrimSpec(prim)) { auto possibleTargetLayer = MayaUsdUtils::strongestLayerWithPrimSpec(prim); std::string err = TfStringPrintf("Cannot rename [%s] defined on another layer. " "Please set [%s] as the target layer to proceed", @@ -69,16 +69,16 @@ UsdUndoRenameCommand::UsdUndoRenameCommand(const UsdSceneItem::Ptr& srcItem, con } else { - auto layers = MayaUsdUtils::layersWithOpinion(prim); + auto layers = MayaUsdUtils::layersWithPrimSpec(prim); if (layers.size() > 1) { - std::string layerNames; + std::string layerDisplayNames; for (auto layer : layers) { - layerNames.append("[" + layer->GetDisplayName() + "]" + ","); + layerDisplayNames.append("[" + layer->GetDisplayName() + "]" + ","); } - layerNames.pop_back(); + layerDisplayNames.pop_back(); std::string err = TfStringPrintf("Cannot rename [%s] with definitions or opinions on other layers. " - "Opinions exist in %s", prim.GetName().GetString(), layerNames); + "Opinions exist in %s", prim.GetName().GetString(), layerDisplayNames); throw std::runtime_error(err.c_str()); } } diff --git a/lib/usd/utils/util.cpp b/lib/usd/utils/util.cpp index 5b1a5bf931..507eb654c6 100644 --- a/lib/usd/utils/util.cpp +++ b/lib/usd/utils/util.cpp @@ -47,22 +47,22 @@ defPrimSpecLayer(const UsdPrim& prim) } std::vector -layersWithOpinion(const UsdPrim& prim) +layersWithPrimSpec(const UsdPrim& prim) { // get the list of PrimSpecs that provide opinions for this prim - // ordered from strongest to weakest opinion. + // ordered from strongest to weakest. const auto& primStack = prim.GetPrimStack(); - std::vector layersWithOpion; + std::vector layersWithPrimSpec; for (auto primSpec : primStack) { - layersWithOpion.emplace_back(primSpec->GetLayer()); + layersWithPrimSpec.emplace_back(primSpec->GetLayer()); } - return layersWithOpion; + return layersWithPrimSpec; } bool -doesLayerHavePrimSpec(const UsdPrim& prim) +doesEditTargetLayerHavePrimSpec(const UsdPrim& prim) { auto editTarget = prim.GetStage()->GetEditTarget(); auto layer = editTarget.GetLayer(); diff --git a/lib/usd/utils/util.h b/lib/usd/utils/util.h index 0720332a1b..09190eb39d 100644 --- a/lib/usd/utils/util.h +++ b/lib/usd/utils/util.h @@ -29,15 +29,15 @@ namespace MayaUsdUtils { MAYA_USD_UTILS_PUBLIC SdfLayerHandle defPrimSpecLayer(const UsdPrim&); - //! Return a list of layers in strength order that have opinions on a prim + //! Return a list of layers in strength order that have opinions on the argument prim. MAYA_USD_UTILS_PUBLIC - std::vector layersWithOpinion(const UsdPrim&); + std::vector layersWithPrimSpec(const UsdPrim&); - //! Check if a layer has any opinions that affects a particular prim + //! Check if a layer has any opinions that affects on the argument prim. MAYA_USD_UTILS_PUBLIC - bool doesLayerHavePrimSpec(const UsdPrim&); + bool doesEditTargetLayerHavePrimSpec(const UsdPrim&); - //! Return the layer that has any opinions on a particular prim + //! Return the strongest layer that has an opinion on the argument prim. MAYA_USD_UTILS_PUBLIC SdfLayerHandle strongestLayerWithPrimSpec(const UsdPrim&); From 97996bbcf61a316522809c1229e0e0df7b0db554 Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Tue, 5 May 2020 10:28:21 -0400 Subject: [PATCH 06/28] - Added two new test cases for rename restriction operations. - edited code logics in testRename to use usdCylinder.ma scene since with new rename restrictions top_layer.ma doesn't meet the requirements for testing undo/redo - refactored code around opening maya test scenes and introduced three utility functions (openCylinderScene, openTwoSpheresScene, openSphereAnimatedRadiusScene) --- test/lib/ufe/testMatrices.py | 5 +- test/lib/ufe/testObject3d.py | 7 +- test/lib/ufe/testRename.py | 100 ++++++++++++++++++++----- test/lib/ufe/testRotatePivot.py | 8 +- test/lib/ufe/ufeTestUtils/mayaUtils.py | 13 +++- 5 files changed, 99 insertions(+), 34 deletions(-) diff --git a/test/lib/ufe/testMatrices.py b/test/lib/ufe/testMatrices.py index e7a8ac648e..cc405b8d8e 100644 --- a/test/lib/ufe/testMatrices.py +++ b/test/lib/ufe/testMatrices.py @@ -62,9 +62,8 @@ def setUp(self): # Load plugins self.assertTrue(self.pluginsLoaded) - # Read in a simple USD scene: a mesh cylinder at the origin. - filePath = os.path.join(os.path.dirname(os.path.realpath(__file__)), "test-samples", "cylinder", "usdCylinder.ma" ) - cmds.file(filePath, force=True, open=True) + # Open usdCylinder.ma scene in test-samples + mayaUtils.openCylinderScene() def assertMatrixAlmostEqual(self, ma, mb): for ra, rb in zip(ma, mb): diff --git a/test/lib/ufe/testObject3d.py b/test/lib/ufe/testObject3d.py index 561027ec65..547c8b6b6f 100644 --- a/test/lib/ufe/testObject3d.py +++ b/test/lib/ufe/testObject3d.py @@ -121,11 +121,8 @@ def testBoundingBox(self): def testAnimatedBoundingBox(self): '''Test the Object3d bounding box interface for animated geometry.''' - # Load up a scene with a sphere that has an animated radius, with - # time connected to the proxy shape. - filePath = os.path.join(os.path.dirname(os.path.realpath(__file__)), "test-samples", "sphereAnimatedRadius", "sphereAnimatedRadiusProxyShape.ma" ) - - cmds.file(filePath, force=True, open=True) + # Open sphereAnimatedRadiusProxyShape.ma scene in test-samples + mayaUtils.openSphereAnimatedRadiusScene() # The extents of the sphere are copied from the .usda file. expected = [ diff --git a/test/lib/ufe/testRename.py b/test/lib/ufe/testRename.py index da86e5c409..6b621277ae 100644 --- a/test/lib/ufe/testRename.py +++ b/test/lib/ufe/testRename.py @@ -98,29 +98,46 @@ def assertStageAndPrimAccess( def testRename(self): '''Rename USD node.''' - # Select a USD object. - ball35Path = ufe.Path([ - mayaUtils.createUfePathSegment( - "|world|transform1|proxyShape1"), - usdUtils.createUfePathSegment("/Room_set/Props/Ball_35")]) - ball35Item = ufe.Hierarchy.createItem(ball35Path) - ball35Hierarchy = ufe.Hierarchy.hierarchy(ball35Item) - propsItem = ball35Hierarchy.parent() + # open usdCylinder.ma scene in test-samples + mayaUtils.openCylinderScene() + + # clear selection to start off + cmds.select(clear=True) + + # select a USD object. + mayaPathSegment = mayaUtils.createUfePathSegment('|world|mayaUsdTransform|shape') + usdPathSegment = usdUtils.createUfePathSegment('/pCylinder1') + cylinderPath = ufe.Path([mayaPathSegment, usdPathSegment]) + cylinderItem = ufe.Hierarchy.createItem(cylinderPath) + cylinderHierarchy = ufe.Hierarchy.hierarchy(cylinderItem) + propsItem = cylinderHierarchy.parent() propsHierarchy = ufe.Hierarchy.hierarchy(propsItem) propsChildrenPre = propsHierarchy.children() - ufe.GlobalSelection.get().append(ball35Item) + ufe.GlobalSelection.get().append(cylinderItem) + + # get the USD stage + stage = mayaUsd.ufe.getStage(str(mayaPathSegment)) - newName = 'Ball_35_Renamed' + # check GetLayerStack behavior + self.assertEqual(stage.GetLayerStack()[0], stage.GetSessionLayer()) + self.assertEqual(stage.GetEditTarget().GetLayer(), stage.GetSessionLayer()) + + # set the edit target to the root layer + stage.SetEditTarget(stage.GetRootLayer()) + self.assertEqual(stage.GetEditTarget().GetLayer(), stage.GetRootLayer()) + + # rename + newName = 'pCylinder1_Renamed' cmds.rename(newName) # The renamed item is in the selection. snIter = iter(ufe.GlobalSelection.get()) - ball35RenItem = next(snIter) - ball35RenName = str(ball35RenItem.path().back()) + pCylinder1Item = next(snIter) + pCylinder1RenName = str(pCylinder1Item.path().back()) - self.assertEqual(ball35RenName, newName) + self.assertEqual(pCylinder1RenName, newName) # MAYA-92350: should not need to re-bind hierarchy interface objects # with their item. @@ -128,19 +145,19 @@ def testRename(self): propsChildren = propsHierarchy.children() self.assertEqual(len(propsChildren), len(propsChildrenPre)) - self.assertIn(ball35RenItem, propsChildren) + self.assertIn(pCylinder1Item, propsChildren) cmds.undo() def childrenNames(children): - return [str(child.path().back()) for child in children] + return [str(child.path().back()) for child in children] propsHierarchy = ufe.Hierarchy.hierarchy(propsItem) propsChildren = propsHierarchy.children() propsChildrenNames = childrenNames(propsChildren) - self.assertNotIn(ball35RenName, propsChildrenNames) - self.assertIn('Ball_35', propsChildrenNames) + self.assertNotIn(pCylinder1RenName, propsChildrenNames) + self.assertIn('pCylinder1', propsChildrenNames) self.assertEqual(len(propsChildren), len(propsChildrenPre)) cmds.redo() @@ -149,7 +166,52 @@ def childrenNames(children): propsChildren = propsHierarchy.children() propsChildrenNames = childrenNames(propsChildren) - self.assertIn(ball35RenName, propsChildrenNames) - self.assertNotIn('Ball_35', propsChildrenNames) + self.assertIn(pCylinder1RenName, propsChildrenNames) + self.assertNotIn('pCylinder1', propsChildrenNames) self.assertEqual(len(propsChildren), len(propsChildrenPre)) + def testRenameRestriction(self): + '''Restrict renaming USD node. Cannot rename a prim defined on another layer.''' + + # select a USD object. + mayaPathSegment = mayaUtils.createUfePathSegment('|world|transform1|proxyShape1') + usdPathSegment = usdUtils.createUfePathSegment('/Room_set/Props/Ball_35') + ball35Path = ufe.Path([mayaPathSegment, usdPathSegment]) + ball35Item = ufe.Hierarchy.createItem(ball35Path) + + ufe.GlobalSelection.get().append(ball35Item) + + # get the USD stage + stage = mayaUsd.ufe.getStage(str(mayaPathSegment)) + + # check GetLayerStack behavior + self.assertEqual(stage.GetLayerStack()[0], stage.GetSessionLayer()) + self.assertEqual(stage.GetEditTarget().GetLayer(), stage.GetSessionLayer()) + + # expect the exception happens + with self.assertRaises(RuntimeError): + newName = 'Ball_35_Renamed' + cmds.rename(newName) + + def testRenameRestriction2(self): + '''Restrict renaming USD node. Cannot rename a prim with definitions or opinions on other layers.''' + + # select a USD object. + mayaPathSegment = mayaUtils.createUfePathSegment('|world|transform1|proxyShape1') + usdPathSegment = usdUtils.createUfePathSegment('/Room_set/Props/Ball_35') + ball35Path = ufe.Path([mayaPathSegment, usdPathSegment]) + ball35Item = ufe.Hierarchy.createItem(ball35Path) + + ufe.GlobalSelection.get().append(ball35Item) + + # get the USD stage + stage = mayaUsd.ufe.getStage(str(mayaPathSegment)) + + # set the edit target to Assembly_room_set.usda + stage.SetEditTarget(stage.GetLayerStack()[2]) + self.assertEqual(stage.GetEditTarget().GetLayer().GetDisplayName(), "Assembly_room_set.usda") + + # expect the exception happens + with self.assertRaises(RuntimeError): + newName = 'Ball_35_Renamed' + cmds.rename(newName) diff --git a/test/lib/ufe/testRotatePivot.py b/test/lib/ufe/testRotatePivot.py index 585e87d454..1d76fd4006 100644 --- a/test/lib/ufe/testRotatePivot.py +++ b/test/lib/ufe/testRotatePivot.py @@ -62,12 +62,8 @@ def setUp(self): # Load plugins self.assertTrue(self.pluginsLoaded) - # Create a simple USD scene. Ideally this would be done - # programmatically, but as of 28-Jun-2018 attempts to do so have - # resulted in a file that crashes Maya on pickWalk of the scene. - # Use a saved scene read from file instead. - filePath = os.path.join(os.path.dirname(os.path.realpath(__file__)), "test-samples", "twoSpheres", "twoSpheres.ma" ) - cmds.file(filePath, force=True, open=True) + # Open twoSpheres.ma scene in test-samples + mayaUtils.openTwoSpheresScene() def testRotatePivot(self): # mayaSphere is at (10, 0, 10) in local space, and since it has no diff --git a/test/lib/ufe/ufeTestUtils/mayaUtils.py b/test/lib/ufe/ufeTestUtils/mayaUtils.py index 258697f02f..3bc70525aa 100644 --- a/test/lib/ufe/ufeTestUtils/mayaUtils.py +++ b/test/lib/ufe/ufeTestUtils/mayaUtils.py @@ -126,4 +126,15 @@ def openTopLayerScene(): # Open top_layer file which contains the USD scene filePath = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "test-samples", "ballset", "StandaloneScene", "top_layer.ma" ) cmds.file(filePath, force=True, open=True) - + +def openCylinderScene(): + filePath = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "test-samples", "cylinder", "usdCylinder.ma" ) + cmds.file(filePath, force=True, open=True) + +def openTwoSpheresScene(): + filePath = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "test-samples", "twoSpheres", "twoSpheres.ma" ) + cmds.file(filePath, force=True, open=True) + +def openSphereAnimatedRadiusScene(): + filePath = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "test-samples", "sphereAnimatedRadius", "sphereAnimatedRadiusProxyShape.ma" ) + cmds.file(filePath, force=True, open=True) From 581932b82e3053af6cebad02c829fb36263c15a6 Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Tue, 5 May 2020 11:14:47 -0400 Subject: [PATCH 07/28] Address feedback: rename test case names to something more meaningful. --- test/lib/ufe/testRename.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/lib/ufe/testRename.py b/test/lib/ufe/testRename.py index 6b621277ae..4ff3e52761 100644 --- a/test/lib/ufe/testRename.py +++ b/test/lib/ufe/testRename.py @@ -170,7 +170,7 @@ def childrenNames(children): self.assertNotIn('pCylinder1', propsChildrenNames) self.assertEqual(len(propsChildren), len(propsChildrenPre)) - def testRenameRestriction(self): + def testRenameRestrictionSameLayerDef(self): '''Restrict renaming USD node. Cannot rename a prim defined on another layer.''' # select a USD object. @@ -193,7 +193,7 @@ def testRenameRestriction(self): newName = 'Ball_35_Renamed' cmds.rename(newName) - def testRenameRestriction2(self): + def testRenameRestrictionOtherLayerOpinions(self): '''Restrict renaming USD node. Cannot rename a prim with definitions or opinions on other layers.''' # select a USD object. From 761143d7f07bc081b7a2dee57c54d94b0a718d2c Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Tue, 5 May 2020 12:26:43 -0400 Subject: [PATCH 08/28] Fix MacOS build and make sure to pass the error messages by char* --- lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp index 72f0a958a7..ee3a7f40cf 100644 --- a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp +++ b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp @@ -63,8 +63,8 @@ UsdUndoRenameCommand::UsdUndoRenameCommand(const UsdSceneItem::Ptr& srcItem, con auto possibleTargetLayer = MayaUsdUtils::strongestLayerWithPrimSpec(prim); std::string err = TfStringPrintf("Cannot rename [%s] defined on another layer. " "Please set [%s] as the target layer to proceed", - prim.GetName().GetString(), - possibleTargetLayer->GetDisplayName()); + prim.GetName().GetString().c_str(), + possibleTargetLayer->GetDisplayName().c_str()); throw std::runtime_error(err.c_str()); } else @@ -78,7 +78,7 @@ UsdUndoRenameCommand::UsdUndoRenameCommand(const UsdSceneItem::Ptr& srcItem, con } layerDisplayNames.pop_back(); std::string err = TfStringPrintf("Cannot rename [%s] with definitions or opinions on other layers. " - "Opinions exist in %s", prim.GetName().GetString(), layerDisplayNames); + "Opinions exist in %s", prim.GetName().GetString().c_str(), layerDisplayNames.c_str()); throw std::runtime_error(err.c_str()); } } From d58a0281e1c82bda5a062c82b49947e9910a6aa1 Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Tue, 5 May 2020 13:32:44 -0400 Subject: [PATCH 09/28] Fix debug build: tbb\concurrent_vector.h(177): fatal error C1017: invalid integer constant expression --- lib/usd/utils/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/usd/utils/CMakeLists.txt b/lib/usd/utils/CMakeLists.txt index 7a7af59f15..b29d8f5712 100644 --- a/lib/usd/utils/CMakeLists.txt +++ b/lib/usd/utils/CMakeLists.txt @@ -18,6 +18,9 @@ target_sources(${TARGET_NAME} target_compile_definitions(${TARGET_NAME} PRIVATE MAYA_USD_UTILS_EXPORT + $<$:TBB_USE_DEBUG> + $<$:BOOST_DEBUG_PYTHON> + $<$:BOOST_LINKING_PYTHON> ) mayaUsd_compile_config(${TARGET_NAME}) From 20be9ac681b1fde7a44abc4e9312db15bd916d1b Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Wed, 6 May 2020 08:40:29 -0400 Subject: [PATCH 10/28] MAYA-104215: fix the "cruft" in USD files as objects are named and renamed. --- lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp | 150 ++++++++++++----------- lib/mayaUsd/ufe/UsdUndoRenameCommand.h | 45 ++++--- lib/mayaUsd/ufe/Utils.cpp | 9 ++ lib/mayaUsd/ufe/Utils.h | 4 + 4 files changed, 110 insertions(+), 98 deletions(-) diff --git a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp index ee3a7f40cf..4b338ec1dd 100644 --- a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp +++ b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp @@ -15,14 +15,14 @@ // #include "UsdUndoRenameCommand.h" -#include -#include #include -#include -#include -#include #include +#include +#include +#include +#include +#include #include @@ -41,22 +41,23 @@ MAYAUSD_NS_DEF { namespace ufe { UsdUndoRenameCommand::UsdUndoRenameCommand(const UsdSceneItem::Ptr& srcItem, const Ufe::PathComponent& newName) - : Ufe::UndoableCommand() + : Ufe::UndoableCommand() { - const UsdPrim& prim = srcItem->prim(); - _stage = prim.GetStage(); - _ufeSrcItem = srcItem; - _usdSrcPath = prim.GetPath(); - - // Every call to rename() (through execute(), undo() or redo()) removes - // a prim, which becomes expired. Since USD UFE scene items contain a - // prim, we must recreate them after every call to rename. - _usdDstPath = prim.GetParent().GetPath().AppendChild(TfToken(newName.string())); - _layer = MayaUsdUtils::defPrimSpecLayer(prim); - if (!_layer) { - std::string err = TfStringPrintf("No prim found at %s", prim.GetPath().GetString().c_str()); - throw std::runtime_error(err.c_str()); - } + const UsdPrim& prim = srcItem->prim(); + _stage = prim.GetStage(); + _ufeSrcItem = srcItem; + _usdSrcPath = prim.GetPath(); + + // Every call to rename() (through execute(), undo() or redo()) removes + // a prim, which becomes expired. Since USD UFE scene items contain a + // prim, we must recreate them after every call to rename. + _usdDstPath = prim.GetParent().GetPath().AppendChild(TfToken(newName.string())); + + _layer = MayaUsdUtils::defPrimSpecLayer(prim); + if (!_layer) { + std::string err = TfStringPrintf("No prim found at %s", prim.GetPath().GetString().c_str()); + throw std::runtime_error(err.c_str()); + } // if the current layer doesn't have any opinions that affects selected prim if (!MayaUsdUtils::doesEditTargetLayerHavePrimSpec(prim)) { @@ -88,43 +89,37 @@ UsdUndoRenameCommand::~UsdUndoRenameCommand() { } -/*static*/ UsdUndoRenameCommand::Ptr UsdUndoRenameCommand::create(const UsdSceneItem::Ptr& srcItem, const Ufe::PathComponent& newName) { - return std::make_shared(srcItem, newName); + return std::make_shared(srcItem, newName); } UsdSceneItem::Ptr UsdUndoRenameCommand::renamedItem() const { - return _ufeDstItem; + return _ufeDstItem; } bool UsdUndoRenameCommand::renameRedo() { - // Copy the source path using CopySpec, and inactivate the source. - - // We use the source layer as the destination. An alternate workflow - // would be the edit target layer be the destination: - // layer = self.fStage.GetEditTarget().GetLayer() - bool status = SdfCopySpec(_layer, _usdSrcPath, _layer, _usdDstPath); - if (status) - { - auto srcPrim = _stage->GetPrimAtPath(_usdSrcPath); -#ifdef UFE_V2_FEATURES_AVAILABLE - UFE_ASSERT_MSG(srcPrim, "Invalid prim cannot be inactivated."); -#else - assert(srcPrim); -#endif - status = srcPrim.SetActive(false); + // Copy the source path using CopySpec, and remove the source. + + // We use the source layer as the destination. An alternate workflow + // would be the edit target layer be the destination: + // _layer = _stage->GetEditTarget().GetLayer() + bool status = SdfCopySpec(_layer, _usdSrcPath, _layer, _usdDstPath); + if (status) { + // remove all scene description for the given path and + // its subtree in the current UsdEditTarget + { + UsdEditContext ctx(_stage, _layer); + status = _stage->RemovePrim(_ufeSrcItem->prim().GetPath()); + } if (status) { // The renamed scene item is a "sibling" of its original name. - auto ufeSrcPath = _ufeSrcItem->path(); - _ufeDstItem = createSiblingSceneItem( - ufeSrcPath, _usdDstPath.GetElementString()); + _ufeDstItem = createSiblingSceneItem(_ufeSrcItem->path(), _usdDstPath.GetElementString()); - Ufe::ObjectRename notification(_ufeDstItem, ufeSrcPath); - Ufe::Scene::notifyObjectPathChange(notification); + sendRenameNotification(_ufeDstItem, _ufeSrcItem->path()); } } else { @@ -132,40 +127,47 @@ bool UsdUndoRenameCommand::renameRedo() _usdSrcPath.GetString() + std::string(") failed.")); } - return status; + return status; } bool UsdUndoRenameCommand::renameUndo() { - bool status{false}; - { - // Regardless of where the edit target is currently set, switch to the - // layer where we copied the source prim into the destination, then - // restore the edit target. - UsdEditContext ctx(_stage, _layer); - status = _stage->RemovePrim(_usdDstPath); - } + // Copy the source path using CopySpec, and remove the source. + bool status = SdfCopySpec(_layer, _usdDstPath, _layer, _usdSrcPath); + if (status) { - auto srcPrim = _stage->GetPrimAtPath(_usdSrcPath); -#ifdef UFE_V2_FEATURES_AVAILABLE - UFE_ASSERT_MSG(srcPrim, "Invalid prim cannot be activated."); -#else - assert(srcPrim); -#endif - status = srcPrim.SetActive(true); + // remove all scene description for the given path and + // its subtree in the current UsdEditTarget + { + UsdEditContext ctx(_stage, _layer); + status = _stage->RemovePrim(_usdDstPath); + } if (status) { - Ufe::ObjectRename notification(_ufeSrcItem, _ufeDstItem->path()); - Ufe::Scene::notifyObjectPathChange(notification); + // create a new prim at _usdSrcPath + auto newPrim = _stage->DefinePrim(_usdSrcPath); + + #ifdef UFE_V2_FEATURES_AVAILABLE + UFE_ASSERT_MSG(newPrim, "Invalid prim cannot be inactivated."); + #else + assert(newPrim); + #endif + + // I shouldn't have to again create a sibling sceneItem here since we already have a valid _ufeSrcItem + // however, I get random crashes if I don't which needs furthur investigation. HS, 6-May-2020. + _ufeSrcItem = createSiblingSceneItem(_ufeDstItem->path(), _usdSrcPath.GetElementString()); + + sendRenameNotification(_ufeSrcItem, _ufeDstItem->path()); + _ufeDstItem = nullptr; } - } + } else { - UFE_LOG(std::string("Warning: RemovePrim(") + + UFE_LOG(std::string("Warning: SdfCopySpec(") + _usdDstPath.GetString() + std::string(") failed.")); } - return status; + return status; } //------------------------------------------------------------------------------ @@ -174,24 +176,24 @@ bool UsdUndoRenameCommand::renameUndo() void UsdUndoRenameCommand::undo() { - // MAYA-92264: Pixar bug prevents undo from working. Try again with USD - // version 0.8.5 or later. PPT, 7-Jul-2018. - try { + // MAYA-92264: Pixar bug prevents undo from working. Try again with USD + // version 0.8.5 or later. PPT, 7-Jul-2018. + try { InPathChange pc; - if (!renameUndo()) { + if (!renameUndo()) { UFE_LOG("rename undo failed"); } - } - catch (const std::exception& e) { - UFE_LOG(e.what()); - throw; // re-throw the same exception - } + } + catch (const std::exception& e) { + UFE_LOG(e.what()); + throw; // re-throw the same exception + } } void UsdUndoRenameCommand::redo() { InPathChange pc; - if (!renameRedo()) { + if (!renameRedo()) { UFE_LOG("rename redo failed"); } } diff --git a/lib/mayaUsd/ufe/UsdUndoRenameCommand.h b/lib/mayaUsd/ufe/UsdUndoRenameCommand.h index 17a5a60635..cd0ed82e01 100644 --- a/lib/mayaUsd/ufe/UsdUndoRenameCommand.h +++ b/lib/mayaUsd/ufe/UsdUndoRenameCommand.h @@ -19,9 +19,6 @@ #include #include -#include -#include - #include #include @@ -34,39 +31,39 @@ namespace ufe { class MAYAUSD_CORE_PUBLIC UsdUndoRenameCommand : public Ufe::UndoableCommand { public: - typedef std::shared_ptr Ptr; + typedef std::shared_ptr Ptr; - UsdUndoRenameCommand(const UsdSceneItem::Ptr& srcItem, const Ufe::PathComponent& newName); - ~UsdUndoRenameCommand() override; + UsdUndoRenameCommand(const UsdSceneItem::Ptr& srcItem, const Ufe::PathComponent& newName); + ~UsdUndoRenameCommand() override; - // Delete the copy/move constructors assignment operators. - UsdUndoRenameCommand(const UsdUndoRenameCommand&) = delete; - UsdUndoRenameCommand& operator=(const UsdUndoRenameCommand&) = delete; - UsdUndoRenameCommand(UsdUndoRenameCommand&&) = delete; - UsdUndoRenameCommand& operator=(UsdUndoRenameCommand&&) = delete; + // Delete the copy/move constructors assignment operators. + UsdUndoRenameCommand(const UsdUndoRenameCommand&) = delete; + UsdUndoRenameCommand& operator=(const UsdUndoRenameCommand&) = delete; + UsdUndoRenameCommand(UsdUndoRenameCommand&&) = delete; + UsdUndoRenameCommand& operator=(UsdUndoRenameCommand&&) = delete; - //! Create a UsdUndoRenameCommand from a USD scene item and UFE pathcomponent. - static UsdUndoRenameCommand::Ptr create(const UsdSceneItem::Ptr& srcItem, const Ufe::PathComponent& newName); + //! Create a UsdUndoRenameCommand from a USD scene item and UFE pathcomponent. + static UsdUndoRenameCommand::Ptr create(const UsdSceneItem::Ptr& srcItem, const Ufe::PathComponent& newName); - UsdSceneItem::Ptr renamedItem() const; + UsdSceneItem::Ptr renamedItem() const; private: - // UsdUndoRenameCommand overrides - void undo() override; - void redo() override; + // UsdUndoRenameCommand overrides + void undo() override; + void redo() override; - bool renameRedo(); - bool renameUndo(); + bool renameRedo(); + bool renameUndo(); - UsdStageWeakPtr _stage; - SdfLayerHandle _layer; + UsdStageWeakPtr _stage; + SdfLayerHandle _layer; UsdSceneItem::Ptr _ufeSrcItem; - SdfPath _usdSrcPath; + SdfPath _usdSrcPath; - UsdSceneItem::Ptr _ufeDstItem; - SdfPath _usdDstPath; + UsdSceneItem::Ptr _ufeDstItem; + SdfPath _usdDstPath; }; // UsdUndoRenameCommand diff --git a/lib/mayaUsd/ufe/Utils.cpp b/lib/mayaUsd/ufe/Utils.cpp index a370845578..1ea572f3f6 100644 --- a/lib/mayaUsd/ufe/Utils.cpp +++ b/lib/mayaUsd/ufe/Utils.cpp @@ -22,6 +22,9 @@ #include #include +#include +#include + #include #include #include @@ -242,5 +245,11 @@ UsdTimeCode getTime(const Ufe::Path& path) return proxyShape->getTime(); } +void sendRenameNotification(const Ufe::SceneItem::Ptr& item, const Ufe::Path& previousPath) +{ + Ufe::ObjectRename notification(item, previousPath); + Ufe::Scene::notifyObjectPathChange(notification); +} + } // namespace ufe } // namespace MayaUsd diff --git a/lib/mayaUsd/ufe/Utils.h b/lib/mayaUsd/ufe/Utils.h index 74d3814dd9..022c0be5e9 100644 --- a/lib/mayaUsd/ufe/Utils.h +++ b/lib/mayaUsd/ufe/Utils.h @@ -82,5 +82,9 @@ MDagPath nameToDagPath(const std::string& name); MAYAUSD_CORE_PUBLIC UsdTimeCode getTime(const Ufe::Path& path); +//! Object renamed scene notification +MAYAUSD_CORE_PUBLIC +void sendRenameNotification(const Ufe::SceneItem::Ptr& item, const Ufe::Path& previousPath); + } // namespace ufe } // namespace MayaUsd From ae2a7e00e53b25698803d1467763239f95d420ac Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Wed, 6 May 2020 10:49:15 -0400 Subject: [PATCH 11/28] Improve rename logics: This change simplifies the rename operation by simply renaming a prim in place via SdfPrimSpec's SetName routine and removes the old work-flow involving SdfCopySpec. --- lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp | 107 +++++++---------------- lib/mayaUsd/ufe/UsdUndoRenameCommand.h | 16 ++-- lib/usd/utils/util.cpp | 6 ++ lib/usd/utils/util.h | 4 + 4 files changed, 49 insertions(+), 84 deletions(-) diff --git a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp index 4b338ec1dd..281b91d1e1 100644 --- a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp +++ b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp @@ -42,35 +42,24 @@ namespace ufe { UsdUndoRenameCommand::UsdUndoRenameCommand(const UsdSceneItem::Ptr& srcItem, const Ufe::PathComponent& newName) : Ufe::UndoableCommand() + , _ufeSrcItem(srcItem) + , _ufeDstItem(nullptr) + , _prim(srcItem->prim()) + , _stage(_prim.GetStage()) + , _newName(newName.string()) { - const UsdPrim& prim = srcItem->prim(); - _stage = prim.GetStage(); - _ufeSrcItem = srcItem; - _usdSrcPath = prim.GetPath(); - - // Every call to rename() (through execute(), undo() or redo()) removes - // a prim, which becomes expired. Since USD UFE scene items contain a - // prim, we must recreate them after every call to rename. - _usdDstPath = prim.GetParent().GetPath().AppendChild(TfToken(newName.string())); - - _layer = MayaUsdUtils::defPrimSpecLayer(prim); - if (!_layer) { - std::string err = TfStringPrintf("No prim found at %s", prim.GetPath().GetString().c_str()); - throw std::runtime_error(err.c_str()); - } - // if the current layer doesn't have any opinions that affects selected prim - if (!MayaUsdUtils::doesEditTargetLayerHavePrimSpec(prim)) { - auto possibleTargetLayer = MayaUsdUtils::strongestLayerWithPrimSpec(prim); + if (!MayaUsdUtils::doesEditTargetLayerHavePrimSpec(_prim)) { + auto possibleTargetLayer = MayaUsdUtils::strongestLayerWithPrimSpec(_prim); std::string err = TfStringPrintf("Cannot rename [%s] defined on another layer. " "Please set [%s] as the target layer to proceed", - prim.GetName().GetString().c_str(), + _prim.GetName().GetString().c_str(), possibleTargetLayer->GetDisplayName().c_str()); throw std::runtime_error(err.c_str()); } else { - auto layers = MayaUsdUtils::layersWithPrimSpec(prim); + auto layers = MayaUsdUtils::layersWithPrimSpec(_prim); if (layers.size() > 1) { std::string layerDisplayNames; @@ -79,7 +68,7 @@ UsdUndoRenameCommand::UsdUndoRenameCommand(const UsdSceneItem::Ptr& srcItem, con } layerDisplayNames.pop_back(); std::string err = TfStringPrintf("Cannot rename [%s] with definitions or opinions on other layers. " - "Opinions exist in %s", prim.GetName().GetString().c_str(), layerDisplayNames.c_str()); + "Opinions exist in %s", _prim.GetName().GetString().c_str(), layerDisplayNames.c_str()); throw std::runtime_error(err.c_str()); } } @@ -101,79 +90,49 @@ UsdSceneItem::Ptr UsdUndoRenameCommand::renamedItem() const bool UsdUndoRenameCommand::renameRedo() { - // Copy the source path using CopySpec, and remove the source. - - // We use the source layer as the destination. An alternate workflow - // would be the edit target layer be the destination: - // _layer = _stage->GetEditTarget().GetLayer() - bool status = SdfCopySpec(_layer, _usdSrcPath, _layer, _usdDstPath); - if (status) { - // remove all scene description for the given path and - // its subtree in the current UsdEditTarget - { - UsdEditContext ctx(_stage, _layer); - status = _stage->RemovePrim(_ufeSrcItem->prim().GetPath()); - } + auto primSpec = MayaUsdUtils::getPrimSpecAtEditTarget(_stage, _prim); - if (status) { - // The renamed scene item is a "sibling" of its original name. - _ufeDstItem = createSiblingSceneItem(_ufeSrcItem->path(), _usdDstPath.GetElementString()); + if(primSpec) { - sendRenameNotification(_ufeDstItem, _ufeSrcItem->path()); - } + // set prim's name + primSpec->SetName(_newName); + + // the renamed scene item is a "sibling" of its original name. + _ufeDstItem = createSiblingSceneItem(_ufeSrcItem->path(), _newName); + + sendRenameNotification(_ufeDstItem, _ufeSrcItem->path()); } else { - UFE_LOG(std::string("Warning: SdfCopySpec(") + - _usdSrcPath.GetString() + std::string(") failed.")); + return false; } - return status; + return true; } bool UsdUndoRenameCommand::renameUndo() { - // Copy the source path using CopySpec, and remove the source. - bool status = SdfCopySpec(_layer, _usdDstPath, _layer, _usdSrcPath); - - if (status) { - // remove all scene description for the given path and - // its subtree in the current UsdEditTarget - { - UsdEditContext ctx(_stage, _layer); - status = _stage->RemovePrim(_usdDstPath); - } + auto primSpec = MayaUsdUtils::getPrimSpecAtEditTarget(_stage, _ufeDstItem->prim()); + + if(primSpec) { - if (status) { - // create a new prim at _usdSrcPath - auto newPrim = _stage->DefinePrim(_usdSrcPath); - - #ifdef UFE_V2_FEATURES_AVAILABLE - UFE_ASSERT_MSG(newPrim, "Invalid prim cannot be inactivated."); - #else - assert(newPrim); - #endif + // set prim's name + primSpec->SetName(_prim.GetPath().GetElementString()); - // I shouldn't have to again create a sibling sceneItem here since we already have a valid _ufeSrcItem - // however, I get random crashes if I don't which needs furthur investigation. HS, 6-May-2020. - _ufeSrcItem = createSiblingSceneItem(_ufeDstItem->path(), _usdSrcPath.GetElementString()); + // shouldn't have to again create a sibling sceneItem here since we already have a valid _ufeSrcItem + // however, I get random crashes if I don't which needs furthur investigation. HS, 6-May-2020. + _ufeSrcItem = createSiblingSceneItem(_ufeDstItem->path(), _prim.GetPath().GetElementString()); - sendRenameNotification(_ufeSrcItem, _ufeDstItem->path()); + sendRenameNotification(_ufeSrcItem, _ufeDstItem->path()); - _ufeDstItem = nullptr; - } + _ufeDstItem = nullptr; } else { - UFE_LOG(std::string("Warning: SdfCopySpec(") + - _usdDstPath.GetString() + std::string(") failed.")); + return false; } - return status; + return true; } -//------------------------------------------------------------------------------ -// UsdUndoRenameCommand overrides -//------------------------------------------------------------------------------ - void UsdUndoRenameCommand::undo() { // MAYA-92264: Pixar bug prevents undo from working. Try again with USD diff --git a/lib/mayaUsd/ufe/UsdUndoRenameCommand.h b/lib/mayaUsd/ufe/UsdUndoRenameCommand.h index cd0ed82e01..e108b56a4c 100644 --- a/lib/mayaUsd/ufe/UsdUndoRenameCommand.h +++ b/lib/mayaUsd/ufe/UsdUndoRenameCommand.h @@ -48,22 +48,18 @@ class MAYAUSD_CORE_PUBLIC UsdUndoRenameCommand : public Ufe::UndoableCommand UsdSceneItem::Ptr renamedItem() const; private: - - // UsdUndoRenameCommand overrides - void undo() override; - void redo() override; - bool renameRedo(); bool renameUndo(); - UsdStageWeakPtr _stage; - SdfLayerHandle _layer; + void undo() override; + void redo() override; UsdSceneItem::Ptr _ufeSrcItem; - SdfPath _usdSrcPath; - UsdSceneItem::Ptr _ufeDstItem; - SdfPath _usdDstPath; + + const UsdPrim& _prim; + UsdStageWeakPtr _stage; + std::string _newName; }; // UsdUndoRenameCommand diff --git a/lib/usd/utils/util.cpp b/lib/usd/utils/util.cpp index 507eb654c6..0bbe31fe21 100644 --- a/lib/usd/utils/util.cpp +++ b/lib/usd/utils/util.cpp @@ -95,4 +95,10 @@ strongestLayerWithPrimSpec(const UsdPrim& prim) return targetLayer; } +SdfPrimSpecHandle +getPrimSpecAtEditTarget(UsdStageWeakPtr stage, const UsdPrim& prim) +{ + return stage->GetEditTarget().GetPrimSpecForScenePath(prim.GetPath()); +} + } // MayaUsdUtils diff --git a/lib/usd/utils/util.h b/lib/usd/utils/util.h index 09190eb39d..d37d718c06 100644 --- a/lib/usd/utils/util.h +++ b/lib/usd/utils/util.h @@ -41,6 +41,10 @@ namespace MayaUsdUtils { MAYA_USD_UTILS_PUBLIC SdfLayerHandle strongestLayerWithPrimSpec(const UsdPrim&); + //! Return a PrimSpec for the argument prim in the layer containing the stage's current edit target. + MAYA_USD_UTILS_PUBLIC + SdfPrimSpecHandle getPrimSpecAtEditTarget(UsdStageWeakPtr, const UsdPrim&); + } // namespace MayaUsdUtils #endif // MAYAUSDUTILS_UTIL_H \ No newline at end of file From bb1da2e9104ac043bca845f16dc642c4a213ecb6 Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Wed, 6 May 2020 17:30:25 -0400 Subject: [PATCH 12/28] - Added early checks to make sure we are in a valid state when doing operations in undo/redo. - To read the code better, I added a new member variable _oldName that holds the prim's original name. --- lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp | 51 ++++++++++++------------ lib/mayaUsd/ufe/UsdUndoRenameCommand.h | 1 + 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp index 281b91d1e1..6e807a5647 100644 --- a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp +++ b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp @@ -47,6 +47,7 @@ UsdUndoRenameCommand::UsdUndoRenameCommand(const UsdSceneItem::Ptr& srcItem, con , _prim(srcItem->prim()) , _stage(_prim.GetStage()) , _newName(newName.string()) + , _oldName(_prim.GetName().GetString()) { // if the current layer doesn't have any opinions that affects selected prim if (!MayaUsdUtils::doesEditTargetLayerHavePrimSpec(_prim)) { @@ -91,45 +92,45 @@ UsdSceneItem::Ptr UsdUndoRenameCommand::renamedItem() const bool UsdUndoRenameCommand::renameRedo() { auto primSpec = MayaUsdUtils::getPrimSpecAtEditTarget(_stage, _prim); - - if(primSpec) { - - // set prim's name - primSpec->SetName(_newName); - - // the renamed scene item is a "sibling" of its original name. - _ufeDstItem = createSiblingSceneItem(_ufeSrcItem->path(), _newName); - - sendRenameNotification(_ufeDstItem, _ufeSrcItem->path()); + if(!primSpec) { + return false; } - else { + + // set prim's name + // XXX: SetName successfuly returns true but when you examine the _prim.GetName() + // after the rename, the prim name shows the original name HS, 6-May-2020. + bool status = primSpec->SetName(_newName); + if (!status) { return false; } + // the renamed scene item is a "sibling" of its original name. + _ufeDstItem = createSiblingSceneItem(_ufeSrcItem->path(), _newName); + sendRenameNotification(_ufeDstItem, _ufeSrcItem->path()); + return true; } bool UsdUndoRenameCommand::renameUndo() { auto primSpec = MayaUsdUtils::getPrimSpecAtEditTarget(_stage, _ufeDstItem->prim()); - - if(primSpec) { - - // set prim's name - primSpec->SetName(_prim.GetPath().GetElementString()); - - // shouldn't have to again create a sibling sceneItem here since we already have a valid _ufeSrcItem - // however, I get random crashes if I don't which needs furthur investigation. HS, 6-May-2020. - _ufeSrcItem = createSiblingSceneItem(_ufeDstItem->path(), _prim.GetPath().GetElementString()); - - sendRenameNotification(_ufeSrcItem, _ufeDstItem->path()); - - _ufeDstItem = nullptr; + if(!primSpec) { + return false; } - else { + + // set prim's name + bool status = primSpec->SetName(_oldName); + if (!status) { return false; } + // shouldn't have to again create a sibling sceneItem here since we already have a valid _ufeSrcItem + // however, I get random crashes if I don't which needs furthur investigation. HS, 6-May-2020. + _ufeSrcItem = createSiblingSceneItem(_ufeDstItem->path(), _oldName); + sendRenameNotification(_ufeSrcItem, _ufeDstItem->path()); + + _ufeDstItem = nullptr; + return true; } diff --git a/lib/mayaUsd/ufe/UsdUndoRenameCommand.h b/lib/mayaUsd/ufe/UsdUndoRenameCommand.h index e108b56a4c..ea5346c565 100644 --- a/lib/mayaUsd/ufe/UsdUndoRenameCommand.h +++ b/lib/mayaUsd/ufe/UsdUndoRenameCommand.h @@ -60,6 +60,7 @@ class MAYAUSD_CORE_PUBLIC UsdUndoRenameCommand : public Ufe::UndoableCommand const UsdPrim& _prim; UsdStageWeakPtr _stage; std::string _newName; + std::string _oldName; }; // UsdUndoRenameCommand From c4f247aeb05e2c73ea1f7d7a76e3ef31a0450196 Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Wed, 6 May 2020 19:54:44 -0400 Subject: [PATCH 13/28] - Added tree.ma and tree.usda to the test-samples. This is a useful usd file for testing purposes. - Renamed testRename to testRenameUndo - Added new logics for testing new way of renaming a prim name via SdfPrimSpec. --- test/lib/ufe/test-samples/tree/tree.ma | 188 +++++++++++++++++++++++ test/lib/ufe/test-samples/tree/tree.usda | 34 ++++ test/lib/ufe/testRename.py | 43 ++++++ test/lib/ufe/ufeTestUtils/mayaUtils.py | 4 + 4 files changed, 269 insertions(+) create mode 100644 test/lib/ufe/test-samples/tree/tree.ma create mode 100644 test/lib/ufe/test-samples/tree/tree.usda diff --git a/test/lib/ufe/test-samples/tree/tree.ma b/test/lib/ufe/test-samples/tree/tree.ma new file mode 100644 index 0000000000..0843d2c800 --- /dev/null +++ b/test/lib/ufe/test-samples/tree/tree.ma @@ -0,0 +1,188 @@ +//Maya ASCII 2020 scene +//Name: tree.ma +//Last modified: Wed, May 06, 2020 06:42:19 PM +//Codeset: 1252 +requires maya "2020"; +requires -nodeType "mayaUsdProxyShape" -dataType "pxrUsdStageData" "mayaUsdPlugin" "1.0"; +currentUnit -l centimeter -a degree -t film; +fileInfo "application" "maya"; +fileInfo "product" "Maya 2021"; +fileInfo "version" "Preview Release 114"; +fileInfo "cutIdentifier" "202005040148-000000"; +fileInfo "osv" "Microsoft Windows 10 Technical Preview (Build 18363)\n"; +fileInfo "UUID" "3EBD9FB4-4F93-586A-A23C-109246F4203C"; +createNode transform -s -n "persp"; + rename -uid "CE5D8A03-438E-FF80-2B66-28ACD0610183"; + setAttr ".v" no; + setAttr ".t" -type "double3" 28 21 28 ; + setAttr ".r" -type "double3" -27.938352729602379 44.999999999999972 -5.172681101354183e-14 ; +createNode camera -s -n "perspShape" -p "persp"; + rename -uid "41E71033-4336-76BF-5B7B-EE93B31968AF"; + setAttr -k off ".v" no; + setAttr ".fl" 34.999999999999993; + setAttr ".coi" 44.82186966202994; + setAttr ".imn" -type "string" "persp"; + setAttr ".den" -type "string" "persp_depth"; + setAttr ".man" -type "string" "persp_mask"; + setAttr ".hc" -type "string" "viewSet -p %camera"; +createNode transform -s -n "top"; + rename -uid "EA2DC585-45DD-4C19-D8A4-20ADD7C7F18C"; + setAttr ".v" no; + setAttr ".t" -type "double3" 0 1000.1 0 ; + setAttr ".r" -type "double3" -90 0 0 ; +createNode camera -s -n "topShape" -p "top"; + rename -uid "C65F40A5-4AEF-E694-72BB-96A4869AE187"; + setAttr -k off ".v" no; + setAttr ".rnd" no; + setAttr ".coi" 1000.1; + setAttr ".ow" 30; + setAttr ".imn" -type "string" "top"; + setAttr ".den" -type "string" "top_depth"; + setAttr ".man" -type "string" "top_mask"; + setAttr ".hc" -type "string" "viewSet -t %camera"; + setAttr ".o" yes; +createNode transform -s -n "front"; + rename -uid "B3204286-4ABA-4497-496E-CA86E793EB18"; + setAttr ".v" no; + setAttr ".t" -type "double3" 0 0 1000.1 ; +createNode camera -s -n "frontShape" -p "front"; + rename -uid "CEA4791C-4797-1A67-067D-C0858EC5272A"; + setAttr -k off ".v" no; + setAttr ".rnd" no; + setAttr ".coi" 1000.1; + setAttr ".ow" 30; + setAttr ".imn" -type "string" "front"; + setAttr ".den" -type "string" "front_depth"; + setAttr ".man" -type "string" "front_mask"; + setAttr ".hc" -type "string" "viewSet -f %camera"; + setAttr ".o" yes; +createNode transform -s -n "side"; + rename -uid "302CB962-4FBF-8E7F-A75C-9597828FFF2F"; + setAttr ".v" no; + setAttr ".t" -type "double3" 1000.1 0 0 ; + setAttr ".r" -type "double3" 0 90 0 ; +createNode camera -s -n "sideShape" -p "side"; + rename -uid "3546ED96-4383-A2F5-9232-FEBA38ACF084"; + setAttr -k off ".v" no; + setAttr ".rnd" no; + setAttr ".coi" 1000.1; + setAttr ".ow" 30; + setAttr ".imn" -type "string" "side"; + setAttr ".den" -type "string" "side_depth"; + setAttr ".man" -type "string" "side_mask"; + setAttr ".hc" -type "string" "viewSet -s %camera"; + setAttr ".o" yes; +createNode transform -n "Tree_usd"; + rename -uid "8D4D45F4-4055-49B2-10D9-678EF1129568"; +createNode mayaUsdProxyShape -n "Tree_usdShape" -p "Tree_usd"; + rename -uid "085EB8BF-4528-E861-2103-14930BCFC965"; + setAttr -k off ".v"; + setAttr ".covm[0]" 0 1 1; + setAttr ".cdvm[0]" 0 1 1; + setAttr ".fp" -type "string" "C:/Users/sabrih/Desktop/USD-Assets/USD-Assets/tree.usda"; + setAttr ".pp" -type "string" ""; + setAttr ".epp" -type "string" ""; +createNode lightLinker -s -n "lightLinker1"; + rename -uid "094B0217-414A-BDE3-286C-E58F77A7E656"; + setAttr -s 2 ".lnk"; + setAttr -s 2 ".slnk"; +createNode shapeEditorManager -n "shapeEditorManager"; + rename -uid "38EF6F3C-459B-646E-96CE-378309CED9C7"; +createNode poseInterpolatorManager -n "poseInterpolatorManager"; + rename -uid "6772BA60-4AB1-D544-2F91-74AF87163422"; +createNode displayLayerManager -n "layerManager"; + rename -uid "D5E1DDD4-4422-BA34-4CDB-C592EA61EB1B"; +createNode displayLayer -n "defaultLayer"; + rename -uid "8860A90B-44C2-BBCA-03A5-768709192B7F"; +createNode renderLayerManager -n "renderLayerManager"; + rename -uid "271CC0C0-4447-491F-6122-279427ECA415"; +createNode renderLayer -n "defaultRenderLayer"; + rename -uid "6AE6F39D-4433-1B99-B91A-BC910122962A"; + setAttr ".g" yes; +createNode script -n "uiConfigurationScriptNode"; + rename -uid "DF9E9282-4B6D-F37F-A575-DDADBFCA4C31"; + setAttr ".b" -type "string" ( + "// Maya Mel UI Configuration File.\n//\n// This script is machine generated. Edit at your own risk.\n//\n//\n\nglobal string $gMainPane;\nif (`paneLayout -exists $gMainPane`) {\n\n\tglobal int $gUseScenePanelConfig;\n\tint $useSceneConfig = $gUseScenePanelConfig;\n\tint $nodeEditorPanelVisible = stringArrayContains(\"nodeEditorPanel1\", `getPanel -vis`);\n\tint $nodeEditorWorkspaceControlOpen = (`workspaceControl -exists nodeEditorPanel1Window` && `workspaceControl -q -visible nodeEditorPanel1Window`);\n\tint $menusOkayInPanels = `optionVar -q allowMenusInPanels`;\n\tint $nVisPanes = `paneLayout -q -nvp $gMainPane`;\n\tint $nPanes = 0;\n\tstring $editorName;\n\tstring $panelName;\n\tstring $itemFilterName;\n\tstring $panelConfig;\n\n\t//\n\t// get current state of the UI\n\t//\n\tsceneUIReplacement -update $gMainPane;\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"modelPanel\" (localizedPanelLabel(\"Top View\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tmodelPanel -edit -l (localizedPanelLabel(\"Top View\")) -mbv $menusOkayInPanels $panelName;\n" + + "\t\t$editorName = $panelName;\n modelEditor -e \n -camera \"top\" \n -useInteractiveMode 0\n -displayLights \"default\" \n -displayAppearance \"smoothShaded\" \n -activeOnly 0\n -ignorePanZoom 0\n -wireframeOnShaded 0\n -headsUpDisplay 1\n -holdOuts 1\n -selectionHiliteDisplay 1\n -useDefaultMaterial 0\n -bufferMode \"double\" \n -twoSidedLighting 0\n -backfaceCulling 0\n -xray 0\n -jointXray 0\n -activeComponentsXray 0\n -displayTextures 0\n -smoothWireframe 0\n -lineWidth 1\n -textureAnisotropic 0\n -textureHilight 1\n -textureSampling 2\n -textureDisplay \"modulate\" \n -textureMaxSize 16384\n -fogging 0\n -fogSource \"fragment\" \n -fogMode \"linear\" \n -fogStart 0\n -fogEnd 100\n -fogDensity 0.1\n -fogColor 0.5 0.5 0.5 1 \n" + + " -depthOfFieldPreview 1\n -maxConstantTransparency 1\n -rendererName \"vp2Renderer\" \n -objectFilterShowInHUD 1\n -isFiltered 0\n -colorResolution 256 256 \n -bumpResolution 512 512 \n -textureCompression 0\n -transparencyAlgorithm \"frontAndBackCull\" \n -transpInShadows 0\n -cullingOverride \"none\" \n -lowQualityLighting 0\n -maximumNumHardwareLights 1\n -occlusionCulling 0\n -shadingModel 0\n -useBaseRenderer 0\n -useReducedRenderer 0\n -smallObjectCulling 0\n -smallObjectThreshold -1 \n -interactiveDisableShadows 0\n -interactiveBackFaceCull 0\n -sortTransparent 1\n -controllers 1\n -nurbsCurves 1\n -nurbsSurfaces 1\n -polymeshes 1\n -subdivSurfaces 1\n -planes 1\n -lights 1\n -cameras 1\n -controlVertices 1\n" + + " -hulls 1\n -grid 1\n -imagePlane 1\n -joints 1\n -ikHandles 1\n -deformers 1\n -dynamics 1\n -particleInstancers 1\n -fluids 1\n -hairSystems 1\n -follicles 1\n -nCloths 1\n -nParticles 1\n -nRigids 1\n -dynamicConstraints 1\n -locators 1\n -manipulators 1\n -pluginShapes 1\n -dimensions 1\n -handles 1\n -pivots 1\n -textures 1\n -strokes 1\n -motionTrails 1\n -clipGhosts 1\n -greasePencils 1\n -shadows 0\n -captureSequenceNumber -1\n -width 1\n -height 1\n -sceneRenderFilter 0\n $editorName;\n modelEditor -e -viewSelected 0 $editorName;\n modelEditor -e \n -pluginObjects \"gpuCacheDisplayFilter\" 1 \n $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n" + + "\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"modelPanel\" (localizedPanelLabel(\"Side View\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tmodelPanel -edit -l (localizedPanelLabel(\"Side View\")) -mbv $menusOkayInPanels $panelName;\n\t\t$editorName = $panelName;\n modelEditor -e \n -camera \"side\" \n -useInteractiveMode 0\n -displayLights \"default\" \n -displayAppearance \"smoothShaded\" \n -activeOnly 0\n -ignorePanZoom 0\n -wireframeOnShaded 0\n -headsUpDisplay 1\n -holdOuts 1\n -selectionHiliteDisplay 1\n -useDefaultMaterial 0\n -bufferMode \"double\" \n -twoSidedLighting 0\n -backfaceCulling 0\n -xray 0\n -jointXray 0\n -activeComponentsXray 0\n -displayTextures 0\n -smoothWireframe 0\n -lineWidth 1\n -textureAnisotropic 0\n -textureHilight 1\n -textureSampling 2\n" + + " -textureDisplay \"modulate\" \n -textureMaxSize 16384\n -fogging 0\n -fogSource \"fragment\" \n -fogMode \"linear\" \n -fogStart 0\n -fogEnd 100\n -fogDensity 0.1\n -fogColor 0.5 0.5 0.5 1 \n -depthOfFieldPreview 1\n -maxConstantTransparency 1\n -rendererName \"vp2Renderer\" \n -objectFilterShowInHUD 1\n -isFiltered 0\n -colorResolution 256 256 \n -bumpResolution 512 512 \n -textureCompression 0\n -transparencyAlgorithm \"frontAndBackCull\" \n -transpInShadows 0\n -cullingOverride \"none\" \n -lowQualityLighting 0\n -maximumNumHardwareLights 1\n -occlusionCulling 0\n -shadingModel 0\n -useBaseRenderer 0\n -useReducedRenderer 0\n -smallObjectCulling 0\n -smallObjectThreshold -1 \n -interactiveDisableShadows 0\n -interactiveBackFaceCull 0\n" + + " -sortTransparent 1\n -controllers 1\n -nurbsCurves 1\n -nurbsSurfaces 1\n -polymeshes 1\n -subdivSurfaces 1\n -planes 1\n -lights 1\n -cameras 1\n -controlVertices 1\n -hulls 1\n -grid 1\n -imagePlane 1\n -joints 1\n -ikHandles 1\n -deformers 1\n -dynamics 1\n -particleInstancers 1\n -fluids 1\n -hairSystems 1\n -follicles 1\n -nCloths 1\n -nParticles 1\n -nRigids 1\n -dynamicConstraints 1\n -locators 1\n -manipulators 1\n -pluginShapes 1\n -dimensions 1\n -handles 1\n -pivots 1\n -textures 1\n -strokes 1\n -motionTrails 1\n -clipGhosts 1\n -greasePencils 1\n -shadows 0\n -captureSequenceNumber -1\n -width 1\n -height 1\n" + + " -sceneRenderFilter 0\n $editorName;\n modelEditor -e -viewSelected 0 $editorName;\n modelEditor -e \n -pluginObjects \"gpuCacheDisplayFilter\" 1 \n $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"modelPanel\" (localizedPanelLabel(\"Front View\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tmodelPanel -edit -l (localizedPanelLabel(\"Front View\")) -mbv $menusOkayInPanels $panelName;\n\t\t$editorName = $panelName;\n modelEditor -e \n -camera \"front\" \n -useInteractiveMode 0\n -displayLights \"default\" \n -displayAppearance \"smoothShaded\" \n -activeOnly 0\n -ignorePanZoom 0\n -wireframeOnShaded 0\n -headsUpDisplay 1\n -holdOuts 1\n -selectionHiliteDisplay 1\n -useDefaultMaterial 0\n -bufferMode \"double\" \n -twoSidedLighting 0\n -backfaceCulling 0\n" + + " -xray 0\n -jointXray 0\n -activeComponentsXray 0\n -displayTextures 0\n -smoothWireframe 0\n -lineWidth 1\n -textureAnisotropic 0\n -textureHilight 1\n -textureSampling 2\n -textureDisplay \"modulate\" \n -textureMaxSize 16384\n -fogging 0\n -fogSource \"fragment\" \n -fogMode \"linear\" \n -fogStart 0\n -fogEnd 100\n -fogDensity 0.1\n -fogColor 0.5 0.5 0.5 1 \n -depthOfFieldPreview 1\n -maxConstantTransparency 1\n -rendererName \"vp2Renderer\" \n -objectFilterShowInHUD 1\n -isFiltered 0\n -colorResolution 256 256 \n -bumpResolution 512 512 \n -textureCompression 0\n -transparencyAlgorithm \"frontAndBackCull\" \n -transpInShadows 0\n -cullingOverride \"none\" \n -lowQualityLighting 0\n -maximumNumHardwareLights 1\n -occlusionCulling 0\n" + + " -shadingModel 0\n -useBaseRenderer 0\n -useReducedRenderer 0\n -smallObjectCulling 0\n -smallObjectThreshold -1 \n -interactiveDisableShadows 0\n -interactiveBackFaceCull 0\n -sortTransparent 1\n -controllers 1\n -nurbsCurves 1\n -nurbsSurfaces 1\n -polymeshes 1\n -subdivSurfaces 1\n -planes 1\n -lights 1\n -cameras 1\n -controlVertices 1\n -hulls 1\n -grid 1\n -imagePlane 1\n -joints 1\n -ikHandles 1\n -deformers 1\n -dynamics 1\n -particleInstancers 1\n -fluids 1\n -hairSystems 1\n -follicles 1\n -nCloths 1\n -nParticles 1\n -nRigids 1\n -dynamicConstraints 1\n -locators 1\n -manipulators 1\n -pluginShapes 1\n -dimensions 1\n -handles 1\n -pivots 1\n" + + " -textures 1\n -strokes 1\n -motionTrails 1\n -clipGhosts 1\n -greasePencils 1\n -shadows 0\n -captureSequenceNumber -1\n -width 1\n -height 1\n -sceneRenderFilter 0\n $editorName;\n modelEditor -e -viewSelected 0 $editorName;\n modelEditor -e \n -pluginObjects \"gpuCacheDisplayFilter\" 1 \n $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"modelPanel\" (localizedPanelLabel(\"Persp View\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tmodelPanel -edit -l (localizedPanelLabel(\"Persp View\")) -mbv $menusOkayInPanels $panelName;\n\t\t$editorName = $panelName;\n modelEditor -e \n -camera \"persp\" \n -useInteractiveMode 0\n -displayLights \"default\" \n -displayAppearance \"smoothShaded\" \n -activeOnly 0\n -ignorePanZoom 0\n" + + " -wireframeOnShaded 0\n -headsUpDisplay 1\n -holdOuts 1\n -selectionHiliteDisplay 1\n -useDefaultMaterial 0\n -bufferMode \"double\" \n -twoSidedLighting 0\n -backfaceCulling 0\n -xray 0\n -jointXray 0\n -activeComponentsXray 0\n -displayTextures 0\n -smoothWireframe 0\n -lineWidth 1\n -textureAnisotropic 0\n -textureHilight 1\n -textureSampling 2\n -textureDisplay \"modulate\" \n -textureMaxSize 16384\n -fogging 0\n -fogSource \"fragment\" \n -fogMode \"linear\" \n -fogStart 0\n -fogEnd 100\n -fogDensity 0.1\n -fogColor 0.5 0.5 0.5 1 \n -depthOfFieldPreview 1\n -maxConstantTransparency 1\n -rendererName \"vp2Renderer\" \n -objectFilterShowInHUD 1\n -isFiltered 0\n -colorResolution 256 256 \n -bumpResolution 512 512 \n" + + " -textureCompression 0\n -transparencyAlgorithm \"frontAndBackCull\" \n -transpInShadows 0\n -cullingOverride \"none\" \n -lowQualityLighting 0\n -maximumNumHardwareLights 1\n -occlusionCulling 0\n -shadingModel 0\n -useBaseRenderer 0\n -useReducedRenderer 0\n -smallObjectCulling 0\n -smallObjectThreshold -1 \n -interactiveDisableShadows 0\n -interactiveBackFaceCull 0\n -sortTransparent 1\n -controllers 1\n -nurbsCurves 1\n -nurbsSurfaces 1\n -polymeshes 1\n -subdivSurfaces 1\n -planes 1\n -lights 1\n -cameras 1\n -controlVertices 1\n -hulls 1\n -grid 1\n -imagePlane 1\n -joints 1\n -ikHandles 1\n -deformers 1\n -dynamics 1\n -particleInstancers 1\n -fluids 1\n -hairSystems 1\n -follicles 1\n" + + " -nCloths 1\n -nParticles 1\n -nRigids 1\n -dynamicConstraints 1\n -locators 1\n -manipulators 1\n -pluginShapes 1\n -dimensions 1\n -handles 1\n -pivots 1\n -textures 1\n -strokes 1\n -motionTrails 1\n -clipGhosts 1\n -greasePencils 1\n -shadows 0\n -captureSequenceNumber -1\n -width 998\n -height 838\n -sceneRenderFilter 0\n $editorName;\n modelEditor -e -viewSelected 0 $editorName;\n modelEditor -e \n -pluginObjects \"gpuCacheDisplayFilter\" 1 \n $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"outlinerPanel\" (localizedPanelLabel(\"ToggledOutliner\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\toutlinerPanel -edit -l (localizedPanelLabel(\"ToggledOutliner\")) -mbv $menusOkayInPanels $panelName;\n" + + "\t\t$editorName = $panelName;\n outlinerEditor -e \n -showShapes 1\n -showAssignedMaterials 0\n -showTimeEditor 1\n -showReferenceNodes 1\n -showReferenceMembers 1\n -showAttributes 0\n -showConnected 0\n -showAnimCurvesOnly 0\n -showMuteInfo 0\n -organizeByLayer 1\n -organizeByClip 1\n -showAnimLayerWeight 1\n -autoExpandLayers 1\n -autoExpand 0\n -showDagOnly 1\n -showAssets 1\n -showContainedOnly 1\n -showPublishedAsConnected 0\n -showParentContainers 0\n -showContainerContents 1\n -ignoreDagHierarchy 0\n -expandConnections 0\n -showUpstreamCurves 1\n -showUnitlessCurves 1\n -showCompounds 1\n -showLeafs 1\n -showNumericAttrsOnly 0\n -highlightActive 1\n -autoSelectNewObjects 0\n -doNotSelectNewObjects 0\n -dropIsParent 1\n" + + " -transmitFilters 0\n -setFilter \"defaultSetFilter\" \n -showSetMembers 1\n -allowMultiSelection 1\n -alwaysToggleSelect 0\n -directSelect 0\n -isSet 0\n -isSetMember 0\n -displayMode \"DAG\" \n -expandObjects 0\n -setsIgnoreFilters 1\n -containersIgnoreFilters 0\n -editAttrName 0\n -showAttrValues 0\n -highlightSecondary 0\n -showUVAttrsOnly 0\n -showTextureNodesOnly 0\n -attrAlphaOrder \"default\" \n -animLayerFilterOptions \"allAffecting\" \n -sortOrder \"none\" \n -longNames 0\n -niceNames 1\n -showNamespace 1\n -showPinIcons 0\n -mapMotionTrails 0\n -ignoreHiddenAttribute 0\n -ignoreOutlinerColor 0\n -renderFilterVisible 0\n -renderFilterIndex 0\n -selectionOrder \"chronological\" \n -expandAttribute 0\n $editorName;\n" + + "\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"outlinerPanel\" (localizedPanelLabel(\"Outliner\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\toutlinerPanel -edit -l (localizedPanelLabel(\"Outliner\")) -mbv $menusOkayInPanels $panelName;\n\t\t$editorName = $panelName;\n outlinerEditor -e \n -showShapes 0\n -showAssignedMaterials 0\n -showTimeEditor 1\n -showReferenceNodes 0\n -showReferenceMembers 0\n -showAttributes 0\n -showConnected 0\n -showAnimCurvesOnly 0\n -showMuteInfo 0\n -organizeByLayer 1\n -organizeByClip 1\n -showAnimLayerWeight 1\n -autoExpandLayers 1\n -autoExpand 0\n -showDagOnly 1\n -showAssets 1\n -showContainedOnly 1\n -showPublishedAsConnected 0\n -showParentContainers 0\n -showContainerContents 1\n -ignoreDagHierarchy 0\n" + + " -expandConnections 0\n -showUpstreamCurves 1\n -showUnitlessCurves 1\n -showCompounds 1\n -showLeafs 1\n -showNumericAttrsOnly 0\n -highlightActive 1\n -autoSelectNewObjects 0\n -doNotSelectNewObjects 0\n -dropIsParent 1\n -transmitFilters 0\n -setFilter \"0\" \n -showSetMembers 1\n -allowMultiSelection 1\n -alwaysToggleSelect 0\n -directSelect 0\n -displayMode \"DAG\" \n -expandObjects 0\n -setsIgnoreFilters 1\n -containersIgnoreFilters 0\n -editAttrName 0\n -showAttrValues 0\n -highlightSecondary 0\n -showUVAttrsOnly 0\n -showTextureNodesOnly 0\n -attrAlphaOrder \"default\" \n -animLayerFilterOptions \"allAffecting\" \n -sortOrder \"none\" \n -longNames 0\n -niceNames 1\n -showNamespace 1\n -showPinIcons 0\n" + + " -mapMotionTrails 0\n -ignoreHiddenAttribute 0\n -ignoreOutlinerColor 0\n -renderFilterVisible 0\n $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"graphEditor\" (localizedPanelLabel(\"Graph Editor\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Graph Editor\")) -mbv $menusOkayInPanels $panelName;\n\n\t\t\t$editorName = ($panelName+\"OutlineEd\");\n outlinerEditor -e \n -showShapes 1\n -showAssignedMaterials 0\n -showTimeEditor 1\n -showReferenceNodes 0\n -showReferenceMembers 0\n -showAttributes 1\n -showConnected 1\n -showAnimCurvesOnly 1\n -showMuteInfo 0\n -organizeByLayer 1\n -organizeByClip 1\n -showAnimLayerWeight 1\n -autoExpandLayers 1\n" + + " -autoExpand 1\n -showDagOnly 0\n -showAssets 1\n -showContainedOnly 0\n -showPublishedAsConnected 0\n -showParentContainers 0\n -showContainerContents 0\n -ignoreDagHierarchy 0\n -expandConnections 1\n -showUpstreamCurves 1\n -showUnitlessCurves 1\n -showCompounds 0\n -showLeafs 1\n -showNumericAttrsOnly 1\n -highlightActive 0\n -autoSelectNewObjects 1\n -doNotSelectNewObjects 0\n -dropIsParent 1\n -transmitFilters 1\n -setFilter \"0\" \n -showSetMembers 0\n -allowMultiSelection 1\n -alwaysToggleSelect 0\n -directSelect 0\n -displayMode \"DAG\" \n -expandObjects 0\n -setsIgnoreFilters 1\n -containersIgnoreFilters 0\n -editAttrName 0\n" + + " -showAttrValues 0\n -highlightSecondary 0\n -showUVAttrsOnly 0\n -showTextureNodesOnly 0\n -attrAlphaOrder \"default\" \n -animLayerFilterOptions \"allAffecting\" \n -sortOrder \"none\" \n -longNames 0\n -niceNames 1\n -showNamespace 1\n -showPinIcons 1\n -mapMotionTrails 1\n -ignoreHiddenAttribute 0\n -ignoreOutlinerColor 0\n -renderFilterVisible 0\n $editorName;\n\n\t\t\t$editorName = ($panelName+\"GraphEd\");\n animCurveEditor -e \n -displayValues 0\n -snapTime \"integer\" \n -snapValue \"none\" \n -showPlayRangeShades \"on\" \n -lockPlayRangeShades \"off\" \n -smoothness \"fine\" \n -resultSamples 1\n -resultScreenSamples 0\n -resultUpdate \"delayed\" \n -showUpstreamCurves 1\n" + + " -stackedCurvesMin -1\n -stackedCurvesMax 1\n -stackedCurvesSpace 0.2\n -preSelectionHighlight 0\n -constrainDrag 0\n -valueLinesToggle 1\n -highlightAffectedCurves 0\n $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"dopeSheetPanel\" (localizedPanelLabel(\"Dope Sheet\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Dope Sheet\")) -mbv $menusOkayInPanels $panelName;\n\n\t\t\t$editorName = ($panelName+\"OutlineEd\");\n outlinerEditor -e \n -showShapes 1\n -showAssignedMaterials 0\n -showTimeEditor 1\n -showReferenceNodes 0\n -showReferenceMembers 0\n -showAttributes 1\n -showConnected 1\n -showAnimCurvesOnly 1\n -showMuteInfo 0\n" + + " -organizeByLayer 1\n -organizeByClip 1\n -showAnimLayerWeight 1\n -autoExpandLayers 1\n -autoExpand 0\n -showDagOnly 0\n -showAssets 1\n -showContainedOnly 0\n -showPublishedAsConnected 0\n -showParentContainers 0\n -showContainerContents 0\n -ignoreDagHierarchy 0\n -expandConnections 1\n -showUpstreamCurves 1\n -showUnitlessCurves 0\n -showCompounds 1\n -showLeafs 1\n -showNumericAttrsOnly 1\n -highlightActive 0\n -autoSelectNewObjects 0\n -doNotSelectNewObjects 1\n -dropIsParent 1\n -transmitFilters 0\n -setFilter \"0\" \n -showSetMembers 0\n -allowMultiSelection 1\n -alwaysToggleSelect 0\n -directSelect 0\n -displayMode \"DAG\" \n" + + " -expandObjects 0\n -setsIgnoreFilters 1\n -containersIgnoreFilters 0\n -editAttrName 0\n -showAttrValues 0\n -highlightSecondary 0\n -showUVAttrsOnly 0\n -showTextureNodesOnly 0\n -attrAlphaOrder \"default\" \n -animLayerFilterOptions \"allAffecting\" \n -sortOrder \"none\" \n -longNames 0\n -niceNames 1\n -showNamespace 1\n -showPinIcons 0\n -mapMotionTrails 1\n -ignoreHiddenAttribute 0\n -ignoreOutlinerColor 0\n -renderFilterVisible 0\n $editorName;\n\n\t\t\t$editorName = ($panelName+\"DopeSheetEd\");\n dopeSheetEditor -e \n -displayValues 0\n -snapTime \"integer\" \n -snapValue \"none\" \n -outliner \"dopeSheetPanel1OutlineEd\" \n -showSummary 1\n -showScene 0\n" + + " -hierarchyBelow 0\n -showTicks 1\n -selectionWindow 0 0 0 0 \n $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"timeEditorPanel\" (localizedPanelLabel(\"Time Editor\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Time Editor\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"clipEditorPanel\" (localizedPanelLabel(\"Trax Editor\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Trax Editor\")) -mbv $menusOkayInPanels $panelName;\n\n\t\t\t$editorName = clipEditorNameFromPanel($panelName);\n clipEditor -e \n -displayValues 0\n -snapTime \"none\" \n -snapValue \"none\" \n -initialized 0\n" + + " -manageSequencer 0 \n $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"sequenceEditorPanel\" (localizedPanelLabel(\"Camera Sequencer\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Camera Sequencer\")) -mbv $menusOkayInPanels $panelName;\n\n\t\t\t$editorName = sequenceEditorNameFromPanel($panelName);\n clipEditor -e \n -displayValues 0\n -snapTime \"none\" \n -snapValue \"none\" \n -initialized 0\n -manageSequencer 1 \n $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"hyperGraphPanel\" (localizedPanelLabel(\"Hypergraph Hierarchy\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Hypergraph Hierarchy\")) -mbv $menusOkayInPanels $panelName;\n" + + "\n\t\t\t$editorName = ($panelName+\"HyperGraphEd\");\n hyperGraph -e \n -graphLayoutStyle \"hierarchicalLayout\" \n -orientation \"horiz\" \n -mergeConnections 0\n -zoom 1\n -animateTransition 0\n -showRelationships 1\n -showShapes 0\n -showDeformers 0\n -showExpressions 0\n -showConstraints 0\n -showConnectionFromSelected 0\n -showConnectionToSelected 0\n -showConstraintLabels 0\n -showUnderworld 0\n -showInvisible 0\n -transitionFrames 1\n -opaqueContainers 0\n -freeform 0\n -imagePosition 0 0 \n -imageScale 1\n -imageEnabled 0\n -graphType \"DAG\" \n -heatMapDisplay 0\n -updateSelection 1\n -updateNodeAdded 1\n -useDrawOverrideColor 0\n -limitGraphTraversal -1\n" + + " -range 0 0 \n -iconSize \"smallIcons\" \n -showCachedConnections 0\n $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"hyperShadePanel\" (localizedPanelLabel(\"Hypershade\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Hypershade\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"visorPanel\" (localizedPanelLabel(\"Visor\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Visor\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"nodeEditorPanel\" (localizedPanelLabel(\"Node Editor\")) `;\n\tif ($nodeEditorPanelVisible || $nodeEditorWorkspaceControlOpen) {\n" + + "\t\tif (\"\" == $panelName) {\n\t\t\tif ($useSceneConfig) {\n\t\t\t\t$panelName = `scriptedPanel -unParent -type \"nodeEditorPanel\" -l (localizedPanelLabel(\"Node Editor\")) -mbv $menusOkayInPanels `;\n\n\t\t\t$editorName = ($panelName+\"NodeEditorEd\");\n nodeEditor -e \n -allAttributes 0\n -allNodes 0\n -autoSizeNodes 1\n -consistentNameSize 1\n -createNodeCommand \"nodeEdCreateNodeCommand\" \n -connectNodeOnCreation 0\n -connectOnDrop 0\n -copyConnectionsOnPaste 0\n -connectionStyle \"bezier\" \n -defaultPinnedState 0\n -additiveGraphingMode 0\n -settingsChangedCallback \"nodeEdSyncControls\" \n -traversalDepthLimit -1\n -keyPressCommand \"nodeEdKeyPressCommand\" \n -nodeTitleMode \"name\" \n -gridSnap 0\n -gridVisibility 1\n -crosshairOnEdgeDragging 0\n -popupMenuScript \"nodeEdBuildPanelMenus\" \n" + + " -showNamespace 1\n -showShapes 1\n -showSGShapes 0\n -showTransforms 1\n -useAssets 1\n -syncedSelection 1\n -extendToShapes 1\n -editorMode \"default\" \n -hasWatchpoint 0\n $editorName;\n\t\t\t}\n\t\t} else {\n\t\t\t$label = `panel -q -label $panelName`;\n\t\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Node Editor\")) -mbv $menusOkayInPanels $panelName;\n\n\t\t\t$editorName = ($panelName+\"NodeEditorEd\");\n nodeEditor -e \n -allAttributes 0\n -allNodes 0\n -autoSizeNodes 1\n -consistentNameSize 1\n -createNodeCommand \"nodeEdCreateNodeCommand\" \n -connectNodeOnCreation 0\n -connectOnDrop 0\n -copyConnectionsOnPaste 0\n -connectionStyle \"bezier\" \n -defaultPinnedState 0\n -additiveGraphingMode 0\n -settingsChangedCallback \"nodeEdSyncControls\" \n" + + " -traversalDepthLimit -1\n -keyPressCommand \"nodeEdKeyPressCommand\" \n -nodeTitleMode \"name\" \n -gridSnap 0\n -gridVisibility 1\n -crosshairOnEdgeDragging 0\n -popupMenuScript \"nodeEdBuildPanelMenus\" \n -showNamespace 1\n -showShapes 1\n -showSGShapes 0\n -showTransforms 1\n -useAssets 1\n -syncedSelection 1\n -extendToShapes 1\n -editorMode \"default\" \n -hasWatchpoint 0\n $editorName;\n\t\t\tif (!$useSceneConfig) {\n\t\t\t\tpanel -e -l $label $panelName;\n\t\t\t}\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"createNodePanel\" (localizedPanelLabel(\"Create Node\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Create Node\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n" + + "\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"polyTexturePlacementPanel\" (localizedPanelLabel(\"UV Editor\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"UV Editor\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"renderWindowPanel\" (localizedPanelLabel(\"Render View\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Render View\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"shapePanel\" (localizedPanelLabel(\"Shape Editor\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tshapePanel -edit -l (localizedPanelLabel(\"Shape Editor\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n" + + "\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"posePanel\" (localizedPanelLabel(\"Pose Editor\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tposePanel -edit -l (localizedPanelLabel(\"Pose Editor\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"dynRelEdPanel\" (localizedPanelLabel(\"Dynamic Relationships\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Dynamic Relationships\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"relationshipPanel\" (localizedPanelLabel(\"Relationship Editor\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Relationship Editor\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n" + + "\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"referenceEditorPanel\" (localizedPanelLabel(\"Reference Editor\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Reference Editor\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"componentEditorPanel\" (localizedPanelLabel(\"Component Editor\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Component Editor\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"dynPaintScriptedPanelType\" (localizedPanelLabel(\"Paint Effects\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Paint Effects\")) -mbv $menusOkayInPanels $panelName;\n" + + "\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"scriptEditorPanel\" (localizedPanelLabel(\"Script Editor\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Script Editor\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"profilerPanel\" (localizedPanelLabel(\"Profiler Tool\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Profiler Tool\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"contentBrowserPanel\" (localizedPanelLabel(\"Content Browser\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Content Browser\")) -mbv $menusOkayInPanels $panelName;\n" + + "\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\tif ($useSceneConfig) {\n string $configName = `getPanel -cwl (localizedPanelLabel(\"Current Layout\"))`;\n if (\"\" != $configName) {\n\t\t\tpanelConfiguration -edit -label (localizedPanelLabel(\"Current Layout\")) \n\t\t\t\t-userCreated false\n\t\t\t\t-defaultImage \"vacantCell.xP:/\"\n\t\t\t\t-image \"\"\n\t\t\t\t-sc false\n\t\t\t\t-configString \"global string $gMainPane; paneLayout -e -cn \\\"single\\\" -ps 1 100 100 $gMainPane;\"\n\t\t\t\t-removeAllPanels\n\t\t\t\t-ap false\n\t\t\t\t\t(localizedPanelLabel(\"Persp View\")) \n\t\t\t\t\t\"modelPanel\"\n" + + "\t\t\t\t\t\"$panelName = `modelPanel -unParent -l (localizedPanelLabel(\\\"Persp View\\\")) -mbv $menusOkayInPanels `;\\n$editorName = $panelName;\\nmodelEditor -e \\n -cam `findStartUpCamera persp` \\n -useInteractiveMode 0\\n -displayLights \\\"default\\\" \\n -displayAppearance \\\"smoothShaded\\\" \\n -activeOnly 0\\n -ignorePanZoom 0\\n -wireframeOnShaded 0\\n -headsUpDisplay 1\\n -holdOuts 1\\n -selectionHiliteDisplay 1\\n -useDefaultMaterial 0\\n -bufferMode \\\"double\\\" \\n -twoSidedLighting 0\\n -backfaceCulling 0\\n -xray 0\\n -jointXray 0\\n -activeComponentsXray 0\\n -displayTextures 0\\n -smoothWireframe 0\\n -lineWidth 1\\n -textureAnisotropic 0\\n -textureHilight 1\\n -textureSampling 2\\n -textureDisplay \\\"modulate\\\" \\n -textureMaxSize 16384\\n -fogging 0\\n -fogSource \\\"fragment\\\" \\n -fogMode \\\"linear\\\" \\n -fogStart 0\\n -fogEnd 100\\n -fogDensity 0.1\\n -fogColor 0.5 0.5 0.5 1 \\n -depthOfFieldPreview 1\\n -maxConstantTransparency 1\\n -rendererName \\\"vp2Renderer\\\" \\n -objectFilterShowInHUD 1\\n -isFiltered 0\\n -colorResolution 256 256 \\n -bumpResolution 512 512 \\n -textureCompression 0\\n -transparencyAlgorithm \\\"frontAndBackCull\\\" \\n -transpInShadows 0\\n -cullingOverride \\\"none\\\" \\n -lowQualityLighting 0\\n -maximumNumHardwareLights 1\\n -occlusionCulling 0\\n -shadingModel 0\\n -useBaseRenderer 0\\n -useReducedRenderer 0\\n -smallObjectCulling 0\\n -smallObjectThreshold -1 \\n -interactiveDisableShadows 0\\n -interactiveBackFaceCull 0\\n -sortTransparent 1\\n -controllers 1\\n -nurbsCurves 1\\n -nurbsSurfaces 1\\n -polymeshes 1\\n -subdivSurfaces 1\\n -planes 1\\n -lights 1\\n -cameras 1\\n -controlVertices 1\\n -hulls 1\\n -grid 1\\n -imagePlane 1\\n -joints 1\\n -ikHandles 1\\n -deformers 1\\n -dynamics 1\\n -particleInstancers 1\\n -fluids 1\\n -hairSystems 1\\n -follicles 1\\n -nCloths 1\\n -nParticles 1\\n -nRigids 1\\n -dynamicConstraints 1\\n -locators 1\\n -manipulators 1\\n -pluginShapes 1\\n -dimensions 1\\n -handles 1\\n -pivots 1\\n -textures 1\\n -strokes 1\\n -motionTrails 1\\n -clipGhosts 1\\n -greasePencils 1\\n -shadows 0\\n -captureSequenceNumber -1\\n -width 998\\n -height 838\\n -sceneRenderFilter 0\\n $editorName;\\nmodelEditor -e -viewSelected 0 $editorName;\\nmodelEditor -e \\n -pluginObjects \\\"gpuCacheDisplayFilter\\\" 1 \\n $editorName\"\n" + + "\t\t\t\t\t\"modelPanel -edit -l (localizedPanelLabel(\\\"Persp View\\\")) -mbv $menusOkayInPanels $panelName;\\n$editorName = $panelName;\\nmodelEditor -e \\n -cam `findStartUpCamera persp` \\n -useInteractiveMode 0\\n -displayLights \\\"default\\\" \\n -displayAppearance \\\"smoothShaded\\\" \\n -activeOnly 0\\n -ignorePanZoom 0\\n -wireframeOnShaded 0\\n -headsUpDisplay 1\\n -holdOuts 1\\n -selectionHiliteDisplay 1\\n -useDefaultMaterial 0\\n -bufferMode \\\"double\\\" \\n -twoSidedLighting 0\\n -backfaceCulling 0\\n -xray 0\\n -jointXray 0\\n -activeComponentsXray 0\\n -displayTextures 0\\n -smoothWireframe 0\\n -lineWidth 1\\n -textureAnisotropic 0\\n -textureHilight 1\\n -textureSampling 2\\n -textureDisplay \\\"modulate\\\" \\n -textureMaxSize 16384\\n -fogging 0\\n -fogSource \\\"fragment\\\" \\n -fogMode \\\"linear\\\" \\n -fogStart 0\\n -fogEnd 100\\n -fogDensity 0.1\\n -fogColor 0.5 0.5 0.5 1 \\n -depthOfFieldPreview 1\\n -maxConstantTransparency 1\\n -rendererName \\\"vp2Renderer\\\" \\n -objectFilterShowInHUD 1\\n -isFiltered 0\\n -colorResolution 256 256 \\n -bumpResolution 512 512 \\n -textureCompression 0\\n -transparencyAlgorithm \\\"frontAndBackCull\\\" \\n -transpInShadows 0\\n -cullingOverride \\\"none\\\" \\n -lowQualityLighting 0\\n -maximumNumHardwareLights 1\\n -occlusionCulling 0\\n -shadingModel 0\\n -useBaseRenderer 0\\n -useReducedRenderer 0\\n -smallObjectCulling 0\\n -smallObjectThreshold -1 \\n -interactiveDisableShadows 0\\n -interactiveBackFaceCull 0\\n -sortTransparent 1\\n -controllers 1\\n -nurbsCurves 1\\n -nurbsSurfaces 1\\n -polymeshes 1\\n -subdivSurfaces 1\\n -planes 1\\n -lights 1\\n -cameras 1\\n -controlVertices 1\\n -hulls 1\\n -grid 1\\n -imagePlane 1\\n -joints 1\\n -ikHandles 1\\n -deformers 1\\n -dynamics 1\\n -particleInstancers 1\\n -fluids 1\\n -hairSystems 1\\n -follicles 1\\n -nCloths 1\\n -nParticles 1\\n -nRigids 1\\n -dynamicConstraints 1\\n -locators 1\\n -manipulators 1\\n -pluginShapes 1\\n -dimensions 1\\n -handles 1\\n -pivots 1\\n -textures 1\\n -strokes 1\\n -motionTrails 1\\n -clipGhosts 1\\n -greasePencils 1\\n -shadows 0\\n -captureSequenceNumber -1\\n -width 998\\n -height 838\\n -sceneRenderFilter 0\\n $editorName;\\nmodelEditor -e -viewSelected 0 $editorName;\\nmodelEditor -e \\n -pluginObjects \\\"gpuCacheDisplayFilter\\\" 1 \\n $editorName\"\n" + + "\t\t\t\t$configName;\n\n setNamedPanelLayout (localizedPanelLabel(\"Current Layout\"));\n }\n\n panelHistory -e -clear mainPanelHistory;\n sceneUIReplacement -clear;\n\t}\n\n\ngrid -spacing 5 -size 12 -divisions 5 -displayAxes yes -displayGridLines yes -displayDivisionLines yes -displayPerspectiveLabels no -displayOrthographicLabels no -displayAxesBold yes -perspectiveLabelPosition axis -orthographicLabelPosition edge;\nviewManip -drawCompass 0 -compassAngle 0 -frontParameters \"\" -homeParameters \"\" -selectionLockParameters \"\";\n}\n"); + setAttr ".st" 3; +createNode script -n "sceneConfigurationScriptNode"; + rename -uid "1E00600E-415B-C82F-8D16-40ADA1C4FC0F"; + setAttr ".b" -type "string" "playbackOptions -min 1 -max 120 -ast 1 -aet 200 "; + setAttr ".st" 6; +select -ne :time1; + setAttr ".o" 1; + setAttr ".unw" 1; +select -ne :hardwareRenderingGlobals; + setAttr ".otfna" -type "stringArray" 22 "NURBS Curves" "NURBS Surfaces" "Polygons" "Subdiv Surface" "Particles" "Particle Instance" "Fluids" "Strokes" "Image Planes" "UI" "Lights" "Cameras" "Locators" "Joints" "IK Handles" "Deformers" "Motion Trails" "Components" "Hair Systems" "Follicles" "Misc. UI" "Ornaments" ; + setAttr ".otfva" -type "Int32Array" 22 0 1 1 1 1 1 + 1 1 1 0 0 0 0 0 0 0 0 0 + 0 0 0 0 ; + setAttr ".fprt" yes; +select -ne :renderPartition; + setAttr -s 2 ".st"; +select -ne :renderGlobalsList1; +select -ne :defaultShaderList1; + setAttr -s 5 ".s"; +select -ne :postProcessList1; + setAttr -s 2 ".p"; +select -ne :defaultRenderingList1; +select -ne :initialShadingGroup; + setAttr ".ro" yes; +select -ne :initialParticleSE; + setAttr ".ro" yes; +select -ne :defaultRenderGlobals; + addAttr -ci true -h true -sn "dss" -ln "defaultSurfaceShader" -dt "string"; + setAttr ".dss" -type "string" "lambert1"; +select -ne :defaultResolution; + setAttr ".pa" 1; +select -ne :hardwareRenderGlobals; + setAttr ".ctrs" 256; + setAttr ".btrs" 512; +select -ne :ikSystem; + setAttr -s 4 ".sol"; +connectAttr ":time1.o" "Tree_usdShape.tm"; +relationship "link" ":lightLinker1" ":initialShadingGroup.message" ":defaultLightSet.message"; +relationship "link" ":lightLinker1" ":initialParticleSE.message" ":defaultLightSet.message"; +relationship "shadowLink" ":lightLinker1" ":initialShadingGroup.message" ":defaultLightSet.message"; +relationship "shadowLink" ":lightLinker1" ":initialParticleSE.message" ":defaultLightSet.message"; +connectAttr "layerManager.dli[0]" "defaultLayer.id"; +connectAttr "renderLayerManager.rlmi[0]" "defaultRenderLayer.rlid"; +connectAttr "defaultRenderLayer.msg" ":defaultRenderingList1.r" -na; +// End of tree.ma diff --git a/test/lib/ufe/test-samples/tree/tree.usda b/test/lib/ufe/test-samples/tree/tree.usda new file mode 100644 index 0000000000..762be07466 --- /dev/null +++ b/test/lib/ufe/test-samples/tree/tree.usda @@ -0,0 +1,34 @@ +#usda 1.0 +( + defaultPrim = "TreeBase" + upAxis = "Y" +) + +def Xform "TreeBase" +{ + def Xform "leavesXform" + { + double3 xformOp:translate = (0, 2.5, 0) + uniform token[] xformOpOrder = ["xformOp:translate"] + + def Sphere "leaves" + { + float3[] extent = [(-2, -2, -2), (2, 2, 2)] + color3f[] primvars:displayColor = [(0, 1, 0)] + double radius = 2 + } + } + + def Cylinder "trunk" ( + active = true + kind = "component" + ) + { + uniform token axis = "Y" + float3[] extent = [(-1, -1, -1), (1, 1, 1)] + double height = 2 + color3f[] primvars:displayColor = [(0.66, 0.33, 0)] + double radius = 0.5 + } +} + diff --git a/test/lib/ufe/testRename.py b/test/lib/ufe/testRename.py index 4ff3e52761..06787d8bea 100644 --- a/test/lib/ufe/testRename.py +++ b/test/lib/ufe/testRename.py @@ -96,6 +96,49 @@ def assertStageAndPrimAccess( assertStageAndPrimAccess(mayaSegment, ball35PathStr, usdSegment) def testRename(self): + # open tree.ma scene in test-samples + mayaUtils.openTreeScene() + + # clear selection to start off + cmds.select(clear=True) + + # select a USD object. + mayaPathSegment = mayaUtils.createUfePathSegment('|world|Tree_usd|Tree_usdShape') + usdPathSegment = usdUtils.createUfePathSegment('/TreeBase') + treebasePath = ufe.Path([mayaPathSegment, usdPathSegment]) + treebaseItem = ufe.Hierarchy.createItem(treebasePath) + + ufe.GlobalSelection.get().append(treebaseItem) + + # get the USD stage + stage = mayaUsd.ufe.getStage(str(mayaPathSegment)) + + # set the edit target to the root layer + stage.SetEditTarget(stage.GetRootLayer()) + self.assertEqual(stage.GetEditTarget().GetLayer(), stage.GetRootLayer()) + self.assertTrue(stage.GetRootLayer().GetPrimAtPath("/TreeBase")) + + # get default prim + defualtPrim = stage.GetDefaultPrim() + self.assertEqual(defualtPrim.GetName(), 'TreeBase') + + # TreeBase has two childern: leavesXform, trunk + assert len(defualtPrim.GetChildren()) == 2 + + # get prim spec for defualtPrim + primspec = stage.GetEditTarget().GetPrimSpecForScenePath(defualtPrim.GetPath()); + + # set primspec name + primspec.name = "TreeBase_potato" + + assert stage.GetPrimAtPath('/TreeBase_potato') + assert stage.GetPrimAtPath('/TreeBase_potato/leavesXform') + + # HS, 6-May-2020. defualtPrim in null?? This can't be null.... + # defualtPrim = stage.GetDefaultPrim() + # self.assertEqual(defualtPrim.GetName(), 'TreeBase_potato') + + def testRenameUndo(self): '''Rename USD node.''' # open usdCylinder.ma scene in test-samples diff --git a/test/lib/ufe/ufeTestUtils/mayaUtils.py b/test/lib/ufe/ufeTestUtils/mayaUtils.py index 3bc70525aa..c1a285cc40 100644 --- a/test/lib/ufe/ufeTestUtils/mayaUtils.py +++ b/test/lib/ufe/ufeTestUtils/mayaUtils.py @@ -138,3 +138,7 @@ def openTwoSpheresScene(): def openSphereAnimatedRadiusScene(): filePath = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "test-samples", "sphereAnimatedRadius", "sphereAnimatedRadiusProxyShape.ma" ) cmds.file(filePath, force=True, open=True) + +def openTreeScene(): + filePath = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "test-samples", "tree", "tree.ma" ) + cmds.file(filePath, force=True, open=True) From a45779cbf6813d282cc57605ce6c4efe9e08b242 Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Thu, 7 May 2020 12:27:12 -0400 Subject: [PATCH 14/28] Updated test prim. tesRename does pass but there are still some issues around the stage behavior that deserves an explanation. --- test/lib/ufe/testRename.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/test/lib/ufe/testRename.py b/test/lib/ufe/testRename.py index 06787d8bea..7fa4e9479b 100644 --- a/test/lib/ufe/testRename.py +++ b/test/lib/ufe/testRename.py @@ -130,13 +130,22 @@ def testRename(self): # set primspec name primspec.name = "TreeBase_potato" + + # HS, 6-May-2020. defualtPrim in null?? This can't be null.... + # defualtPrim = stage.GetDefaultPrim() + # self.assertEqual(defualtPrim.GetName(), 'TreeBase_potato') + # make sure we have a valid prims after the primspec rename assert stage.GetPrimAtPath('/TreeBase_potato') assert stage.GetPrimAtPath('/TreeBase_potato/leavesXform') - # HS, 6-May-2020. defualtPrim in null?? This can't be null.... - # defualtPrim = stage.GetDefaultPrim() - # self.assertEqual(defualtPrim.GetName(), 'TreeBase_potato') + # prim should be called TreeBase_potato + potatoPrim = stage.GetPrimAtPath('/TreeBase_potato') + self.assertEqual(potatoPrim.GetName(), 'TreeBase_potato') + + # prim should be called leaves + leavesPrimSpec = stage.GetObjectAtPath('/TreeBase_potato/leavesXform/leaves') + self.assertEqual(leavesPrimSpec.GetName(), 'leaves') def testRenameUndo(self): '''Rename USD node.''' From b207895d0dda9c08c6759098fff8b7ec7cab3826 Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Mon, 11 May 2020 15:38:27 -0400 Subject: [PATCH 15/28] - Add new logics for handling internal vs external references. - Add a simple testRenameRestrictionExternalReference unit test. --- lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp | 17 +- test/lib/ufe/test-samples/tree/treeRef.ma | 188 ++++++++++++++++++++ test/lib/ufe/test-samples/tree/treeRef.usda | 51 ++++++ test/lib/ufe/testRename.py | 36 ++++ test/lib/ufe/ufeTestUtils/mayaUtils.py | 4 + 5 files changed, 295 insertions(+), 1 deletion(-) create mode 100644 test/lib/ufe/test-samples/tree/treeRef.ma create mode 100644 test/lib/ufe/test-samples/tree/treeRef.usda diff --git a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp index 6e807a5647..f90f0d57fa 100644 --- a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp +++ b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp @@ -60,8 +60,23 @@ UsdUndoRenameCommand::UsdUndoRenameCommand(const UsdSceneItem::Ptr& srcItem, con } else { - auto layers = MayaUsdUtils::layersWithPrimSpec(_prim); + // account for internal vs external references + if (_prim.HasAuthoredReferences()) { + auto primSpec = MayaUsdUtils::getPrimSpecAtEditTarget(_stage, _prim); + for (const SdfReference& ref : primSpec->GetReferenceList().GetAddedOrExplicitItems()) { + // GetAssetPath returns the asset path to the root layer of the referenced layer + // this will be empty in the case of an internal reference. + if (ref.GetAssetPath().empty()) { + return; + }else{ + std::string err = TfStringPrintf("Unable to rename referenced object [%s]", + _prim.GetName().GetString().c_str()); + throw std::runtime_error(err.c_str()); + } + } + } + auto layers = MayaUsdUtils::layersWithPrimSpec(_prim); if (layers.size() > 1) { std::string layerDisplayNames; for (auto layer : layers) { diff --git a/test/lib/ufe/test-samples/tree/treeRef.ma b/test/lib/ufe/test-samples/tree/treeRef.ma new file mode 100644 index 0000000000..84194a96fd --- /dev/null +++ b/test/lib/ufe/test-samples/tree/treeRef.ma @@ -0,0 +1,188 @@ +//Maya ASCII 2020 scene +//Name: treeRef.ma +//Last modified: Mon, May 11, 2020 02:01:42 PM +//Codeset: 1252 +requires maya "2020"; +requires -nodeType "mayaUsdProxyShape" -dataType "pxrUsdStageData" "mayaUsdPlugin" "1.0"; +currentUnit -l centimeter -a degree -t film; +fileInfo "application" "maya"; +fileInfo "product" "Maya 2021"; +fileInfo "version" "Preview Release 114"; +fileInfo "cutIdentifier" "202005040148-000000"; +fileInfo "osv" "Microsoft Windows 10 Technical Preview (Build 18363)\n"; +fileInfo "UUID" "56B25683-4BEE-1841-FB6E-8F9FDB55B964"; +createNode transform -s -n "persp"; + rename -uid "C6455DE8-4852-C6C1-5C79-B98E5E2942F0"; + setAttr ".v" no; + setAttr ".t" -type "double3" 33.084547980870425 27.799098447340008 37.322134830526778 ; + setAttr ".r" -type "double3" -27.938352729602379 44.999999999999972 -5.172681101354183e-14 ; +createNode camera -s -n "perspShape" -p "persp"; + rename -uid "BE099625-4362-A3A3-B4CA-8086BC864645"; + setAttr -k off ".v" no; + setAttr ".fl" 34.999999999999993; + setAttr ".coi" 57.007175411913423; + setAttr ".imn" -type "string" "persp"; + setAttr ".den" -type "string" "persp_depth"; + setAttr ".man" -type "string" "persp_mask"; + setAttr ".hc" -type "string" "viewSet -p %camera"; +createNode transform -s -n "top"; + rename -uid "0C95C688-446E-A0AB-6CBB-7BBAB53A67B3"; + setAttr ".v" no; + setAttr ".t" -type "double3" 0 1000.1 0 ; + setAttr ".r" -type "double3" -90 0 0 ; +createNode camera -s -n "topShape" -p "top"; + rename -uid "A7E8C37E-4CBA-C436-7D6C-5FB51AA3F534"; + setAttr -k off ".v" no; + setAttr ".rnd" no; + setAttr ".coi" 1000.1; + setAttr ".ow" 30; + setAttr ".imn" -type "string" "top"; + setAttr ".den" -type "string" "top_depth"; + setAttr ".man" -type "string" "top_mask"; + setAttr ".hc" -type "string" "viewSet -t %camera"; + setAttr ".o" yes; +createNode transform -s -n "front"; + rename -uid "DF94BB18-42A2-B49B-EAC0-9997968C52FE"; + setAttr ".v" no; + setAttr ".t" -type "double3" 0 0 1000.1 ; +createNode camera -s -n "frontShape" -p "front"; + rename -uid "AAD72F0A-4867-CDCB-5E8C-A3A797A0A0E9"; + setAttr -k off ".v" no; + setAttr ".rnd" no; + setAttr ".coi" 1000.1; + setAttr ".ow" 30; + setAttr ".imn" -type "string" "front"; + setAttr ".den" -type "string" "front_depth"; + setAttr ".man" -type "string" "front_mask"; + setAttr ".hc" -type "string" "viewSet -f %camera"; + setAttr ".o" yes; +createNode transform -s -n "side"; + rename -uid "0479122C-431B-16EB-CE66-3CA4FDE3FEA2"; + setAttr ".v" no; + setAttr ".t" -type "double3" 1000.1 0 0 ; + setAttr ".r" -type "double3" 0 90 0 ; +createNode camera -s -n "sideShape" -p "side"; + rename -uid "E8711B43-4D16-3347-A860-C9AF51F2A979"; + setAttr -k off ".v" no; + setAttr ".rnd" no; + setAttr ".coi" 1000.1; + setAttr ".ow" 30; + setAttr ".imn" -type "string" "side"; + setAttr ".den" -type "string" "side_depth"; + setAttr ".man" -type "string" "side_mask"; + setAttr ".hc" -type "string" "viewSet -s %camera"; + setAttr ".o" yes; +createNode transform -n "TreeRef_usd"; + rename -uid "16C280A5-41BD-026A-4CA3-C8B6412EADCA"; +createNode mayaUsdProxyShape -n "TreeRef_usdShape" -p "TreeRef_usd"; + rename -uid "7C26E617-4C83-0CAF-7228-3193512FCAF4"; + setAttr -k off ".v"; + setAttr ".covm[0]" 0 1 1; + setAttr ".cdvm[0]" 0 1 1; + setAttr ".fp" -type "string" "R:/Users/sabrih/Autodesk2019/maya/worktrees/master/Maya/src/Components/USD/maya-usd/test/lib/ufe/test-samples/tree/treeRef.usda"; + setAttr ".pp" -type "string" ""; + setAttr ".epp" -type "string" ""; +createNode lightLinker -s -n "lightLinker1"; + rename -uid "96879827-4612-575C-4E96-EDA573CAFC1C"; + setAttr -s 2 ".lnk"; + setAttr -s 2 ".slnk"; +createNode shapeEditorManager -n "shapeEditorManager"; + rename -uid "09ED14F4-4B41-24F9-0AAE-2A952DEFC02C"; +createNode poseInterpolatorManager -n "poseInterpolatorManager"; + rename -uid "67DC7121-459A-9E38-1359-3AA488F604B4"; +createNode displayLayerManager -n "layerManager"; + rename -uid "2CB4DBC2-4B06-9CFD-6429-88A3603FCFA7"; +createNode displayLayer -n "defaultLayer"; + rename -uid "59A2A72B-47DC-BD3E-6E01-689385416552"; +createNode renderLayerManager -n "renderLayerManager"; + rename -uid "2FF71245-4B4A-F0F0-2DD3-5A9660C0E422"; +createNode renderLayer -n "defaultRenderLayer"; + rename -uid "9B57EA7D-4185-7A9D-224E-EBAF23B6790B"; + setAttr ".g" yes; +createNode script -n "uiConfigurationScriptNode"; + rename -uid "C4D2795C-460F-FFBD-8976-73A7064EF58F"; + setAttr ".b" -type "string" ( + "// Maya Mel UI Configuration File.\n//\n// This script is machine generated. Edit at your own risk.\n//\n//\n\nglobal string $gMainPane;\nif (`paneLayout -exists $gMainPane`) {\n\n\tglobal int $gUseScenePanelConfig;\n\tint $useSceneConfig = $gUseScenePanelConfig;\n\tint $nodeEditorPanelVisible = stringArrayContains(\"nodeEditorPanel1\", `getPanel -vis`);\n\tint $nodeEditorWorkspaceControlOpen = (`workspaceControl -exists nodeEditorPanel1Window` && `workspaceControl -q -visible nodeEditorPanel1Window`);\n\tint $menusOkayInPanels = `optionVar -q allowMenusInPanels`;\n\tint $nVisPanes = `paneLayout -q -nvp $gMainPane`;\n\tint $nPanes = 0;\n\tstring $editorName;\n\tstring $panelName;\n\tstring $itemFilterName;\n\tstring $panelConfig;\n\n\t//\n\t// get current state of the UI\n\t//\n\tsceneUIReplacement -update $gMainPane;\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"modelPanel\" (localizedPanelLabel(\"Top View\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tmodelPanel -edit -l (localizedPanelLabel(\"Top View\")) -mbv $menusOkayInPanels $panelName;\n" + + "\t\t$editorName = $panelName;\n modelEditor -e \n -camera \"top\" \n -useInteractiveMode 0\n -displayLights \"default\" \n -displayAppearance \"smoothShaded\" \n -activeOnly 0\n -ignorePanZoom 0\n -wireframeOnShaded 0\n -headsUpDisplay 1\n -holdOuts 1\n -selectionHiliteDisplay 1\n -useDefaultMaterial 0\n -bufferMode \"double\" \n -twoSidedLighting 0\n -backfaceCulling 0\n -xray 0\n -jointXray 0\n -activeComponentsXray 0\n -displayTextures 0\n -smoothWireframe 0\n -lineWidth 1\n -textureAnisotropic 0\n -textureHilight 1\n -textureSampling 2\n -textureDisplay \"modulate\" \n -textureMaxSize 16384\n -fogging 0\n -fogSource \"fragment\" \n -fogMode \"linear\" \n -fogStart 0\n -fogEnd 100\n -fogDensity 0.1\n -fogColor 0.5 0.5 0.5 1 \n" + + " -depthOfFieldPreview 1\n -maxConstantTransparency 1\n -rendererName \"vp2Renderer\" \n -objectFilterShowInHUD 1\n -isFiltered 0\n -colorResolution 256 256 \n -bumpResolution 512 512 \n -textureCompression 0\n -transparencyAlgorithm \"frontAndBackCull\" \n -transpInShadows 0\n -cullingOverride \"none\" \n -lowQualityLighting 0\n -maximumNumHardwareLights 1\n -occlusionCulling 0\n -shadingModel 0\n -useBaseRenderer 0\n -useReducedRenderer 0\n -smallObjectCulling 0\n -smallObjectThreshold -1 \n -interactiveDisableShadows 0\n -interactiveBackFaceCull 0\n -sortTransparent 1\n -controllers 1\n -nurbsCurves 1\n -nurbsSurfaces 1\n -polymeshes 1\n -subdivSurfaces 1\n -planes 1\n -lights 1\n -cameras 1\n -controlVertices 1\n" + + " -hulls 1\n -grid 1\n -imagePlane 1\n -joints 1\n -ikHandles 1\n -deformers 1\n -dynamics 1\n -particleInstancers 1\n -fluids 1\n -hairSystems 1\n -follicles 1\n -nCloths 1\n -nParticles 1\n -nRigids 1\n -dynamicConstraints 1\n -locators 1\n -manipulators 1\n -pluginShapes 1\n -dimensions 1\n -handles 1\n -pivots 1\n -textures 1\n -strokes 1\n -motionTrails 1\n -clipGhosts 1\n -greasePencils 1\n -shadows 0\n -captureSequenceNumber -1\n -width 1\n -height 1\n -sceneRenderFilter 0\n $editorName;\n modelEditor -e -viewSelected 0 $editorName;\n modelEditor -e \n -pluginObjects \"gpuCacheDisplayFilter\" 1 \n $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n" + + "\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"modelPanel\" (localizedPanelLabel(\"Side View\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tmodelPanel -edit -l (localizedPanelLabel(\"Side View\")) -mbv $menusOkayInPanels $panelName;\n\t\t$editorName = $panelName;\n modelEditor -e \n -camera \"side\" \n -useInteractiveMode 0\n -displayLights \"default\" \n -displayAppearance \"smoothShaded\" \n -activeOnly 0\n -ignorePanZoom 0\n -wireframeOnShaded 0\n -headsUpDisplay 1\n -holdOuts 1\n -selectionHiliteDisplay 1\n -useDefaultMaterial 0\n -bufferMode \"double\" \n -twoSidedLighting 0\n -backfaceCulling 0\n -xray 0\n -jointXray 0\n -activeComponentsXray 0\n -displayTextures 0\n -smoothWireframe 0\n -lineWidth 1\n -textureAnisotropic 0\n -textureHilight 1\n -textureSampling 2\n" + + " -textureDisplay \"modulate\" \n -textureMaxSize 16384\n -fogging 0\n -fogSource \"fragment\" \n -fogMode \"linear\" \n -fogStart 0\n -fogEnd 100\n -fogDensity 0.1\n -fogColor 0.5 0.5 0.5 1 \n -depthOfFieldPreview 1\n -maxConstantTransparency 1\n -rendererName \"vp2Renderer\" \n -objectFilterShowInHUD 1\n -isFiltered 0\n -colorResolution 256 256 \n -bumpResolution 512 512 \n -textureCompression 0\n -transparencyAlgorithm \"frontAndBackCull\" \n -transpInShadows 0\n -cullingOverride \"none\" \n -lowQualityLighting 0\n -maximumNumHardwareLights 1\n -occlusionCulling 0\n -shadingModel 0\n -useBaseRenderer 0\n -useReducedRenderer 0\n -smallObjectCulling 0\n -smallObjectThreshold -1 \n -interactiveDisableShadows 0\n -interactiveBackFaceCull 0\n" + + " -sortTransparent 1\n -controllers 1\n -nurbsCurves 1\n -nurbsSurfaces 1\n -polymeshes 1\n -subdivSurfaces 1\n -planes 1\n -lights 1\n -cameras 1\n -controlVertices 1\n -hulls 1\n -grid 1\n -imagePlane 1\n -joints 1\n -ikHandles 1\n -deformers 1\n -dynamics 1\n -particleInstancers 1\n -fluids 1\n -hairSystems 1\n -follicles 1\n -nCloths 1\n -nParticles 1\n -nRigids 1\n -dynamicConstraints 1\n -locators 1\n -manipulators 1\n -pluginShapes 1\n -dimensions 1\n -handles 1\n -pivots 1\n -textures 1\n -strokes 1\n -motionTrails 1\n -clipGhosts 1\n -greasePencils 1\n -shadows 0\n -captureSequenceNumber -1\n -width 1\n -height 1\n" + + " -sceneRenderFilter 0\n $editorName;\n modelEditor -e -viewSelected 0 $editorName;\n modelEditor -e \n -pluginObjects \"gpuCacheDisplayFilter\" 1 \n $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"modelPanel\" (localizedPanelLabel(\"Front View\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tmodelPanel -edit -l (localizedPanelLabel(\"Front View\")) -mbv $menusOkayInPanels $panelName;\n\t\t$editorName = $panelName;\n modelEditor -e \n -camera \"front\" \n -useInteractiveMode 0\n -displayLights \"default\" \n -displayAppearance \"smoothShaded\" \n -activeOnly 0\n -ignorePanZoom 0\n -wireframeOnShaded 0\n -headsUpDisplay 1\n -holdOuts 1\n -selectionHiliteDisplay 1\n -useDefaultMaterial 0\n -bufferMode \"double\" \n -twoSidedLighting 0\n -backfaceCulling 0\n" + + " -xray 0\n -jointXray 0\n -activeComponentsXray 0\n -displayTextures 0\n -smoothWireframe 0\n -lineWidth 1\n -textureAnisotropic 0\n -textureHilight 1\n -textureSampling 2\n -textureDisplay \"modulate\" \n -textureMaxSize 16384\n -fogging 0\n -fogSource \"fragment\" \n -fogMode \"linear\" \n -fogStart 0\n -fogEnd 100\n -fogDensity 0.1\n -fogColor 0.5 0.5 0.5 1 \n -depthOfFieldPreview 1\n -maxConstantTransparency 1\n -rendererName \"vp2Renderer\" \n -objectFilterShowInHUD 1\n -isFiltered 0\n -colorResolution 256 256 \n -bumpResolution 512 512 \n -textureCompression 0\n -transparencyAlgorithm \"frontAndBackCull\" \n -transpInShadows 0\n -cullingOverride \"none\" \n -lowQualityLighting 0\n -maximumNumHardwareLights 1\n -occlusionCulling 0\n" + + " -shadingModel 0\n -useBaseRenderer 0\n -useReducedRenderer 0\n -smallObjectCulling 0\n -smallObjectThreshold -1 \n -interactiveDisableShadows 0\n -interactiveBackFaceCull 0\n -sortTransparent 1\n -controllers 1\n -nurbsCurves 1\n -nurbsSurfaces 1\n -polymeshes 1\n -subdivSurfaces 1\n -planes 1\n -lights 1\n -cameras 1\n -controlVertices 1\n -hulls 1\n -grid 1\n -imagePlane 1\n -joints 1\n -ikHandles 1\n -deformers 1\n -dynamics 1\n -particleInstancers 1\n -fluids 1\n -hairSystems 1\n -follicles 1\n -nCloths 1\n -nParticles 1\n -nRigids 1\n -dynamicConstraints 1\n -locators 1\n -manipulators 1\n -pluginShapes 1\n -dimensions 1\n -handles 1\n -pivots 1\n" + + " -textures 1\n -strokes 1\n -motionTrails 1\n -clipGhosts 1\n -greasePencils 1\n -shadows 0\n -captureSequenceNumber -1\n -width 1\n -height 1\n -sceneRenderFilter 0\n $editorName;\n modelEditor -e -viewSelected 0 $editorName;\n modelEditor -e \n -pluginObjects \"gpuCacheDisplayFilter\" 1 \n $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"modelPanel\" (localizedPanelLabel(\"Persp View\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tmodelPanel -edit -l (localizedPanelLabel(\"Persp View\")) -mbv $menusOkayInPanels $panelName;\n\t\t$editorName = $panelName;\n modelEditor -e \n -camera \"persp\" \n -useInteractiveMode 0\n -displayLights \"default\" \n -displayAppearance \"smoothShaded\" \n -activeOnly 0\n -ignorePanZoom 0\n" + + " -wireframeOnShaded 0\n -headsUpDisplay 1\n -holdOuts 1\n -selectionHiliteDisplay 1\n -useDefaultMaterial 0\n -bufferMode \"double\" \n -twoSidedLighting 0\n -backfaceCulling 0\n -xray 0\n -jointXray 0\n -activeComponentsXray 0\n -displayTextures 0\n -smoothWireframe 0\n -lineWidth 1\n -textureAnisotropic 0\n -textureHilight 1\n -textureSampling 2\n -textureDisplay \"modulate\" \n -textureMaxSize 16384\n -fogging 0\n -fogSource \"fragment\" \n -fogMode \"linear\" \n -fogStart 0\n -fogEnd 100\n -fogDensity 0.1\n -fogColor 0.5 0.5 0.5 1 \n -depthOfFieldPreview 1\n -maxConstantTransparency 1\n -rendererName \"vp2Renderer\" \n -objectFilterShowInHUD 1\n -isFiltered 0\n -colorResolution 256 256 \n -bumpResolution 512 512 \n" + + " -textureCompression 0\n -transparencyAlgorithm \"frontAndBackCull\" \n -transpInShadows 0\n -cullingOverride \"none\" \n -lowQualityLighting 0\n -maximumNumHardwareLights 1\n -occlusionCulling 0\n -shadingModel 0\n -useBaseRenderer 0\n -useReducedRenderer 0\n -smallObjectCulling 0\n -smallObjectThreshold -1 \n -interactiveDisableShadows 0\n -interactiveBackFaceCull 0\n -sortTransparent 1\n -controllers 1\n -nurbsCurves 1\n -nurbsSurfaces 1\n -polymeshes 1\n -subdivSurfaces 1\n -planes 1\n -lights 1\n -cameras 1\n -controlVertices 1\n -hulls 1\n -grid 1\n -imagePlane 1\n -joints 1\n -ikHandles 1\n -deformers 1\n -dynamics 1\n -particleInstancers 1\n -fluids 1\n -hairSystems 1\n -follicles 1\n" + + " -nCloths 1\n -nParticles 1\n -nRigids 1\n -dynamicConstraints 1\n -locators 1\n -manipulators 1\n -pluginShapes 1\n -dimensions 1\n -handles 1\n -pivots 1\n -textures 1\n -strokes 1\n -motionTrails 1\n -clipGhosts 1\n -greasePencils 1\n -shadows 0\n -captureSequenceNumber -1\n -width 998\n -height 838\n -sceneRenderFilter 0\n $editorName;\n modelEditor -e -viewSelected 0 $editorName;\n modelEditor -e \n -pluginObjects \"gpuCacheDisplayFilter\" 1 \n $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"outlinerPanel\" (localizedPanelLabel(\"ToggledOutliner\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\toutlinerPanel -edit -l (localizedPanelLabel(\"ToggledOutliner\")) -mbv $menusOkayInPanels $panelName;\n" + + "\t\t$editorName = $panelName;\n outlinerEditor -e \n -showShapes 1\n -showAssignedMaterials 0\n -showTimeEditor 1\n -showReferenceNodes 1\n -showReferenceMembers 1\n -showAttributes 0\n -showConnected 0\n -showAnimCurvesOnly 0\n -showMuteInfo 0\n -organizeByLayer 1\n -organizeByClip 1\n -showAnimLayerWeight 1\n -autoExpandLayers 1\n -autoExpand 0\n -showDagOnly 1\n -showAssets 1\n -showContainedOnly 1\n -showPublishedAsConnected 0\n -showParentContainers 0\n -showContainerContents 1\n -ignoreDagHierarchy 0\n -expandConnections 0\n -showUpstreamCurves 1\n -showUnitlessCurves 1\n -showCompounds 1\n -showLeafs 1\n -showNumericAttrsOnly 0\n -highlightActive 1\n -autoSelectNewObjects 0\n -doNotSelectNewObjects 0\n -dropIsParent 1\n" + + " -transmitFilters 0\n -setFilter \"defaultSetFilter\" \n -showSetMembers 1\n -allowMultiSelection 1\n -alwaysToggleSelect 0\n -directSelect 0\n -isSet 0\n -isSetMember 0\n -displayMode \"DAG\" \n -expandObjects 0\n -setsIgnoreFilters 1\n -containersIgnoreFilters 0\n -editAttrName 0\n -showAttrValues 0\n -highlightSecondary 0\n -showUVAttrsOnly 0\n -showTextureNodesOnly 0\n -attrAlphaOrder \"default\" \n -animLayerFilterOptions \"allAffecting\" \n -sortOrder \"none\" \n -longNames 0\n -niceNames 1\n -showNamespace 1\n -showPinIcons 0\n -mapMotionTrails 0\n -ignoreHiddenAttribute 0\n -ignoreOutlinerColor 0\n -renderFilterVisible 0\n -renderFilterIndex 0\n -selectionOrder \"chronological\" \n -expandAttribute 0\n $editorName;\n" + + "\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"outlinerPanel\" (localizedPanelLabel(\"Outliner\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\toutlinerPanel -edit -l (localizedPanelLabel(\"Outliner\")) -mbv $menusOkayInPanels $panelName;\n\t\t$editorName = $panelName;\n outlinerEditor -e \n -showShapes 0\n -showAssignedMaterials 0\n -showTimeEditor 1\n -showReferenceNodes 0\n -showReferenceMembers 0\n -showAttributes 0\n -showConnected 0\n -showAnimCurvesOnly 0\n -showMuteInfo 0\n -organizeByLayer 1\n -organizeByClip 1\n -showAnimLayerWeight 1\n -autoExpandLayers 1\n -autoExpand 0\n -showDagOnly 1\n -showAssets 1\n -showContainedOnly 1\n -showPublishedAsConnected 0\n -showParentContainers 0\n -showContainerContents 1\n -ignoreDagHierarchy 0\n" + + " -expandConnections 0\n -showUpstreamCurves 1\n -showUnitlessCurves 1\n -showCompounds 1\n -showLeafs 1\n -showNumericAttrsOnly 0\n -highlightActive 1\n -autoSelectNewObjects 0\n -doNotSelectNewObjects 0\n -dropIsParent 1\n -transmitFilters 0\n -setFilter \"0\" \n -showSetMembers 1\n -allowMultiSelection 1\n -alwaysToggleSelect 0\n -directSelect 0\n -displayMode \"DAG\" \n -expandObjects 0\n -setsIgnoreFilters 1\n -containersIgnoreFilters 0\n -editAttrName 0\n -showAttrValues 0\n -highlightSecondary 0\n -showUVAttrsOnly 0\n -showTextureNodesOnly 0\n -attrAlphaOrder \"default\" \n -animLayerFilterOptions \"allAffecting\" \n -sortOrder \"none\" \n -longNames 0\n -niceNames 1\n -showNamespace 1\n -showPinIcons 0\n" + + " -mapMotionTrails 0\n -ignoreHiddenAttribute 0\n -ignoreOutlinerColor 0\n -renderFilterVisible 0\n $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"graphEditor\" (localizedPanelLabel(\"Graph Editor\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Graph Editor\")) -mbv $menusOkayInPanels $panelName;\n\n\t\t\t$editorName = ($panelName+\"OutlineEd\");\n outlinerEditor -e \n -showShapes 1\n -showAssignedMaterials 0\n -showTimeEditor 1\n -showReferenceNodes 0\n -showReferenceMembers 0\n -showAttributes 1\n -showConnected 1\n -showAnimCurvesOnly 1\n -showMuteInfo 0\n -organizeByLayer 1\n -organizeByClip 1\n -showAnimLayerWeight 1\n -autoExpandLayers 1\n" + + " -autoExpand 1\n -showDagOnly 0\n -showAssets 1\n -showContainedOnly 0\n -showPublishedAsConnected 0\n -showParentContainers 0\n -showContainerContents 0\n -ignoreDagHierarchy 0\n -expandConnections 1\n -showUpstreamCurves 1\n -showUnitlessCurves 1\n -showCompounds 0\n -showLeafs 1\n -showNumericAttrsOnly 1\n -highlightActive 0\n -autoSelectNewObjects 1\n -doNotSelectNewObjects 0\n -dropIsParent 1\n -transmitFilters 1\n -setFilter \"0\" \n -showSetMembers 0\n -allowMultiSelection 1\n -alwaysToggleSelect 0\n -directSelect 0\n -displayMode \"DAG\" \n -expandObjects 0\n -setsIgnoreFilters 1\n -containersIgnoreFilters 0\n -editAttrName 0\n" + + " -showAttrValues 0\n -highlightSecondary 0\n -showUVAttrsOnly 0\n -showTextureNodesOnly 0\n -attrAlphaOrder \"default\" \n -animLayerFilterOptions \"allAffecting\" \n -sortOrder \"none\" \n -longNames 0\n -niceNames 1\n -showNamespace 1\n -showPinIcons 1\n -mapMotionTrails 1\n -ignoreHiddenAttribute 0\n -ignoreOutlinerColor 0\n -renderFilterVisible 0\n $editorName;\n\n\t\t\t$editorName = ($panelName+\"GraphEd\");\n animCurveEditor -e \n -displayValues 0\n -snapTime \"integer\" \n -snapValue \"none\" \n -showPlayRangeShades \"on\" \n -lockPlayRangeShades \"off\" \n -smoothness \"fine\" \n -resultSamples 1\n -resultScreenSamples 0\n -resultUpdate \"delayed\" \n -showUpstreamCurves 1\n" + + " -stackedCurvesMin -1\n -stackedCurvesMax 1\n -stackedCurvesSpace 0.2\n -preSelectionHighlight 0\n -constrainDrag 0\n -valueLinesToggle 1\n -highlightAffectedCurves 0\n $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"dopeSheetPanel\" (localizedPanelLabel(\"Dope Sheet\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Dope Sheet\")) -mbv $menusOkayInPanels $panelName;\n\n\t\t\t$editorName = ($panelName+\"OutlineEd\");\n outlinerEditor -e \n -showShapes 1\n -showAssignedMaterials 0\n -showTimeEditor 1\n -showReferenceNodes 0\n -showReferenceMembers 0\n -showAttributes 1\n -showConnected 1\n -showAnimCurvesOnly 1\n -showMuteInfo 0\n" + + " -organizeByLayer 1\n -organizeByClip 1\n -showAnimLayerWeight 1\n -autoExpandLayers 1\n -autoExpand 0\n -showDagOnly 0\n -showAssets 1\n -showContainedOnly 0\n -showPublishedAsConnected 0\n -showParentContainers 0\n -showContainerContents 0\n -ignoreDagHierarchy 0\n -expandConnections 1\n -showUpstreamCurves 1\n -showUnitlessCurves 0\n -showCompounds 1\n -showLeafs 1\n -showNumericAttrsOnly 1\n -highlightActive 0\n -autoSelectNewObjects 0\n -doNotSelectNewObjects 1\n -dropIsParent 1\n -transmitFilters 0\n -setFilter \"0\" \n -showSetMembers 0\n -allowMultiSelection 1\n -alwaysToggleSelect 0\n -directSelect 0\n -displayMode \"DAG\" \n" + + " -expandObjects 0\n -setsIgnoreFilters 1\n -containersIgnoreFilters 0\n -editAttrName 0\n -showAttrValues 0\n -highlightSecondary 0\n -showUVAttrsOnly 0\n -showTextureNodesOnly 0\n -attrAlphaOrder \"default\" \n -animLayerFilterOptions \"allAffecting\" \n -sortOrder \"none\" \n -longNames 0\n -niceNames 1\n -showNamespace 1\n -showPinIcons 0\n -mapMotionTrails 1\n -ignoreHiddenAttribute 0\n -ignoreOutlinerColor 0\n -renderFilterVisible 0\n $editorName;\n\n\t\t\t$editorName = ($panelName+\"DopeSheetEd\");\n dopeSheetEditor -e \n -displayValues 0\n -snapTime \"integer\" \n -snapValue \"none\" \n -outliner \"dopeSheetPanel1OutlineEd\" \n -showSummary 1\n -showScene 0\n" + + " -hierarchyBelow 0\n -showTicks 1\n -selectionWindow 0 0 0 0 \n $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"timeEditorPanel\" (localizedPanelLabel(\"Time Editor\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Time Editor\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"clipEditorPanel\" (localizedPanelLabel(\"Trax Editor\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Trax Editor\")) -mbv $menusOkayInPanels $panelName;\n\n\t\t\t$editorName = clipEditorNameFromPanel($panelName);\n clipEditor -e \n -displayValues 0\n -snapTime \"none\" \n -snapValue \"none\" \n -initialized 0\n" + + " -manageSequencer 0 \n $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"sequenceEditorPanel\" (localizedPanelLabel(\"Camera Sequencer\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Camera Sequencer\")) -mbv $menusOkayInPanels $panelName;\n\n\t\t\t$editorName = sequenceEditorNameFromPanel($panelName);\n clipEditor -e \n -displayValues 0\n -snapTime \"none\" \n -snapValue \"none\" \n -initialized 0\n -manageSequencer 1 \n $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"hyperGraphPanel\" (localizedPanelLabel(\"Hypergraph Hierarchy\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Hypergraph Hierarchy\")) -mbv $menusOkayInPanels $panelName;\n" + + "\n\t\t\t$editorName = ($panelName+\"HyperGraphEd\");\n hyperGraph -e \n -graphLayoutStyle \"hierarchicalLayout\" \n -orientation \"horiz\" \n -mergeConnections 0\n -zoom 1\n -animateTransition 0\n -showRelationships 1\n -showShapes 0\n -showDeformers 0\n -showExpressions 0\n -showConstraints 0\n -showConnectionFromSelected 0\n -showConnectionToSelected 0\n -showConstraintLabels 0\n -showUnderworld 0\n -showInvisible 0\n -transitionFrames 1\n -opaqueContainers 0\n -freeform 0\n -imagePosition 0 0 \n -imageScale 1\n -imageEnabled 0\n -graphType \"DAG\" \n -heatMapDisplay 0\n -updateSelection 1\n -updateNodeAdded 1\n -useDrawOverrideColor 0\n -limitGraphTraversal -1\n" + + " -range 0 0 \n -iconSize \"smallIcons\" \n -showCachedConnections 0\n $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"hyperShadePanel\" (localizedPanelLabel(\"Hypershade\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Hypershade\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"visorPanel\" (localizedPanelLabel(\"Visor\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Visor\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"nodeEditorPanel\" (localizedPanelLabel(\"Node Editor\")) `;\n\tif ($nodeEditorPanelVisible || $nodeEditorWorkspaceControlOpen) {\n" + + "\t\tif (\"\" == $panelName) {\n\t\t\tif ($useSceneConfig) {\n\t\t\t\t$panelName = `scriptedPanel -unParent -type \"nodeEditorPanel\" -l (localizedPanelLabel(\"Node Editor\")) -mbv $menusOkayInPanels `;\n\n\t\t\t$editorName = ($panelName+\"NodeEditorEd\");\n nodeEditor -e \n -allAttributes 0\n -allNodes 0\n -autoSizeNodes 1\n -consistentNameSize 1\n -createNodeCommand \"nodeEdCreateNodeCommand\" \n -connectNodeOnCreation 0\n -connectOnDrop 0\n -copyConnectionsOnPaste 0\n -connectionStyle \"bezier\" \n -defaultPinnedState 0\n -additiveGraphingMode 0\n -settingsChangedCallback \"nodeEdSyncControls\" \n -traversalDepthLimit -1\n -keyPressCommand \"nodeEdKeyPressCommand\" \n -nodeTitleMode \"name\" \n -gridSnap 0\n -gridVisibility 1\n -crosshairOnEdgeDragging 0\n -popupMenuScript \"nodeEdBuildPanelMenus\" \n" + + " -showNamespace 1\n -showShapes 1\n -showSGShapes 0\n -showTransforms 1\n -useAssets 1\n -syncedSelection 1\n -extendToShapes 1\n -editorMode \"default\" \n -hasWatchpoint 0\n $editorName;\n\t\t\t}\n\t\t} else {\n\t\t\t$label = `panel -q -label $panelName`;\n\t\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Node Editor\")) -mbv $menusOkayInPanels $panelName;\n\n\t\t\t$editorName = ($panelName+\"NodeEditorEd\");\n nodeEditor -e \n -allAttributes 0\n -allNodes 0\n -autoSizeNodes 1\n -consistentNameSize 1\n -createNodeCommand \"nodeEdCreateNodeCommand\" \n -connectNodeOnCreation 0\n -connectOnDrop 0\n -copyConnectionsOnPaste 0\n -connectionStyle \"bezier\" \n -defaultPinnedState 0\n -additiveGraphingMode 0\n -settingsChangedCallback \"nodeEdSyncControls\" \n" + + " -traversalDepthLimit -1\n -keyPressCommand \"nodeEdKeyPressCommand\" \n -nodeTitleMode \"name\" \n -gridSnap 0\n -gridVisibility 1\n -crosshairOnEdgeDragging 0\n -popupMenuScript \"nodeEdBuildPanelMenus\" \n -showNamespace 1\n -showShapes 1\n -showSGShapes 0\n -showTransforms 1\n -useAssets 1\n -syncedSelection 1\n -extendToShapes 1\n -editorMode \"default\" \n -hasWatchpoint 0\n $editorName;\n\t\t\tif (!$useSceneConfig) {\n\t\t\t\tpanel -e -l $label $panelName;\n\t\t\t}\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"createNodePanel\" (localizedPanelLabel(\"Create Node\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Create Node\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n" + + "\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"polyTexturePlacementPanel\" (localizedPanelLabel(\"UV Editor\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"UV Editor\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"renderWindowPanel\" (localizedPanelLabel(\"Render View\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Render View\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"shapePanel\" (localizedPanelLabel(\"Shape Editor\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tshapePanel -edit -l (localizedPanelLabel(\"Shape Editor\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n" + + "\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"posePanel\" (localizedPanelLabel(\"Pose Editor\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tposePanel -edit -l (localizedPanelLabel(\"Pose Editor\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"dynRelEdPanel\" (localizedPanelLabel(\"Dynamic Relationships\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Dynamic Relationships\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"relationshipPanel\" (localizedPanelLabel(\"Relationship Editor\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Relationship Editor\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n" + + "\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"referenceEditorPanel\" (localizedPanelLabel(\"Reference Editor\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Reference Editor\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"componentEditorPanel\" (localizedPanelLabel(\"Component Editor\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Component Editor\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"dynPaintScriptedPanelType\" (localizedPanelLabel(\"Paint Effects\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Paint Effects\")) -mbv $menusOkayInPanels $panelName;\n" + + "\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"scriptEditorPanel\" (localizedPanelLabel(\"Script Editor\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Script Editor\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"profilerPanel\" (localizedPanelLabel(\"Profiler Tool\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Profiler Tool\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"contentBrowserPanel\" (localizedPanelLabel(\"Content Browser\")) `;\n\tif (\"\" != $panelName) {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Content Browser\")) -mbv $menusOkayInPanels $panelName;\n" + + "\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\tif ($useSceneConfig) {\n string $configName = `getPanel -cwl (localizedPanelLabel(\"Current Layout\"))`;\n if (\"\" != $configName) {\n\t\t\tpanelConfiguration -edit -label (localizedPanelLabel(\"Current Layout\")) \n\t\t\t\t-userCreated false\n\t\t\t\t-defaultImage \"vacantCell.xP:/\"\n\t\t\t\t-image \"\"\n\t\t\t\t-sc false\n\t\t\t\t-configString \"global string $gMainPane; paneLayout -e -cn \\\"single\\\" -ps 1 100 100 $gMainPane;\"\n\t\t\t\t-removeAllPanels\n\t\t\t\t-ap false\n\t\t\t\t\t(localizedPanelLabel(\"Persp View\")) \n\t\t\t\t\t\"modelPanel\"\n" + + "\t\t\t\t\t\"$panelName = `modelPanel -unParent -l (localizedPanelLabel(\\\"Persp View\\\")) -mbv $menusOkayInPanels `;\\n$editorName = $panelName;\\nmodelEditor -e \\n -cam `findStartUpCamera persp` \\n -useInteractiveMode 0\\n -displayLights \\\"default\\\" \\n -displayAppearance \\\"smoothShaded\\\" \\n -activeOnly 0\\n -ignorePanZoom 0\\n -wireframeOnShaded 0\\n -headsUpDisplay 1\\n -holdOuts 1\\n -selectionHiliteDisplay 1\\n -useDefaultMaterial 0\\n -bufferMode \\\"double\\\" \\n -twoSidedLighting 0\\n -backfaceCulling 0\\n -xray 0\\n -jointXray 0\\n -activeComponentsXray 0\\n -displayTextures 0\\n -smoothWireframe 0\\n -lineWidth 1\\n -textureAnisotropic 0\\n -textureHilight 1\\n -textureSampling 2\\n -textureDisplay \\\"modulate\\\" \\n -textureMaxSize 16384\\n -fogging 0\\n -fogSource \\\"fragment\\\" \\n -fogMode \\\"linear\\\" \\n -fogStart 0\\n -fogEnd 100\\n -fogDensity 0.1\\n -fogColor 0.5 0.5 0.5 1 \\n -depthOfFieldPreview 1\\n -maxConstantTransparency 1\\n -rendererName \\\"vp2Renderer\\\" \\n -objectFilterShowInHUD 1\\n -isFiltered 0\\n -colorResolution 256 256 \\n -bumpResolution 512 512 \\n -textureCompression 0\\n -transparencyAlgorithm \\\"frontAndBackCull\\\" \\n -transpInShadows 0\\n -cullingOverride \\\"none\\\" \\n -lowQualityLighting 0\\n -maximumNumHardwareLights 1\\n -occlusionCulling 0\\n -shadingModel 0\\n -useBaseRenderer 0\\n -useReducedRenderer 0\\n -smallObjectCulling 0\\n -smallObjectThreshold -1 \\n -interactiveDisableShadows 0\\n -interactiveBackFaceCull 0\\n -sortTransparent 1\\n -controllers 1\\n -nurbsCurves 1\\n -nurbsSurfaces 1\\n -polymeshes 1\\n -subdivSurfaces 1\\n -planes 1\\n -lights 1\\n -cameras 1\\n -controlVertices 1\\n -hulls 1\\n -grid 1\\n -imagePlane 1\\n -joints 1\\n -ikHandles 1\\n -deformers 1\\n -dynamics 1\\n -particleInstancers 1\\n -fluids 1\\n -hairSystems 1\\n -follicles 1\\n -nCloths 1\\n -nParticles 1\\n -nRigids 1\\n -dynamicConstraints 1\\n -locators 1\\n -manipulators 1\\n -pluginShapes 1\\n -dimensions 1\\n -handles 1\\n -pivots 1\\n -textures 1\\n -strokes 1\\n -motionTrails 1\\n -clipGhosts 1\\n -greasePencils 1\\n -shadows 0\\n -captureSequenceNumber -1\\n -width 998\\n -height 838\\n -sceneRenderFilter 0\\n $editorName;\\nmodelEditor -e -viewSelected 0 $editorName;\\nmodelEditor -e \\n -pluginObjects \\\"gpuCacheDisplayFilter\\\" 1 \\n $editorName\"\n" + + "\t\t\t\t\t\"modelPanel -edit -l (localizedPanelLabel(\\\"Persp View\\\")) -mbv $menusOkayInPanels $panelName;\\n$editorName = $panelName;\\nmodelEditor -e \\n -cam `findStartUpCamera persp` \\n -useInteractiveMode 0\\n -displayLights \\\"default\\\" \\n -displayAppearance \\\"smoothShaded\\\" \\n -activeOnly 0\\n -ignorePanZoom 0\\n -wireframeOnShaded 0\\n -headsUpDisplay 1\\n -holdOuts 1\\n -selectionHiliteDisplay 1\\n -useDefaultMaterial 0\\n -bufferMode \\\"double\\\" \\n -twoSidedLighting 0\\n -backfaceCulling 0\\n -xray 0\\n -jointXray 0\\n -activeComponentsXray 0\\n -displayTextures 0\\n -smoothWireframe 0\\n -lineWidth 1\\n -textureAnisotropic 0\\n -textureHilight 1\\n -textureSampling 2\\n -textureDisplay \\\"modulate\\\" \\n -textureMaxSize 16384\\n -fogging 0\\n -fogSource \\\"fragment\\\" \\n -fogMode \\\"linear\\\" \\n -fogStart 0\\n -fogEnd 100\\n -fogDensity 0.1\\n -fogColor 0.5 0.5 0.5 1 \\n -depthOfFieldPreview 1\\n -maxConstantTransparency 1\\n -rendererName \\\"vp2Renderer\\\" \\n -objectFilterShowInHUD 1\\n -isFiltered 0\\n -colorResolution 256 256 \\n -bumpResolution 512 512 \\n -textureCompression 0\\n -transparencyAlgorithm \\\"frontAndBackCull\\\" \\n -transpInShadows 0\\n -cullingOverride \\\"none\\\" \\n -lowQualityLighting 0\\n -maximumNumHardwareLights 1\\n -occlusionCulling 0\\n -shadingModel 0\\n -useBaseRenderer 0\\n -useReducedRenderer 0\\n -smallObjectCulling 0\\n -smallObjectThreshold -1 \\n -interactiveDisableShadows 0\\n -interactiveBackFaceCull 0\\n -sortTransparent 1\\n -controllers 1\\n -nurbsCurves 1\\n -nurbsSurfaces 1\\n -polymeshes 1\\n -subdivSurfaces 1\\n -planes 1\\n -lights 1\\n -cameras 1\\n -controlVertices 1\\n -hulls 1\\n -grid 1\\n -imagePlane 1\\n -joints 1\\n -ikHandles 1\\n -deformers 1\\n -dynamics 1\\n -particleInstancers 1\\n -fluids 1\\n -hairSystems 1\\n -follicles 1\\n -nCloths 1\\n -nParticles 1\\n -nRigids 1\\n -dynamicConstraints 1\\n -locators 1\\n -manipulators 1\\n -pluginShapes 1\\n -dimensions 1\\n -handles 1\\n -pivots 1\\n -textures 1\\n -strokes 1\\n -motionTrails 1\\n -clipGhosts 1\\n -greasePencils 1\\n -shadows 0\\n -captureSequenceNumber -1\\n -width 998\\n -height 838\\n -sceneRenderFilter 0\\n $editorName;\\nmodelEditor -e -viewSelected 0 $editorName;\\nmodelEditor -e \\n -pluginObjects \\\"gpuCacheDisplayFilter\\\" 1 \\n $editorName\"\n" + + "\t\t\t\t$configName;\n\n setNamedPanelLayout (localizedPanelLabel(\"Current Layout\"));\n }\n\n panelHistory -e -clear mainPanelHistory;\n sceneUIReplacement -clear;\n\t}\n\n\ngrid -spacing 5 -size 12 -divisions 5 -displayAxes yes -displayGridLines yes -displayDivisionLines yes -displayPerspectiveLabels no -displayOrthographicLabels no -displayAxesBold yes -perspectiveLabelPosition axis -orthographicLabelPosition edge;\nviewManip -drawCompass 0 -compassAngle 0 -frontParameters \"\" -homeParameters \"\" -selectionLockParameters \"\";\n}\n"); + setAttr ".st" 3; +createNode script -n "sceneConfigurationScriptNode"; + rename -uid "D9E4EC1E-4624-46C8-B2DE-258C0E40C012"; + setAttr ".b" -type "string" "playbackOptions -min 1 -max 120 -ast 1 -aet 200 "; + setAttr ".st" 6; +select -ne :time1; + setAttr ".o" 1; + setAttr ".unw" 1; +select -ne :hardwareRenderingGlobals; + setAttr ".otfna" -type "stringArray" 22 "NURBS Curves" "NURBS Surfaces" "Polygons" "Subdiv Surface" "Particles" "Particle Instance" "Fluids" "Strokes" "Image Planes" "UI" "Lights" "Cameras" "Locators" "Joints" "IK Handles" "Deformers" "Motion Trails" "Components" "Hair Systems" "Follicles" "Misc. UI" "Ornaments" ; + setAttr ".otfva" -type "Int32Array" 22 0 1 1 1 1 1 + 1 1 1 0 0 0 0 0 0 0 0 0 + 0 0 0 0 ; + setAttr ".fprt" yes; +select -ne :renderPartition; + setAttr -s 2 ".st"; +select -ne :renderGlobalsList1; +select -ne :defaultShaderList1; + setAttr -s 5 ".s"; +select -ne :postProcessList1; + setAttr -s 2 ".p"; +select -ne :defaultRenderingList1; +select -ne :initialShadingGroup; + setAttr ".ro" yes; +select -ne :initialParticleSE; + setAttr ".ro" yes; +select -ne :defaultRenderGlobals; + addAttr -ci true -h true -sn "dss" -ln "defaultSurfaceShader" -dt "string"; + setAttr ".dss" -type "string" "lambert1"; +select -ne :defaultResolution; + setAttr ".pa" 1; +select -ne :hardwareRenderGlobals; + setAttr ".ctrs" 256; + setAttr ".btrs" 512; +select -ne :ikSystem; + setAttr -s 4 ".sol"; +connectAttr ":time1.o" "TreeRef_usdShape.tm"; +relationship "link" ":lightLinker1" ":initialShadingGroup.message" ":defaultLightSet.message"; +relationship "link" ":lightLinker1" ":initialParticleSE.message" ":defaultLightSet.message"; +relationship "shadowLink" ":lightLinker1" ":initialShadingGroup.message" ":defaultLightSet.message"; +relationship "shadowLink" ":lightLinker1" ":initialParticleSE.message" ":defaultLightSet.message"; +connectAttr "layerManager.dli[0]" "defaultLayer.id"; +connectAttr "renderLayerManager.rlmi[0]" "defaultRenderLayer.rlid"; +connectAttr "defaultRenderLayer.msg" ":defaultRenderingList1.r" -na; +// End of treeRef.ma diff --git a/test/lib/ufe/test-samples/tree/treeRef.usda b/test/lib/ufe/test-samples/tree/treeRef.usda new file mode 100644 index 0000000000..de7fe51318 --- /dev/null +++ b/test/lib/ufe/test-samples/tree/treeRef.usda @@ -0,0 +1,51 @@ +#usda 1.0 +( + defaultPrim = "TreeBase" + upAxis = "Y" +) + +def Xform "TreeBase" +{ + def Xform "leavesXform" + { + double3 xformOp:translate = (0, 2.5, 0) + uniform token[] xformOpOrder = ["xformOp:translate"] + + def Sphere "greenLeaf" + { + float3[] extent = [(-2, -2, -2), (2, 2, 2)] + color3f[] primvars:displayColor = [(0, 1, 0)] + double radius = 2 + } + } + + def Cylinder "trunk" ( + active = true + kind = "component" + ) + { + uniform token axis = "Y" + float3[] extent = [(-1, -1, -1), (1, 1, 1)] + double height = 2 + color3f[] primvars:displayColor = [(0.66, 0.33, 0)] + double radius = 0.5 + } + + def "leaf_ref_1" ( + append references = + ) + { + double3 xformOp:translate = (2.0, 2.5, 0) + uniform token[] xformOpOrder = ["xformOp:translate"] + double radius = 0.5 + } + + def "leaf_ref_2" ( + append references = @./tree_ref.usda@ + ) + { + double3 xformOp:translate = (0.0, 4.5, 0) + uniform token[] xformOpOrder = ["xformOp:translate"] + double radius = 0.5 + } +} diff --git a/test/lib/ufe/testRename.py b/test/lib/ufe/testRename.py index 7fa4e9479b..d83f18ab4d 100644 --- a/test/lib/ufe/testRename.py +++ b/test/lib/ufe/testRename.py @@ -267,3 +267,39 @@ def testRenameRestrictionOtherLayerOpinions(self): with self.assertRaises(RuntimeError): newName = 'Ball_35_Renamed' cmds.rename(newName) + + def testRenameRestrictionExternalReference(self): + # open tree_ref.ma scene in test-samples + mayaUtils.openTreeRefScene() + + # clear selection to start off + cmds.select(clear=True) + + # select a USD object. + mayaPathSegment = mayaUtils.createUfePathSegment('|world|TreeRef_usd|TreeRef_usdShape') + usdPathSegment = usdUtils.createUfePathSegment('/TreeBase/leaf_ref_2') + treebasePath = ufe.Path([mayaPathSegment, usdPathSegment]) + treebaseItem = ufe.Hierarchy.createItem(treebasePath) + + ufe.GlobalSelection.get().append(treebaseItem) + + # get the USD stage + stage = mayaUsd.ufe.getStage(str(mayaPathSegment)) + + # set the edit target to the root layer + stage.SetEditTarget(stage.GetRootLayer()) + self.assertEqual(stage.GetEditTarget().GetLayer(), stage.GetRootLayer()) + self.assertTrue(stage.GetRootLayer().GetPrimAtPath("/TreeBase")) + + # create a leafRefPrim + leafRefPrim = usdUtils.getPrimFromSceneItem(treebaseItem) + + # leafRefPrim should have an Authored References + self.assertTrue(leafRefPrim.HasAuthoredReferences()) + + # expect the exception to happen + with self.assertRaises(RuntimeError): + newName = 'leaf_ref_2_renaming' + cmds.rename(newName) + + diff --git a/test/lib/ufe/ufeTestUtils/mayaUtils.py b/test/lib/ufe/ufeTestUtils/mayaUtils.py index c1a285cc40..61ff8aa455 100644 --- a/test/lib/ufe/ufeTestUtils/mayaUtils.py +++ b/test/lib/ufe/ufeTestUtils/mayaUtils.py @@ -142,3 +142,7 @@ def openSphereAnimatedRadiusScene(): def openTreeScene(): filePath = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "test-samples", "tree", "tree.ma" ) cmds.file(filePath, force=True, open=True) + +def openTreeRefScene(): + filePath = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "test-samples", "tree", "treeRef.ma" ) + cmds.file(filePath, force=True, open=True) \ No newline at end of file From 890372dc03f86239d329e08ff71c028e36e5ba42 Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Tue, 12 May 2020 12:46:11 -0400 Subject: [PATCH 16/28] Eliminate the need to stores _prim and _oldName member variables. --- lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp | 34 +++++++++++++----------- lib/mayaUsd/ufe/UsdUndoRenameCommand.h | 2 -- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp index f90f0d57fa..90a486acb0 100644 --- a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp +++ b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp @@ -44,25 +44,25 @@ UsdUndoRenameCommand::UsdUndoRenameCommand(const UsdSceneItem::Ptr& srcItem, con : Ufe::UndoableCommand() , _ufeSrcItem(srcItem) , _ufeDstItem(nullptr) - , _prim(srcItem->prim()) - , _stage(_prim.GetStage()) + , _stage(_ufeSrcItem->prim().GetStage()) , _newName(newName.string()) - , _oldName(_prim.GetName().GetString()) { + const UsdPrim& prim = _stage->GetPrimAtPath(_ufeSrcItem->prim().GetPath()); + // if the current layer doesn't have any opinions that affects selected prim - if (!MayaUsdUtils::doesEditTargetLayerHavePrimSpec(_prim)) { - auto possibleTargetLayer = MayaUsdUtils::strongestLayerWithPrimSpec(_prim); + if (!MayaUsdUtils::doesEditTargetLayerHavePrimSpec(prim)) { + auto possibleTargetLayer = MayaUsdUtils::strongestLayerWithPrimSpec(prim); std::string err = TfStringPrintf("Cannot rename [%s] defined on another layer. " "Please set [%s] as the target layer to proceed", - _prim.GetName().GetString().c_str(), + prim.GetName().GetString().c_str(), possibleTargetLayer->GetDisplayName().c_str()); throw std::runtime_error(err.c_str()); } else { // account for internal vs external references - if (_prim.HasAuthoredReferences()) { - auto primSpec = MayaUsdUtils::getPrimSpecAtEditTarget(_stage, _prim); + if (prim.HasAuthoredReferences()) { + auto primSpec = MayaUsdUtils::getPrimSpecAtEditTarget(_stage, prim); for (const SdfReference& ref : primSpec->GetReferenceList().GetAddedOrExplicitItems()) { // GetAssetPath returns the asset path to the root layer of the referenced layer // this will be empty in the case of an internal reference. @@ -70,13 +70,13 @@ UsdUndoRenameCommand::UsdUndoRenameCommand(const UsdSceneItem::Ptr& srcItem, con return; }else{ std::string err = TfStringPrintf("Unable to rename referenced object [%s]", - _prim.GetName().GetString().c_str()); + prim.GetName().GetString().c_str()); throw std::runtime_error(err.c_str()); } } } - auto layers = MayaUsdUtils::layersWithPrimSpec(_prim); + auto layers = MayaUsdUtils::layersWithPrimSpec(prim); if (layers.size() > 1) { std::string layerDisplayNames; for (auto layer : layers) { @@ -84,7 +84,7 @@ UsdUndoRenameCommand::UsdUndoRenameCommand(const UsdSceneItem::Ptr& srcItem, con } layerDisplayNames.pop_back(); std::string err = TfStringPrintf("Cannot rename [%s] with definitions or opinions on other layers. " - "Opinions exist in %s", _prim.GetName().GetString().c_str(), layerDisplayNames.c_str()); + "Opinions exist in %s", prim.GetName().GetString().c_str(), layerDisplayNames.c_str()); throw std::runtime_error(err.c_str()); } } @@ -106,7 +106,9 @@ UsdSceneItem::Ptr UsdUndoRenameCommand::renamedItem() const bool UsdUndoRenameCommand::renameRedo() { - auto primSpec = MayaUsdUtils::getPrimSpecAtEditTarget(_stage, _prim); + const UsdPrim& prim = _stage->GetPrimAtPath(_ufeSrcItem->prim().GetPath()); + + auto primSpec = MayaUsdUtils::getPrimSpecAtEditTarget(_stage, prim); if(!primSpec) { return false; } @@ -128,20 +130,22 @@ bool UsdUndoRenameCommand::renameRedo() bool UsdUndoRenameCommand::renameUndo() { - auto primSpec = MayaUsdUtils::getPrimSpecAtEditTarget(_stage, _ufeDstItem->prim()); + const UsdPrim& prim = _stage->GetPrimAtPath(_ufeDstItem->prim().GetPath()); + + auto primSpec = MayaUsdUtils::getPrimSpecAtEditTarget(_stage, prim); if(!primSpec) { return false; } // set prim's name - bool status = primSpec->SetName(_oldName); + bool status = primSpec->SetName(_ufeSrcItem->prim().GetName()); if (!status) { return false; } // shouldn't have to again create a sibling sceneItem here since we already have a valid _ufeSrcItem // however, I get random crashes if I don't which needs furthur investigation. HS, 6-May-2020. - _ufeSrcItem = createSiblingSceneItem(_ufeDstItem->path(), _oldName); + _ufeSrcItem = createSiblingSceneItem(_ufeDstItem->path(), _ufeSrcItem->prim().GetName()); sendRenameNotification(_ufeSrcItem, _ufeDstItem->path()); _ufeDstItem = nullptr; diff --git a/lib/mayaUsd/ufe/UsdUndoRenameCommand.h b/lib/mayaUsd/ufe/UsdUndoRenameCommand.h index ea5346c565..83edcbafeb 100644 --- a/lib/mayaUsd/ufe/UsdUndoRenameCommand.h +++ b/lib/mayaUsd/ufe/UsdUndoRenameCommand.h @@ -57,10 +57,8 @@ class MAYAUSD_CORE_PUBLIC UsdUndoRenameCommand : public Ufe::UndoableCommand UsdSceneItem::Ptr _ufeSrcItem; UsdSceneItem::Ptr _ufeDstItem; - const UsdPrim& _prim; UsdStageWeakPtr _stage; std::string _newName; - std::string _oldName; }; // UsdUndoRenameCommand From a305af95bbe17a8e7a68e8e807335ccc80fe043f Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Tue, 12 May 2020 13:42:45 -0400 Subject: [PATCH 17/28] Address feedback: Re-factored the logics for detecting internal vs external reference and create a new utility for it. --- lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp | 19 +++++++++---------- lib/usd/utils/util.cpp | 16 ++++++++++++++++ lib/usd/utils/util.h | 4 ++++ 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp index 90a486acb0..f4a139bac9 100644 --- a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp +++ b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp @@ -61,18 +61,17 @@ UsdUndoRenameCommand::UsdUndoRenameCommand(const UsdSceneItem::Ptr& srcItem, con else { // account for internal vs external references + // internal references (references without a file path specified) from the same file + // should be renamable. if (prim.HasAuthoredReferences()) { auto primSpec = MayaUsdUtils::getPrimSpecAtEditTarget(_stage, prim); - for (const SdfReference& ref : primSpec->GetReferenceList().GetAddedOrExplicitItems()) { - // GetAssetPath returns the asset path to the root layer of the referenced layer - // this will be empty in the case of an internal reference. - if (ref.GetAssetPath().empty()) { - return; - }else{ - std::string err = TfStringPrintf("Unable to rename referenced object [%s]", - prim.GetName().GetString().c_str()); - throw std::runtime_error(err.c_str()); - } + + if(MayaUsdUtils::isInternalReference(primSpec)) { + return; + }else { + std::string err = TfStringPrintf("Unable to rename referenced object [%s]", + prim.GetName().GetString().c_str()); + throw std::runtime_error(err.c_str()); } } diff --git a/lib/usd/utils/util.cpp b/lib/usd/utils/util.cpp index 0bbe31fe21..bfbb1c6dd0 100644 --- a/lib/usd/utils/util.cpp +++ b/lib/usd/utils/util.cpp @@ -101,4 +101,20 @@ getPrimSpecAtEditTarget(UsdStageWeakPtr stage, const UsdPrim& prim) return stage->GetEditTarget().GetPrimSpecForScenePath(prim.GetPath()); } +bool +isInternalReference(const SdfPrimSpecHandle& primSpec) +{ + bool isInternalRef{false}; + + for (const SdfReference& ref : primSpec->GetReferenceList().GetAddedOrExplicitItems()) { + // GetAssetPath returns the asset path to the root layer of the referenced layer + // this will be empty in the case of an internal reference. + if (ref.GetAssetPath().empty()) { + isInternalRef = true; + } + } + + return isInternalRef; +} + } // MayaUsdUtils diff --git a/lib/usd/utils/util.h b/lib/usd/utils/util.h index d37d718c06..4db330ff11 100644 --- a/lib/usd/utils/util.h +++ b/lib/usd/utils/util.h @@ -45,6 +45,10 @@ namespace MayaUsdUtils { MAYA_USD_UTILS_PUBLIC SdfPrimSpecHandle getPrimSpecAtEditTarget(UsdStageWeakPtr, const UsdPrim&); + //! Returns true if the prim spec has an internal reference. + MAYA_USD_UTILS_PUBLIC + bool isInternalReference(const SdfPrimSpecHandle&); + } // namespace MayaUsdUtils #endif // MAYAUSDUTILS_UTIL_H \ No newline at end of file From 610f2ce099cceab4f2727e7df0774aa39d7ea815 Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Tue, 12 May 2020 14:34:58 -0400 Subject: [PATCH 18/28] Address feedback: break out of the loop once the condition is met. --- lib/usd/utils/util.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/usd/utils/util.cpp b/lib/usd/utils/util.cpp index bfbb1c6dd0..029070420a 100644 --- a/lib/usd/utils/util.cpp +++ b/lib/usd/utils/util.cpp @@ -111,6 +111,7 @@ isInternalReference(const SdfPrimSpecHandle& primSpec) // this will be empty in the case of an internal reference. if (ref.GetAssetPath().empty()) { isInternalRef = true; + break; } } From 80aa35e4160b7c35147042f45c49d727ac3289f5 Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Tue, 12 May 2020 15:26:03 -0400 Subject: [PATCH 19/28] Address feedback: Don't return if we have an internal reference since we do still want the opinion detection in other layers happens. --- lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp index f4a139bac9..fc7de44403 100644 --- a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp +++ b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp @@ -66,9 +66,7 @@ UsdUndoRenameCommand::UsdUndoRenameCommand(const UsdSceneItem::Ptr& srcItem, con if (prim.HasAuthoredReferences()) { auto primSpec = MayaUsdUtils::getPrimSpecAtEditTarget(_stage, prim); - if(MayaUsdUtils::isInternalReference(primSpec)) { - return; - }else { + if(!MayaUsdUtils::isInternalReference(primSpec)) { std::string err = TfStringPrintf("Unable to rename referenced object [%s]", prim.GetName().GetString().c_str()); throw std::runtime_error(err.c_str()); From 3cf2acce328bf62b5f0952aa952b8ba586905ee4 Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Wed, 13 May 2020 11:39:39 -0400 Subject: [PATCH 20/28] - change the wording form opinion to contribute/contribution to make things more readable. - change the container type for layersWithContribution method from std::vector to std::set to guarantee having unique layers. --- lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp | 11 +++++----- lib/usd/utils/util.cpp | 28 ++++++++++++------------ lib/usd/utils/util.h | 12 +++++----- 3 files changed, 26 insertions(+), 25 deletions(-) diff --git a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp index fc7de44403..0b8d35e7d0 100644 --- a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp +++ b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp @@ -49,13 +49,13 @@ UsdUndoRenameCommand::UsdUndoRenameCommand(const UsdSceneItem::Ptr& srcItem, con { const UsdPrim& prim = _stage->GetPrimAtPath(_ufeSrcItem->prim().GetPath()); - // if the current layer doesn't have any opinions that affects selected prim - if (!MayaUsdUtils::doesEditTargetLayerHavePrimSpec(prim)) { - auto possibleTargetLayer = MayaUsdUtils::strongestLayerWithPrimSpec(prim); + // if the current layer doesn't have any contributions + if (!MayaUsdUtils::doesEditTargetLayerContribute(prim)) { + auto strongestContributingLayer = MayaUsdUtils::strongestContributingLayer(prim); std::string err = TfStringPrintf("Cannot rename [%s] defined on another layer. " "Please set [%s] as the target layer to proceed", prim.GetName().GetString().c_str(), - possibleTargetLayer->GetDisplayName().c_str()); + strongestContributingLayer->GetDisplayName().c_str()); throw std::runtime_error(err.c_str()); } else @@ -73,7 +73,8 @@ UsdUndoRenameCommand::UsdUndoRenameCommand(const UsdSceneItem::Ptr& srcItem, con } } - auto layers = MayaUsdUtils::layersWithPrimSpec(prim); + auto layers = MayaUsdUtils::layersWithContribution(prim); + // if we have more than 2 layers that contributes to the final composed prim if (layers.size() > 1) { std::string layerDisplayNames; for (auto layer : layers) { diff --git a/lib/usd/utils/util.cpp b/lib/usd/utils/util.cpp index 029070420a..7e01971535 100644 --- a/lib/usd/utils/util.cpp +++ b/lib/usd/utils/util.cpp @@ -20,7 +20,7 @@ #include #include -#include +#include PXR_NAMESPACE_USING_DIRECTIVE @@ -46,30 +46,30 @@ defPrimSpecLayer(const UsdPrim& prim) return defLayer; } -std::vector -layersWithPrimSpec(const UsdPrim& prim) +std::set +layersWithContribution(const UsdPrim& prim) { - // get the list of PrimSpecs that provide opinions for this prim - // ordered from strongest to weakest. + // get the list of all the specs that can + // contribute to the final composed prim const auto& primStack = prim.GetPrimStack(); - std::vector layersWithPrimSpec; + std::set layersWithContribution; for (auto primSpec : primStack) { - layersWithPrimSpec.emplace_back(primSpec->GetLayer()); + layersWithContribution.insert(primSpec->GetLayer()); } - return layersWithPrimSpec; + return layersWithContribution; } bool -doesEditTargetLayerHavePrimSpec(const UsdPrim& prim) +doesEditTargetLayerContribute(const UsdPrim& prim) { auto editTarget = prim.GetStage()->GetEditTarget(); auto layer = editTarget.GetLayer(); auto primSpec = layer->GetPrimAtPath(prim.GetPath()); - // to know whether the target layer contains any opinions that - // affect a particular prim, there must be a primSpec for that prim + // to know whether the target layer can contribute to the + // final composed prim, there must be a primSpec for that prim if (!primSpec) { return false; } @@ -78,14 +78,14 @@ doesEditTargetLayerHavePrimSpec(const UsdPrim& prim) } SdfLayerHandle -strongestLayerWithPrimSpec(const UsdPrim& prim) +strongestContributingLayer(const UsdPrim& prim) { SdfLayerHandle targetLayer; auto layerStack = prim.GetStage()->GetLayerStack(); for (auto layer : layerStack) { - // to know whether the target layer contains any opinions that - // affect a particular prim, there must be a primSpec for that prim + // to know whether the target layer can contribute to the + // final composed prim, there must be a primSpec for that prim auto primSpec = layer->GetPrimAtPath(prim.GetPath()); if (primSpec) { targetLayer = layer; diff --git a/lib/usd/utils/util.h b/lib/usd/utils/util.h index 4db330ff11..049c7d3180 100644 --- a/lib/usd/utils/util.h +++ b/lib/usd/utils/util.h @@ -29,17 +29,17 @@ namespace MayaUsdUtils { MAYA_USD_UTILS_PUBLIC SdfLayerHandle defPrimSpecLayer(const UsdPrim&); - //! Return a list of layers in strength order that have opinions on the argument prim. + //! Return a list of layers in no strength order that can contribute to the argument prim. MAYA_USD_UTILS_PUBLIC - std::vector layersWithPrimSpec(const UsdPrim&); + std::set layersWithContribution(const UsdPrim&); - //! Check if a layer has any opinions that affects on the argument prim. + //! Check if a layer has any contributions towards the argument prim. MAYA_USD_UTILS_PUBLIC - bool doesEditTargetLayerHavePrimSpec(const UsdPrim&); + bool doesEditTargetLayerContribute(const UsdPrim&); - //! Return the strongest layer that has an opinion on the argument prim. + //! Return the strongest layer that can contribute to the argument prim. MAYA_USD_UTILS_PUBLIC - SdfLayerHandle strongestLayerWithPrimSpec(const UsdPrim&); + SdfLayerHandle strongestContributingLayer(const UsdPrim&); //! Return a PrimSpec for the argument prim in the layer containing the stage's current edit target. MAYA_USD_UTILS_PUBLIC From 7e66d4137793b61f50de32e07bf3261078a236dd Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Wed, 13 May 2020 14:32:45 -0400 Subject: [PATCH 21/28] Fix build after merging dev branch into this PR. --- lib/mayaUsd/ufe/UsdUndoInsertChildCommand.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/mayaUsd/ufe/UsdUndoInsertChildCommand.cpp b/lib/mayaUsd/ufe/UsdUndoInsertChildCommand.cpp index 285e2ca8ac..099b3628d6 100644 --- a/lib/mayaUsd/ufe/UsdUndoInsertChildCommand.cpp +++ b/lib/mayaUsd/ufe/UsdUndoInsertChildCommand.cpp @@ -28,6 +28,8 @@ #include #endif +#include + #include #include #include @@ -62,7 +64,7 @@ UsdUndoInsertChildCommand::UsdUndoInsertChildCommand( } fUsdDstPath = parent->prim().GetPath().AppendChild(TfToken(childName)); - fLayer = defPrimSpecLayer(childPrim); + fLayer = MayaUsdUtils::defPrimSpecLayer(childPrim); if (!fLayer) { std::string err = TfStringPrintf("No prim found at %s", childPrim.GetPath().GetString().c_str()); throw std::runtime_error(err.c_str()); From 22d6fc9d2a3ced839fcd3a8bbd063c4bd4b4f2d0 Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Wed, 13 May 2020 14:35:37 -0400 Subject: [PATCH 22/28] Fix reference file path. --- test/lib/ufe/test-samples/tree/treeRef.usda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/lib/ufe/test-samples/tree/treeRef.usda b/test/lib/ufe/test-samples/tree/treeRef.usda index de7fe51318..6bae789c2e 100644 --- a/test/lib/ufe/test-samples/tree/treeRef.usda +++ b/test/lib/ufe/test-samples/tree/treeRef.usda @@ -41,7 +41,7 @@ def Xform "TreeBase" } def "leaf_ref_2" ( - append references = @./tree_ref.usda@ + append references = @./treeRef.usda@ ) { double3 xformOp:translate = (0.0, 4.5, 0) From df3ff4404f91a56ada4b4b4643849bdea2cca08c Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Wed, 13 May 2020 15:40:13 -0400 Subject: [PATCH 23/28] Make sure maya scene examples are using relative path. --- test/lib/ufe/test-samples/tree/tree.ma | 2 +- test/lib/ufe/test-samples/tree/treeRef.ma | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/lib/ufe/test-samples/tree/tree.ma b/test/lib/ufe/test-samples/tree/tree.ma index 0843d2c800..1e8ae50abe 100644 --- a/test/lib/ufe/test-samples/tree/tree.ma +++ b/test/lib/ufe/test-samples/tree/tree.ma @@ -79,7 +79,7 @@ createNode mayaUsdProxyShape -n "Tree_usdShape" -p "Tree_usd"; setAttr -k off ".v"; setAttr ".covm[0]" 0 1 1; setAttr ".cdvm[0]" 0 1 1; - setAttr ".fp" -type "string" "C:/Users/sabrih/Desktop/USD-Assets/USD-Assets/tree.usda"; + setAttr ".fp" -type "string" "./tree.usda"; setAttr ".pp" -type "string" ""; setAttr ".epp" -type "string" ""; createNode lightLinker -s -n "lightLinker1"; diff --git a/test/lib/ufe/test-samples/tree/treeRef.ma b/test/lib/ufe/test-samples/tree/treeRef.ma index 84194a96fd..df1bf688f9 100644 --- a/test/lib/ufe/test-samples/tree/treeRef.ma +++ b/test/lib/ufe/test-samples/tree/treeRef.ma @@ -79,7 +79,7 @@ createNode mayaUsdProxyShape -n "TreeRef_usdShape" -p "TreeRef_usd"; setAttr -k off ".v"; setAttr ".covm[0]" 0 1 1; setAttr ".cdvm[0]" 0 1 1; - setAttr ".fp" -type "string" "R:/Users/sabrih/Autodesk2019/maya/worktrees/master/Maya/src/Components/USD/maya-usd/test/lib/ufe/test-samples/tree/treeRef.usda"; + setAttr ".fp" -type "string" "./treeRef.usda"; setAttr ".pp" -type "string" ""; setAttr ".epp" -type "string" ""; createNode lightLinker -s -n "lightLinker1"; From 67fd431b76e66853e097a1db88abea1b31203f9e Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Thu, 14 May 2020 08:58:09 -0400 Subject: [PATCH 24/28] Nit-pick: No need to pass stage as an argument since it can be retrieved from the prim argument. --- lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp | 6 +++--- lib/usd/utils/util.cpp | 3 ++- lib/usd/utils/util.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp index 0b8d35e7d0..4b39b5dbeb 100644 --- a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp +++ b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp @@ -64,7 +64,7 @@ UsdUndoRenameCommand::UsdUndoRenameCommand(const UsdSceneItem::Ptr& srcItem, con // internal references (references without a file path specified) from the same file // should be renamable. if (prim.HasAuthoredReferences()) { - auto primSpec = MayaUsdUtils::getPrimSpecAtEditTarget(_stage, prim); + auto primSpec = MayaUsdUtils::getPrimSpecAtEditTarget(prim); if(!MayaUsdUtils::isInternalReference(primSpec)) { std::string err = TfStringPrintf("Unable to rename referenced object [%s]", @@ -106,7 +106,7 @@ bool UsdUndoRenameCommand::renameRedo() { const UsdPrim& prim = _stage->GetPrimAtPath(_ufeSrcItem->prim().GetPath()); - auto primSpec = MayaUsdUtils::getPrimSpecAtEditTarget(_stage, prim); + auto primSpec = MayaUsdUtils::getPrimSpecAtEditTarget(prim); if(!primSpec) { return false; } @@ -130,7 +130,7 @@ bool UsdUndoRenameCommand::renameUndo() { const UsdPrim& prim = _stage->GetPrimAtPath(_ufeDstItem->prim().GetPath()); - auto primSpec = MayaUsdUtils::getPrimSpecAtEditTarget(_stage, prim); + auto primSpec = MayaUsdUtils::getPrimSpecAtEditTarget(prim); if(!primSpec) { return false; } diff --git a/lib/usd/utils/util.cpp b/lib/usd/utils/util.cpp index 7e01971535..69e069be97 100644 --- a/lib/usd/utils/util.cpp +++ b/lib/usd/utils/util.cpp @@ -96,8 +96,9 @@ strongestContributingLayer(const UsdPrim& prim) } SdfPrimSpecHandle -getPrimSpecAtEditTarget(UsdStageWeakPtr stage, const UsdPrim& prim) +getPrimSpecAtEditTarget(const UsdPrim& prim) { + auto stage = prim.GetStage(); return stage->GetEditTarget().GetPrimSpecForScenePath(prim.GetPath()); } diff --git a/lib/usd/utils/util.h b/lib/usd/utils/util.h index 049c7d3180..0bb2a6f780 100644 --- a/lib/usd/utils/util.h +++ b/lib/usd/utils/util.h @@ -43,7 +43,7 @@ namespace MayaUsdUtils { //! Return a PrimSpec for the argument prim in the layer containing the stage's current edit target. MAYA_USD_UTILS_PUBLIC - SdfPrimSpecHandle getPrimSpecAtEditTarget(UsdStageWeakPtr, const UsdPrim&); + SdfPrimSpecHandle getPrimSpecAtEditTarget(const UsdPrim&); //! Returns true if the prim spec has an internal reference. MAYA_USD_UTILS_PUBLIC From 7e8bef6f1b585bfc78d5a35892cb06d18dc56f9b Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Thu, 14 May 2020 12:35:17 -0400 Subject: [PATCH 25/28] Added more logics for handling defaultprim rename. --- lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp | 28 +++++++++++++++++++++--- test/lib/ufe/testRename.py | 14 ++++++++---- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp index 4b39b5dbeb..58e5947856 100644 --- a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp +++ b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp @@ -111,9 +111,12 @@ bool UsdUndoRenameCommand::renameRedo() return false; } + // these two lines MUST be called before the set name + // _stage->GetDefaultPrim() and prim after the rename can be invalid. + auto primNameStr = prim.GetPath().GetName(); + auto stageDefPrimNameStr = _stage->GetDefaultPrim().GetPath().GetName(); + // set prim's name - // XXX: SetName successfuly returns true but when you examine the _prim.GetName() - // after the rename, the prim name shows the original name HS, 6-May-2020. bool status = primSpec->SetName(_newName); if (!status) { return false; @@ -122,7 +125,14 @@ bool UsdUndoRenameCommand::renameRedo() // the renamed scene item is a "sibling" of its original name. _ufeDstItem = createSiblingSceneItem(_ufeSrcItem->path(), _newName); sendRenameNotification(_ufeDstItem, _ufeSrcItem->path()); - + + // SdfLayer is a "simple" container, and all it knows about defaultPrim is that it is a piece of token-valued layer metadata. + // It is only the higher-level Usd and Pcp modules that know that it is identifying a prim on the stage. + // One must use the SdfLayer API for setting the defaultPrim when you rename the prim it identifies. + if(primNameStr == stageDefPrimNameStr){ + _stage->SetDefaultPrim(_ufeDstItem->prim()); + } + return true; } @@ -135,6 +145,11 @@ bool UsdUndoRenameCommand::renameUndo() return false; } + // these two lines MUST be called before the set name + // _stage->GetDefaultPrim() and prim after the rename can be invalid. + auto primNameStr = prim.GetPath().GetName(); + auto stageDefPrimNameStr = _stage->GetDefaultPrim().GetPath().GetName(); + // set prim's name bool status = primSpec->SetName(_ufeSrcItem->prim().GetName()); if (!status) { @@ -146,6 +161,13 @@ bool UsdUndoRenameCommand::renameUndo() _ufeSrcItem = createSiblingSceneItem(_ufeDstItem->path(), _ufeSrcItem->prim().GetName()); sendRenameNotification(_ufeSrcItem, _ufeDstItem->path()); + // SdfLayer is a "simple" container, and all it knows about defaultPrim is that it is a piece of token-valued layer metadata. + // It is only the higher-level Usd and Pcp modules that know that it is identifying a prim on the stage. + // One must use the SdfLayer API for setting the defaultPrim when you rename the prim it identifies. + if (primNameStr == stageDefPrimNameStr) { + _stage->SetDefaultPrim(_ufeSrcItem->prim()); + } + _ufeDstItem = nullptr; return true; diff --git a/test/lib/ufe/testRename.py b/test/lib/ufe/testRename.py index d2596468e5..3f9151c9e2 100644 --- a/test/lib/ufe/testRename.py +++ b/test/lib/ufe/testRename.py @@ -130,10 +130,16 @@ def testRename(self): # set primspec name primspec.name = "TreeBase_potato" - - # HS, 6-May-2020. defualtPrim in null?? This can't be null.... - # defualtPrim = stage.GetDefaultPrim() - # self.assertEqual(defualtPrim.GetName(), 'TreeBase_potato') + + # get the renamed prim + renamedPrim = stage.GetPrimAtPath('/TreeBase_potato') + + # One must use the SdfLayer API for setting the defaultPrim when you rename the prim it identifies. + stage.SetDefaultPrim(renamedPrim); + + # get defualtPrim again + defualtPrim = stage.GetDefaultPrim() + self.assertEqual(defualtPrim.GetName(), 'TreeBase_potato') # make sure we have a valid prims after the primspec rename assert stage.GetPrimAtPath('/TreeBase_potato') From d84d82fcaa2f377e77114aaf9adf25f5be8c601b Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Thu, 14 May 2020 16:44:46 -0400 Subject: [PATCH 26/28] Nit-Pick: do an object comparison instead of string. --- lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp index 58e5947856..1ab26b4a45 100644 --- a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp +++ b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp @@ -113,10 +113,12 @@ bool UsdUndoRenameCommand::renameRedo() // these two lines MUST be called before the set name // _stage->GetDefaultPrim() and prim after the rename can be invalid. - auto primNameStr = prim.GetPath().GetName(); - auto stageDefPrimNameStr = _stage->GetDefaultPrim().GetPath().GetName(); + auto primPath = prim.GetPath(); + auto defaultPrimPath = _stage->GetDefaultPrim().GetPath(); // set prim's name + // XXX: SetName successfuly returns true but when you examine the _prim.GetName() + // after the rename, the prim name shows the original name HS, 6-May-2020. bool status = primSpec->SetName(_newName); if (!status) { return false; @@ -129,7 +131,7 @@ bool UsdUndoRenameCommand::renameRedo() // SdfLayer is a "simple" container, and all it knows about defaultPrim is that it is a piece of token-valued layer metadata. // It is only the higher-level Usd and Pcp modules that know that it is identifying a prim on the stage. // One must use the SdfLayer API for setting the defaultPrim when you rename the prim it identifies. - if(primNameStr == stageDefPrimNameStr){ + if(primPath == defaultPrimPath){ _stage->SetDefaultPrim(_ufeDstItem->prim()); } @@ -147,8 +149,8 @@ bool UsdUndoRenameCommand::renameUndo() // these two lines MUST be called before the set name // _stage->GetDefaultPrim() and prim after the rename can be invalid. - auto primNameStr = prim.GetPath().GetName(); - auto stageDefPrimNameStr = _stage->GetDefaultPrim().GetPath().GetName(); + auto primPath = prim.GetPath(); + auto defaultPrimPath = _stage->GetDefaultPrim().GetPath(); // set prim's name bool status = primSpec->SetName(_ufeSrcItem->prim().GetName()); @@ -164,7 +166,7 @@ bool UsdUndoRenameCommand::renameUndo() // SdfLayer is a "simple" container, and all it knows about defaultPrim is that it is a piece of token-valued layer metadata. // It is only the higher-level Usd and Pcp modules that know that it is identifying a prim on the stage. // One must use the SdfLayer API for setting the defaultPrim when you rename the prim it identifies. - if (primNameStr == stageDefPrimNameStr) { + if (primPath == defaultPrimPath) { _stage->SetDefaultPrim(_ufeSrcItem->prim()); } From 5d81f6c44e27bacb64176f2cd9434b0a5902703d Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Fri, 15 May 2020 11:49:45 -0400 Subject: [PATCH 27/28] For future reference, added the feedback I received from Spiff under "Question around SdfPrimSepc's SetName routine" thread. --- lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp index 1ab26b4a45..c0f4038a5f 100644 --- a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp +++ b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp @@ -40,6 +40,17 @@ MAYAUSD_NS_DEF { namespace ufe { +/* + HS, May 15, 2020 + + See usd-interest: Question around SdfPrimSepc's SetName routine + + SdfPrimSpec::SetName() will rename any prim in the layer, but it does not allow you to reparent the prim, + nor will it update any relationship or connection targets in the layer that targeted the prim or any of its + decendants (they will all break unless you fix them up yourself.Renaming and reparenting prims destructively + in composed scenes is pretty tricky stuff that cannot really practically be done with 100% guarantees. +*/ + UsdUndoRenameCommand::UsdUndoRenameCommand(const UsdSceneItem::Ptr& srcItem, const Ufe::PathComponent& newName) : Ufe::UndoableCommand() , _ufeSrcItem(srcItem) From ade83faf01d6450fadd0e41612b728b7eb7b6e07 Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Fri, 15 May 2020 14:14:09 -0400 Subject: [PATCH 28/28] Remove out of date comment. MAYA-92264 is now internally closed. --- lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp index c0f4038a5f..0806fc678e 100644 --- a/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp +++ b/lib/mayaUsd/ufe/UsdUndoRenameCommand.cpp @@ -188,8 +188,6 @@ bool UsdUndoRenameCommand::renameUndo() void UsdUndoRenameCommand::undo() { - // MAYA-92264: Pixar bug prevents undo from working. Try again with USD - // version 0.8.5 or later. PPT, 7-Jul-2018. try { InPathChange pc; if (!renameUndo()) {