Ver código fonte

Do not delete the actor instance if it's belong to an entity. (#4624)

Signed-off-by: rhhong <[email protected]>
Roman 3 anos atrás
pai
commit
129d249cb4

+ 4 - 0
Gems/AtomLyIntegration/EMotionFXAtom/Code/Tools/EMStudio/AnimViewportRenderer.cpp

@@ -92,6 +92,7 @@ namespace EMStudio
         m_postProcessEntity->CreateComponent(AZ::Render::PostFxLayerComponentTypeId);
         m_postProcessEntity->CreateComponent(AZ::Render::ExposureControlComponentTypeId);
         m_postProcessEntity->CreateComponent(azrtti_typeid<AzFramework::TransformComponent>());
+        m_postProcessEntity->Init();
         m_postProcessEntity->Activate();
 
         // Init directional light processor
@@ -112,6 +113,7 @@ namespace EMStudio
 
         m_iblEntity->CreateComponent(AZ::Render::ImageBasedLightComponentTypeId);
         m_iblEntity->CreateComponent(azrtti_typeid<AzFramework::TransformComponent>());
+        m_iblEntity->Init();
         m_iblEntity->Activate();
 
         // Load light preset
@@ -134,6 +136,7 @@ namespace EMStudio
         gridComponent->SetConfiguration(gridConfig);
 
         m_gridEntity->CreateComponent(azrtti_typeid<AzFramework::TransformComponent>());
+        m_gridEntity->Init();
         m_gridEntity->Activate();
 
         Reinit();
@@ -251,6 +254,7 @@ namespace EMStudio
         actorEntity->CreateComponent(azrtti_typeid<EMotionFX::Integration::ActorComponent>());
         actorEntity->CreateComponent(AZ::Render::MaterialComponentTypeId);
         actorEntity->CreateComponent(azrtti_typeid<AzFramework::TransformComponent>());
+        actorEntity->Init();
         actorEntity->Activate();
 
         EMotionFX::Integration::ActorComponent* actorComponent = actorEntity->FindComponent<EMotionFX::Integration::ActorComponent>();

+ 5 - 0
Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ActorCommands.cpp

@@ -825,6 +825,11 @@ namespace CommandSystem
                 {
                     continue;
                 }
+                // Ignore actor instances owned by entity
+                if (actorInstance->GetEntity())
+                {
+                    continue;
+                }
 
                 // generate command to remove the actor instance
                 const AZStd::string command = AZStd::string::format("RemoveActorInstance -actorInstanceID %i", actorInstance->GetID());