[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36289] trunk/blender/source/blender/ editors/armature/poseSlide.c: skip pose slide if the RNA value isn't found.

Campbell Barton ideasman42 at gmail.com
Sat Apr 23 09:04:50 CEST 2011


Revision: 36289
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36289
Author:   campbellbarton
Date:     2011-04-23 07:04:50 +0000 (Sat, 23 Apr 2011)
Log Message:
-----------
skip pose slide if the RNA value isn't found.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/armature/poseSlide.c

Modified: trunk/blender/source/blender/editors/armature/poseSlide.c
===================================================================
--- trunk/blender/source/blender/editors/armature/poseSlide.c	2011-04-23 04:46:22 UTC (rev 36288)
+++ trunk/blender/source/blender/editors/armature/poseSlide.c	2011-04-23 07:04:50 UTC (rev 36289)
@@ -989,11 +989,11 @@
 }
 
 /* get reference value from F-Curve using RNA */
-static float pose_propagate_get_refVal (Object *ob, FCurve *fcu)
+static float pose_propagate_get_refVal (Object *ob, FCurve *fcu, float *value)
 {
 	PointerRNA id_ptr, ptr;
 	PropertyRNA *prop;
-	float value;
+	int found= FALSE;
 	
 	/* base pointer is always the object -> id_ptr */
 	RNA_id_pointer_create(&ob->id, &id_ptr);
@@ -1002,44 +1002,48 @@
 	if (RNA_path_resolve(&id_ptr, fcu->rna_path, &ptr, &prop)) {
 		if (RNA_property_array_check(&ptr, prop)) {
 			/* array */
-			if (fcu->array_index < RNA_property_array_length(&ptr, prop)) {	
+			if (fcu->array_index < RNA_property_array_length(&ptr, prop)) {
+				found= TRUE;
 				switch (RNA_property_type(prop)) {
 					case PROP_BOOLEAN:
-						value= (float)RNA_property_boolean_get_index(&ptr, prop, fcu->array_index);
+						*value= (float)RNA_property_boolean_get_index(&ptr, prop, fcu->array_index);
 						break;
 					case PROP_INT:
-						value= (float)RNA_property_int_get_index(&ptr, prop, fcu->array_index);
+						*value= (float)RNA_property_int_get_index(&ptr, prop, fcu->array_index);
 						break;
 					case PROP_FLOAT:
-						value= RNA_property_float_get_index(&ptr, prop, fcu->array_index);
+						*value= RNA_property_float_get_index(&ptr, prop, fcu->array_index);
 						break;
 					default:
+						found= FALSE;
 						break;
 				}
 			}
 		}
 		else {
 			/* not an array */
+			found= TRUE;
 			switch (RNA_property_type(prop)) {
 				case PROP_BOOLEAN:
-					value= (float)RNA_property_boolean_get(&ptr, prop);
+					*value= (float)RNA_property_boolean_get(&ptr, prop);
 					break;
 				case PROP_INT:
-					value= (float)RNA_property_int_get(&ptr, prop);
+					*value= (float)RNA_property_int_get(&ptr, prop);
 					break;
 				case PROP_ENUM:
-					value= (float)RNA_property_enum_get(&ptr, prop);
+					*value= (float)RNA_property_enum_get(&ptr, prop);
 					break;
 				case PROP_FLOAT:
-					value= RNA_property_float_get(&ptr, prop);
+					*value= RNA_property_float_get(&ptr, prop);
 					break;
 				default:
+					found= FALSE;
 					break;
 			}
 		}
 	}
 	
-	return value;
+	return found;
 }
 
 /* propagate just works along each F-Curve in turn */
@@ -1062,8 +1066,9 @@
 	 * doesn't need to firstly keyframe the pose (though this doesn't mean that 
 	 * they can't either)
 	 */
-	refVal = pose_propagate_get_refVal(ob, fcu);
-	
+	if(!pose_propagate_get_refVal(ob, fcu, &refVal))
+		return;
+
 	/* find the first keyframe to start propagating from 
 	 *	- if there's a keyframe on the current frame, we probably want to save this value there too
 	 *	  since it may be as of yet unkeyed




More information about the Bf-blender-cvs mailing list