diff options
Diffstat (limited to 'source/blender/makesrna/RNA_define.h')
-rw-r--r-- | source/blender/makesrna/RNA_define.h | 396 |
1 files changed, 322 insertions, 74 deletions
diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h index ab9b6f74832..706f1ca9e84 100644 --- a/source/blender/makesrna/RNA_define.h +++ b/source/blender/makesrna/RNA_define.h @@ -34,9 +34,9 @@ extern "C" { #endif #ifdef UNIT_TEST -#define RNA_MAX_ARRAY_LENGTH 64 +# define RNA_MAX_ARRAY_LENGTH 64 #else -#define RNA_MAX_ARRAY_LENGTH 32 +# define RNA_MAX_ARRAY_LENGTH 32 #endif #define RNA_MAX_ARRAY_DIMENSION 3 @@ -65,7 +65,10 @@ void RNA_def_struct_clear_flag(StructRNA *srna, int flag); void RNA_def_struct_property_tags(StructRNA *srna, const EnumPropertyItem *prop_tag_defines); void RNA_def_struct_refine_func(StructRNA *srna, const char *refine); void RNA_def_struct_idprops_func(StructRNA *srna, const char *refine); -void RNA_def_struct_register_funcs(StructRNA *srna, const char *reg, const char *unreg, const char *instance); +void RNA_def_struct_register_funcs(StructRNA *srna, + const char *reg, + const char *unreg, + const char *instance); void RNA_def_struct_path_func(StructRNA *srna, const char *path); void RNA_def_struct_identifier_no_struct_map(StructRNA *srna, const char *identifier); void RNA_def_struct_identifier(BlenderRNA *brna, StructRNA *srna, const char *identifier); @@ -80,68 +83,258 @@ void RNA_def_struct_translation_context(StructRNA *srna, const char *context); typedef void StructOrFunctionRNA; -PropertyRNA *RNA_def_boolean(StructOrFunctionRNA *cont, const char *identifier, bool default_value, const char *ui_name, const char *ui_description); -PropertyRNA *RNA_def_boolean_array(StructOrFunctionRNA *cont, const char *identifier, int len, bool *default_value, const char *ui_name, const char *ui_description); -PropertyRNA *RNA_def_boolean_layer(StructOrFunctionRNA *cont, const char *identifier, int len, bool *default_value, const char *ui_name, const char *ui_description); -PropertyRNA *RNA_def_boolean_layer_member(StructOrFunctionRNA *cont, const char *identifier, int len, bool *default_value, const char *ui_name, const char *ui_description); -PropertyRNA *RNA_def_boolean_vector(StructOrFunctionRNA *cont, const char *identifier, int len, bool *default_value, const char *ui_name, const char *ui_description); - -PropertyRNA *RNA_def_int(StructOrFunctionRNA *cont, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax); -PropertyRNA *RNA_def_int_vector(StructOrFunctionRNA *cont, const char *identifier, int len, const int *default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax); -PropertyRNA *RNA_def_int_array(StructOrFunctionRNA *cont, const char *identifier, int len, const int *default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax); - -PropertyRNA *RNA_def_string(StructOrFunctionRNA *cont, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description); -PropertyRNA *RNA_def_string_file_path(StructOrFunctionRNA *cont, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description); -PropertyRNA *RNA_def_string_dir_path(StructOrFunctionRNA *cont, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description); -PropertyRNA *RNA_def_string_file_name(StructOrFunctionRNA *cont, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description); - -PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description); -PropertyRNA *RNA_def_enum_flag(StructOrFunctionRNA *cont, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description); +PropertyRNA *RNA_def_boolean(StructOrFunctionRNA *cont, + const char *identifier, + bool default_value, + const char *ui_name, + const char *ui_description); +PropertyRNA *RNA_def_boolean_array(StructOrFunctionRNA *cont, + const char *identifier, + int len, + bool *default_value, + const char *ui_name, + const char *ui_description); +PropertyRNA *RNA_def_boolean_layer(StructOrFunctionRNA *cont, + const char *identifier, + int len, + bool *default_value, + const char *ui_name, + const char *ui_description); +PropertyRNA *RNA_def_boolean_layer_member(StructOrFunctionRNA *cont, + const char *identifier, + int len, + bool *default_value, + const char *ui_name, + const char *ui_description); +PropertyRNA *RNA_def_boolean_vector(StructOrFunctionRNA *cont, + const char *identifier, + int len, + bool *default_value, + const char *ui_name, + const char *ui_description); + +PropertyRNA *RNA_def_int(StructOrFunctionRNA *cont, + const char *identifier, + int default_value, + int hardmin, + int hardmax, + const char *ui_name, + const char *ui_description, + int softmin, + int softmax); +PropertyRNA *RNA_def_int_vector(StructOrFunctionRNA *cont, + const char *identifier, + int len, + const int *default_value, + int hardmin, + int hardmax, + const char *ui_name, + const char *ui_description, + int softmin, + int softmax); +PropertyRNA *RNA_def_int_array(StructOrFunctionRNA *cont, + const char *identifier, + int len, + const int *default_value, + int hardmin, + int hardmax, + const char *ui_name, + const char *ui_description, + int softmin, + int softmax); + +PropertyRNA *RNA_def_string(StructOrFunctionRNA *cont, + const char *identifier, + const char *default_value, + int maxlen, + const char *ui_name, + const char *ui_description); +PropertyRNA *RNA_def_string_file_path(StructOrFunctionRNA *cont, + const char *identifier, + const char *default_value, + int maxlen, + const char *ui_name, + const char *ui_description); +PropertyRNA *RNA_def_string_dir_path(StructOrFunctionRNA *cont, + const char *identifier, + const char *default_value, + int maxlen, + const char *ui_name, + const char *ui_description); +PropertyRNA *RNA_def_string_file_name(StructOrFunctionRNA *cont, + const char *identifier, + const char *default_value, + int maxlen, + const char *ui_name, + const char *ui_description); + +PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont, + const char *identifier, + const EnumPropertyItem *items, + int default_value, + const char *ui_name, + const char *ui_description); +PropertyRNA *RNA_def_enum_flag(StructOrFunctionRNA *cont, + const char *identifier, + const EnumPropertyItem *items, + int default_value, + const char *ui_name, + const char *ui_description); void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc); -PropertyRNA *RNA_def_float(StructOrFunctionRNA *cont, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax); -PropertyRNA *RNA_def_float_vector(StructOrFunctionRNA *cont, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax); -PropertyRNA *RNA_def_float_vector_xyz(StructOrFunctionRNA *cont, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax); -PropertyRNA *RNA_def_float_color(StructOrFunctionRNA *cont, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax); -PropertyRNA *RNA_def_float_matrix(StructOrFunctionRNA *cont, const char *identifier, int rows, int columns, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax); -PropertyRNA *RNA_def_float_rotation(StructOrFunctionRNA *cont, const char *identifier, int len, const float *default_value, - float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax); -PropertyRNA *RNA_def_float_distance(StructOrFunctionRNA *cont, const char *identifier, float default_value, - float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax); -PropertyRNA *RNA_def_float_array(StructOrFunctionRNA *cont, const char *identifier, int len, const float *default_value, - float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax); +PropertyRNA *RNA_def_float(StructOrFunctionRNA *cont, + const char *identifier, + float default_value, + float hardmin, + float hardmax, + const char *ui_name, + const char *ui_description, + float softmin, + float softmax); +PropertyRNA *RNA_def_float_vector(StructOrFunctionRNA *cont, + const char *identifier, + int len, + const float *default_value, + float hardmin, + float hardmax, + const char *ui_name, + const char *ui_description, + float softmin, + float softmax); +PropertyRNA *RNA_def_float_vector_xyz(StructOrFunctionRNA *cont, + const char *identifier, + int len, + const float *default_value, + float hardmin, + float hardmax, + const char *ui_name, + const char *ui_description, + float softmin, + float softmax); +PropertyRNA *RNA_def_float_color(StructOrFunctionRNA *cont, + const char *identifier, + int len, + const float *default_value, + float hardmin, + float hardmax, + const char *ui_name, + const char *ui_description, + float softmin, + float softmax); +PropertyRNA *RNA_def_float_matrix(StructOrFunctionRNA *cont, + const char *identifier, + int rows, + int columns, + const float *default_value, + float hardmin, + float hardmax, + const char *ui_name, + const char *ui_description, + float softmin, + float softmax); +PropertyRNA *RNA_def_float_rotation(StructOrFunctionRNA *cont, + const char *identifier, + int len, + const float *default_value, + float hardmin, + float hardmax, + const char *ui_name, + const char *ui_description, + float softmin, + float softmax); +PropertyRNA *RNA_def_float_distance(StructOrFunctionRNA *cont, + const char *identifier, + float default_value, + float hardmin, + float hardmax, + const char *ui_name, + const char *ui_description, + float softmin, + float softmax); +PropertyRNA *RNA_def_float_array(StructOrFunctionRNA *cont, + const char *identifier, + int len, + const float *default_value, + float hardmin, + float hardmax, + const char *ui_name, + const char *ui_description, + float softmin, + float softmax); //PropertyRNA *RNA_def_float_dynamic_array(StructOrFunctionRNA *cont, const char *identifier, float hardmin, float hardmax, -// const char *ui_name, const char *ui_description, float softmin, float softmax, unsigned int dimension, unsigned short dim_size[]); - -PropertyRNA *RNA_def_float_percentage(StructOrFunctionRNA *cont, const char *identifier, float default_value, float hardmin, float hardmax, - const char *ui_name, const char *ui_description, float softmin, float softmax); -PropertyRNA *RNA_def_float_factor(StructOrFunctionRNA *cont, const char *identifier, float default_value, float hardmin, float hardmax, - const char *ui_name, const char *ui_description, float softmin, float softmax); - -PropertyRNA *RNA_def_pointer(StructOrFunctionRNA *cont, const char *identifier, const char *type, - const char *ui_name, const char *ui_description); -PropertyRNA *RNA_def_pointer_runtime(StructOrFunctionRNA *cont, const char *identifier, StructRNA *type, - const char *ui_name, const char *ui_description); - -PropertyRNA *RNA_def_collection(StructOrFunctionRNA *cont, const char *identifier, const char *type, - const char *ui_name, const char *ui_description); -PropertyRNA *RNA_def_collection_runtime(StructOrFunctionRNA *cont, const char *identifier, StructRNA *type, - const char *ui_name, const char *ui_description); +// const char *ui_name, const char *ui_description, float softmin, float softmax, unsigned int dimension, unsigned short dim_size[]); + +PropertyRNA *RNA_def_float_percentage(StructOrFunctionRNA *cont, + const char *identifier, + float default_value, + float hardmin, + float hardmax, + const char *ui_name, + const char *ui_description, + float softmin, + float softmax); +PropertyRNA *RNA_def_float_factor(StructOrFunctionRNA *cont, + const char *identifier, + float default_value, + float hardmin, + float hardmax, + const char *ui_name, + const char *ui_description, + float softmin, + float softmax); + +PropertyRNA *RNA_def_pointer(StructOrFunctionRNA *cont, + const char *identifier, + const char *type, + const char *ui_name, + const char *ui_description); +PropertyRNA *RNA_def_pointer_runtime(StructOrFunctionRNA *cont, + const char *identifier, + StructRNA *type, + const char *ui_name, + const char *ui_description); + +PropertyRNA *RNA_def_collection(StructOrFunctionRNA *cont, + const char *identifier, + const char *type, + const char *ui_name, + const char *ui_description); +PropertyRNA *RNA_def_collection_runtime(StructOrFunctionRNA *cont, + const char *identifier, + StructRNA *type, + const char *ui_name, + const char *ui_description); /* Extended Property Definitions */ -PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont, const char *identifier, int type, int subtype); - -void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int bit); -void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int bit); +PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont, + const char *identifier, + int type, + int subtype); + +void RNA_def_property_boolean_sdna(PropertyRNA *prop, + const char *structname, + const char *propname, + int bit); +void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, + const char *structname, + const char *propname, + int bit); void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname); void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname); void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname); void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname); -void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop, const char *structname, const char *propname); -void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname); -void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname); +void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop, + const char *structname, + const char *propname); +void RNA_def_property_pointer_sdna(PropertyRNA *prop, + const char *structname, + const char *propname); +void RNA_def_property_collection_sdna(PropertyRNA *prop, + const char *structname, + const char *propname, + const char *lengthpropname); void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag); void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag); @@ -168,37 +361,84 @@ void RNA_def_property_enum_default(PropertyRNA *prop, int value); void RNA_def_property_string_default(PropertyRNA *prop, const char *value); void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description); -void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision); +void RNA_def_property_ui_range( + PropertyRNA *prop, double min, double max, double step, int precision); void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive); void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *updatefunc); void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable); void RNA_def_property_editable_array_func(PropertyRNA *prop, const char *editable); -void RNA_def_property_override_funcs(PropertyRNA *prop, const char *diff, const char *store, const char *apply); +void RNA_def_property_override_funcs(PropertyRNA *prop, + const char *diff, + const char *store, + const char *apply); void RNA_def_property_update_runtime(PropertyRNA *prop, const void *func); void RNA_def_property_poll_runtime(PropertyRNA *prop, const void *func); void RNA_def_property_dynamic_array_funcs(PropertyRNA *prop, const char *getlength); void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set); -void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range); -void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range); -void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item); -void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set); -void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *typef, const char *poll); -void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring, const char *assignint); +void RNA_def_property_int_funcs(PropertyRNA *prop, + const char *get, + const char *set, + const char *range); +void RNA_def_property_float_funcs(PropertyRNA *prop, + const char *get, + const char *set, + const char *range); +void RNA_def_property_enum_funcs(PropertyRNA *prop, + const char *get, + const char *set, + const char *item); +void RNA_def_property_string_funcs(PropertyRNA *prop, + const char *get, + const char *length, + const char *set); +void RNA_def_property_pointer_funcs( + PropertyRNA *prop, const char *get, const char *set, const char *typef, const char *poll); +void RNA_def_property_collection_funcs(PropertyRNA *prop, + const char *begin, + const char *next, + const char *end, + const char *get, + const char *length, + const char *lookupint, + const char *lookupstring, + const char *assignint); void RNA_def_property_srna(PropertyRNA *prop, const char *type); void RNA_def_py_data(PropertyRNA *prop, void *py_data); -void RNA_def_property_boolean_funcs_runtime(PropertyRNA *prop, BooleanPropertyGetFunc getfunc, BooleanPropertySetFunc setfunc); -void RNA_def_property_boolean_array_funcs_runtime(PropertyRNA *prop, BooleanArrayPropertyGetFunc getfunc, BooleanArrayPropertySetFunc setfunc); -void RNA_def_property_int_funcs_runtime(PropertyRNA *prop, IntPropertyGetFunc getfunc, IntPropertySetFunc setfunc, IntPropertyRangeFunc rangefunc); -void RNA_def_property_int_array_funcs_runtime(PropertyRNA *prop, IntArrayPropertyGetFunc getfunc, IntArrayPropertySetFunc setfunc, IntPropertyRangeFunc rangefunc); -void RNA_def_property_float_funcs_runtime(PropertyRNA *prop, FloatPropertyGetFunc getfunc, FloatPropertySetFunc setfunc, FloatPropertyRangeFunc rangefunc); -void RNA_def_property_float_array_funcs_runtime(PropertyRNA *prop, FloatArrayPropertyGetFunc getfunc, FloatArrayPropertySetFunc setfunc, FloatPropertyRangeFunc rangefunc); -void RNA_def_property_enum_funcs_runtime(PropertyRNA *prop, EnumPropertyGetFunc getfunc, EnumPropertySetFunc setfunc, EnumPropertyItemFunc itemfunc); -void RNA_def_property_string_funcs_runtime(PropertyRNA *prop, StringPropertyGetFunc getfunc, StringPropertyLengthFunc lengthfunc, StringPropertySetFunc setfunc); +void RNA_def_property_boolean_funcs_runtime(PropertyRNA *prop, + BooleanPropertyGetFunc getfunc, + BooleanPropertySetFunc setfunc); +void RNA_def_property_boolean_array_funcs_runtime(PropertyRNA *prop, + BooleanArrayPropertyGetFunc getfunc, + BooleanArrayPropertySetFunc setfunc); +void RNA_def_property_int_funcs_runtime(PropertyRNA *prop, + IntPropertyGetFunc getfunc, + IntPropertySetFunc setfunc, + IntPropertyRangeFunc rangefunc); +void RNA_def_property_int_array_funcs_runtime(PropertyRNA *prop, + IntArrayPropertyGetFunc getfunc, + IntArrayPropertySetFunc setfunc, + IntPropertyRangeFunc rangefunc); +void RNA_def_property_float_funcs_runtime(PropertyRNA *prop, + FloatPropertyGetFunc getfunc, + FloatPropertySetFunc setfunc, + FloatPropertyRangeFunc rangefunc); +void RNA_def_property_float_array_funcs_runtime(PropertyRNA *prop, + FloatArrayPropertyGetFunc getfunc, + FloatArrayPropertySetFunc setfunc, + FloatPropertyRangeFunc rangefunc); +void RNA_def_property_enum_funcs_runtime(PropertyRNA *prop, + EnumPropertyGetFunc getfunc, + EnumPropertySetFunc setfunc, + EnumPropertyItemFunc itemfunc); +void RNA_def_property_string_funcs_runtime(PropertyRNA *prop, + StringPropertyGetFunc getfunc, + StringPropertyLengthFunc lengthfunc, + StringPropertySetFunc setfunc); void RNA_def_property_enum_py_data(PropertyRNA *prop, void *py_data); @@ -213,8 +453,12 @@ void RNA_def_function_output(FunctionRNA *func, PropertyRNA *ret); void RNA_def_function_flag(FunctionRNA *func, int flag); void RNA_def_function_ui_description(FunctionRNA *func, const char *description); -void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter); -void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter); +void RNA_def_parameter_flags(PropertyRNA *prop, + PropertyFlag flag_property, + ParameterFlag flag_parameter); +void RNA_def_parameter_clear_flags(PropertyRNA *prop, + PropertyFlag flag_property, + ParameterFlag flag_parameter); /* Dynamic Enums * strings are not freed, assumed pointing to static location. */ @@ -222,7 +466,10 @@ void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item); void RNA_enum_item_add_separator(EnumPropertyItem **items, int *totitem); void RNA_enum_items_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item); -void RNA_enum_items_add_value(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item, int value); +void RNA_enum_items_add_value(EnumPropertyItem **items, + int *totitem, + const EnumPropertyItem *item, + int value); void RNA_enum_item_end(EnumPropertyItem **items, int *totitem); /* Memory management */ @@ -238,7 +485,8 @@ int RNA_def_property_free_identifier(StructOrFunctionRNA *cont_, const char *ide /* utilities */ const char *RNA_property_typename(PropertyType type); #define IS_DNATYPE_FLOAT_COMPAT(_str) (strcmp(_str, "float") == 0 || strcmp(_str, "double") == 0) -#define IS_DNATYPE_INT_COMPAT(_str) (strcmp(_str, "int") == 0 || strcmp(_str, "short") == 0 || strcmp(_str, "char") == 0) +#define IS_DNATYPE_INT_COMPAT(_str) \ + (strcmp(_str, "int") == 0 || strcmp(_str, "short") == 0 || strcmp(_str, "char") == 0) void RNA_identifier_sanitize(char *identifier, int property); |