[Bf-blender-cvs] [1cc7b42] depsgraph_refactor: Drivers interleaved with bones seem to work now

Joshua Leung noreply at git.blender.org
Thu Dec 4 14:24:34 CET 2014


Commit: 1cc7b426576e146dfc9da52cf2408ee3ac87f7cb
Author: Joshua Leung
Date:   Fri Dec 5 02:12:22 2014 +1300
Branches: depsgraph_refactor
https://developer.blender.org/rB1cc7b426576e146dfc9da52cf2408ee3ac87f7cb

Drivers interleaved with bones seem to work now

More testing is needed, but for now, it seems that this finally works.
Other cases will need to be manually added later, but for a proof of
concept, this is working well already.

TODO: The drivers -> object transform link is superflous in this case...

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

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 d6ab7ac..db4094e 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
@@ -542,12 +542,31 @@ void DepsgraphRelationBuilder::build_driver(ID *id, FCurve *fcurve)
 	OperationKey driver_key(id, DEPSNODE_TYPE_PARAMETERS, deg_op_name_driver(driver));
 	
 	/* create dependency between driver and data affected by it */
-	// XXX: this should return a parameter context for dealing with this...
+	/* - direct property relationship... */
 	RNAPathKey affected_key(id, fcurve->rna_path);
-	
-	/* make data dependent on driver */
 	add_relation(driver_key, affected_key, DEPSREL_TYPE_DRIVER, "[Driver -> Data] DepsRel");
 	
+	/* driver -> data components (for interleaved evaluation - bones/constraints/modifiers) */
+	// XXX: this probably shouldn't be inlined here like this...
+	if (strstr(fcurve->rna_path, "pose.bones[\"") != NULL) {
+		/* interleaved drivers during bone eval */
+		char *bone_name = BLI_str_quoted_substrN(fcurve->rna_path, "pose.bones[");
+		
+		Object *ob = (Object *)id;
+		bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, bone_name);
+		
+		printf("driver on bone: id = %s, pchan = %s\n", id->name, pchan->name);
+		ComponentKey bone_key(id, DEPSNODE_TYPE_BONE, pchan->name);
+		DepsNode *bkey_node = find_node(bone_key);
+		if (bkey_node) {
+			printf("%s %d\n", bkey_node->name.c_str(), bkey_node->type);
+			add_relation(driver_key, bone_key, DEPSREL_TYPE_DRIVER, "[Driver -> SubData] DepsRel");
+		}
+		else {
+			printf("couldn't find bone node!\n");
+		}
+	}
+	
 	/* ensure that affected prop's update callbacks will be triggered once done */
 	// TODO: implement this once the functionality to add these links exists in RNA
 	// XXX: the data itself could also set this, if it were to be truly initialised later?




More information about the Bf-blender-cvs mailing list