[Bf-blender-cvs] [42d64c4] depsgraph_cleanup: Depsgraph: Remove old, dead and unused query routines

Sergey Sharybin noreply at git.blender.org
Thu May 26 10:02:41 CEST 2016


Commit: 42d64c44474a27eb97c18ac9cd33e1c76a027668
Author: Sergey Sharybin
Date:   Wed May 25 17:33:57 2016 +0200
Branches: depsgraph_cleanup
https://developer.blender.org/rB42d64c44474a27eb97c18ac9cd33e1c76a027668

Depsgraph: Remove old, dead and unused query routines

This API was never finished, used or tested.

Surely it's something we'll need to have, but for now it's easier to remove
all the complexity and other craft.

Better to bring it back when we'll actually be using it.

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

M	source/blender/depsgraph/CMakeLists.txt
M	source/blender/depsgraph/DEG_depsgraph_query.h
M	source/blender/depsgraph/intern/depsgraph_query.cc
D	source/blender/depsgraph/intern/depsgraph_queue.cc
D	source/blender/depsgraph/intern/depsgraph_queue.h

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

diff --git a/source/blender/depsgraph/CMakeLists.txt b/source/blender/depsgraph/CMakeLists.txt
index 4ff2505..3898a7f 100644
--- a/source/blender/depsgraph/CMakeLists.txt
+++ b/source/blender/depsgraph/CMakeLists.txt
@@ -56,7 +56,6 @@ set(SRC
 	intern/depsgraph_debug.cc
 	intern/depsgraph_eval.cc
 	intern/depsgraph_query.cc
-	intern/depsgraph_queue.cc
 	intern/depsgraph_tag.cc
 	intern/depsgraph_type_defines.cc
 	intern/depsnode_opcodes.cc
@@ -82,7 +81,6 @@ set(SRC
 	intern/depsnode_opcodes.h
 	intern/depsgraph_debug.h
 	intern/depsgraph_intern.h
-	intern/depsgraph_queue.h
 	intern/depsgraph_types.h
 
 	util/depsgraph_util_cycle.h
diff --git a/source/blender/depsgraph/DEG_depsgraph_query.h b/source/blender/depsgraph/DEG_depsgraph_query.h
index 60d673d..6862586 100644
--- a/source/blender/depsgraph/DEG_depsgraph_query.h
+++ b/source/blender/depsgraph/DEG_depsgraph_query.h
@@ -44,144 +44,6 @@ struct DepsRelation;
 extern "C" {
 #endif
 
-/* ************************************************ */
-/* Type Defines */
-
-/* FilterPredicate Callback 
- *
- * Defines a callback function which can be supplied to check whether a 
- * node is relevant or not.
- *
- * < graph: Depsgraph that we're traversing
- * < node: The node to check
- * < userdata: FilterPredicate state data (as needed)
- * > returns: True if node is relevant
- */
-typedef bool (*DEG_FilterPredicate)(const struct Depsgraph *graph, const struct DepsNode *node, void *userdata);
-
-
-/* Node Operation 
- *
- * Performs some action on the given node, provided that the node was
- * deemed to be relevant to operate on.
- *
- * < graph: Depsgraph that we're traversing
- * < node: The node to perform operation on/with
- * < userdata: Node Operation's state data (as needed)
- * > returns: True if traversal should be aborted at this point
- */
-typedef bool (*DEG_NodeOperation)(const struct Depsgraph *graph, struct DepsNode *node, void *userdata);
-
-/* ************************************************ */
-/* Low-Level Filtering API */
-
-/* Create a filtered copy of the given graph which contains only the
- * nodes which fulfill the criteria specified using the FilterPredicate
- * passed in.
- *
- * < graph: The graph to be copied and filtered
- * < filter: FilterPredicate used to check which nodes should be included
- *           (If null, full graph is copied as-is)
- * < userdata: State data for filter (as necessary)
- *
- * > returns: a full copy of all the relevant nodes - the matching subgraph
- */
-// XXX: is there any need for extra settings/options for how the filtering goes?
-Depsgraph *DEG_graph_filter(const struct Depsgraph *graph, DEG_FilterPredicate *filter, void *userdata);
-
-
-/* Traverse nodes in graph which are deemed relevant,
- * performing the provided operation on the nodes.
- *
- * < graph: The graph to perform operations on
- * < filter: FilterPredicate used to check which nodes should be included
- *           (If null, all nodes are considered valid targets)
- * < filter_data: Custom state data for FilterPredicate
- *                (Note: This can be the same as op_data, where appropriate)
- * < op: NodeOperation to perform on each node
- *       (If null, no graph traversal is performed for efficiency)
- * < op_data: Custom state data for NodeOperation
- *            (Note: This can be the same as filter_data, where appropriate)
- */
-void DEG_graph_traverse(const struct Depsgraph *graph,
-                        DEG_FilterPredicate *filter, void *filter_data,
-                        DEG_NodeOperation *op, void *op_data);
-
-/* ************************************************ */
-/* Node-Based Operations */
-// XXX: do we want to be able to attach conditional requirements here?
-
-/* Find an (outer) node matching given conditions 
- * ! Assumes that there will only be one such node, or that only the first one matters
- *
- * < graph: a dependency graph which may or may not contain a node matching these requirements
- * < query: query conditions for the criteria that the node must satisfy 
- */
-//DepsNode *DEG_node_find(const Depsgraph *graph, DEG_QueryConditions *query);
-
-/* Topology Queries (Direct) ---------------------- */
-
-/* Get list of nodes which directly depend on given node  
- *
- * > result: list to write results to
- * < node: the node to find the children/dependents of
- */
-void DEG_node_get_children(struct ListBase *result, const struct DepsNode *node);
-
-
-/* Get list of nodes which given node directly depends on 
- *
- * > result: list to write results to
- * < node: the node to find the dependencies of
- */
-void DEG_node_get_dependencies(struct ListBase *result, const struct DepsNode *node);
-
-
-/* Topology Queries (Subgraph) -------------------- */
-// XXX: given that subgraphs potentially involve many interconnected nodes, we currently
-//      just spit out a copy of the subgraph which matches. This works well for the cases
-//      where these are used - mostly for efficient updating of subsets of the nodes.
-
-// XXX: allow supplying a filter predicate to provide further filtering/pruning?
-
-
-/* Get all descendants of a node
- *
- * That is, get the subgraph / subset of nodes which are dependent
- * on the results of the given node.
- */
-Depsgraph *DEG_node_get_descendants(const struct Depsgraph *graph, const struct DepsNode *node);
-
-
-/* Get all ancestors of a node 
- *
- * That is, get the subgraph / subset of nodes which the given node
- * is dependent on in order to be evaluated.
- */
-Depsgraph *DEG_node_get_ancestors(const struct Depsgraph *graph, const struct DepsNode *node);
-
-/* ************************************************ */
-/* Higher-Level Queries */
-
-/* Get ID-blocks which would be affected if specified ID is modified 
- * < only_direct: True = Only ID-blocks with direct relationships to ID-block will be returned
- *
- * > result: (LinkData : ID) a list of ID-blocks matching the specified criteria
- * > returns: number of matching ID-blocks
- */
-size_t DEG_query_affected_ids(struct ListBase *result, const struct ID *id, const bool only_direct);
-
-
-/* Get ID-blocks which are needed to update/evaluate specified ID 
- * < only_direct: True = Only ID-blocks with direct relationships to ID-block will be returned
- *
- * > result: (LinkData : ID) a list of ID-blocks matching the specified criteria
- * > returns: number of matching ID-blocks
- */
-size_t DEG_query_required_ids(struct ListBase *result, const struct ID *id, const bool only_direct);
-
-/* ************************************************ */
-
 /* Check if given ID type was tagged for update. */
 bool DEG_id_type_tagged(struct Main *bmain, short idtype);
 
diff --git a/source/blender/depsgraph/intern/depsgraph_query.cc b/source/blender/depsgraph/intern/depsgraph_query.cc
index 7aabd21..dd673bb 100644
--- a/source/blender/depsgraph/intern/depsgraph_query.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query.cc
@@ -41,153 +41,10 @@ extern "C" {
 #include "DEG_depsgraph_query.h"
 } /* extern "C" */
 
-#include "depsgraph_queue.h"
 #include "depsnode.h"
 #include "depsnode_operation.h"
 #include "depsgraph_intern.h"
 
-/* ************************* */
-/* Low-Level Graph Traversal */
-
-#if 0
-/* Prepare for graph traversal, by tagging nodes, etc. */
-static void DEG_graph_traverse_begin(Depsgraph * /*graph*/)
-{
-	/* go over all nodes, initialising the valence counts */
-	// XXX: this will end up being O(|V|), which is bad when we're just updating a few nodes...
-}
-
-/* Perform a traversal of graph from given starting node (in execution order) */
-// TODO: additional flags for controlling the process?
-void DEG_graph_traverse_from_node(Depsgraph *graph, OperationDepsNode *start_node,
-                                  DEG_FilterPredicate filter, void *filter_data,
-                                  DEG_NodeOperation op, void *operation_data)
-{
-	DepsgraphQueue *q;
-
-	/* sanity checks */
-	if (ELEM(NULL, graph, start_node, op))
-		return;
-
-	/* add node as starting node to be evaluated, with value of 0 */
-	q = DEG_queue_new();
-
-	start_node->num_links_pending = 0;
-	DEG_queue_push(q, start_node, 0.0f);
-
-	/* while we still have nodes in the queue, grab and work on next one */
-	do {
-		/* grab item at front of queue */
-		// XXX: in practice, we may need to wait until one becomes available...
-		OperationDepsNode *node = (OperationDepsNode *)DEG_queue_pop(q);
-
-		/* perform operation on node */
-		op(graph, node, operation_data);
-
-		/* schedule up operations which depend on this */
-		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) {
-				OperationDepsNode *child_node = (OperationDepsNode *)rel->to;
-
-				/* only visit node if the filtering function agrees */
-				if ((filter == NULL) || filter(graph, child_node, filter_data)) {
-					/* schedule up node... */
-					child_node->num_links_pending--;
-					DEG_queue_push(q, child_node, (float)child_node->num_links_pending);
-				}
-			}
-		}
-	} while (DEG_queue_is_empty(q) == false);
-
-	/* cleanup */
-	DEG_queue_free(q);
-}
-#endif
-
-/* ************************************************************** */
-/* Filtering API - Basically, making a copy of the existing graph */
-
-/* Create filtering context */
-// TODO: allow passing in a number of criteria?
-DepsgraphCopyContext *DEG_filter_init()
-{
-	DepsgraphCopyContext *dcc = (DepsgraphCopyContext *)MEM_callocN(sizeof(DepsgraphCopyContext), "DepsgraphCopyContext");
-
-	/* init hashes for easy lookups */
-	dcc->nodes_hash = BLI_ghash_ptr_new("Depsgraph Filter NodeHash");
-	dcc->rels_hash = BLI_ghash_ptr_new("Depsgraph Filter Relationship Hash"); // XXX?
-
-	/* store filtering criteria? */
-	// xxx...
-
-	return dcc;
-}
-
-/* Cleanup filtering context */
-void DEG_filter_cleanup(DepsgraphCopyContext *dcc)
-{
-	/* sanity check */
-	if (dcc == NULL)
-		return;
-
-	/* free hashes - contents are weren't copied, so are ok... */
-	BLI_ghash_free(dcc->nodes_hash, NULL, NULL);
-	BLI_ghash_free(dcc->rels_hash, NULL, 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list