diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/makesrna/RNA_access.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 6560c2eb195..0cc4fa4c221 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -881,6 +881,7 @@ int RNA_enum_is_equal(struct bContext *C, PointerRNA *ptr, const char *name, con int RNA_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int *value); int RNA_enum_id_from_value(EnumPropertyItem *item, int value, const char **identifier); int RNA_enum_icon_from_value(EnumPropertyItem *item, int value, int *icon); +int RNA_enum_name_from_value(EnumPropertyItem *item, int value, const char **name); void RNA_string_get(PointerRNA *ptr, const char *name, char *value); char *RNA_string_get_alloc(PointerRNA *ptr, const char *name, char *fixedbuf, int fixedlen); diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 73e046f0d63..294e812d598 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -4332,6 +4332,18 @@ int RNA_enum_icon_from_value(EnumPropertyItem *item, int value, int *icon) return 0; } +int RNA_enum_name_from_value(EnumPropertyItem *item, int value, const char **name) +{ + for( ; item->identifier; item++) { + if(item->value==value) { + *name = item->name; + return 1; + } + } + + return 0; +} + void RNA_string_get(PointerRNA *ptr, const char *name, char *value) { PropertyRNA *prop = RNA_struct_find_property(ptr, name); |