[Bf-blender-cvs] [81bdaefbd77] active-fcurve-keyframe: Draw active keyframe differently in dopesheet
Hans Goudey
noreply at git.blender.org
Thu Jul 16 20:16:21 CEST 2020
Commit: 81bdaefbd77cb921f15564a5dde1321e09f93e75
Author: Hans Goudey
Date: Mon May 18 12:53:48 2020 -0400
Branches: active-fcurve-keyframe
https://developer.blender.org/rB81bdaefbd77cb921f15564a5dde1321e09f93e75
Draw active keyframe differently in dopesheet
===================================================================
M source/blender/editors/animation/keyframes_draw.c
M source/blender/editors/include/ED_keyframes_draw.h
M source/blender/editors/interface/interface_icons.c
M source/blender/editors/space_nla/nla_draw.c
===================================================================
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index b921ba039be..69e805d66e7 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -193,6 +193,7 @@ static DLRBT_Node *nalloc_ak_bezt(void *data)
ak->key_type = BEZKEYTYPE(bezt);
ak->handle_type = bezt_handle_type(bezt);
ak->extreme_type = bezt_extreme_type(chain);
+ ak->active = false;
/* count keyframes in this column */
ak->totkey = 1;
@@ -374,6 +375,7 @@ static const ActKeyBlockInfo dummy_keyblock = {0};
static void compute_keyblock_data(ActKeyBlockInfo *info, BezTriple *prev, BezTriple *beztn)
{
+
memset(info, 0, sizeof(ActKeyBlockInfo));
if (BEZKEYTYPE(beztn) == BEZT_KEYTYPE_MOVEHOLD) {
@@ -556,6 +558,7 @@ void draw_keyframe_shape(float x,
float y,
float size,
bool sel,
+ bool active,
short key_type,
short mode,
float alpha,
@@ -636,8 +639,13 @@ void draw_keyframe_shape(float x,
}
if (draw_outline) {
- /* exterior - black frame */
- UI_GetThemeColor4ubv(sel ? TH_KEYBORDER_SELECT : TH_KEYBORDER, outline_col);
+ /* Draw outline, special outline if this is an active keyframe. */
+ if (active) {
+ UI_GetThemeColor4ubv(sel ? TH_KEYTYPE_KEYFRAME : TH_KEYBORDER, outline_col);
+ }
+ else {
+ UI_GetThemeColor4ubv(sel ? TH_KEYBORDER_SELECT : TH_KEYBORDER, outline_col);
+ }
outline_col[3] *= alpha;
if (!draw_fill) {
@@ -710,13 +718,14 @@ static void draw_keylist(View2D *v2d,
/* draw keyblocks */
if (keys) {
- float sel_color[4], unsel_color[4];
+ float sel_color[4], unsel_color[4], active_color[4];
float sel_mhcol[4], unsel_mhcol[4];
float ipo_color[4], ipo_color_mix[4];
/* cache colors first */
UI_GetThemeColor4fv(TH_STRIP_SELECT, sel_color);
UI_GetThemeColor4fv(TH_STRIP, unsel_color);
+ UI_GetThemeColor4fv(TH_VERTEX_ACTIVE, active_color);
UI_GetThemeColor4fv(TH_DOPESHEET_IPOLINE, ipo_color);
sel_color[3] *= alpha;
@@ -836,6 +845,7 @@ static void draw_keylist(View2D *v2d,
ypos,
icon_sz,
(ak->sel & SELECT),
+ ak->active,
ak->key_type,
KEYFRAME_SHAPE_BOTH,
alpha,
@@ -1191,6 +1201,13 @@ void fcurve_to_keylist(AnimData *adt, FCurve *fcu, DLRBT_Tree *keys, int saction
/* Update keyblocks. */
update_keyblocks(keys, fcu->bezt, fcu->totvert);
+ /* Add active keyframe information if the FCurve is active. */
+ if (fcu->flag & FCURVE_ACTIVE) {
+ ActKeyColumn *active_column = (ActKeyColumn *)BLI_dlrbTree_search_exact(
+ keys, compare_ak_cfraPtr, &fcu->bezt[fcu->active_key].vec[1][0]);
+ active_column->active = true;
+ }
+
/* unapply NLA-mapping if applicable */
if (adt) {
ANIM_nla_mapping_apply_fcurve(adt, fcu, 1, 0);
diff --git a/source/blender/editors/include/ED_keyframes_draw.h b/source/blender/editors/include/ED_keyframes_draw.h
index 7000075d4b5..009c1e3ed1a 100644
--- a/source/blender/editors/include/ED_keyframes_draw.h
+++ b/source/blender/editors/include/ED_keyframes_draw.h
@@ -78,6 +78,8 @@ typedef struct ActKeyColumn {
char extreme_type;
short sel;
float cfra;
+ /* Active keyframe in active FCurve. */
+ bool active;
/* key-block info */
ActKeyBlockInfo block;
@@ -141,6 +143,7 @@ void draw_keyframe_shape(float x,
float y,
float size,
bool sel,
+ bool active,
short key_type,
short mode,
float alpha,
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index c94a95890c0..284911fdfdd 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -328,6 +328,7 @@ static void vicon_keytype_draw_wrapper(
yco,
(10.0f / 16.0f) * h,
sel,
+ false,
key_type,
KEYFRAME_SHAPE_BOTH,
alpha,
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index 5c4ccd96534..90df5cfcb0c 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -155,6 +155,7 @@ static void nla_action_draw_keyframes(
y,
6.0f,
false,
+ false,
ak->key_type,
KEYFRAME_SHAPE_FRAME,
1.0f,
More information about the Bf-blender-cvs
mailing list