diff options
author | Bastien Montagne <bastien@blender.org> | 2022-06-10 16:50:30 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-06-10 16:56:55 +0300 |
commit | f5d0a40122ab73e0a7c6dca93d94724e3c10600f (patch) | |
tree | 3c95c33935cdbaff7aba4b6c03dafe05741acefa /source/blender/makesrna/RNA_access.h | |
parent | 07341d7b3215d1ad4029fffbb1550479da89ada1 (diff) |
RNA path: add util to find the char in an RNA path where the array indexing starts.
Usefull to easily trim away the 'aray index' part of an RNA path, e.g.
when searching for an FCurve (which never contains that index part in
its RNA path).
Diffstat (limited to 'source/blender/makesrna/RNA_access.h')
-rw-r--r-- | source/blender/makesrna/RNA_access.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index e855395482e..67605201a9f 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -490,6 +490,18 @@ char *RNA_path_append( char *RNA_path_back(const char *path); #endif +/** + * Search for the start of the 'rna array index' part of the given `rna_path`. + * + * Given the root RNA pointer and resolved RNA property, and the RNA path, return the first + * character in `rna_path` that is part of the array index for the given property. Return NULL if + * none can be found, e.g. because the property is not an RNA array. + * + * \param array_prop if not NULL, the PropertyRNA assumed to be the last one from the RNA path. + * Only used to ensure it is a valid array property. + */ +const char *RNA_path_array_index_token_find(const char *rna_path, const PropertyRNA *array_prop); + /* RNA_path_resolve() variants only ensure that a valid pointer (and optionally property) exist. */ /** |