-
Notifications
You must be signed in to change notification settings - Fork 203
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-128460 - undoing rename of prim causes prim's icon to change to def #2965
MAYA-128460 - undoing rename of prim causes prim's icon to change to def #2965
Conversation
…ge to a def * For undo send the correct (new) prim in the Ufe notification. * Refactor undo/redo into common helper method.
void renameHelper( | ||
PXR_NS::UsdStageWeakPtr stage, | ||
const UsdSceneItem::Ptr& ufeSrcItem, | ||
const Ufe::Path& srcPath, | ||
UsdSceneItem::Ptr& ufeDstItem, | ||
const Ufe::Path& dstPath, | ||
const std::string& newName) |
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.
Added new helper method for both undo and redo to avoid code duplication.
@@ -190,67 +192,63 @@ static void doUsdRename( | |||
applyToAllPrimSpecs(prim, renameFunc); | |||
} | |||
|
|||
void UsdUndoRenameCommand::renameRedo() | |||
void renameHelper( | |||
PXR_NS::UsdStageWeakPtr stage, |
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.
While unlikely, a weak pointer could become invalid at any time. Also, it could be passed as const &. So i'd suggest using a const UsdStagePtr& here.
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.
Right good point.
// stale. | ||
const UsdPrim prim = _stage->GetPrimAtPath(_ufeDstItem->prim().GetPath()); | ||
const std::string newName = _ufeSrcItem->prim().GetName(); | ||
const Ufe::Path srcPath = _ufeSrcItem->path(); |
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.
I think scene item return teh path by ref, so this could be a &, to verify.
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.
Good point, changed to auto so we don't need to worry about return type.
if (_ufeDstItem->prim().GetPath() == defaultPrimPath) { | ||
_stage->SetDefaultPrim(_ufeSrcItem->prim()); | ||
} | ||
const Ufe::Path srcPath = _ufeDstItem->path(); |
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.
Same comment as above, could be const&
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.
Minor tweaks possible, otherwise LGTM.
…ge to a def * Code review feedback
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.
LGTM
…ge to a def * clang-format fix (darn trailing space).
MAYA-128460 - undoing the rename of a prim causes prim's icon to change to a def