diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2017-09-21 13:11:57 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2017-09-21 13:11:57 +0300 |
commit | dd5d8b050b5c1434a78f86157181bd15b96b44cd (patch) | |
tree | 70ceb60c515156a84b142c6b06e66120cbc5fc37 /source/blender/makesrna/intern/rna_rna.c | |
parent | d83bdbac2d22498a2812e6f4cf03ac48b89bb59f (diff) | |
parent | 806bc55a34581d49065a5c6221746b6e50715a1d (diff) |
Merge branch 'master' into id_override_static
Diffstat (limited to 'source/blender/makesrna/intern/rna_rna.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_rna.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 083564d8b7f..6e992dc816e 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -617,6 +617,22 @@ static int rna_Property_array_length_get(PointerRNA *ptr) return prop->totarraylength; } +static void rna_Property_array_dimensions_get(PointerRNA *ptr, int dimensions[RNA_MAX_ARRAY_DIMENSION]) +{ + PropertyRNA *prop = (PropertyRNA *)ptr->data; + rna_idproperty_check(&prop, ptr); + + if (prop->arraydimension > 1) { + for (int i = RNA_MAX_ARRAY_DIMENSION; i--; ) { + dimensions[i] = (i >= prop->arraydimension) ? 0 : prop->arraylength[i]; + } + } + else { + memset(dimensions, 0, sizeof(*dimensions) * RNA_MAX_ARRAY_DIMENSION); + dimensions[0] = prop->totarraylength; + } +} + static int rna_Property_is_registered_get(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; @@ -1366,6 +1382,12 @@ static void rna_def_number_property(StructRNA *srna, PropertyType type) RNA_def_property_int_funcs(prop, "rna_Property_array_length_get", NULL, NULL); RNA_def_property_ui_text(prop, "Array Length", "Maximum length of the array, 0 means unlimited"); + prop = RNA_def_property(srna, "array_dimensions", PROP_INT, PROP_UNSIGNED); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_array(prop, RNA_MAX_ARRAY_DIMENSION); + RNA_def_property_int_funcs(prop, "rna_Property_array_dimensions_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Array Dimensions", "Length of each dimension of the array"); + prop = RNA_def_property(srna, "is_array", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_boolean_funcs(prop, "rna_NumberProperty_is_array_get", NULL); |