From 0f32bc49ecb54911eea705d661443fbb09d0ff9d Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Mon, 18 Nov 2013 14:52:07 -0800 Subject: Fix T37171: Camera parented to a bone doesn't move with the bone, unless another object is parented too Armatures used to check if any of their meshes were culled to see if they needed to be updated. However, this meant armatures with no meshes would never update, since non-mesh objects are always considered culled. Instead, if a non-culled child was not found, we now check to see if the armature contained only non-mesh objects. If this is the case, always update the armature. If this becomes a problem, we can look into being able to cull non-mesh objects. --- source/gameengine/Ketsji/KX_Scene.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'source/gameengine/Ketsji/KX_Scene.cpp') diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 5a956ffc048..2f23bdaccb7 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -1613,16 +1613,29 @@ void KX_Scene::UpdateAnimations(double curtime) CListValue *children = gameobj->GetChildren(); KX_GameObject *child; + bool has_mesh = false, has_non_mesh = false; + // Check for meshes that haven't been culled for (int j=0; jGetCount(); ++j) { child = (KX_GameObject*)children->GetValue(j); - if (child->GetMeshCount() > 0 && !child->GetCulled()) { + if (!child->GetCulled()) { needs_update = true; break; } + + if (child->GetMeshCount() == 0) + has_non_mesh = true; + else + has_mesh = true; } + // If we didn't find a non-culled mesh, check to see + // if we even have any meshes, and update if this + // armature has only non-mesh children. + if (!needs_update && !has_mesh && has_non_mesh) + needs_update = true; + children->Release(); } -- cgit v1.2.3