[Bf-blender-cvs] [9dee0a10c81] master: Fix T85564: FCurve modifier zero influence on restrict range borders

Philipp Oeser noreply at git.blender.org
Fri Sep 17 09:18:27 CEST 2021


Commit: 9dee0a10c81d9f4ce8d4fc85ed8722d899f34dde
Author: Philipp Oeser
Date:   Fri Feb 12 11:22:48 2021 +0100
Branches: master
https://developer.blender.org/rB9dee0a10c81d9f4ce8d4fc85ed8722d899f34dde

Fix T85564: FCurve modifier zero influence on restrict range borders

When using FModifier `Restrict Frame Range`, the resulting influence was
zero being exactly on `Start` / `End` range borders (so borders were
**exclusive**).
This made it impossible to chain FModifers together (forcing the user to
specify values slightly below the desired border in following
FModifiers).
This is now corrected to be **inclusive** on Start / End range borders.

Before
{F10234864}
After
{F10234865}
Testfile
{F10234866}

In the case of touching open borders (so [frame A frame B] followed by
[frame B frame C]) both modifiers are evaluated (in stack order).
If the later modifier has full influence (and is not additive) this simply
means the result is the same as the later modifier's value.
If influences below 1 are used (or modifiers are additive) both modifier's
values are interpolated/added accordingly.

technical notes:
- this was caused by the introduction of FModifier Influence/BlendIn-Out
in rB185663b52b61.
- for comparison, see other occurrences of
`FMODIFIER_FLAG_RANGERESTRICT`.
- the following conditions in `eval_fmodifier_influence` for blend in/
out have been changed accordingly.

Maniphest Tasks: T85564

Differential Revision: https://developer.blender.org/D10401

===================================================================

M	source/blender/blenkernel/intern/fmodifier.c

===================================================================

diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c
index 5aa3815729f..121927513cc 100644
--- a/source/blender/blenkernel/intern/fmodifier.c
+++ b/source/blender/blenkernel/intern/fmodifier.c
@@ -1419,17 +1419,19 @@ static float eval_fmodifier_influence(FModifier *fcm, float evaltime)
 
   /* restricted range or full range? */
   if (fcm->flag & FMODIFIER_FLAG_RANGERESTRICT) {
-    if ((evaltime <= fcm->sfra) || (evaltime >= fcm->efra)) {
+    if ((evaltime < fcm->sfra) || (evaltime > fcm->efra)) {
       /* out of range */
       return 0.0f;
     }
-    if ((evaltime > fcm->sfra) && (evaltime < fcm->sfra + fcm->blendin)) {
+    if ((fcm->blendin != 0.0f) && (evaltime >= fcm->sfra) &&
+        (evaltime <= fcm->sfra + fcm->blendin)) {
       /* blend in range */
       float a = fcm->sfra;
       float b = fcm->sfra + fcm->blendin;
       return influence * (evaltime - a) / (b - a);
     }
-    if ((evaltime < fcm->efra) && (evaltime > fcm->efra - fcm->blendout)) {
+    if ((fcm->blendout != 0.0f) && (evaltime <= fcm->efra) &&
+        (evaltime >= fcm->efra - fcm->blendout)) {
       /* blend out range */
       float a = fcm->efra;
       float b = fcm->efra - fcm->blendout;



More information about the Bf-blender-cvs mailing list