From 3fa6b6ed4c7ad98d0002032e9ef77fa4024f28a5 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 2 May 2018 16:31:05 +0200 Subject: Depsgraph: Add function to iterate over all original IDs --- source/blender/depsgraph/DEG_depsgraph_query.h | 3 +++ source/blender/depsgraph/intern/depsgraph_query_foreach.cc | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/source/blender/depsgraph/DEG_depsgraph_query.h b/source/blender/depsgraph/DEG_depsgraph_query.h index 508714db218..6d21c143877 100644 --- a/source/blender/depsgraph/DEG_depsgraph_query.h +++ b/source/blender/depsgraph/DEG_depsgraph_query.h @@ -188,6 +188,9 @@ void DEG_foreach_dependent_ID(const Depsgraph *depsgraph, const ID *id, DEGForeachIDCallback callback, void *user_data); +void DEG_foreach_ID(const Depsgraph *depsgraph, + DEGForeachIDCallback callback, void *user_data); + #ifdef __cplusplus } /* extern "C" */ diff --git a/source/blender/depsgraph/intern/depsgraph_query_foreach.cc b/source/blender/depsgraph/intern/depsgraph_query_foreach.cc index e6692cf49b3..b5ed3e38f09 100644 --- a/source/blender/depsgraph/intern/depsgraph_query_foreach.cc +++ b/source/blender/depsgraph/intern/depsgraph_query_foreach.cc @@ -136,6 +136,14 @@ static void deg_foreach_dependent_ID(const Depsgraph *graph, } } +static void deg_foreach_id(const Depsgraph *depsgraph, + DEGForeachIDCallback callback, void *user_data) +{ + foreach (const IDDepsNode *id_node, depsgraph->id_nodes) { + callback(id_node->id_orig, user_data); + } +} + } // namespace DEG void DEG_foreach_dependent_ID(const Depsgraph *depsgraph, @@ -146,3 +154,9 @@ void DEG_foreach_dependent_ID(const Depsgraph *depsgraph, id, callback, user_data); } + +void DEG_foreach_ID(const Depsgraph *depsgraph, + DEGForeachIDCallback callback, void *user_data) +{ + DEG::deg_foreach_id((const DEG::Depsgraph *)depsgraph, callback, user_data); +} -- cgit v1.2.3