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:
authorCampbell Barton <ideasman42@gmail.com>2009-04-01 16:43:07 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-04-01 16:43:07 +0400
commit3224efc38419201b44503982541aca8eaeb29486 (patch)
tree77a09bed4e1668427c48ceac7fdb8021eaa7f729 /source/blender/makesrna/intern/rna_access.c
parent3a28a7450596f46281431bd163b9a237eb481055 (diff)
Python Panels WIP
- Register python panels - Added a generic class checking function BPY_class_validate() for panels/operators. - No button drawing yet Brecht, Added RNA_enum_value_from_id() and RNA_enum_id_from_value() to rna_access.c to do lookups between identifiers and values of EnumPropertyItem's, Not sure if these should go here.
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r--source/blender/makesrna/intern/rna_access.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 52b1b77ddf0..cf6072c2bfd 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -1832,6 +1832,32 @@ int RNA_enum_is_equal(PointerRNA *ptr, const char *name, const char *enumname)
}
}
+int RNA_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int *value)
+{
+ for( ; item->identifier; item++) {
+ if (strcmp(item->identifier, identifier)==0) {
+ *value= item->value;
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+int RNA_enum_id_from_value(EnumPropertyItem *item, int value, const char **identifier)
+{
+ for( ; item->identifier; item++) {
+ if (item->value==value) {
+ *identifier= item->identifier;
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+
+
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
{
PropertyRNA *prop= RNA_struct_find_property(ptr, name);