diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_define.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_define.c | 224 |
1 files changed, 224 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 844f3ea5451..7dab55ee4f5 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -1548,3 +1548,227 @@ void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, con } } +/* Compact definitions */ + +PropertyRNA *RNA_def_boolean(StructRNA *srna, const char *identifier, int default_value, + const char *ui_name, const char *ui_description) +{ + PropertyRNA *prop; + + prop= RNA_def_property(srna, identifier, PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_default(prop, default_value); + RNA_def_property_ui_text(prop, ui_name, ui_description); + + return prop; +} + +PropertyRNA *RNA_def_int(StructRNA *srna, const char *identifier, int default_value, int hardmin, int hardmax, + const char *ui_name, const char *ui_description, int softmin, int softmax) +{ + PropertyRNA *prop; + + prop= RNA_def_property(srna, identifier, PROP_INT, PROP_NONE); + RNA_def_property_int_default(prop, default_value); + if(hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax); + RNA_def_property_ui_text(prop, ui_name, ui_description); + RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); + + return prop; +} + +PropertyRNA *RNA_def_int_vector(StructRNA *srna, 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 *prop; + + prop= RNA_def_property(srna, identifier, PROP_INT, PROP_VECTOR); + if(len != 0) RNA_def_property_array(prop, len); + RNA_def_property_int_array_default(prop, default_value); + if(hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax); + RNA_def_property_ui_text(prop, ui_name, ui_description); + RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); + + return prop; +} + +PropertyRNA *RNA_def_int_array(StructRNA *srna, 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 *prop; + + prop= RNA_def_property(srna, identifier, PROP_INT, PROP_NONE); + if(len != 0) RNA_def_property_array(prop, len); + RNA_def_property_int_array_default(prop, default_value); + if(hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax); + RNA_def_property_ui_text(prop, ui_name, ui_description); + RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); + + return prop; +} + +PropertyRNA *RNA_def_string(StructRNA *srna, const char *identifier, const char *default_value, int maxlen, + const char *ui_name, const char *ui_description) +{ + PropertyRNA *prop; + + prop= RNA_def_property(srna, identifier, PROP_STRING, PROP_NONE); + if(maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen); + RNA_def_property_string_default(prop, default_value); + RNA_def_property_ui_text(prop, ui_name, ui_description); + + return prop; +} + +PropertyRNA *RNA_def_string_file_path(StructRNA *srna, const char *identifier, const char *default_value, int maxlen, + const char *ui_name, const char *ui_description) +{ + PropertyRNA *prop; + + prop= RNA_def_property(srna, identifier, PROP_STRING, PROP_FILEPATH); + if(maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen); + RNA_def_property_string_default(prop, default_value); + RNA_def_property_ui_text(prop, ui_name, ui_description); + + return prop; +} + +PropertyRNA *RNA_def_string_dir_path(StructRNA *srna, const char *identifier, const char *default_value, int maxlen, + const char *ui_name, const char *ui_description) +{ + PropertyRNA *prop; + + prop= RNA_def_property(srna, identifier, PROP_STRING, PROP_DIRPATH); + if(maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen); + RNA_def_property_string_default(prop, default_value); + RNA_def_property_ui_text(prop, ui_name, ui_description); + + return prop; +} + +PropertyRNA *RNA_def_enum(StructRNA *srna, const char *identifier, EnumPropertyItem *items, int default_value, + const char *ui_name, const char *ui_description) +{ + PropertyRNA *prop; + + prop= RNA_def_property(srna, identifier, PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, items); + RNA_def_property_enum_default(prop, default_value); + RNA_def_property_ui_text(prop, ui_name, ui_description); + + return prop; +} + +PropertyRNA *RNA_def_float(StructRNA *srna, const char *identifier, float default_value, + float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax) +{ + PropertyRNA *prop; + + prop= RNA_def_property(srna, identifier, PROP_FLOAT, PROP_NONE); + RNA_def_property_float_default(prop, default_value); + if(hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax); + RNA_def_property_ui_text(prop, ui_name, ui_description); + RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); + + return prop; +} + +PropertyRNA *RNA_def_float_vector(StructRNA *srna, 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 *prop; + + prop= RNA_def_property(srna, identifier, PROP_FLOAT, PROP_VECTOR); + if(len != 0) RNA_def_property_array(prop, len); + RNA_def_property_float_array_default(prop, default_value); + if(hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax); + RNA_def_property_ui_text(prop, ui_name, ui_description); + RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); + + return prop; +} + +PropertyRNA *RNA_def_float_color(StructRNA *srna, 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 *prop; + + prop= RNA_def_property(srna, identifier, PROP_FLOAT, PROP_COLOR); + if(len != 0) RNA_def_property_array(prop, len); + RNA_def_property_float_array_default(prop, default_value); + if(hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax); + RNA_def_property_ui_text(prop, ui_name, ui_description); + RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); + + return prop; +} + + +PropertyRNA *RNA_def_float_matrix(StructRNA *srna, 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 *prop; + + prop= RNA_def_property(srna, identifier, PROP_FLOAT, PROP_MATRIX); + if(len != 0) RNA_def_property_array(prop, len); + RNA_def_property_float_array_default(prop, default_value); + if(hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax); + RNA_def_property_ui_text(prop, ui_name, ui_description); + RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); + + return prop; +} + +PropertyRNA *RNA_def_float_rotation(StructRNA *srna, 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 *prop; + + prop= RNA_def_property(srna, identifier, PROP_FLOAT, PROP_ROTATION); + if(len != 0) RNA_def_property_array(prop, len); + RNA_def_property_float_array_default(prop, default_value); + if(hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax); + RNA_def_property_ui_text(prop, ui_name, ui_description); + RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); + + return prop; +} + +PropertyRNA *RNA_def_float_array(StructRNA *srna, 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 *prop; + + prop= RNA_def_property(srna, identifier, PROP_FLOAT, PROP_NONE); + if(len != 0) RNA_def_property_array(prop, len); + RNA_def_property_float_array_default(prop, default_value); + if(hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax); + RNA_def_property_ui_text(prop, ui_name, ui_description); + RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); + + return prop; +} + +PropertyRNA *RNA_def_pointer_runtime(StructRNA *srna, const char *identifier, StructRNA *type, + const char *ui_name, const char *ui_description) +{ + PropertyRNA *prop; + + prop= RNA_def_property(srna, identifier, PROP_POINTER, PROP_NONE); + RNA_def_property_struct_runtime(prop, type); + RNA_def_property_ui_text(prop, ui_name, ui_description); + + return prop; +} + +PropertyRNA *RNA_def_collection_runtime(StructRNA *srna, const char *identifier, StructRNA *type, + const char *ui_name, const char *ui_description) +{ + PropertyRNA *prop; + + prop= RNA_def_property(srna, identifier, PROP_COLLECTION, PROP_NONE); + RNA_def_property_struct_runtime(prop, type); + RNA_def_property_ui_text(prop, ui_name, ui_description); + + return prop; +} + |