diff options
author | Bastien Montagne <bastien@blender.org> | 2021-10-27 12:30:43 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2021-10-29 12:32:26 +0300 |
commit | e3b2f0fd6ff912bac69a94e35ac2f617c720328e (patch) | |
tree | 126e82061cd858dc086e57dde1a561af124bf680 /source/blender/blenkernel/BKE_lib_query.h | |
parent | 51c1c1cd938f990333b09d89fb063bb28864b302 (diff) |
LibQuery: Add macro to help break looping when requested.
The new `BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL` execute the given
statement and then check status of `LibraryForeachIDData` data, and
return in case stop of iteration is requested.
This is very similar to the other `BKE_LIB_FOREACHID_PROCESS_` existing
macros, and allows us to properly break iteration when a sub-function
has requested it.
Part of T90922: Fix return policy inconsistency in `scene_foreach_id`.
Diffstat (limited to 'source/blender/blenkernel/BKE_lib_query.h')
-rw-r--r-- | source/blender/blenkernel/BKE_lib_query.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_lib_query.h b/source/blender/blenkernel/BKE_lib_query.h index 093d3fb12a6..364a9056dd4 100644 --- a/source/blender/blenkernel/BKE_lib_query.h +++ b/source/blender/blenkernel/BKE_lib_query.h @@ -172,6 +172,15 @@ int BKE_lib_query_foreachid_process_callback_flag_override(struct LibraryForeach } \ ((void)0) +#define BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL(_data, _func_call) \ + { \ + _func_call; \ + if (BKE_lib_query_foreachid_iter_stop((_data))) { \ + return; \ + } \ + } \ + ((void)0) + bool BKE_library_foreach_ID_embedded(struct LibraryForeachIDData *data, struct ID **id_pp); void BKE_lib_query_idpropertiesForeachIDLink_callback(struct IDProperty *id_prop, void *user_data); |