diff options
author | Joshua Leung <aligorith@gmail.com> | 2010-10-16 15:30:41 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2010-10-16 15:30:41 +0400 |
commit | 98d6c533a606f7965d0a2bfe1da4f83942693066 (patch) | |
tree | fa9fa3b22a26f14c04c53c37e2398ddf6ac34b3d | |
parent | 5999658569d781bdc4e0b8fa6e0cceb2efb5e612 (diff) |
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.
-rw-r--r-- | source/blender/makesrna/intern/rna_fcurve.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 63405e08f69..31ba51a9b04 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -542,14 +542,14 @@ static BezTriple *rna_FKeyframe_points_add(FCurve *fcu, float frame, float value 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 @@ static void rna_def_fcurve_keyframe_points(BlenderRNA *brna, PropertyRNA *cprop) 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"); |