-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MAYA-108549: Fix undo crash when switching between target layers in a stage #965
Changes from all commits
120ae47
2981cca
a87fc0b
677db40
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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<UsdUndoStateDelegatePtr>(layer->GetStateDelegate()); | ||
if (!usdUndoStateDelegatePtr) { | ||
layer->SetStateDelegate(UsdUndoStateDelegate::New()); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ppt-adsk Thanks for great feedback. Using a dynamic_cast to determine if a layer is already registered with our UsdUndoStateDelegate. If the cast fails, that means it needs to be set with a new one. The UsdUndoStateDelegate is stateless and doesn't need to be shared among layers. |
||
} | ||
|
||
void UsdUndoManager::addInverse(InvertFunc func) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ppt-adsk Based on our internal discussion, lowering the version to cover existing shipped PR.