From fb70f9bf997114a55cdfebe47fa42005c2112927 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Thu, 8 Mar 2018 15:17:53 +1300 Subject: Fix crash if NLA strip with "Use Animated Influence" setting is enabled without the Influence Strip F-Curve existing --- source/blender/editors/space_nla/nla_draw.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'source/blender/editors/space_nla') diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index 255fc0d6f8f..d33b84f76c0 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -285,16 +285,20 @@ static void nla_draw_strip_curves(NlaStrip *strip, float yminc, float ymaxc) float cfra; /* plot the curve (over the strip's main region) */ - glBegin(GL_LINE_STRIP); - /* sample at 1 frame intervals, and draw - * - min y-val is yminc, max is y-maxc, so clamp in those regions - */ - for (cfra = strip->start; cfra <= strip->end; cfra += 1.0f) { - float y = evaluate_fcurve(fcu, cfra); - CLAMP(y, 0.0f, 1.0f); - glVertex2f(cfra, ((y * yheight) + yminc)); + if (fcu) { + glBegin(GL_LINE_STRIP); + + /* sample at 1 frame intervals, and draw + * - min y-val is yminc, max is y-maxc, so clamp in those regions + */ + for (cfra = strip->start; cfra <= strip->end; cfra += 1.0f) { + float y = evaluate_fcurve(fcu, cfra); + CLAMP(y, 0.0f, 1.0f); + glVertex2f(cfra, ((y * yheight) + yminc)); + } + + glEnd(); // GL_LINE_STRIP } - glEnd(); // GL_LINE_STRIP } else { /* use blend in/out values only if both aren't zero */ -- cgit v1.2.3 From 5331581ea4cd382ce0c133a99bf50c0aea257aac Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Thu, 8 Mar 2018 17:14:46 +1300 Subject: Cleanup: Use BKE_ prefix for all public functions exposed by the NLA module --- source/blender/editors/space_nla/nla_channels.c | 8 ++++---- source/blender/editors/space_nla/nla_edit.c | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'source/blender/editors/space_nla') diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index c261821db16..27f275c15dd 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -596,12 +596,12 @@ bool nlaedit_add_tracks_existing(bAnimContext *ac, bool above_sel) */ if (above_sel) { /* just add a new one above this one */ - add_nlatrack(adt, nlt); + BKE_nlatrack_add(adt, nlt); added = true; } else if ((lastAdt == NULL) || (adt != lastAdt)) { /* add one track to the top of the owning AnimData's stack, then don't add anymore to this stack */ - add_nlatrack(adt, NULL); + BKE_nlatrack_add(adt, NULL); lastAdt = adt; added = true; } @@ -636,7 +636,7 @@ bool nlaedit_add_tracks_empty(bAnimContext *ac) /* ensure it is empty */ if (BLI_listbase_is_empty(&adt->nla_tracks)) { /* add new track to this AnimData block then */ - add_nlatrack(adt, NULL); + BKE_nlatrack_add(adt, NULL); added = true; } } @@ -731,7 +731,7 @@ static int nlaedit_delete_tracks_exec(bContext *C, wmOperator *UNUSED(op)) adt->flag &= ~ADT_NLA_SOLO_TRACK; /* call delete on this track - deletes all strips too */ - free_nlatrack(&adt->nla_tracks, nlt); + BKE_nlatrack_free(&adt->nla_tracks, nlt); } } diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index 31524f8450a..87b7599ec66 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -645,7 +645,7 @@ static int nlaedit_add_actionclip_exec(bContext *C, wmOperator *op) } /* create a new strip, and offset it to start on the current frame */ - strip = add_nlastrip(act); + strip = BKE_nlastrip_new(act); strip->end += (cfra - strip->start); strip->start = cfra; @@ -655,7 +655,7 @@ static int nlaedit_add_actionclip_exec(bContext *C, wmOperator *op) /* trying to add to the current failed (no space), * so add a new track to the stack, and add to that... */ - nlt = add_nlatrack(adt, NULL); + nlt = BKE_nlatrack_add(adt, NULL); BKE_nlatrack_add_strip(nlt, strip); } @@ -858,7 +858,7 @@ static int nlaedit_add_sound_exec(bContext *C, wmOperator *UNUSED(op)) continue; /* create a new strip, and offset it to start on the current frame */ - strip = add_nla_soundstrip(ac.scene, ob->data); + strip = BKE_nla_add_soundstrip(ac.scene, ob->data); strip->start += cfra; strip->end += cfra; @@ -868,7 +868,7 @@ static int nlaedit_add_sound_exec(bContext *C, wmOperator *UNUSED(op)) /* trying to add to the current failed (no space), * so add a new track to the stack, and add to that... */ - nlt = add_nlatrack(adt, NULL); + nlt = BKE_nlatrack_add(adt, NULL); BKE_nlatrack_add_strip(nlt, strip); } @@ -1057,7 +1057,7 @@ static int nlaedit_duplicate_exec(bContext *C, wmOperator *op) /* if selected, split the strip at its midpoint */ if (strip->flag & NLASTRIP_FLAG_SELECT) { /* make a copy (assume that this is possible) */ - nstrip = copy_nlastrip(strip, linked); + nstrip = BKE_nlastrip_copy(strip, linked); /* in case there's no space in the track above, or we haven't got a reference to it yet, try adding */ if (BKE_nlatrack_add_strip(nlt->next, nstrip) == 0) { @@ -1065,7 +1065,7 @@ static int nlaedit_duplicate_exec(bContext *C, wmOperator *op) * - if the current one is the last one, nlt->next will be NULL, which defaults to adding * at the top of the stack anyway... */ - track = add_nlatrack(adt, nlt->next); + track = BKE_nlatrack_add(adt, nlt->next); BKE_nlatrack_add_strip(track, nstrip); } @@ -1160,14 +1160,14 @@ static int nlaedit_delete_exec(bContext *C, wmOperator *UNUSED(op)) if (strip->flag & NLASTRIP_FLAG_SELECT) { /* if a strip either side of this was a transition, delete those too */ if ((strip->prev) && (strip->prev->type == NLASTRIP_TYPE_TRANSITION)) - free_nlastrip(&nlt->strips, strip->prev); + BKE_nlastrip_free(&nlt->strips, strip->prev); if ((nstrip) && (nstrip->type == NLASTRIP_TYPE_TRANSITION)) { nstrip = nstrip->next; - free_nlastrip(&nlt->strips, strip->next); + BKE_nlastrip_free(&nlt->strips, strip->next); } /* finally, delete this strip */ - free_nlastrip(&nlt->strips, strip); + BKE_nlastrip_free(&nlt->strips, strip); } } } @@ -1242,7 +1242,7 @@ static void nlaedit_split_strip_actclip(AnimData *adt, NlaTrack *nlt, NlaStrip * /* make a copy (assume that this is possible) and append * it immediately after the current strip */ - nstrip = copy_nlastrip(strip, true); + nstrip = BKE_nlastrip_copy(strip, true); BLI_insertlinkafter(&nlt->strips, strip, nstrip); /* set the endpoint of the first strip and the start of the new strip @@ -2186,7 +2186,7 @@ static int nlaedit_snap_exec(bContext *C, wmOperator *op) /* in case there's no space in the current track, try adding */ if (BKE_nlatrack_add_strip(nlt, strip) == 0) { /* need to add a new track above the current one */ - track = add_nlatrack(adt, nlt); + track = BKE_nlatrack_add(adt, nlt); BKE_nlatrack_add_strip(track, strip); /* clear temp meta-strips on this new track, as we may not be able to get back to it */ -- cgit v1.2.3