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

Alexander Gavrilov noreply at git.blender.org
Sat Feb 4 21:41:00 CET 2023


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

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.

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

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

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 d0b978b7adf..92bad9f9168 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 eff12af02d2..56a8fb14876 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 7aaeb41572b..171ec3ae7f5 100644
--- a/source/blender/editors/include/ED_keyframes_keylist.h
+++ b/source/blender/editors/include/ED_keyframes_keylist.h
@@ -36,6 +36,9 @@ typedef struct ActKeyBlockInfo {
 
   /* Selection flag. */
   char sel;
+
+  /* Interpolation mode. */
+  signed char ipo;
 } ActKeyBlockInfo;
 
 /* Keyframe Column Struct */



More information about the Bf-blender-cvs mailing list