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:
authorCampbell Barton <ideasman42@gmail.com>2016-02-29 03:02:08 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-02-29 03:02:08 +0300
commit2baa6fa8645a8ca4de70f152c273db27995f8a66 (patch)
treec940c331aa2d4aa722f10005a15dbf6c9b1ce2ee /source/blender/makesrna/intern/rna_rna.c
parentb285394acc26348b4086cf744f3959961c2d41cc (diff)
RNA: add is_array property
Needed since dynamic arrays would have zero length.
Diffstat (limited to 'source/blender/makesrna/intern/rna_rna.c')
-rw-r--r--source/blender/makesrna/intern/rna_rna.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index f04aa3caf4d..727bdac087b 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -652,6 +652,13 @@ static int rna_NumberProperty_default_array_get_length(PointerRNA *ptr, int leng
return length[0];
}
+static int rna_NumberProperty_is_array_get(PointerRNA *ptr)
+{
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+
+ return RNA_property_array_check(prop);
+}
+
static void rna_IntProperty_default_array_get(PointerRNA *ptr, int *values)
{
PropertyRNA *prop = (PropertyRNA *)ptr->data;
@@ -1337,6 +1344,11 @@ 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, "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);
+ RNA_def_property_ui_text(prop, "Is Array", "");
+
if (type == PROP_BOOLEAN)
return;