[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60154] trunk/blender/source/blender: replace RNA_property_array_length with RNA_property_array_check where the length of the array is only used to check if the property is an array or not .

Campbell Barton ideasman42 at gmail.com
Mon Sep 16 03:35:53 CEST 2013


Revision: 60154
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60154
Author:   campbellbarton
Date:     2013-09-16 01:35:52 +0000 (Mon, 16 Sep 2013)
Log Message:
-----------
replace RNA_property_array_length with RNA_property_array_check where the length of the array is only used to check if the property is an array or not.
(this isnt reliable since arrays can be zero length).

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/anim_sys.c
    trunk/blender/source/blender/editors/animation/anim_ipo_utils.c
    trunk/blender/source/blender/editors/animation/keyframing.c
    trunk/blender/source/blender/editors/interface/interface.c
    trunk/blender/source/blender/editors/interface/interface_anim.c
    trunk/blender/source/blender/editors/space_outliner/outliner_edit.c

Modified: trunk/blender/source/blender/blenkernel/intern/anim_sys.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/anim_sys.c	2013-09-16 00:18:09 UTC (rev 60153)
+++ trunk/blender/source/blender/blenkernel/intern/anim_sys.c	2013-09-16 01:35:52 UTC (rev 60154)
@@ -1652,19 +1652,19 @@
 	 */
 	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 @@
 		/* 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);

Modified: trunk/blender/source/blender/editors/animation/anim_ipo_utils.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_ipo_utils.c	2013-09-16 00:18:09 UTC (rev 60153)
+++ trunk/blender/source/blender/editors/animation/anim_ipo_utils.c	2013-09-16 01:35:52 UTC (rev 60154)
@@ -132,7 +132,7 @@
 			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) */

Modified: trunk/blender/source/blender/editors/animation/keyframing.c
===================================================================
--- trunk/blender/source/blender/editors/animation/keyframing.c	2013-09-16 00:18:09 UTC (rev 60153)
+++ trunk/blender/source/blender/editors/animation/keyframing.c	2013-09-16 01:35:52 UTC (rev 60154)
@@ -508,19 +508,19 @@
 	
 	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);

Modified: trunk/blender/source/blender/editors/interface/interface.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface.c	2013-09-16 00:18:09 UTC (rev 60153)
+++ trunk/blender/source/blender/editors/interface/interface.c	2013-09-16 01:35:52 UTC (rev 60154)
@@ -1646,19 +1646,19 @@
 		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 @@
 	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;

Modified: trunk/blender/source/blender/editors/interface/interface_anim.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_anim.c	2013-09-16 00:18:09 UTC (rev 60153)
+++ trunk/blender/source/blender/editors/interface/interface_anim.c	2013-09-16 01:35:52 UTC (rev 60154)
@@ -144,7 +144,7 @@
 		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");

Modified: trunk/blender/source/blender/editors/space_outliner/outliner_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_outliner/outliner_edit.c	2013-09-16 00:18:09 UTC (rev 60153)
+++ trunk/blender/source/blender/editors/space_outliner/outliner_edit.c	2013-09-16 01:35:52 UTC (rev 60154)
@@ -1102,7 +1102,7 @@
 			/* 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;
 		}




More information about the Bf-blender-cvs mailing list