Reset the whole Qt model when an entry in the EditorEntityModel is removed. (#48) (#82)

An optimization introduced in Prefab mode currently changes the relative ordering of children, causing stale QModelIndex variables to still be referenced and crash the Editor sporadically. This change is theoretically a bit slower, but still much faster than the pre-optimization times.

Co-authored-by: Shirang Jia <shiranj@amazon.com>

Co-authored-by: Shirang Jia <shiranj@amazon.com>
This commit is contained in:
AMZN-daimini
2021-04-19 21:52:10 -07:00
committed by GitHub
parent b15850176b
commit 7901fe8625
@@ -1344,14 +1344,15 @@ namespace AzToolsFramework
emit EnableSelectionUpdates(false);
auto parentIndex = GetIndexFromEntity(parentId);
auto childIndex = GetIndexFromEntity(childId);
beginRemoveRows(parentIndex, childIndex.row(), childIndex.row());
beginResetModel();
}
void EntityOutlinerListModel::OnEntityInfoUpdatedRemoveChildEnd(AZ::EntityId parentId, AZ::EntityId childId)
{
(void)childId;
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
endRemoveRows();
endResetModel();
//must refresh partial lock/visibility of parents
m_isFilterDirty = true;