[Bf-blender-cvs] [adbf88f] depsgraph_refactor: Depsgraph: Improve handling of unexisting RNA paths in driver targets

Sergey Sharybin noreply at git.blender.org
Wed Apr 1 15:52:55 CEST 2015


Commit: adbf88f53aef119f39d89d1a2598f926ff0ad28e
Author: Sergey Sharybin
Date:   Wed Apr 1 18:52:20 2015 +0500
Branches: depsgraph_refactor
https://developer.blender.org/rBadbf88f53aef119f39d89d1a2598f926ff0ad28e

Depsgraph: Improve handling of unexisting RNA paths in driver targets

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

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

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

diff --git a/source/blender/depsgraph/intern/depsgraph_build.h b/source/blender/depsgraph/intern/depsgraph_build.h
index bd7f26b..d27e5ab 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.h
+++ b/source/blender/depsgraph/intern/depsgraph_build.h
@@ -284,6 +284,7 @@ protected:
 	ComponentDepsNode *find_node(const ComponentKey &key) const;
 	OperationDepsNode *find_node(const OperationKey &key) const;
 	DepsNode *find_node(const RNAPathKey &key) const;
+	OperationDepsNode *has_node(const OperationKey &key) const;
 
 	void add_time_relation(TimeSourceDepsNode *timesrc, DepsNode *node_to, const string &description);
 	void add_operation_relation(OperationDepsNode *node_from, OperationDepsNode *node_to,
diff --git a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
index 08aba93..1688e10 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
@@ -185,6 +185,21 @@ DepsNode *DepsgraphRelationBuilder::find_node(const RNAPathKey &key) const
 	return m_graph->find_node_from_pointer(&key.ptr, key.prop);
 }
 
+OperationDepsNode *DepsgraphRelationBuilder::has_node(
+        const OperationKey &key) const
+{
+	IDDepsNode *id_node = m_graph->find_id_node(key.id);
+	if (!id_node) {
+		return NULL;
+	}
+	ComponentDepsNode *comp_node = id_node->find_component(key.component_type,
+	                                                       key.component_name);
+	if (!comp_node) {
+		return NULL;
+	}
+	return comp_node->has_operation(key.opcode, key.name);
+}
+
 void DepsgraphRelationBuilder::add_time_relation(TimeSourceDepsNode *timesrc,
                                                  DepsNode *node_to,
                                                  const string &description)
@@ -764,8 +779,16 @@ void DepsgraphRelationBuilder::build_driver(ID *id, FCurve *fcu)
 		/* modifier driver - connect directly to the modifier */
 		char *modifier_name = BLI_str_quoted_substrN(fcu->rna_path, "modifiers[");
 		if (modifier_name) {
-			OperationKey modifier_key(id, DEPSNODE_TYPE_GEOMETRY, DEG_OPCODE_GEOMETRY_MODIFIER, modifier_name);
-			add_relation(driver_key, modifier_key, DEPSREL_TYPE_DRIVER, "[Driver -> Modifier]");
+			OperationKey modifier_key(id,
+			                          DEPSNODE_TYPE_GEOMETRY,
+			                          DEG_OPCODE_GEOMETRY_MODIFIER,
+			                          modifier_name);
+			if (has_node(modifier_key)) {
+				add_relation(driver_key, modifier_key, DEPSREL_TYPE_DRIVER, "[Driver -> Modifier]");
+			}
+			else {
+				printf("Unexisting driver RNA path: %s\n", fcu->rna_path);
+			}
 
 			MEM_freeN(modifier_name);
 		}




More information about the Bf-blender-cvs mailing list