diff --git a/lib/mayaUsd/ufe/StagesSubject.cpp b/lib/mayaUsd/ufe/StagesSubject.cpp index 5904b10d43..3c48b3706a 100644 --- a/lib/mayaUsd/ufe/StagesSubject.cpp +++ b/lib/mayaUsd/ufe/StagesSubject.cpp @@ -21,7 +21,7 @@ #include #include #include -#if UFE_PREVIEW_VERSION_NUM >= 2029 +#if UFE_PREVIEW_VERSION_NUM >= 2025 #include #endif @@ -301,7 +301,7 @@ void StagesSubject::stageChanged( } } -#if UFE_PREVIEW_VERSION_NUM >= 2029 +#if UFE_PREVIEW_VERSION_NUM >= 2025 void StagesSubject::stageEditTargetChanged( UsdNotice::StageEditTargetChanged const& notice, UsdStageWeakPtr const& sender) @@ -313,7 +313,7 @@ void StagesSubject::stageEditTargetChanged( void StagesSubject::onStageSet(const MayaUsdProxyStageSetNotice& notice) { -#if UFE_PREVIEW_VERSION_NUM >= 2029 +#if UFE_PREVIEW_VERSION_NUM >= 2025 auto noticeStage = notice.GetStage(); // Check if stage received from notice is valid. We could have cases where a ProxyShape has an // invalid stage. @@ -336,7 +336,7 @@ void StagesSubject::onStageSet(const MayaUsdProxyStageSetNotice& notice) NoticeKeys noticeKeys; noticeKeys[0] = TfNotice::Register(me, &StagesSubject::stageChanged, stage); -#if UFE_PREVIEW_VERSION_NUM >= 2029 +#if UFE_PREVIEW_VERSION_NUM >= 2025 noticeKeys[1] = TfNotice::Register(me, &StagesSubject::stageEditTargetChanged, stage); #endif fStageListeners[stage] = noticeKeys; diff --git a/lib/mayaUsd/ufe/StagesSubject.h b/lib/mayaUsd/ufe/StagesSubject.h index 74a8e7fdcc..0b0bba6699 100644 --- a/lib/mayaUsd/ufe/StagesSubject.h +++ b/lib/mayaUsd/ufe/StagesSubject.h @@ -73,7 +73,7 @@ class MAYAUSD_CORE_PUBLIC StagesSubject : public TfWeakBase //! Call the stageChanged() methods on stage observers. void stageChanged(UsdNotice::ObjectsChanged const& notice, UsdStageWeakPtr const& sender); -#if UFE_PREVIEW_VERSION_NUM >= 2029 +#if UFE_PREVIEW_VERSION_NUM >= 2025 //! Call the stageEditTargetChanged() methods on stage observers. void stageEditTargetChanged( UsdNotice::StageEditTargetChanged const& notice, @@ -88,7 +88,7 @@ class MAYAUSD_CORE_PUBLIC StagesSubject : public TfWeakBase void onStageInvalidate(const MayaUsdProxyStageInvalidateNotice& notice); // Array of Notice::Key for registered listener -#if UFE_PREVIEW_VERSION_NUM >= 2029 +#if UFE_PREVIEW_VERSION_NUM >= 2025 using NoticeKeys = std::array; #else using NoticeKeys = std::array; diff --git a/lib/mayaUsd/undo/UsdUndoManager.cpp b/lib/mayaUsd/undo/UsdUndoManager.cpp index f7f14c0721..9dbb491318 100644 --- a/lib/mayaUsd/undo/UsdUndoManager.cpp +++ b/lib/mayaUsd/undo/UsdUndoManager.cpp @@ -31,7 +31,13 @@ UsdUndoManager& UsdUndoManager::instance() void UsdUndoManager::trackLayerStates(const SdfLayerHandle& layer) { - layer->SetStateDelegate(UsdUndoStateDelegate::New()); + // Check if the layer has already been given a UsdUndoStateDelegate + // if the cast fails that means we need to set a new one. + auto usdUndoStateDelegatePtr + = TfDynamic_cast(layer->GetStateDelegate()); + if (!usdUndoStateDelegatePtr) { + layer->SetStateDelegate(UsdUndoStateDelegate::New()); + } } void UsdUndoManager::addInverse(InvertFunc func)