diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-03-07 18:23:03 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-03-07 18:23:03 +0300 |
commit | c20b4d661863b62089f0819d1079920bc5f2a62d (patch) | |
tree | 9a4ba4a3dcba85c52af4101496b2b669be5c576c /source/blender | |
parent | d7479f99b06c351343237e3939f469e9323cd6a7 (diff) |
RNA:
* boolean/int/float_get_array now works for non-array
properties as well, just filling in a single value.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index b19faee38b9..a3f85a056de 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -586,8 +586,14 @@ void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int *val BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop; IDProperty *idprop; - if((idprop=rna_idproperty_check(&prop, ptr))) - memcpy(values, IDP_Array(idprop), sizeof(int)*idprop->len); + if((idprop=rna_idproperty_check(&prop, ptr))) { + if(prop->arraylength == 0) + values[0]= RNA_property_boolean_get(ptr, prop); + else + memcpy(values, IDP_Array(idprop), sizeof(int)*idprop->len); + } + else if(prop->arraylength == 0) + values[0]= RNA_property_boolean_get(ptr, prop); else if(bprop->getarray) bprop->getarray(ptr, values); else if(bprop->defaultarray) @@ -677,8 +683,14 @@ void RNA_property_int_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values) IntPropertyRNA *iprop= (IntPropertyRNA*)prop; IDProperty *idprop; - if((idprop=rna_idproperty_check(&prop, ptr))) - memcpy(values, IDP_Array(idprop), sizeof(int)*idprop->len); + if((idprop=rna_idproperty_check(&prop, ptr))) { + if(prop->arraylength == 0) + values[0]= RNA_property_int_get(ptr, prop); + else + memcpy(values, IDP_Array(idprop), sizeof(int)*idprop->len); + } + else if(prop->arraylength == 0) + values[0]= RNA_property_int_get(ptr, prop); else if(iprop->getarray) iprop->getarray(ptr, values); else if(iprop->defaultarray) @@ -779,7 +791,9 @@ void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *val int i; if((idprop=rna_idproperty_check(&prop, ptr))) { - if(idprop->subtype == IDP_FLOAT) { + if(prop->arraylength == 0) + values[0]= RNA_property_float_get(ptr, prop); + else if(idprop->subtype == IDP_FLOAT) { memcpy(values, IDP_Array(idprop), sizeof(float)*idprop->len); } else { @@ -787,13 +801,14 @@ void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *val values[i]= (float)(((double*)IDP_Array(idprop))[i]); } } + else if(prop->arraylength == 0) + values[0]= RNA_property_float_get(ptr, prop); else if(fprop->getarray) fprop->getarray(ptr, values); else if(fprop->defaultarray) memcpy(values, fprop->defaultarray, sizeof(float)*prop->arraylength); else memset(values, 0, sizeof(float)*prop->arraylength); - } float RNA_property_float_get_index(PointerRNA *ptr, PropertyRNA *prop, int index) |