replace RNA_property_array_length with RNA_property_array_check where the length...
authorCampbell Barton <ideasman42@gmail.com>
Mon, 16 Sep 2013 01:35:52 +0000 (01:35 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 16 Sep 2013 01:35:52 +0000 (01:35 +0000)
(this isnt reliable since arrays can be zero length).

source/blender/blenkernel/intern/anim_sys.c
source/blender/editors/animation/anim_ipo_utils.c
source/blender/editors/animation/keyframing.c
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_anim.c
source/blender/editors/space_outliner/outliner_edit.c

index 4b05b0800a50c4ec6b3446d0a6101f72514d83bf..8e697ad4ef3984dd33ee9cc99e733808a13ecc63 100644 (file)
@@ -1652,19 +1652,19 @@ static void nlaevalchan_value_init(NlaEvalChannel *nec)
         */
        switch (RNA_property_type(prop)) {
                case PROP_BOOLEAN:
-                       if (RNA_property_array_length(ptr, prop))
+                       if (RNA_property_array_check(prop))
                                nec->value = (float)RNA_property_boolean_get_default_index(ptr, prop, index);
                        else
                                nec->value = (float)RNA_property_boolean_get_default(ptr, prop);
                        break;
                case PROP_INT:
-                       if (RNA_property_array_length(ptr, prop))
+                       if (RNA_property_array_check(prop))
                                nec->value = (float)RNA_property_int_get_default_index(ptr, prop, index);
                        else
                                nec->value = (float)RNA_property_int_get_default(ptr, prop);
                        break;
                case PROP_FLOAT:
-                       if (RNA_property_array_length(ptr, prop))
+                       if (RNA_property_array_check(prop))
                                nec->value = RNA_property_float_get_default_index(ptr, prop, index);
                        else
                                nec->value = RNA_property_float_get_default(ptr, prop);
@@ -2071,19 +2071,19 @@ void nladata_flush_channels(ListBase *channels)
                /* write values - see animsys_write_rna_setting() to sync the code */
                switch (RNA_property_type(prop)) {
                        case PROP_BOOLEAN:
-                               if (RNA_property_array_length(ptr, prop))
+                               if (RNA_property_array_check(prop))
                                        RNA_property_boolean_set_index(ptr, prop, array_index, ANIMSYS_FLOAT_AS_BOOL(value));
                                else
                                        RNA_property_boolean_set(ptr, prop, ANIMSYS_FLOAT_AS_BOOL(value));
                                break;
                        case PROP_INT:
-                               if (RNA_property_array_length(ptr, prop))
+                               if (RNA_property_array_check(prop))
                                        RNA_property_int_set_index(ptr, prop, array_index, (int)value);
                                else
                                        RNA_property_int_set(ptr, prop, (int)value);
                                break;
                        case PROP_FLOAT:
-                               if (RNA_property_array_length(ptr, prop))
+                               if (RNA_property_array_check(prop))
                                        RNA_property_float_set_index(ptr, prop, array_index, value);
                                else
                                        RNA_property_float_set(ptr, prop, value);
index 21941c7ed625c557d6889d8d9fd0d8711097ed4c..d3e6d8f474fa31bdbf20e2978beacb346da01d13 100644 (file)
@@ -132,7 +132,7 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
                        propname = RNA_property_ui_name(prop);
                        
                        /* Array Index - only if applicable */
-                       if (RNA_property_array_length(&ptr, prop)) {
+                       if (RNA_property_array_check(prop)) {
                                char c = RNA_property_array_item_char(prop, fcu->array_index);
                                
                                /* we need to write the index to a temp buffer (in py syntax) */
index cfc03050a9e96d9d26c988a2526d5ad8e6d87b7c..70361f00004a8ccceb8c62c9c8987b92970cd5eb 100644 (file)
@@ -508,19 +508,19 @@ static float setting_get_rna_value(PointerRNA *ptr, PropertyRNA *prop, int index
        
        switch (RNA_property_type(prop)) {
                case PROP_BOOLEAN:
-                       if (RNA_property_array_length(ptr, prop))
+                       if (RNA_property_array_check(prop))
                                value = (float)RNA_property_boolean_get_index(ptr, prop, index);
                        else
                                value = (float)RNA_property_boolean_get(ptr, prop);
                        break;
                case PROP_INT:
-                       if (RNA_property_array_length(ptr, prop))
+                       if (RNA_property_array_check(prop))
                                value = (float)RNA_property_int_get_index(ptr, prop, index);
                        else
                                value = (float)RNA_property_int_get(ptr, prop);
                        break;
                case PROP_FLOAT:
-                       if (RNA_property_array_length(ptr, prop))
+                       if (RNA_property_array_check(prop))
                                value = RNA_property_float_get_index(ptr, prop, index);
                        else
                                value = RNA_property_float_get(ptr, prop);
index 111757da01ff420a6a1fb768927ba1d95d811e36..e02cdf018c0dacb92e19bddc5af287e7f90e1830 100644 (file)
@@ -1646,19 +1646,19 @@ void ui_set_but_val(uiBut *but, double value)
                if (RNA_property_editable(&but->rnapoin, prop)) {
                        switch (RNA_property_type(prop)) {
                                case PROP_BOOLEAN:
-                                       if (RNA_property_array_length(&but->rnapoin, prop))
+                                       if (RNA_property_array_check(prop))
                                                RNA_property_boolean_set_index(&but->rnapoin, prop, but->rnaindex, value);
                                        else
                                                RNA_property_boolean_set(&but->rnapoin, prop, value);
                                        break;
                                case PROP_INT:
-                                       if (RNA_property_array_length(&but->rnapoin, prop))
+                                       if (RNA_property_array_check(prop))
                                                RNA_property_int_set_index(&but->rnapoin, prop, but->rnaindex, (int)value);
                                        else
                                                RNA_property_int_set(&but->rnapoin, prop, (int)value);
                                        break;
                                case PROP_FLOAT:
-                                       if (RNA_property_array_length(&but->rnapoin, prop))
+                                       if (RNA_property_array_check(prop))
                                                RNA_property_float_set_index(&but->rnapoin, prop, but->rnaindex, value);
                                        else
                                                RNA_property_float_set(&but->rnapoin, prop, value);
@@ -3027,7 +3027,7 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
        but->rnapoin = *ptr;
        but->rnaprop = prop;
 
-       if (RNA_property_array_length(&but->rnapoin, but->rnaprop))
+       if (RNA_property_array_check(but->rnaprop))
                but->rnaindex = index;
        else
                but->rnaindex = 0;
index 3feb563d3eef3b4ed13e1dc80231b31e018bffe9..5b6b889a6c6d7b7799ebe3bfbe28ebfaecfd726c 100644 (file)
@@ -144,7 +144,7 @@ int ui_but_anim_expression_create(uiBut *but, const char *str)
                return 0;
        }
        
-       if (RNA_property_array_length(&but->rnapoin, but->rnaprop) != 0) {
+       if (RNA_property_array_check(but->rnaprop) != 0) {
                if (but->rnaindex == -1) {
                        if (G.debug & G_DEBUG)
                                printf("ERROR: create expression failed - can't create expression for entire array\n");
index 6d0dc365317a1b85dbea47ee4ed8c5e1ded1221c..559fb6f932ed6a93c2a29f2eacffc9b70e4d76d0 100644 (file)
@@ -1102,7 +1102,7 @@ static void tree_element_to_path(TreeElement *te, TreeStoreElem *tselem,
                        /* item is part of an array, so must set the array_index */
                        *array_index = te->index;
                }
-               else if (RNA_property_array_length(ptr, prop)) {
+               else if (RNA_property_array_check(prop)) {
                        /* entire array was selected, so keyframe all */
                        *flag |= KSP_FLAG_WHOLE_ARRAY;
                }