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

Alexander Gavrilov noreply at git.blender.org
Sat Feb 5 12:24:04 CET 2022


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

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 ae8d04f51d3..872de5c61ae 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -303,14 +303,30 @@ static void draw_keylist_block_interpolation_line(const DrawKeylistUIData *ctx,
                                                   const ActKeyColumn *ab,
                                                   float ypos)
 {
+  float width = ctx->ipo_sz;
+  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_sz,
-          .ymax = ypos + ctx->ipo_sz,
+          .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 aba73ec141b..5b0fab8f320 100644
--- a/source/blender/editors/animation/keyframes_keylist.cc
+++ b/source/blender/editors/animation/keyframes_keylist.cc
@@ -731,6 +731,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);
@@ -747,6 +751,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 36a30bd5ee6..6214f7b250c 100644
--- a/source/blender/editors/include/ED_keyframes_keylist.h
+++ b/source/blender/editors/include/ED_keyframes_keylist.h
@@ -53,6 +53,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