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:
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r--source/blender/makesrna/intern/rna_access.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index ba893319ce9..13686809cd2 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -669,6 +669,28 @@ int RNA_property_enum_value(PointerRNA *ptr, PropertyRNA *prop, const char *iden
return 0;
}
+int RNA_enum_identifier(const EnumPropertyItem *item, const int value, const char **identifier)
+{
+ for (; item->identifier; item++) {
+ if(item->value==value) {
+ *identifier = item->identifier;
+ return 1;
+ }
+ }
+ return 0;
+}
+
+int RNA_enum_name(const EnumPropertyItem *item, const int value, const char **name)
+{
+ for (; item->identifier; item++) {
+ if(item->value==value) {
+ *name = item->name;
+ return 1;
+ }
+ }
+ return 0;
+}
+
int RNA_property_enum_identifier(PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier)
{
const EnumPropertyItem *item;
@@ -676,14 +698,7 @@ int RNA_property_enum_identifier(PointerRNA *ptr, PropertyRNA *prop, const int v
RNA_property_enum_items(ptr, prop, &item, &totitem);
- for(i=0; i<totitem; i++) {
- if(item[i].value==value) {
- *identifier = item[i].identifier;
- return 1;
- }
- }
-
- return 0;
+ return RNA_enum_identifier(item, value, identifier);
}
const char *RNA_property_ui_name(PropertyRNA *prop)