Revision: 19220
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19220
Author:   blendix
Date:     2009-03-07 16:23:03 +0100 (Sat, 07 Mar 2009)

Log Message:
-----------
RNA:
* boolean/int/float_get_array now works for non-array
  properties as well, just filling in a single value.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c

Modified: 
branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c     
2009-03-07 10:28:08 UTC (rev 19219)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c     
2009-03-07 15:23:03 UTC (rev 19220)
@@ -586,8 +586,14 @@
        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 @@
        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 @@
        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 @@
                                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)


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to