[Bf-blender-cvs] [9617a7a] depsgraph_refactor: Depsgraph: Fixes for drivers with bone targets defined using RNA Paths

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


Commit: 9617a7a1ab3114d5050bd8dc078eeffc7ce1974a
Author: Joshua Leung
Date:   Tue Jan 13 14:47:53 2015 +1300
Branches: depsgraph_refactor
https://developer.blender.org/rB9617a7a1ab3114d5050bd8dc078eeffc7ce1974a

Depsgraph: Fixes for drivers with bone targets defined using RNA Paths

Now, these drivers don't get blocked waiting for the bone evals to finish.
This makes them function better (specifically, allowing them to have some
of the same benefits as they did in the old depsgraph)

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

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 02a6b17..9fb3359 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
@@ -708,6 +708,7 @@ void DepsgraphRelationBuilder::build_driver(ID *id, FCurve *fcu)
 				
 				if (pchan != NULL) {
 					/* get node associated with bone */
+					// XXX: watch the space!
 					OperationKey target_key(dtar->id, DEPSNODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_DONE);
 					add_relation(target_key, driver_key, DEPSREL_TYPE_DRIVER_TARGET, "[Bone Target -> Driver]");
 				}
@@ -715,7 +716,28 @@ void DepsgraphRelationBuilder::build_driver(ID *id, FCurve *fcu)
 			else if (dtar->flag & DTAR_FLAG_STRUCT_REF) {
 				/* get node associated with the object's transforms */
 				OperationKey target_key(dtar->id, DEPSNODE_TYPE_TRANSFORM, DEG_OPCODE_TRANSFORM_FINAL);
-				add_relation(target_key, driver_key, DEPSREL_TYPE_DRIVER_TARGET, "[Bone Target -> Driver]");
+				add_relation(target_key, driver_key, DEPSREL_TYPE_DRIVER_TARGET, "[Target -> Driver]");
+			}
+			else if (dtar->rna_path && strstr(dtar->rna_path, "pose.bones[")) {
+				/* workaround for ensuring that local bone transforms don't end up
+				 * having to wait for pose eval to finish (to prevent cycles)
+				 */
+				Object *ob = (Object *)dtar->id;
+				bPoseChannel *pchan;
+				char *bone_name;
+				
+				bone_name = BLI_str_quoted_substrN(dtar->rna_path, "pose.bones[");
+				pchan = BKE_pose_channel_find_name(ob->pose, bone_name);
+				
+				if (bone_name) {
+					MEM_freeN(bone_name);
+					bone_name = NULL;
+				}
+				
+				if (pchan) {
+					OperationKey bone_key(dtar->id, DEPSNODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_LOCAL);
+					add_relation(bone_key, driver_key, DEPSREL_TYPE_DRIVER, "[RNA Bone -> Driver]");
+				}
 			}
 			else {
 				/* resolve path to get node */




More information about the Bf-blender-cvs mailing list