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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-01-17 02:53:11 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-01-17 02:53:11 +0300
commitc1cf33c8aa1d9fd5f8d36231f4a28da63ce0e5e0 (patch)
treeeab94699866be5af61bc8c847f5aa222d21e50d1 /source/blender/makesrna/intern/rna_define.c
parentef93f8a36e39a67f5d25b0332a6d40e261a6d793 (diff)
RNA
* Added more compact property definitions, with a single function. Only used by operators at the moment, would need to tweak regular expressions a bit more to use it also for other RNA definitions. * The operator properties defined now were completed a bit more but still have many issues that need to be adressed, specifically; * Some properties that should be booleans or enums are defined as ints, note that ints are only for numeric values, not bitflags or multiple choice. * Soft/hard limits and default values of many properties are not well defined still, * Inconsistent naming, especially for example mouse locations or bounds are named differently in different places. Also mouse locations and other vector like properties should become a single vector property instead of multiple X/Y properties. * Almost no properties have descriptions, these would be good to have for docs and tooltips. So, please verify that the properties of the operators you wrote are well defined.
Diffstat (limited to 'source/blender/makesrna/intern/rna_define.c')
-rw-r--r--source/blender/makesrna/intern/rna_define.c224
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;
+}
+