diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-06-22 08:39:35 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-06-22 08:39:35 +0400 |
commit | aa267976b86f90423204e11a30eec4e0def0f296 (patch) | |
tree | e1b09c017eef0191473b9aa1e59fd08ffe705f43 /source/blender/makesrna/intern/rna_access.c | |
parent | f1fb09a493b79e6320a651a035203dff98c3b580 (diff) | |
parent | 1efffc1f564af0597512699890d7be9f41a6aee2 (diff) |
NLA SoC: Merge from 2.5
21043 to 21072
(NOTE TO SELF: Campbell made a commit in 2.5 before this merge finished)
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 31 |
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) |