diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-11-14 20:05:25 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-11-14 20:05:25 +0300 |
commit | a2175968a7a21bd09463ac9582130c593d27094d (patch) | |
tree | 26456772fb769aa67a9bc381908eb277bc76a097 /source/blender/makesrna/intern/rna_rna.c | |
parent | 4a8e571e8d3b5a4f8d223d40594b1be96206a141 (diff) |
RNA
* Added RNA list viewer. This is currently drawn in the outliner
window, the UI is limited but it is just intended to test RNA
at the moment.
* Added UI names for currently wrapped properties.
* Made iterating collections a bit more convenient.
Diffstat (limited to 'source/blender/makesrna/intern/rna_rna.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_rna.c | 75 |
1 files changed, 51 insertions, 24 deletions
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index dc3d2486126..02746681d4a 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -57,19 +57,19 @@ static void *rna_StructRNA_name_property_get(PointerRNA *ptr) return ((StructRNA*)ptr->data)->nameproperty; } -static void *rna_StructRNA_iterator_property_get(PointerRNA *ptr) +static void rna_StructRNA_properties_next(CollectionPropertyIterator *iter) { - return ((StructRNA*)ptr->data)->iteratorproperty; + do { + rna_iterator_listbase_next(iter); + } while(iter->valid && (((PropertyRNA*)iter->internal)->flag & PROP_BUILTIN)); } static void rna_StructRNA_properties_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { rna_iterator_listbase_begin(iter, &((StructRNA*)ptr->data)->properties); -} -static void rna_StructRNA_properties_next(CollectionPropertyIterator *iter) -{ - rna_iterator_listbase_next(iter); + if(iter->valid && (((PropertyRNA*)iter->internal)->flag & PROP_BUILTIN)) + rna_StructRNA_properties_next(iter); } static void *rna_StructRNA_properties_get(CollectionPropertyIterator *iter) @@ -180,6 +180,11 @@ static int rna_PropertyRNA_array_length_get(PointerRNA *ptr) return ((PropertyRNA*)ptr->data)->arraylength; } +static int rna_PropertyRNA_max_length_get(PointerRNA *ptr) +{ + return ((StringPropertyRNA*)ptr->data)->maxlength; +} + #else static void rna_def_property(StructRNA *srna) @@ -204,32 +209,33 @@ static void rna_def_property(StructRNA *srna) {PROP_ROTATION, "ROTATION", "Rotation"}, {0, NULL, NULL}}; - prop= RNA_def_property(srna, "cname", PROP_STRING, PROP_NONE); - RNA_def_property_flag(prop, PROP_NOT_EDITABLE); - RNA_def_property_string_funcs(prop, "rna_PropertyRNA_cname_get", "rna_PropertyRNA_cname_length", NULL); - prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_flag(prop, PROP_NOT_EDITABLE); RNA_def_property_string_funcs(prop, "rna_PropertyRNA_name_get", "rna_PropertyRNA_name_length", NULL); + RNA_def_property_ui_text(prop, "Name", "Human readable name."); RNA_def_struct_name_property(srna, prop); + prop= RNA_def_property(srna, "cname", PROP_STRING, PROP_NONE); + RNA_def_property_flag(prop, PROP_NOT_EDITABLE); + RNA_def_property_string_funcs(prop, "rna_PropertyRNA_cname_get", "rna_PropertyRNA_cname_length", NULL); + RNA_def_property_ui_text(prop, "Identifier", "Unique name used in the code and scripting."); + prop= RNA_def_property(srna, "description", PROP_STRING, PROP_NONE); RNA_def_property_flag(prop, PROP_NOT_EDITABLE); RNA_def_property_string_funcs(prop, "rna_PropertyRNA_description_get", "rna_PropertyRNA_description_length", NULL); + RNA_def_property_ui_text(prop, "Description", "Description of the property for tooltips."); prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_flag(prop, PROP_NOT_EDITABLE); RNA_def_property_enum_items(prop, type_items); RNA_def_property_enum_funcs(prop, "rna_PropertyRNA_type_get", NULL); + RNA_def_property_ui_text(prop, "Type", "Data type of the property."); prop= RNA_def_property(srna, "subtype", PROP_ENUM, PROP_NONE); RNA_def_property_flag(prop, PROP_NOT_EDITABLE); RNA_def_property_enum_items(prop, subtype_items); RNA_def_property_enum_funcs(prop, "rna_PropertyRNA_subtype_get", NULL); - - prop= RNA_def_property(srna, "array_length", PROP_INT, PROP_NONE); - RNA_def_property_flag(prop, PROP_NOT_EDITABLE); - RNA_def_property_int_funcs(prop, "rna_PropertyRNA_array_length_get", NULL); + RNA_def_property_ui_text(prop, "Sub Type", "Sub type indicating the interpretation of the property."); } void RNA_def_rna(BlenderRNA *brna) @@ -240,45 +246,64 @@ void RNA_def_rna(BlenderRNA *brna) /* StructRNA */ srna= RNA_def_struct(brna, "StructRNA", "Struct RNA"); - prop= RNA_def_property(srna, "cname", PROP_STRING, PROP_NONE); - RNA_def_property_flag(prop, PROP_NOT_EDITABLE); - RNA_def_property_string_funcs(prop, "rna_StructRNA_cname_get", "rna_StructRNA_cname_length", NULL); - prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_flag(prop, PROP_NOT_EDITABLE); RNA_def_property_string_funcs(prop, "rna_StructRNA_name_get", "rna_StructRNA_name_length", NULL); + RNA_def_property_ui_text(prop, "Name", "Human readable name."); RNA_def_struct_name_property(srna, prop); + prop= RNA_def_property(srna, "cname", PROP_STRING, PROP_NONE); + RNA_def_property_flag(prop, PROP_NOT_EDITABLE); + RNA_def_property_string_funcs(prop, "rna_StructRNA_cname_get", "rna_StructRNA_cname_length", NULL); + RNA_def_property_ui_text(prop, "Identifier", "Unique name used in the code and scripting."); + prop= RNA_def_property(srna, "name_property", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NOT_EDITABLE); RNA_def_property_struct_type(prop, "StringPropertyRNA"); RNA_def_property_pointer_funcs(prop, "rna_StructRNA_name_property_get", NULL, NULL); - - prop= RNA_def_property(srna, "iterator_property", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_NOT_EDITABLE); - RNA_def_property_struct_type(prop, "CollectionPropertyRNA"); - RNA_def_property_pointer_funcs(prop, "rna_StructRNA_iterator_property_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Name Property", "Property that gives the name of the struct."); prop= RNA_def_property(srna, "properties", PROP_COLLECTION, PROP_NONE); RNA_def_property_flag(prop, PROP_NOT_EDITABLE); RNA_def_property_collection_funcs(prop, "rna_StructRNA_properties_begin", "rna_StructRNA_properties_next", 0, "rna_StructRNA_properties_get", "rna_StructRNA_properties_type", 0, 0, 0); + RNA_def_property_ui_text(prop, "Properties", "Properties in the struct."); /* BooleanPropertyRNA */ srna= RNA_def_struct(brna, "BooleanPropertyRNA", "Boolean Property"); rna_def_property(srna); + prop= RNA_def_property(srna, "array_length", PROP_INT, PROP_NONE); + RNA_def_property_flag(prop, PROP_NOT_EDITABLE); + RNA_def_property_int_funcs(prop, "rna_PropertyRNA_array_length_get", NULL); + RNA_def_property_ui_text(prop, "Array Length", "Maximum length of the array, 0 means unlimited."); + /* IntPropertyRNA */ srna= RNA_def_struct(brna, "IntPropertyRNA", "Int Property"); rna_def_property(srna); + prop= RNA_def_property(srna, "array_length", PROP_INT, PROP_NONE); + RNA_def_property_flag(prop, PROP_NOT_EDITABLE); + RNA_def_property_int_funcs(prop, "rna_PropertyRNA_array_length_get", NULL); + RNA_def_property_ui_text(prop, "Array Length", "Maximum length of the array, 0 means unlimited."); + /* FloatPropertyRNA */ srna= RNA_def_struct(brna, "FloatPropertyRNA", "Float Property"); rna_def_property(srna); + prop= RNA_def_property(srna, "array_length", PROP_INT, PROP_NONE); + RNA_def_property_flag(prop, PROP_NOT_EDITABLE); + RNA_def_property_int_funcs(prop, "rna_PropertyRNA_array_length_get", NULL); + RNA_def_property_ui_text(prop, "Array Length", "Maximum length of the array, 0 means unlimited."); + /* StringPropertyRNA */ srna= RNA_def_struct(brna, "StringPropertyRNA", "String Property"); rna_def_property(srna); + prop= RNA_def_property(srna, "max_length", PROP_INT, PROP_NONE); + RNA_def_property_flag(prop, PROP_NOT_EDITABLE); + RNA_def_property_int_funcs(prop, "rna_PropertyRNA_max_length_get", NULL); + RNA_def_property_ui_text(prop, "Maximum Length", "Maximum length of the string, 0 means unlimited."); + /* EnumPropertyRNA */ srna= RNA_def_struct(brna, "EnumPropertyRNA", "Enum Property"); rna_def_property(srna); @@ -299,11 +324,13 @@ void rna_def_builtin_properties(StructRNA *srna) prop= RNA_def_property(srna, "rna_properties", PROP_COLLECTION, PROP_NONE); RNA_def_property_flag(prop, PROP_NOT_EDITABLE|PROP_BUILTIN); RNA_def_property_collection_funcs(prop, "rna_builtin_properties_begin", "rna_builtin_properties_next", 0, "rna_builtin_properties_get", "rna_builtin_properties_type", 0, 0, 0); + RNA_def_property_ui_text(prop, "Properties", "RNA property collection."); prop= RNA_def_property(srna, "rna_type", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_NOT_EDITABLE|PROP_BUILTIN); + RNA_def_property_flag(prop, PROP_NOT_EDITABLE); RNA_def_property_struct_type(prop, "StructRNA"); RNA_def_property_pointer_funcs(prop, "rna_builtin_type_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Type", "RNA type definition."); } #endif |