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 <bastien@blender.org>2021-11-19 16:39:40 +0300
committerBastien Montagne <bastien@blender.org>2021-11-19 17:41:36 +0300
commitd6ea881a741a254b6f4e931ea25047d3f51686d0 (patch)
treeacd9b37713733c54b71a0768454b54067bee0272 /source/blender/blenlib/BLI_listbase.h
parent04ec36f677d47e3a70baa944bb26fc03d5e8d52e (diff)
BLI_listbase: Add utils to search from string or index.
If a valid matching string is found, return that item, otherwise fallback to the item matching the given index, if any. This will be useful in RNA override code, and potentially other areas where data in lists can be referenced by their names or indices.
Diffstat (limited to 'source/blender/blenlib/BLI_listbase.h')
-rw-r--r--source/blender/blenlib/BLI_listbase.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_listbase.h b/source/blender/blenlib/BLI_listbase.h
index 345d9d93d03..cf525d1c2af 100644
--- a/source/blender/blenlib/BLI_listbase.h
+++ b/source/blender/blenlib/BLI_listbase.h
@@ -55,6 +55,10 @@ void *BLI_listbase_bytes_find(const ListBase *listbase,
const void *bytes,
const size_t bytes_size,
const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2);
+void *BLI_listbase_string_or_index_find(const struct ListBase *listbase,
+ const char *string,
+ const size_t string_offset,
+ const int index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1);
/* find backwards */
void *BLI_rfindlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT