Fix the crash when switching between sim obj and physix layout in animation editor. (#4185)

* Update the simulated object layout

Signed-off-by: rhhong <rhhong@amazon.com>

* Fixed the bug. Do not store uncessory cached selected model indices which would become stall.

Signed-off-by: rhhong <rhhong@amazon.com>

* update the simulted object layout.

Signed-off-by: rhhong <rhhong@amazon.com>

* Get rid of locally cached selectedIndices variable.

Signed-off-by: rhhong <rhhong@amazon.com>

* Remove debug code

Signed-off-by: rhhong <rhhong@amazon.com>
This commit is contained in:
Roman
2021-09-22 09:41:45 -07:00
committed by GitHub
parent aaf292f8cd
commit d00d9a9515
8 changed files with 67 additions and 62 deletions
@@ -211,15 +211,15 @@ namespace EMotionFX
AZ::Outcome<const QModelIndexList&> SkeletonOutlinerPlugin::GetSelectedRowIndices()
{
return AZ::Success(m_selectedRows);
return AZ::Success(m_treeView->selectionModel()->selectedRows());
}
void SkeletonOutlinerPlugin::OnSelectionChanged([[maybe_unused]] const QItemSelection& selected, [[maybe_unused]] const QItemSelection& deselected)
{
m_selectedRows = m_treeView->selectionModel()->selectedRows();
if (m_selectedRows.size() == 1)
QModelIndexList selectedRows = m_treeView->selectionModel()->selectedRows();
if (selectedRows.size() == 1)
{
const QModelIndex& modelIndex = m_selectedRows[0];
const QModelIndex& modelIndex = selectedRows[0];
Node* selectedNode = modelIndex.data(SkeletonModel::ROLE_POINTER).value<Node*>();
Actor* selectedActor = modelIndex.data(SkeletonModel::ROLE_ACTOR_POINTER).value<Actor*>();
SkeletonOutlinerNotificationBus::Broadcast(&SkeletonOutlinerNotifications::SingleNodeSelectionChanged, selectedActor, selectedNode);