diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-05-10 21:36:11 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-05-10 21:36:11 +0300 |
commit | f305aba8688a2b88b6495985435cc79213a22a3f (patch) | |
tree | 776da790c24419de67ef8b5d6b82ed52f81113ce | |
parent | 4f80260f1160178a47180ccc0b82a11437388a83 (diff) |
Make sure 'use_property_button_exec' can deal with arrays as well
-rw-r--r-- | source/blender/editors/interface/interface_ops.c | 14 | ||||
-rw-r--r-- | source/blender/makesrna/RNA_define.h | 8 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_internal_types.h | 9 |
3 files changed, 20 insertions, 11 deletions
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index c130064ca12..09388ff1a18 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -353,11 +353,21 @@ static int use_property_button_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_CANCELLED; } + int array_len = RNA_property_array_length(&scene_props_ptr, prop); + bool is_array = array_len != 0; + switch (RNA_property_type(prop)) { case PROP_FLOAT: { - float value = RNA_property_float_get(&scene_props_ptr, prop); - BKE_collection_engine_property_add_float(props, identifier, value); + if (is_array) { + float values[RNA_MAX_ARRAY_LENGTH]; + RNA_property_float_get_array(&scene_props_ptr, prop, values); + BKE_collection_engine_property_add_float_array(props, identifier, values, array_len); + } + else { + float value = RNA_property_float_get(&scene_props_ptr, prop); + BKE_collection_engine_property_add_float(props, identifier, value); + } break; } case PROP_ENUM: diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h index 6e62313b00a..54938b236d5 100644 --- a/source/blender/makesrna/RNA_define.h +++ b/source/blender/makesrna/RNA_define.h @@ -37,6 +37,14 @@ extern "C" { #endif +#ifdef UNIT_TEST +#define RNA_MAX_ARRAY_LENGTH 64 +#else +#define RNA_MAX_ARRAY_LENGTH 32 +#endif + +#define RNA_MAX_ARRAY_DIMENSION 3 + /* Blender RNA */ BlenderRNA *RNA_create(void); diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h index df591659fdb..c412d110e5e 100644 --- a/source/blender/makesrna/intern/rna_internal_types.h +++ b/source/blender/makesrna/intern/rna_internal_types.h @@ -45,15 +45,6 @@ struct GHash; struct Main; struct Scene; -#ifdef UNIT_TEST -#define RNA_MAX_ARRAY_LENGTH 64 -#else -#define RNA_MAX_ARRAY_LENGTH 32 -#endif - -#define RNA_MAX_ARRAY_DIMENSION 3 - - /* store local properties here */ #define RNA_IDP_UI "_RNA_UI" |