diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-08-12 09:44:39 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-08-12 10:14:15 +0300 |
commit | 04ef718226e800c376e370c2d219444b44817a29 (patch) | |
tree | d5f0f89da632e3b089016c1e4038ae8e3f600273 /source/blender/makesrna/intern/rna_access.c | |
parent | 806bf3f4527cf35b4510a3934bc73604d3f2b253 (diff) |
RNA: include base types in RNA_struct_type_find_property search
Add RNA_struct_type_find_property_no_base for use in the rare situations
when this isn't desired.
Resolves T90617, where sequence strip sub-types weren't detecting
properties that exist in the base "Sequence" types.
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index a795d78a058..216e58a9c52 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -967,11 +967,26 @@ const struct ListBase *RNA_struct_type_properties(StructRNA *srna) return &srna->cont.properties; } -PropertyRNA *RNA_struct_type_find_property(StructRNA *srna, const char *identifier) +PropertyRNA *RNA_struct_type_find_property_no_base(StructRNA *srna, const char *identifier) { return BLI_findstring_ptr(&srna->cont.properties, identifier, offsetof(PropertyRNA, identifier)); } +/** + * \note #RNA_struct_find_property is a higher level alternative to this function + * which takes a #PointerRNA instead of a #StructRNA. + */ +PropertyRNA *RNA_struct_type_find_property(StructRNA *srna, const char *identifier) +{ + for (; srna; srna = srna->base) { + PropertyRNA *prop = RNA_struct_type_find_property_no_base(srna, identifier); + if (prop != NULL) { + return prop; + } + } + return NULL; +} + FunctionRNA *RNA_struct_find_function(StructRNA *srna, const char *identifier) { #if 1 |