[Bf-blender-cvs] [c94cef7] depsgraph_refactor: Depsgraph: Bone constraints depending on the armature transforms were not working

Joshua Leung noreply at git.blender.org
Tue Jan 13 03:40:26 CET 2015


Commit: c94cef784868b18eb1458ee1094917aaf6e93c86
Author: Joshua Leung
Date:   Tue Jan 13 13:03:57 2015 +1300
Branches: depsgraph_refactor
https://developer.blender.org/rBc94cef784868b18eb1458ee1094917aaf6e93c86

Depsgraph: Bone constraints depending on the armature transforms were not working

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

M	source/blender/depsgraph/intern/depsgraph_build_relations.cpp

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

diff --git a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
index 1f77334..41a03ce 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
@@ -521,8 +521,24 @@ void DepsgraphRelationBuilder::build_constraints(Scene *scene, ID *id, eDepsNode
 				else {
 					/* standard object relation */
 					// TODO: loc vs rot vs scale?
-					/* TODO(sergey): What to do if target is self?  -- should use local transform or just the previous constraint in that case... */
-					if (&ct->tar->id != id) {
+					if (&ct->tar->id == id) {
+						/* Constraint targetting own object:
+						 * - This case is fine IFF we're dealing with a bone constraint pointing to
+						 *   its own armature. In that case, it's just transform -> bone.
+						 * - If however it is a real self targetting case, just make it depend on the
+						 *   previous constraint (or the pre-constraint state)...
+						 */
+						if ((ct->tar->type == OB_ARMATURE) && (component_type == DEPSNODE_TYPE_BONE)) {
+							OperationKey target_key(&ct->tar->id, DEPSNODE_TYPE_TRANSFORM, DEG_OPCODE_TRANSFORM_FINAL);
+							add_relation(target_key, constraint_op_key, DEPSREL_TYPE_TRANSFORM, cti->name);
+						}
+						else {
+							OperationKey target_key(&ct->tar->id, DEPSNODE_TYPE_TRANSFORM, DEG_OPCODE_TRANSFORM_LOCAL);
+							add_relation(target_key, constraint_op_key, DEPSREL_TYPE_TRANSFORM, cti->name);
+						}
+					}
+					else {
+						/* normal object dependency */
 						OperationKey target_key(&ct->tar->id, DEPSNODE_TYPE_TRANSFORM, DEG_OPCODE_TRANSFORM_FINAL);
 						add_relation(target_key, constraint_op_key, DEPSREL_TYPE_TRANSFORM, cti->name);
 					}




More information about the Bf-blender-cvs mailing list