[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32515] trunk/blender/source/blender/ makesrna/intern/rna_fcurve.c: Bugfix #23979: FCurve.keyframe_points.add(... , replace=True)

Joshua Leung aligorith at gmail.com
Sat Oct 16 13:30:41 CEST 2010


Revision: 32515
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32515
Author:   aligorith
Date:     2010-10-16 13:30:41 +0200 (Sat, 16 Oct 2010)

Log Message:
-----------
Bugfix #23979: FCurve.keyframe_points.add(..., replace=True)

... fails if there were no keyframes in the curve yet. Was a missing null-check for case when no keyframe array is created.

Also, changed the description for the "replace" arg to better reflect what it really does.

Modified Paths:
--------------
    trunk/blender/source/blender/makesrna/intern/rna_fcurve.c

Modified: trunk/blender/source/blender/makesrna/intern/rna_fcurve.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_fcurve.c	2010-10-16 10:14:17 UTC (rev 32514)
+++ trunk/blender/source/blender/makesrna/intern/rna_fcurve.c	2010-10-16 11:30:41 UTC (rev 32515)
@@ -542,14 +542,14 @@
 
 
 	index= insert_vert_fcurve(fcu, frame, value, flag);
-	return index >= 0 ? fcu->bezt + index : NULL;
+	return ((fcu->bezt) && (index >= 0))? (fcu->bezt + index) : NULL;
 }
 
 static void rna_FKeyframe_points_remove(FCurve *fcu, ReportList *reports, BezTriple *bezt, int do_fast)
 {
 	int index= (int)(bezt - fcu->bezt);
 	if (index < 0 || index >= fcu->totvert) {
-		BKE_report(reports, RPT_ERROR, "bezier not in fcurve.");
+		BKE_report(reports, RPT_ERROR, "Keyframe not in F-Curve.");
 		return;
 	}
 
@@ -1320,7 +1320,7 @@
 	parm= RNA_def_float(func, "value", 0.0f, -FLT_MAX, FLT_MAX, "", "Y Value of this keyframe point", -FLT_MAX, FLT_MAX);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* optional */
-	parm= RNA_def_boolean(func, "replace", 0, "Replace", "Replace existing keyframes");
+	parm= RNA_def_boolean(func, "replace", 0, "Replace", "Don't add any new keyframes, but just replace existing ones");
 	parm= RNA_def_boolean(func, "needed", 0, "Needed", "Only adds keyframes that are needed");
 	parm= RNA_def_boolean(func, "fast", 0, "Fast", "Fast keyframe insertion to avoid recalculating the curve each time");
 





More information about the Bf-blender-cvs mailing list