[Bf-blender-cvs] [7250c5c] depsgraph_refactor: Fix for Driver: fcu->rna_path was not unique enough to be an identifying key

Joshua Leung noreply at git.blender.org
Tue Dec 30 10:26:23 CET 2014


Commit: 7250c5cfc173480bbd4a02e95ac2a2ffdc24adb1
Author: Joshua Leung
Date:   Tue Dec 30 18:35:49 2014 +1300
Branches: depsgraph_refactor
https://developer.blender.org/rB7250c5cfc173480bbd4a02e95ac2a2ffdc24adb1

Fix for Driver: fcu->rna_path was not unique enough to be an identifying key

For identifying a particular driver within a component, just using the RNA
path isn't enough, as that means that only the first driver for array/vector
properties gets executed or included in the graph. To ensure that it is still
possible to easily figure out what's going on, we now generate strings for the
"name" identifiers now (i.e. rna path + array index)

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

M	source/blender/depsgraph/intern/depsgraph_build.cpp
M	source/blender/depsgraph/intern/depsgraph_build.h
M	source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
M	source/blender/depsgraph/intern/depsgraph_build_relations.cpp

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

diff --git a/source/blender/depsgraph/intern/depsgraph_build.cpp b/source/blender/depsgraph/intern/depsgraph_build.cpp
index 4674fcf..91d77cb 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build.cpp
@@ -143,6 +143,18 @@ void DEG_add_object_relation(DepsNodeHandle *handle, struct Object *ob, eDepsObj
 }
 
 /* ************************************************* */
+/* Utilities for Builders */
+
+/* Get unique identifier for FCurves and Drivers */
+string deg_fcurve_id_name(const FCurve *fcu)
+{
+	char index_buf[32];
+	sprintf(index_buf, "[%d]", fcu->array_index);
+	
+	return string(fcu->rna_path) + index_buf;
+}
+
+/* ************************************************* */
 /* Node Builder */
 
 DepsgraphNodeBuilder::DepsgraphNodeBuilder(Main *bmain, Depsgraph *graph) :
diff --git a/source/blender/depsgraph/intern/depsgraph_build.h b/source/blender/depsgraph/intern/depsgraph_build.h
index 5977b37..16b7ff0 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.h
+++ b/source/blender/depsgraph/intern/depsgraph_build.h
@@ -289,6 +289,11 @@ struct DepsNodeHandle
 	const string &default_name;
 };
 
+/* Utilities for Builders ----------------------------------------------------- */
+
+/* Get unique identifier for FCurves and Drivers */
+string deg_fcurve_id_name(const FCurve *fcu);
+
 /* Inline Function Templates -------------------------------------------------- */
 
 #include "depsnode_component.h"
diff --git a/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp b/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
index 187a738..c3efd15 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
@@ -392,7 +392,7 @@ OperationDepsNode *DepsgraphNodeBuilder::build_driver(ID *id, FCurve *fcu)
 	TimeSourceDepsNode *time_src = m_graph->find_time_source();
 	OperationDepsNode *driver_op = add_operation_node(id, DEPSNODE_TYPE_PARAMETERS,
 	                                                  DEPSOP_TYPE_EXEC, function_bind(BKE_animsys_eval_driver, _1, id, fcu, time_src),
-	                                                  DEG_OPCODE_DRIVER, fcu->rna_path);
+	                                                  DEG_OPCODE_DRIVER, deg_fcurve_id_name(fcu));
 	
 	/* tag "scripted expression" drivers as needing Python (due to GIL issues, etc.) */
 	if (driver->type == DRIVER_TYPE_PYTHON) {
diff --git a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
index 9c1670e..400643e 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
@@ -563,7 +563,7 @@ void DepsgraphRelationBuilder::build_animdata(ID *id)
 void DepsgraphRelationBuilder::build_driver(ID *id, FCurve *fcu)
 {
 	ChannelDriver *driver = fcu->driver;
-	OperationKey driver_key(id, DEPSNODE_TYPE_PARAMETERS, DEG_OPCODE_DRIVER, fcu->rna_path);
+	OperationKey driver_key(id, DEPSNODE_TYPE_PARAMETERS, DEG_OPCODE_DRIVER, deg_fcurve_id_name(fcu));
 	
 	/* create dependency between driver and data affected by it */
 	/* - direct property relationship... */




More information about the Bf-blender-cvs mailing list