[Bf-blender-cvs] [bc2033bb583] temp-angavrilov: Dope Sheet: distinguish Constant and Linear from other interpolation modes.

Alexander Gavrilov noreply at git.blender.org
Fri Jul 15 13:30:33 CEST 2022


Commit: bc2033bb58348fe4fd1bf81667d4b6977f085365
Author: Alexander Gavrilov
Date:   Sat Feb 5 14:11:29 2022 +0300
Branches: temp-angavrilov
https://developer.blender.org/rBbc2033bb58348fe4fd1bf81667d4b6977f085365

Dope Sheet: distinguish Constant and Linear from other interpolation modes.

There is an option to display handles and interpolation modes in
the dope sheet, but the only interpolation mode it distinguishes
is Bezier. This adds distinct display for Constant and Linear:

- Constant is drawn as a thicker line.
- Linear is drawn the same as now.
- Other non-Bezier modes are drawn as a double line.

Constant, Linear and Bezier are the most common modes, so it makes
sense to distinguish them from all others.

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

M	source/blender/editors/animation/keyframes_draw.c
M	source/blender/editors/animation/keyframes_keylist.cc
M	source/blender/editors/include/ED_keyframes_keylist.h

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

diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index 786204a52ed..1e6aa4602ea 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -287,14 +287,30 @@ static void draw_keylist_block_interpolation_line(const DrawKeylistUIData *ctx,
                                                   const ActKeyColumn *ab,
                                                   float ypos)
 {
+  float width = ctx->ipo_size;
+  bool fill = true;
+
+  switch (ab->block.ipo) {
+    case BEZT_IPO_CONST:
+      width *= 1.7f;
+      break;
+
+    case BEZT_IPO_LIN:
+      break;
+
+    default:
+      width *= 2.0f;
+      fill = false;
+  }
+
   UI_draw_roundbox_4fv(
       &(const rctf){
           .xmin = ab->cfra,
           .xmax = ab->next->cfra,
-          .ymin = ypos - ctx->ipo_size,
-          .ymax = ypos + ctx->ipo_size,
+          .ymin = ypos - width,
+          .ymax = ypos + width,
       },
-      true,
+      fill,
       3.0f,
       (ab->block.conflict & ACTKEYBLOCK_FLAG_NON_BEZIER) ? ctx->ipo_color_mix : ctx->ipo_color);
 }
diff --git a/source/blender/editors/animation/keyframes_keylist.cc b/source/blender/editors/animation/keyframes_keylist.cc
index 8dc598e6e2d..adc3a35e9e2 100644
--- a/source/blender/editors/animation/keyframes_keylist.cc
+++ b/source/blender/editors/animation/keyframes_keylist.cc
@@ -749,6 +749,10 @@ static void compute_keyblock_data(ActKeyBlockInfo *info,
   /* Remember non-bezier interpolation info. */
   if (prev->ipo != BEZT_IPO_BEZ) {
     info->flag |= ACTKEYBLOCK_FLAG_NON_BEZIER;
+    info->ipo = prev->ipo;
+  }
+  else {
+    info->ipo = -1;
   }
 
   info->sel = BEZT_ISSEL_ANY(prev) || BEZT_ISSEL_ANY(beztn);
@@ -765,6 +769,13 @@ static void add_keyblock_info(ActKeyColumn *col, const ActKeyBlockInfo *block)
     col->block.conflict |= (col->block.flag ^ block->flag);
     col->block.flag |= block->flag;
     col->block.sel |= block->sel;
+
+    /* Combine interpolations; detect conflicts and use max value. */
+    if (col->block.ipo != block->ipo) {
+      col->block.conflict |= ACTKEYBLOCK_FLAG_NON_BEZIER;
+    }
+
+    col->block.ipo = MAX2(col->block.ipo, block->ipo);
   }
 
   if (block->flag) {
diff --git a/source/blender/editors/include/ED_keyframes_keylist.h b/source/blender/editors/include/ED_keyframes_keylist.h
index 251b6e4d83d..61b604a496f 100644
--- a/source/blender/editors/include/ED_keyframes_keylist.h
+++ b/source/blender/editors/include/ED_keyframes_keylist.h
@@ -37,6 +37,9 @@ typedef struct ActKeyBlockInfo {
 
   /* Selection flag. */
   char sel;
+
+  /* Inteprolation mode. */
+  signed char ipo;
 } ActKeyBlockInfo;
 
 /* Keyframe Column Struct */



More information about the Bf-blender-cvs mailing list