From 06f57a0522897e23593b388e3fd17fd0f8cc9d07 Mon Sep 17 00:00:00 2001 From: Fredrik Lindahl Date: Fri, 22 Nov 2024 11:13:03 +0100 Subject: [PATCH] Fixed incorrect setup order for character context --- .../graphicsfeature/managers/graphicsmanager.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/code/addons/graphicsfeature/managers/graphicsmanager.cc b/code/addons/graphicsfeature/managers/graphicsmanager.cc index 3548072ea..f499a6560 100644 --- a/code/addons/graphicsfeature/managers/graphicsmanager.cc +++ b/code/addons/graphicsfeature/managers/graphicsmanager.cc @@ -60,10 +60,6 @@ RegisterModelEntity( { Raytracing::RaytracingContext::RegisterEntity(gid); } - if (anim.IsValid() && skeleton.IsValid()) - { - Characters::CharacterContext::RegisterEntity(gid); - } Models::ModelContext::Setup( gid, res, @@ -74,16 +70,17 @@ RegisterModelEntity( return; Visibility::ObservableContext::RegisterEntity(gid); Models::ModelContext::SetTransform(gid, t); + Visibility::ObservableContext::Setup(gid, Visibility::VisibilityEntityType::Model); if (raytracing && CoreGraphics::RayTracingSupported) { Raytracing::RaytracingContext::SetupModel(gid, CoreGraphics::BlasInstanceFlags::NoFlags, 0xFF); } if (anim.IsValid() && skeleton.IsValid()) { + Characters::CharacterContext::RegisterEntity(gid); Characters::CharacterContext::Setup(gid, skeleton, 0, anim, 0, "NONE"); Characters::CharacterContext::PlayClip(gid, nullptr, 0, 0, Characters::EnqueueMode::Replace); } - Visibility::ObservableContext::Setup(gid, Visibility::VisibilityEntityType::Model); } ); } @@ -102,6 +99,10 @@ DeregisterModelEntity(Model const* model) { Raytracing::RaytracingContext::DeregisterEntity(model->graphicsEntityId); } + if (Characters::CharacterContext::IsEntityRegistered(model->graphicsEntityId)) + { + Characters::CharacterContext::DeregisterEntity(model->graphicsEntityId); + } if (Visibility::ObservableContext::IsEntityRegistered(model->graphicsEntityId)) { Visibility::ObservableContext::DeregisterEntity(model->graphicsEntityId);