[Bf-blender-cvs] [0f32bc4] master: Fix T37171: Camera parented to a bone doesn't move with the bone, unless another object is parented too

Mitchell Stokes noreply at git.blender.org
Mon Nov 18 23:53:28 CET 2013


Commit: 0f32bc49ecb54911eea705d661443fbb09d0ff9d
Author: Mitchell Stokes
Date:   Mon Nov 18 14:52:07 2013 -0800
http://developer.blender.org/rB0f32bc49ecb54911eea705d661443fbb09d0ff9d

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.

===================================================================

M	source/gameengine/Ketsji/KX_Scene.cpp

===================================================================

diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp
index 5a956ff..2f23bda 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();
 		}




More information about the Bf-blender-cvs mailing list