Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index 515fd729d1c..65e1f433c20 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -1701,25 +1701,27 @@ static void nlaevalchan_accumulate(NlaEvalChannel *nec, NlaEvalStrip *nes, short
if (nes->strip_mode == NES_TIME_TRANSITION_END)
inf *= nes->strip_time;
- /* premultiply the value by the weighting factor */
+ /* optimisation: no need to try applying if there is no influence */
if (IS_EQ(inf, 0)) return;
- value *= inf;
/* perform blending */
switch (blendmode) {
case NLASTRIP_MODE_ADD:
/* simply add the scaled value on to the stack */
- nec->value += value;
+ nec->value += (value * inf);
break;
case NLASTRIP_MODE_SUBTRACT:
/* simply subtract the scaled value from the stack */
- nec->value -= value;
+ nec->value -= (value * inf);
break;
case NLASTRIP_MODE_MULTIPLY:
/* multiply the scaled value with the stack */
- nec->value *= value;
+ /* Formula Used:
+ * result = fac * (a * b) + (1 - fac) * a
+ */
+ nec->value = inf * (nec->value * value) + (1 - inf) * nec->value;
break;
case NLASTRIP_MODE_REPLACE:
@@ -1728,7 +1730,7 @@ static void nlaevalchan_accumulate(NlaEvalChannel *nec, NlaEvalStrip *nes, short
* - the influence of the accumulated data (elsewhere, that is called dstweight)
* is 1 - influence, since the strip's influence is srcweight
*/
- nec->value = nec->value * (1.0f - inf) + value;
+ nec->value = nec->value * (1.0f - inf) + (value * inf);
break;
}
}