diff options
Diffstat (limited to 'source/blender/blenkernel/BKE_main.h')
-rw-r--r-- | source/blender/blenkernel/BKE_main.h | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h index 03f9f9a21ea..6b9c35d90d3 100644 --- a/source/blender/blenkernel/BKE_main.h +++ b/source/blender/blenkernel/BKE_main.h @@ -152,31 +152,29 @@ struct GSet *BKE_main_gset_create(struct Main *bmain, struct GSet *gset); } \ } ((void)0) - -#define FOREACH_MAIN_ID_BEGIN(_bmain, _id) \ +#define FOREACH_MAIN_LISTBASE_BEGIN(_bmain, _lb) \ { \ ListBase *_lbarray[MAX_LIBARRAY]; \ int _i = set_listbasepointers(_bmain, _lbarray); \ while (_i--) { \ - FOREACH_MAIN_LISTBASE_ID_BEGIN(_lbarray[_i], _id) + _lb = _lbarray[_i]; -#define FOREACH_MAIN_ID_END \ - FOREACH_MAIN_LISTBASE_ID_END; \ +#define FOREACH_MAIN_LISTBASE_END \ } \ } ((void)0) -/** \param _do_break A boolean, to allow breaking iteration (only used to break by type, - * you must also use an explicit `break;` operation if you want to - * immediately break from inner by-ID loop). - */ -#define FOREACH_MAIN_ID_BREAKABLE_BEGIN(_bmain, _id, _do_break) \ +/* DO NOT use break statement with that macro, use FOREACH_MAIN_LISTBASE and FOREACH_MAIN_LISTBASE_ID instead + * if you need that kind of control flow. */ +#define FOREACH_MAIN_ID_BEGIN(_bmain, _id) \ { \ - ListBase *_lbarray[MAX_LIBARRAY]; \ - int i = set_listbasepointers(_bmain, _lbarray); \ - while (i-- && !_do_break) { \ - FOREACH_MAIN_LISTBASE_ID_BEGIN(_lbarray[i], _id) \ + ListBase *_lb; \ + FOREACH_MAIN_LISTBASE_BEGIN(_bmain, _lb) { \ + FOREACH_MAIN_LISTBASE_ID_BEGIN(_lbarray[_i], _id) -#define FOREACH_MAIN_ID_BREAKABLE_END FOREACH_MAIN_ID_END +#define FOREACH_MAIN_ID_END \ + FOREACH_MAIN_LISTBASE_ID_END; \ + } FOREACH_MAIN_LISTBASE_END; \ + } ((void)0) struct BlendThumbnail *BKE_main_thumbnail_from_imbuf(struct Main *bmain, struct ImBuf *img); |