Commit: 2ce068678d5bc19445fadad7454b687e2472958a
Author: Sergey Sharybin
Date:   Wed May 25 14:34:03 2016 +0200
Branches: depsgraph_cleanup
https://developer.blender.org/rB2ce068678d5bc19445fadad7454b687e2472958a

Depsgraph: Remove DEPSNODE_RELATIONS_ITER helper

It was only used in read-only cases only where foreach() makes code shorter.

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

M       source/blender/depsgraph/intern/depsgraph.h
M       source/blender/depsgraph/intern/depsgraph_build_relations.cc
M       source/blender/depsgraph/intern/depsgraph_debug.cc
M       source/blender/depsgraph/intern/depsgraph_eval.cc
M       source/blender/depsgraph/intern/depsgraph_query.cc
M       source/blender/depsgraph/intern/depsnode.cc

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

diff --git a/source/blender/depsgraph/intern/depsgraph.h 
b/source/blender/depsgraph/intern/depsgraph.h
index 9533fbd..424142c 100644
--- a/source/blender/depsgraph/intern/depsgraph.h
+++ b/source/blender/depsgraph/intern/depsgraph.h
@@ -198,27 +198,4 @@ struct Depsgraph {
        // XXX: additional stuff like eval contexts, mempools for allocating 
nodes from, etc.
 };
 
-/**
- * Helper macros for iterating over set of relationship links
- * incident on each node.
- *
- * \note it is safe to perform removal operations here...
- *
- * relations_set[in]: (DepsNode::Relations) set of relationships (in/out links)
- * relation[out]:  (DepsRelation *) identifier where DepsRelation that we're
- *              currently accessing comes up
- */
-#define DEPSNODE_RELATIONS_ITER_BEGIN(relations_set_, relation_) \
-       { \
-               OperationDepsNode::Relations::const_iterator __rel_iter = 
relations_set_.begin();  \
-               while (__rel_iter != relations_set_.end()) { \
-                       DepsRelation *relation_ = *__rel_iter; \
-                       ++__rel_iter; \
-
-                       /* ... code for iterator body can be written here ... */
-
-#define DEPSNODE_RELATIONS_ITER_END \
-               } \
-       } ((void)0)
-
 #endif  /* __DEPSGRAPH_H__ */
