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
@@ -65,7 +65,7 @@ namespace EMotionFX
void HitDetectionJointWidget::InternalReinit()
{
if (m_selectedModelIndices.size() == 1)
if (GetSelectedModelIndices().size() == 1)
{
Physics::CharacterColliderNodeConfiguration* hitDetectionNodeConfig = GetNodeConfig();
if (hitDetectionNodeConfig)
@@ -90,17 +90,17 @@ namespace EMotionFX
void HitDetectionJointWidget::OnAddCollider(const AZ::TypeId& colliderType)
{
ColliderHelpers::AddCollider(m_selectedModelIndices, PhysicsSetup::HitDetection, colliderType);
ColliderHelpers::AddCollider(GetSelectedModelIndices(), PhysicsSetup::HitDetection, colliderType);
}
void HitDetectionJointWidget::OnCopyCollider(size_t colliderIndex)
{
ColliderHelpers::CopyColliderToClipboard(m_selectedModelIndices.first(), colliderIndex, PhysicsSetup::HitDetection);
ColliderHelpers::CopyColliderToClipboard(GetSelectedModelIndices().first(), colliderIndex, PhysicsSetup::HitDetection);
}
void HitDetectionJointWidget::OnPasteCollider(size_t colliderIndex, bool replace)
{
ColliderHelpers::PasteColliderFromClipboard(m_selectedModelIndices.first(), colliderIndex, PhysicsSetup::HitDetection, replace);
ColliderHelpers::PasteColliderFromClipboard(GetSelectedModelIndices().first(), colliderIndex, PhysicsSetup::HitDetection, replace);
}
void HitDetectionJointWidget::OnRemoveCollider(size_t colliderIndex)
@@ -110,7 +110,7 @@ namespace EMotionFX
Physics::CharacterColliderNodeConfiguration* HitDetectionJointWidget::GetNodeConfig()
{
AZ_Assert(m_selectedModelIndices.size() == 1, "Get Node config function only return the config when it is single seleted");
AZ_Assert(GetSelectedModelIndices().size() == 1, "Get Node config function only return the config when it is single seleted");
Actor* actor = GetActor();
Node* node = GetNode();
if (!actor || !node)