[Bf-blender-cvs] [f7857c7] depsgraph_refactor: Depsgraph: Corrections for Spline IK solver

Sergey Sharybin noreply at git.blender.org
Wed Nov 12 15:16:18 CET 2014


Commit: f7857c72790b55cede699e9367312d04d015fa48
Author: Sergey Sharybin
Date:   Wed Nov 12 15:06:53 2014 +0100
Branches: depsgraph_refactor
https://developer.blender.org/rBf7857c72790b55cede699e9367312d04d015fa48

Depsgraph: Corrections for Spline IK solver

The issue was caused by the missing relation between Spline IK solver node
and spline itself. This happened because builder used bone node type for
the IK solver, but relation builder was expecting pose eval node type.

Also added a dependency between IK solver node and flush nodes, so flush
happens after the solver. Well, it's a bit more tricky internally, because
we still using uber object update nodes, but adding that relation makes it
so DAG update flush all happens nicely.

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

M	source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
M	source/blender/depsgraph/intern/depsgraph_build_relations.cpp
M	source/blender/modifiers/intern/MOD_hook.c

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

diff --git a/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp b/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
index 8534605..890cf86 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
@@ -529,7 +529,7 @@ void DepsgraphNodeBuilder::build_ik_pose(Object *ob, bPoseChannel *pchan, bConst
 	}
 	
 	/* operation node for evaluating/running IK Solver */
-	add_operation_node(&ob->id, DEPSNODE_TYPE_BONE, pchan->name,
+	add_operation_node(&ob->id, DEPSNODE_TYPE_EVAL_POSE, pchan->name,
 	                   DEPSOP_TYPE_SIM, bind(BKE_pose_iktree_evaluate, _1, ob, rootchan),
 	                   deg_op_name_ik_solver);
 }
@@ -553,7 +553,7 @@ void DepsgraphNodeBuilder::build_splineik_pose(Object *ob, bPoseChannel *pchan,
 	/* operation node for evaluating/running IK Solver
 	 * store the "root bone" of this chain in the solver, so it knows where to start
 	 */
-	add_operation_node(&ob->id, DEPSNODE_TYPE_BONE, pchan->name,
+	add_operation_node(&ob->id, DEPSNODE_TYPE_EVAL_POSE, pchan->name,
 	                   DEPSOP_TYPE_SIM, bind(BKE_pose_splineik_evaluate, _1, ob, rootchan),
 	                   deg_op_name_spline_ik_solver);
 	// XXX: what sort of ID-data is needed?
diff --git a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
index 07523f9..3b75f93 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
@@ -732,6 +732,9 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *ob, bPoseChannel *pchan, bC
 		
 		parchan  = parchan->parent;
 	}
+
+	OperationKey flush_key(&ob->id, DEPSNODE_TYPE_EVAL_POSE, deg_op_name_pose_eval_flush);
+	add_relation(solver_key, flush_key, DEPSREL_TYPE_OPERATION, "PoseEval Result-Bone Link");
 }
 
 /* Spline IK Eval Steps */
@@ -770,6 +773,9 @@ void DepsgraphRelationBuilder::build_splineik_pose(Object *ob, bPoseChannel *pch
 		segcount++;
 		if ((segcount == data->chainlen) || (segcount > 255)) break;  /* 255 is weak */
 	}
+
+	OperationKey flush_key(&ob->id, DEPSNODE_TYPE_EVAL_POSE, deg_op_name_pose_eval_flush);
+	add_relation(solver_key, flush_key, DEPSREL_TYPE_OPERATION, "PoseEval Result-Bone Link");
 }
 
 /* Pose/Armature Bones Graph */
@@ -813,7 +819,7 @@ void DepsgraphRelationBuilder::build_rig(Scene *scene, Object *ob)
 			add_relation(transforms_key, constraints_key, DEPSREL_TYPE_OPERATION, "Constraints Stack");
 		}
 
-		/* TODO(sergey): Assume for now that pose flush depends on all the pose channels/ */
+		/* TODO(sergey): Assume for now that pose flush depends on all the pose channels. */
 		add_relation(bone_key, flush_key, DEPSREL_TYPE_OPERATION, "PoseEval Result-Bone Link");
 	}
 	
diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c
index b64b519..b96d30b 100644
--- a/source/blender/modifiers/intern/MOD_hook.c
+++ b/source/blender/modifiers/intern/MOD_hook.c
@@ -128,8 +128,10 @@ static void updateDepsgraph(ModifierData *md,
 	HookModifierData *hmd = (HookModifierData *) md;
 
 	if (hmd->object != NULL) {
-		/* TODO(sergey): Different relation type depending on subtarget? */
-		DEG_add_object_relation(node, hmd->object, DEG_OB_COMP_TRANSFORM, "Hook Modifier");
+		if (hmd->subtarget[0])
+			DEG_add_object_relation(node, hmd->object, DEG_OB_COMP_GEOMETRY, "Hook Modifier");
+		else
+			DEG_add_object_relation(node, hmd->object, DEG_OB_COMP_TRANSFORM, "Hook Modifier");
 	}
 }




More information about the Bf-blender-cvs mailing list