Fix prim expiry crashes and add context menu hierarchy ops
Crash fixes (expired UsdPrim after namespace edits): - RenderPrimNode: early-out after rename commit (renamed flag + column cleanup) - RenderPrimNode: early-out after context menu op expires prim (prim.IsValid() guard) - RenderContextMenu: EndPopup+return when Unparent/Group expires prim mid-popup - Child iteration: snapshot GetChildren() into vector before recursing to guard against live iterator invalidation from stage mutations deeper in the tree - Rename: firstFrame guard prevents spurious IsItemDeactivated cancel on SetKeyboardFocusHere activation frame (fixes second-rename not working) - RenamePrimCommand: check RenamePrim() return value, log if rejected New features: - Context menu Add Child submenu: create typed child prim under selection - Context menu Unparent to Root: move prim to stage root (undo-able) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -27,7 +27,10 @@ void RenamePrimCommand::Execute() {
|
||||
return;
|
||||
}
|
||||
UsdNamespaceEditor editor(m_stage);
|
||||
editor.RenamePrim(prim, TfToken(m_newName));
|
||||
if (!editor.RenamePrim(prim, TfToken(m_newName))) {
|
||||
LOG_ERROR("RenamePrimCommand::Execute: RenamePrim() rejected for " + m_oldPath.GetString());
|
||||
return;
|
||||
}
|
||||
std::string whyNot;
|
||||
if (!editor.CanApplyEdits(&whyNot)) {
|
||||
LOG_ERROR("RenamePrimCommand::Execute: cannot rename " + m_oldPath.GetString() + ": " + whyNot);
|
||||
@@ -45,7 +48,10 @@ void RenamePrimCommand::Undo() {
|
||||
return;
|
||||
}
|
||||
UsdNamespaceEditor editor(m_stage);
|
||||
editor.RenamePrim(prim, TfToken(m_oldName));
|
||||
if (!editor.RenamePrim(prim, TfToken(m_oldName))) {
|
||||
LOG_ERROR("RenamePrimCommand::Undo: RenamePrim() rejected for " + m_newPath.GetString());
|
||||
return;
|
||||
}
|
||||
std::string whyNot;
|
||||
if (!editor.CanApplyEdits(&whyNot)) {
|
||||
LOG_ERROR("RenamePrimCommand::Undo: cannot rename back " + m_newPath.GetString() + ": " + whyNot);
|
||||
|
||||
Reference in New Issue
Block a user