Skip to content

Commit

Permalink
Add actor instance destruction handling
Browse files Browse the repository at this point in the history
Signed-off-by: Aleksander Kamiński <[email protected]>
  • Loading branch information
alek-kam-robotec-ai committed Sep 13, 2024
1 parent 94de9a6 commit c8cfc29
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Code/Source/Entity/ActorEntityManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace RGL

void ActorEntityManager::Update()
{
if (RGLInterface::Get()->GetSceneConfiguration().m_isSkinnedMeshUpdateEnabled)
if (!m_entities.empty() && RGLInterface::Get()->GetSceneConfiguration().m_isSkinnedMeshUpdateEnabled)
{
UpdateMeshVertices();
}
Expand Down Expand Up @@ -99,6 +99,11 @@ namespace RGL
m_isPoseUpdateNeeded = true;
}

void ActorEntityManager::OnActorInstanceDestroyed(EMotionFX::ActorInstance* actorInstance)
{
m_entities.clear();
}

void ActorEntityManager::UpdateMeshVertices()
{
m_actorInstance->UpdateMeshDeformers(0.0f);
Expand Down
1 change: 1 addition & 0 deletions Code/Source/Entity/ActorEntityManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ namespace RGL
protected:
// ActorComponentNotificationBus overrides
void OnActorInstanceCreated(EMotionFX::ActorInstance* actorInstance) override;
void OnActorInstanceDestroyed(EMotionFX::ActorInstance* actorInstance) override;

private:
EMotionFX::ActorInstance* m_actorInstance = nullptr;
Expand Down
5 changes: 5 additions & 0 deletions Code/Source/Entity/MeshEntityManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,9 @@ namespace RGL
}
}
}

void MeshEntityManager::OnMaterialPropertiesUpdated([[maybe_unused]] const AZ::Render::MaterialAssignmentMap& materials)
{
AZ_Printf(__func__, "Material properties updated");
}
} // namespace RGL
1 change: 1 addition & 0 deletions Code/Source/Entity/MeshEntityManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ namespace RGL

// AZ::Render::MaterialComponentNotificationBus implementation overrides
void OnMaterialsUpdated(const AZ::Render::MaterialAssignmentMap& materials) override;
void OnMaterialPropertiesUpdated([[maybe_unused]] const AZ::Render::MaterialAssignmentMap& materials) override;

AZStd::unordered_map<AZ::RPI::ModelMaterialSlot::StableId, size_t> m_materialSlotMeshIdMap;
};
Expand Down

0 comments on commit c8cfc29

Please sign in to comment.