diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-11-07 02:54:14 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-11-07 02:54:56 +0300 |
commit | 895295a9f0cb85c7c48c395621b9c9d7e5fc78a3 (patch) | |
tree | f9621ae96c65433301ba2a8ba401d43ad0df68d4 /source/blender/makesrna/intern/rna_access.c | |
parent | 87a6aab2518ed391c755e3e7aeae9692f25569ae (diff) |
Paint: update shortcut detection for new logic
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 3cc99571ccf..33246ba4a30 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -1665,6 +1665,21 @@ int RNA_enum_from_identifier(const EnumPropertyItem *item, const char *identifie return -1; } +/** + * Take care using this with translated enums, + * prefer #RNA_enum_from_identifier where possible. + */ +int RNA_enum_from_name(const EnumPropertyItem *item, const char *name) +{ + int i = 0; + for (; item->identifier; item++, i++) { + if (item->identifier[0] && STREQ(item->name, name)) { + return i; + } + } + return -1; +} + int RNA_enum_from_value(const EnumPropertyItem *item, const int value) { int i = 0; |