[Bf-blender-cvs] [d2bf1af] depsgraph_refactor: Depsgraph: Use pointer to a cons char instead of a string for relation name

Sergey Sharybin noreply at git.blender.org
Wed Apr 1 17:06:59 CEST 2015


Commit: d2bf1afe2db0f76a6932e9bdedd08c8eae864bd4
Author: Sergey Sharybin
Date:   Wed Apr 1 19:46:27 2015 +0500
Branches: depsgraph_refactor
https://developer.blender.org/rBd2bf1afe2db0f76a6932e9bdedd08c8eae864bd4

Depsgraph: Use pointer to a cons char instead of a string for relation name

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

M	source/blender/depsgraph/intern/depsgraph.cpp
M	source/blender/depsgraph/intern/depsgraph.h
M	source/blender/depsgraph/intern/depsgraph_build.cpp
M	source/blender/depsgraph/intern/depsgraph_build.h
M	source/blender/depsgraph/intern/depsgraph_build_idusers.cpp
M	source/blender/depsgraph/intern/depsgraph_build_relations.cpp
M	source/blender/depsgraph/intern/depsgraph_debug.cpp
M	source/blender/depsgraph/util/depsgraph_util_cycle.cpp

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

diff --git a/source/blender/depsgraph/intern/depsgraph.cpp b/source/blender/depsgraph/intern/depsgraph.cpp
index 54fa44f..c62bf3b 100644
--- a/source/blender/depsgraph/intern/depsgraph.cpp
+++ b/source/blender/depsgraph/intern/depsgraph.cpp
@@ -343,7 +343,7 @@ void Depsgraph::clear_id_nodes()
 DepsRelation *Depsgraph::add_new_relation(OperationDepsNode *from,
                                           OperationDepsNode *to,
                                           eDepsRelation_Type type,
-                                          const string &description)
+                                          const char *description)
 {
 	/* Create new relation, and add it to the graph. */
 	DepsRelation *rel = OBJECT_GUARDED_NEW(DepsRelation, from, to, type, description);
@@ -353,7 +353,7 @@ DepsRelation *Depsgraph::add_new_relation(OperationDepsNode *from,
 /* Add new relation between two nodes */
 DepsRelation *Depsgraph::add_new_relation(DepsNode *from, DepsNode *to,
                                           eDepsRelation_Type type,
-                                          const string &description)
+                                          const char *description)
 {
 	/* Create new relation, and add it to the graph. */
 	DepsRelation *rel = OBJECT_GUARDED_NEW(DepsRelation, from, to, type, description);
@@ -366,14 +366,13 @@ DepsRelation *Depsgraph::add_new_relation(DepsNode *from, DepsNode *to,
 DepsRelation::DepsRelation(DepsNode *from,
                            DepsNode *to,
                            eDepsRelation_Type type,
-                           const string &description)
+                           const char *description)
+  : from(from),
+    to(to),
+    name(description),
+    type(type),
+    flag(0)
 {
-	this->from = from;
-	this->to = to;
-	this->type = type;
-	this->name = description;
-	this->flag = 0;
-
 #ifndef NDEBUG
 /*
 	for (OperationDepsNode::Relations::const_iterator it = from->outlinks.begin();
diff --git a/source/blender/depsgraph/intern/depsgraph.h b/source/blender/depsgraph/intern/depsgraph.h
index 64dfea7..200524e 100644
--- a/source/blender/depsgraph/intern/depsgraph.h
+++ b/source/blender/depsgraph/intern/depsgraph.h
@@ -72,7 +72,7 @@ struct DepsRelation {
 	DepsNode *to;                 /* B */
 
 	/* relationship attributes */
-	string name;                  /* label for debugging */
+	const char* name;             /* label for debugging */
 
 	eDepsRelation_Type type;      /* type */
 	int flag;                     /* (eDepsRelation_Flag) */
@@ -80,7 +80,7 @@ struct DepsRelation {
 	DepsRelation(DepsNode *from,
 	             DepsNode *to,
 	             eDepsRelation_Type type,
-	             const string &description);
+	             const char *description);
 
 	~DepsRelation();
 };
@@ -139,12 +139,12 @@ struct Depsgraph {
 	DepsRelation *add_new_relation(OperationDepsNode *from,
 	                               OperationDepsNode *to,
 	                               eDepsRelation_Type type,
-	                               const string &description);
+	                               const char *description);
 
 	DepsRelation *add_new_relation(DepsNode *from,
 	                               DepsNode *to,
 	                               eDepsRelation_Type type,
-	                               const string &description);
+	                               const char *description);
 
 	/* Tag a specific node as needing updates. */
 	void add_entry_tag(OperationDepsNode *node);
diff --git a/source/blender/depsgraph/intern/depsgraph_build.cpp b/source/blender/depsgraph/intern/depsgraph_build.cpp
index 5c1b034..f517d91 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build.cpp
@@ -132,14 +132,14 @@ void DEG_add_scene_relation(DepsNodeHandle *handle, struct Scene *scene, eDepsSc
 {
 	eDepsNode_Type type = deg_build_scene_component_type(component);
 	ComponentKey comp_key(&scene->id, type);
-	handle->builder->add_node_handle_relation(comp_key, handle, DEPSREL_TYPE_GEOMETRY_EVAL, string(description));
+	handle->builder->add_node_handle_relation(comp_key, handle, DEPSREL_TYPE_GEOMETRY_EVAL, description);
 }
 
 void DEG_add_object_relation(DepsNodeHandle *handle, struct Object *ob, eDepsObjectComponentType component, const char *description)
 {
 	eDepsNode_Type type = deg_build_object_component_type(component);
 	ComponentKey comp_key(&ob->id, type);
-	handle->builder->add_node_handle_relation(comp_key, handle, DEPSREL_TYPE_GEOMETRY_EVAL, string(description));
+	handle->builder->add_node_handle_relation(comp_key, handle, DEPSREL_TYPE_GEOMETRY_EVAL, description);
 }
 
 void DEG_add_bone_relation(DepsNodeHandle *handle, struct Object *ob, const char *bone_name, eDepsObjectComponentType component, const char *description)
@@ -148,7 +148,7 @@ void DEG_add_bone_relation(DepsNodeHandle *handle, struct Object *ob, const char
 	ComponentKey comp_key(&ob->id, type, bone_name);
 
 	// XXX: "Geometry Eval" might not always be true, but this only gets called from modifier building now
-	handle->builder->add_node_handle_relation(comp_key, handle, DEPSREL_TYPE_GEOMETRY_EVAL, string(description));
+	handle->builder->add_node_handle_relation(comp_key, handle, DEPSREL_TYPE_GEOMETRY_EVAL, description);
 }
 
 void DEG_add_special_eval_flag(Depsgraph *graph, ID *id, short flag)
diff --git a/source/blender/depsgraph/intern/depsgraph_build.h b/source/blender/depsgraph/intern/depsgraph_build.h
index d27e5ab..0149640 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.h
+++ b/source/blender/depsgraph/intern/depsgraph_build.h
@@ -242,15 +242,15 @@ struct DepsgraphRelationBuilder
 
 	template <typename KeyFrom, typename KeyTo>
 	void add_relation(const KeyFrom &key_from, const KeyTo &key_to,
-	                  eDepsRelation_Type type, const string &description);
+	                  eDepsRelation_Type type, const char *description);
 
 	template <typename KeyTo>
 	void add_relation(const TimeSourceKey &key_from, const KeyTo &key_to,
-	                  eDepsRelation_Type type, const string &description);
+	                  eDepsRelation_Type type, const char *description);
 
 	template <typename KeyType>
 	void add_node_handle_relation(const KeyType &key_from, const DepsNodeHandle *handle,
-	                              eDepsRelation_Type type, const string &description);
+	                              eDepsRelation_Type type, const char *description);
 
 	void build_scene(Main *bmain, Scene *scene);
 	void build_group(Main *bmain, Scene *scene, Object *object, Group *group);
