diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_idcode.h | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/idcode.c | 5 |
2 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_idcode.h b/source/blender/blenkernel/BKE_idcode.h index 1b2b3d2ee95..e46ad450c31 100644 --- a/source/blender/blenkernel/BKE_idcode.h +++ b/source/blender/blenkernel/BKE_idcode.h @@ -76,4 +76,12 @@ int BKE_idcode_is_linkable(int code); */ int BKE_idcode_is_valid(int code); +/** + * Return an ID code and steps the index forward 1. + * + * @param index, start as 0. + * @return the code, 0 when all codes have been returned. + */ +int BKE_idcode_iter_step(int *index); + #endif diff --git a/source/blender/blenkernel/intern/idcode.c b/source/blender/blenkernel/intern/idcode.c index 0779e1cc017..8c8a693e6e7 100644 --- a/source/blender/blenkernel/intern/idcode.c +++ b/source/blender/blenkernel/intern/idcode.c @@ -133,3 +133,8 @@ const char *BKE_idcode_to_name_plural(int code) return idt?idt->plural:NULL; } + +int BKE_idcode_iter_step(int *index) +{ + return (*index < nidtypes) ? idtypes[(*index)++].code : 0; +} |