diff --git a/source/blender/depsgraph/intern/depsgraph_build_relations.cc 
b/source/blender/depsgraph/intern/depsgraph_build_relations.cc
index 126b34c..56670cb 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_relations.cc
+++ b/source/blender/depsgraph/intern/depsgraph_build_relations.cc
@@ -101,6 +101,7 @@ extern "C" {
 #include "depsgraph_intern.h"
 #include "depsgraph_types.h"
 
+#include "depsgraph_util_foreach.h"
 #include "depsgraph_util_pchanmap.h"
 
 /* ***************** */
@@ -786,8 +787,7 @@ void DepsgraphRelationBuilder::build_driver(ID *id, FCurve 
*fcu)
 
                if (arm_node && bone_name) {
                        /* find objects which use this, and make their eval 
callbacks depend on this */
-                       DEPSNODE_RELATIONS_ITER_BEGIN(arm_node->outlinks, rel)
-                       {
+                       foreach (DepsRelation *rel, arm_node->outlinks) {
                                IDDepsNode *to_node = (IDDepsNode *)rel->to;
 
                                /* we only care about objects with pose data 
which use this... */
@@ -801,7 +801,6 @@ void DepsgraphRelationBuilder::build_driver(ID *id, FCurve 
*fcu)
                                        }
                                }
                        }
-                       DEPSNODE_RELATIONS_ITER_END;
 
                        /* free temp data */
                        MEM_freeN(bone_name);
diff --git a/source/blender/depsgraph/intern/depsgraph_debug.cc 
b/source/blender/depsgraph/intern/depsgraph_debug.cc
index 5d21eff..8f21065 100644
--- a/source/blender/depsgraph/intern/depsgraph_debug.cc
+++ b/source/blender/depsgraph/intern/depsgraph_debug.cc
@@ -598,8 +598,7 @@ static bool deg_debug_graphviz_is_owner(const DepsNode 
*node,
 static void deg_debug_graphviz_node_relations(const DebugContext &ctx,
                                               const DepsNode *node)
 {
-       DEPSNODE_RELATIONS_ITER_BEGIN(node->inlinks, rel)
-       {
+       foreach (DepsRelation *rel, node->inlinks) {
                float penwidth = 2.0f;
                
                const DepsNode *tail = rel->to; /* same as node */
@@ -639,7 +638,6 @@ static void deg_debug_graphviz_node_relations(const 
DebugContext &ctx,
                deg_debug_fprintf(ctx, "];" NL);
                deg_debug_fprintf(ctx, NL);
        }
-       DEPSNODE_RELATIONS_ITER_END;
 
 #if 0
        if (node->tclass == DEPSNODE_CLASS_COMPONENT) {
diff --git a/source/blender/depsgraph/intern/depsgraph_eval.cc 
b/source/blender/depsgraph/intern/depsgraph_eval.cc
index e584e8a..5d56487 100644
--- a/source/blender/depsgraph/intern/depsgraph_eval.cc
+++ b/source/blender/depsgraph/intern/depsgraph_eval.cc
@@ -261,8 +261,7 @@ static void calculate_pending_func(void *data_v, int i)
        if ((id_node->layers & layers) != 0 &&
            (node->flag & DEPSOP_FLAG_NEEDS_UPDATE) != 0)
        {
-               DEPSNODE_RELATIONS_ITER_BEGIN(node->inlinks, rel)
-               {
+               foreach (DepsRelation *rel, node->inlinks) {
                        if (rel->from->type == DEPSNODE_TYPE_OPERATION &&
                            (rel->flag & DEPSREL_FLAG_CYCLIC) == 0)
                        {
@@ -275,7 +274,6 @@ static void calculate_pending_func(void *data_v, int i)
                                }
                        }
                }
-               DEPSNODE_RELATIONS_ITER_END;
        }
 }
 
@@ -370,8 +368,7 @@ static void schedule_children(TaskPool *pool,
                               const int layers,
                               const int thread_id)
 {
-       DEPSNODE_RELATIONS_ITER_BEGIN(node->outlinks, rel)
-       {
+       foreach (DepsRelation *rel, node->outlinks) {
                OperationDepsNode *child = (OperationDepsNode *)rel->to;
                BLI_assert(child->type == DEPSNODE_TYPE_OPERATION);
                if (child->scheduled) {
@@ -380,7 +377,6 @@ static void schedule_children(TaskPool *pool,
                }
                schedule_node(pool, graph, layers, child, (rel->flag & 
DEPSREL_FLAG_CYCLIC) == 0, thread_id);
        }
-       DEPSNODE_RELATIONS_ITER_END;
 }
 
 /**
diff --git a/source/blender/depsgraph/intern/depsgraph_query.cc 
b/source/blender/depsgraph/intern/depsgraph_query.cc
index 7319374..7aabd21 100644
--- a/source/blender/depsgraph/intern/depsgraph_query.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query.cc
@@ -85,8 +85,7 @@ void DEG_graph_traverse_from_node(Depsgraph *graph, 
OperationDepsNode *start_nod
                op(graph, node, operation_data);
 
                /* schedule up operations which depend on this */
-               DEPSNODE_RELATIONS_ITER_BEGIN(node->outlinks, rel)
-               {
+               foreach (DepsRelation *rel, node->outlinks) {
                        /* ensure that relationship is not tagged for ignoring 
(i.e. cyclic, etc.) */
                        // TODO: cyclic refs should probably all get clustered 
towards the end, so that we can just stop on the first one
                        if ((rel->flag & DEPSREL_FLAG_CYCLIC) == 0) {
@@ -100,7 +99,6 @@ void DEG_graph_traverse_from_node(Depsgraph *graph, 
OperationDepsNode *start_nod
                                }
                        }
                }
-               DEPSNODE_RELATIONS_ITER_END;
        } while (DEG_queue_is_empty(q) == false);
 
        /* cleanup */
diff --git a/source/blender/depsgraph/intern/depsnode.cc 
b/source/blender/depsgraph/intern/depsnode.cc
index ca9a7d9..1e7e3cd 100644
--- a/source/blender/depsgraph/intern/depsnode.cc
+++ b/source/blender/depsgraph/intern/depsnode.cc
@@ -77,11 +77,9 @@ DepsNode::~DepsNode()
         * when we're trying to free same link from both it's sides. We don't 
have
         * dangling links so this is not a problem from memory leaks point of 
view.
         */
-       DEPSNODE_RELATIONS_ITER_BEGIN(this->inlinks, rel)
-       {
+       foreach (DepsRelation *rel, inlinks) {
                OBJECT_GUARDED_DELETE(rel, DepsRelation);
        }
-       DEPSNODE_RELATIONS_ITER_END;
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to