Animation: Keep icons aligned when curves are baked #108518

Merged
Christoph Lendenfeld merged 6 commits from ChrisLend/blender:channel_draw_lock_on_baked into main 2023-09-05 14:27:19 +02:00
1 changed files with 12 additions and 13 deletions

View File

@ -1027,11 +1027,9 @@ static bool acf_fcurve_name_prop(bAnimListElem *ale, PointerRNA *r_ptr, Property
/* check if some setting exists for this channel */
static bool acf_fcurve_setting_valid(bAnimContext *ac,
bAnimListElem *ale,
bAnimListElem * /*ale*/,
eAnimChannel_Settings setting)
{
FCurve *fcu = (FCurve *)ale->data;
switch (setting) {
/* unsupported */
case ACHANNEL_SETTING_SOLO: /* Solo Flag is only for NLA */
@ -1039,15 +1037,6 @@ static bool acf_fcurve_setting_valid(bAnimContext *ac,
case ACHANNEL_SETTING_PINNED: /* This is only for NLA Actions */
return false;
/* conditionally available */
case ACHANNEL_SETTING_PROTECT: /* Protection is only valid when there's keyframes */
if (fcu->bezt) {
return true;
}
else {
return false; /* NOTE: in this special case, we need to draw ICON_ZOOMOUT */
}
case ACHANNEL_SETTING_VISIBLE: /* Only available in Graph Editor */
return (ac->spacetype == SPACE_GRAPH);
@ -5398,7 +5387,17 @@ void ANIM_channel_draw_widgets(const bContext *C,
/* protect... */
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PROTECT)) {
offset -= ICON_WIDTH;
draw_setting_widget(ac, ale, acf, block, offset, ymid, ACHANNEL_SETTING_PROTECT);
if (ale->type == ANIMTYPE_FCURVE) {
FCurve *fcu = static_cast<FCurve *>(ale->data);
/* Don't draw lock icon when curve is baked.
* Still using the offset so icons are aligned. */
if (fcu->bezt) {
draw_setting_widget(ac, ale, acf, block, offset, ymid, ACHANNEL_SETTING_PROTECT);
}
}
else {
draw_setting_widget(ac, ale, acf, block, offset, ymid, ACHANNEL_SETTING_PROTECT);
}
}
/* mute... */
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_MUTE)) {