diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-12-17 13:47:55 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-12-17 13:47:55 +0300 |
commit | e3a1d044d68000a2e81b662c0cf15bbe17698aa4 (patch) | |
tree | b9f12ad7ca22073cc00f3420114d2d53f7300a55 /source/blender/makesrna/RNA_access.h | |
parent | 6c006b2ebbaa2d56f7dba0a036910138d864305e (diff) |
RNA/UI - Reset Settings to Default Values
Added a new operator for properties which resets RNA-based settings to their 'default' values, as defined in RNA. This currently only works for floats, ints, enums, and booleans (strings and pointers still need to be implemented).
The current extensions to the RNA API that I've made here seem a bit excessive, and can be toned down if necessary. In short, I've just added accessor functions for the default-values of the property definitions.
For this to be really useful, many properties in RNA will need to get defaults defined, since the current defaults for quite a few properties tested were less than ideal.
Diffstat (limited to 'source/blender/makesrna/RNA_access.h')
-rw-r--r-- | source/blender/makesrna/RNA_access.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index edbe55ba11d..188c6b2474b 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -660,6 +660,9 @@ void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int *val int RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index); void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *values); void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, int value); +int RNA_property_boolean_get_default(PointerRNA *ptr, PropertyRNA *prop); +void RNA_property_boolean_get_default_array(PointerRNA *ptr, PropertyRNA *prop, int *values); +int RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index); int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop); void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value); @@ -667,6 +670,9 @@ void RNA_property_int_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values) int RNA_property_int_get_index(PointerRNA *ptr, PropertyRNA *prop, int index); void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *values); void RNA_property_int_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, int value); +int RNA_property_int_get_default(PointerRNA *ptr, PropertyRNA *prop); +void RNA_property_int_get_default_array(PointerRNA *ptr, PropertyRNA *prop, int *values); +int RNA_property_int_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index); float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop); void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value); @@ -674,17 +680,22 @@ void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *val float RNA_property_float_get_index(PointerRNA *ptr, PropertyRNA *prop, int index); void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const float *values); void RNA_property_float_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, float value); +float RNA_property_float_get_default(PointerRNA *ptr, PropertyRNA *prop); +void RNA_property_float_get_default_array(PointerRNA *ptr, PropertyRNA *prop, float *values); +float RNA_property_float_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index); void RNA_property_string_get(PointerRNA *ptr, PropertyRNA *prop, char *value); char *RNA_property_string_get_alloc(PointerRNA *ptr, PropertyRNA *prop, char *fixedbuf, int fixedlen); int RNA_property_string_length(PointerRNA *ptr, PropertyRNA *prop); -void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *value); +// TODO: get default strings... int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop); void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value); +int RNA_property_enum_get_default(PointerRNA *ptr, PropertyRNA *prop); PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop); void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr_value); +// TODO: get default pointers... void RNA_property_collection_begin(PointerRNA *ptr, PropertyRNA *prop, CollectionPropertyIterator *iter); void RNA_property_collection_next(CollectionPropertyIterator *iter); |