@@ -286,9 +286,9 @@ protected:
 	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_time_relation(TimeSourceDepsNode *timesrc, DepsNode *node_to, const char *description);
 	void add_operation_relation(OperationDepsNode *node_from, OperationDepsNode *node_to,
-	                            eDepsRelation_Type type, const string &description);
+	                            eDepsRelation_Type type, const char *description);
 
 	template <typename KeyType>
 	DepsNodeHandle create_node_handle(const KeyType &key, const string &default_name = "");
@@ -303,7 +303,7 @@ struct DepsgraphIDUsersBuilder {
 	DepsgraphIDUsersBuilder(Depsgraph *graph);
 
 	void add_relation(const ID *from_id, const ID *to_id,
-	                  eDepsRelation_Type type, const string &description);
+	                  eDepsRelation_Type type, const char *description);
 
 	void build_scene(Main *bmain, Scene *scene);
 	void build_object(Scene *scene, Object *ob);
@@ -337,7 +337,7 @@ template <typename KeyFrom, typename KeyTo>
 void DepsgraphRelationBuilder::add_relation(const KeyFrom &key_from,
                                             const KeyTo &key_to,
                                             eDepsRelation_Type type,
-                                            const string &description)
+                                            const char *description)
 {
 	DepsNode *node_from = find_node(key_from);
 	DepsNode *node_to = find_node(key_to);
@@ -350,20 +350,20 @@ void DepsgraphRelationBuilder::add_relation(const KeyFrom &key_from,
 		if (!op_from) {
 			/* XXX TODO handle as error or report if needed */
 			fprintf(stderr, "add_relation(%d, %s) - Could not find op_from (%s)\n",
-			        type, description.c_str(), key_from.identifier().c_str());
+			        type, description, key_from.identifier().c_str());
 		}
 		else {
 			fprintf(stderr, "add_relation(%d, %s) - Failed, but op_from (%s) was ok\n",
-			        type, description.c_str(), key_from.identifier().c_str());
+			        type, description, key_from.identifier().c_str());
 		}
 		if (!op_to) {
 			/* XXX TODO handle as error or report if needed */
 			fprintf(stderr, "add_relation(%d, %s) - Could not find op_to (%s)\n",
-			        type, description.c_str(), key_to.identifier().c_str());
+			        type, description, key_to.identifier().c_str());
 		}
 		else {
 			fprintf(stderr, "add_relation(%d, %s) - Failed, but op_to (%s) was ok\n",
-			        type, description.c_str(), key_to.identifier().c_str());
+			        type, description, key_to.identifier().c_str());
 		}
 	}
 }
@@ -372,7 +372,7 @@ template <typename KeyTo>
 void DepsgraphRelationBuilder::add_relation(const TimeSourceKey &key_from,
                                             const KeyTo &key_to,
                                             eDepsRelation_Type type,
-                                            const string &description)
+                                            const char *description)
 {
 	BLI_assert(type == DEPSREL_TYPE_TIME);
 	TimeSourceDepsNode *time_from = find_node(key_from);
@@ -389,7 +389,7 @@ template <typename KeyType>
 void DepsgraphRelationBuilder::add_node_handle_relation(const KeyType &key_from,
                                                         const DepsNodeHandle *handle,
                                                         eDepsRelation_Type type,
-                                                        const string &description)
+                                  

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list