Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2016-03-24 14:28:41 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2016-03-24 18:10:39 +0300
commitc08924bf94f2dffaae7b3ef2fad3c49cb8043c89 (patch)
treeee01dfd8f137667c39be7e3ed894236a64464751 /source/blender/python/intern/bpy_rna_id_collection.c
parent60cf62ff4b08e310208dca9e35bd75131833e1aa (diff)
Rework library_query foreach looper - add optional recursivity.
This commit: * Fixes bad handling of 'stop iteration' (by adding a status flag, so that we can actually stop in helper functions too, and jumping to a finalize label instead of raw return, to allow propper clean up). * Adds optional recursion into 'ID tree' - callback can also decide to exclude current id_pp from recursion. Note that this implies 'readonly', modifying IDs while recursing is not something we want to support! * Changes callback signature/expected behavior: return behavior is now handled through flags, and 'parent' ID of id_pp is also passed (since it may not always be root id anymore). Reviewers: sergey, campbellbarton Differential Revision: https://developer.blender.org/D1869
Diffstat (limited to 'source/blender/python/intern/bpy_rna_id_collection.c')
-rw-r--r--source/blender/python/intern/bpy_rna_id_collection.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/python/intern/bpy_rna_id_collection.c b/source/blender/python/intern/bpy_rna_id_collection.c
index a80190d8162..104e3e47646 100644
--- a/source/blender/python/intern/bpy_rna_id_collection.c
+++ b/source/blender/python/intern/bpy_rna_id_collection.c
@@ -80,7 +80,8 @@ static bool id_check_type(const ID *id, const BLI_bitmap *types_bitmap)
return BLI_BITMAP_TEST_BOOL(types_bitmap, id_code_as_index(GS(id->name)));
}
-static bool foreach_libblock_id_user_map_callback(void *user_data, ID **id_p, int UNUSED(cb_flag))
+static int foreach_libblock_id_user_map_callback(
+ void *user_data, ID *UNUSED(self_id), ID **id_p, int UNUSED(cb_flag))
{
IDUserMapData *data = user_data;
@@ -88,7 +89,7 @@ static bool foreach_libblock_id_user_map_callback(void *user_data, ID **id_p, in
if (data->types_bitmap) {
if (!id_check_type(*id_p, data->types_bitmap)) {
- return true;
+ return IDWALK_RET_NOP;
}
}
@@ -104,7 +105,7 @@ static bool foreach_libblock_id_user_map_callback(void *user_data, ID **id_p, in
/* limit to key's added already */
if (data->is_subset) {
- return true;
+ return IDWALK_RET_NOP;
}
/* Cannot use our placeholder key here! */
@@ -122,7 +123,7 @@ static bool foreach_libblock_id_user_map_callback(void *user_data, ID **id_p, in
PySet_Add(set, data->py_id_curr);
}
- return true;
+ return IDWALK_RET_NOP;
}
PyDoc_STRVAR(bpy_user_map_doc,