Restore event listening behavior in EntityOutlinerListModel (#4254)
Disables a problematic child reparenting code path in EditorEntityModel that led to the series of remove -> add -> remove notifications for reparented entities that led to unnecessary updates and a sporadic QSortFilterProxyModel crash Signed-off-by: nvsickle <nvsickle@amazon.com>
This commit is contained in:
committed by
GitHub
parent
e8c4d52b31
commit
a692ae1567
@@ -381,12 +381,22 @@ namespace AzToolsFramework
|
||||
return;
|
||||
}
|
||||
|
||||
//orphan any children that remain attached to the entity
|
||||
auto children = entityInfo.GetChildren();
|
||||
for (auto childId : children)
|
||||
bool isPrefabSystemEnabled = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(
|
||||
isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
|
||||
|
||||
// For slices, orphan any children that remain attached to the entity
|
||||
// For prefabs, this is an unneeded operation because the prefab system handles the orphans
|
||||
// and the extra reparenting operation can be problematic for consumers subscribed to entity
|
||||
// events, such as the entity outliner.
|
||||
if (!isPrefabSystemEnabled)
|
||||
{
|
||||
ReparentChild(childId, AZ::EntityId(), entityId);
|
||||
m_entityOrphanTable[entityId].insert(childId);
|
||||
auto children = entityInfo.GetChildren();
|
||||
for (auto childId : children)
|
||||
{
|
||||
ReparentChild(childId, AZ::EntityId(), entityId);
|
||||
m_entityOrphanTable[entityId].insert(childId);
|
||||
}
|
||||
}
|
||||
|
||||
m_savedOrderInfo[entityId] = AZStd::make_pair(entityInfo.GetParent(), entityInfo.GetIndexForSorting());
|
||||
|
||||
+5
-2
@@ -1344,7 +1344,10 @@ namespace AzToolsFramework
|
||||
//add/remove operations trigger selection change signals which assert and break undo/redo operations in progress in inspector etc.
|
||||
//so disallow selection updates until change is complete
|
||||
emit EnableSelectionUpdates(false);
|
||||
beginResetModel();
|
||||
|
||||
auto parentIndex = GetIndexFromEntity(parentId);
|
||||
auto childIndex = GetIndexFromEntity(childId);
|
||||
beginRemoveRows(parentIndex, childIndex.row(), childIndex.row());
|
||||
}
|
||||
|
||||
void EntityOutlinerListModel::OnEntityInfoUpdatedRemoveChildEnd(AZ::EntityId parentId, AZ::EntityId childId)
|
||||
@@ -1352,7 +1355,7 @@ namespace AzToolsFramework
|
||||
(void)childId;
|
||||
AZ_PROFILE_FUNCTION(AzToolsFramework);
|
||||
|
||||
endResetModel();
|
||||
endRemoveRows();
|
||||
|
||||
//must refresh partial lock/visibility of parents
|
||||
m_isFilterDirty = true;
|
||||
|
||||
Reference in New Issue
Block a user