diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2013-11-19 02:52:07 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2013-11-19 02:52:07 +0400 |
commit | 0f32bc49ecb54911eea705d661443fbb09d0ff9d (patch) | |
tree | 0972e7633e25a39d67d54801c86e9b5fe83002db /source/gameengine | |
parent | 55e3be560e5895be593dcf93a50dcd09631729b8 (diff) |
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.
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Ketsji/KX_Scene.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
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; j<children->GetCount(); ++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(); } |