Animation: Keep icons aligned when curves are baked

When curves were baked, the lock icon wasn't drawn, which resulted in
a misalignment of the other icons.
With this patch, the icons are kept in alignment.

Also removes the comments that are no longer valid.

Pull Request: https://projects.blender.org/blender/blender/pulls/108518
This commit is contained in:
Christoph Lendenfeld 2023-09-05 14:27:09 +02:00 committed by Christoph Lendenfeld
parent 9d4edd3565
commit b7a84c49ea
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);
@ -5613,7 +5602,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)) {