From cdcba166f63dcb3c87bf1c99c4b7aae4f3481701 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Mon, 14 Jan 2008 15:16:59 +0000 Subject: [PATCH] Bad bad bug! Newly added strip->scale was never initialized 1.0f on adding, causing divide by zero in NLA/Action UI. Bug since september or so... is nobody using NLA? :) --- source/blender/blenkernel/intern/action.c | 2 ++ source/blender/src/editnla.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 4dab625d2c9..61668ddb0eb 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -441,6 +441,8 @@ static float get_actionstrip_frame(bActionStrip *strip, float cframe, int invert float length, actlength, repeat, scale; repeat = (strip->flag & ACTSTRIP_USESTRIDE) ? (1.0f) : (strip->repeat); + if(strip->scale == 0.0f) strip->scale= 1.0f; + scale = abs(strip->scale); /* scale must be positive (for now) */ actlength = strip->actend-strip->actstart; diff --git a/source/blender/src/editnla.c b/source/blender/src/editnla.c index a75f5a211b7..05e030bf80b 100644 --- a/source/blender/src/editnla.c +++ b/source/blender/src/editnla.c @@ -581,7 +581,7 @@ static void add_nla_block(short event) /* simple prevention of zero strips */ if(strip->start>strip->end-2) strip->end= strip->start+100; - strip->repeat = 1.0; + strip->repeat = strip->scale= 1.0f; strip->flag = ACTSTRIP_SELECT|ACTSTRIP_LOCK_ACTION; @@ -620,6 +620,7 @@ static void add_nla_block_by_name(char name[32], Object *ob, short hold, short a /* Initialize the new action block */ strip = MEM_callocN(sizeof(bActionStrip), "bActionStrip"); + strip->scale= 1.0f; deselect_nlachannel_keys(0);