[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26707] trunk/blender/source/blender/ editors/animation/keyframes_edit.c: fix for segfault when setting handle type
Campbell Barton
ideasman42 at gmail.com
Mon Feb 8 15:34:23 CET 2010
Revision: 26707
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26707
Author: campbellbarton
Date: 2010-02-08 15:34:23 +0100 (Mon, 08 Feb 2010)
Log Message:
-----------
fix for segfault when setting handle type
Modified Paths:
--------------
trunk/blender/source/blender/editors/animation/keyframes_edit.c
Modified: trunk/blender/source/blender/editors/animation/keyframes_edit.c
===================================================================
--- trunk/blender/source/blender/editors/animation/keyframes_edit.c 2010-02-08 14:12:18 UTC (rev 26706)
+++ trunk/blender/source/blender/editors/animation/keyframes_edit.c 2010-02-08 14:34:23 UTC (rev 26707)
@@ -89,52 +89,59 @@
*/
short ANIM_fcurve_keys_bezier_loop(BeztEditData *bed, FCurve *fcu, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb)
{
- BezTriple *bezt;
+ BezTriple *bezt;
+ int i;
/* sanity check */
if (ELEM(NULL, fcu, fcu->bezt))
return 0;
/* set the F-Curve into the editdata so that it can be accessed */
- bed->fcu= fcu;
- bed->curIndex= 0;
+ if(bed) {
+ bed->fcu= fcu;
+ bed->curIndex= 0;
+ }
/* if function to apply to bezier curves is set, then loop through executing it on beztriples */
- if (bezt_cb) {
+ if (bezt_cb) {
/* if there's a validation func, include that check in the loop
* (this is should be more efficient than checking for it in every loop)
*/
if (bezt_ok) {
- for (bed->curIndex=0, bezt=fcu->bezt; bed->curIndex < fcu->totvert; bed->curIndex++, bezt++) {
+ for (bezt=fcu->bezt, i=0; i < fcu->totvert; bezt++, i++) {
/* Only operate on this BezTriple if it fullfills the criteria of the validation func */
+ if(bed) bed->curIndex= i;
if (bezt_ok(bed, bezt)) {
/* Exit with return-code '1' if function returns positive
* This is useful if finding if some BezTriple satisfies a condition.
*/
- if (bezt_cb(bed, bezt)) return 1;
+ if (bezt_cb(bed, bezt)) return 1;
}
}
}
else {
- for (bed->curIndex=0, bezt=fcu->bezt; bed->curIndex < fcu->totvert; bed->curIndex++, bezt++) {
+ for (bezt=fcu->bezt, i=0; i < fcu->totvert; bezt++, i++) {
/* Exit with return-code '1' if function returns positive
* This is useful if finding if some BezTriple satisfies a condition.
*/
- if (bezt_cb(bed, bezt)) return 1;
+ if(bed) bed->curIndex= i;
+ if (bezt_cb(bed, bezt)) return 1;
}
}
- }
+ }
/* unset the F-Curve from the editdata now that it's done */
- bed->fcu= NULL;
- bed->curIndex= 0;
+ if(bed) {
+ bed->fcu= NULL;
+ bed->curIndex= 0;
+ }
- /* if fcu_cb (F-Curve post-editing callback) has been specified then execute it */
- if (fcu_cb)
- fcu_cb(fcu);
+ /* if fcu_cb (F-Curve post-editing callback) has been specified then execute it */
+ if (fcu_cb)
+ fcu_cb(fcu);
/* done */
- return 0;
+ return 0;
}
/* -------------------------------- Further Abstracted (Not Exposed Directly) ----------------------------- */
More information about the Bf-blender-cvs
mailing list