Graph Editor: fix keyframe not activating in certain cases

When clicking on an already-selected keyframe, mark it as active if the
click caused the previously-active keyframe to become deselected.

When clicking on a key in the graph editor, it is selected and all other
keys are deselected. If that key was already selected before the click,
it would not become the active keyframe. This is now fixed.

Reviewed by: Severin

Differential Revision: https://developer.blender.org/D9639
This commit is contained in:
Sybren A. Stüvel 2020-11-24 12:27:43 +01:00
parent bb5c4de009
commit 31bf8307af
1 changed files with 7 additions and 2 deletions

View File

@ -1518,8 +1518,13 @@ static int mouse_graph_keys(bAnimContext *ac,
something_was_selected = true;
}
if (!run_modal && BEZT_ISSEL_ANY(bezt) && !already_selected) {
BKE_fcurve_active_keyframe_set(nvi->fcu, bezt);
if (!run_modal && BEZT_ISSEL_ANY(bezt)) {
const bool may_activate = !already_selected ||
BKE_fcurve_active_keyframe_index(nvi->fcu) ==
FCURVE_ACTIVE_KEYFRAME_NONE;
if (may_activate) {
BKE_fcurve_active_keyframe_set(nvi->fcu, bezt);
}
}
}
else if (nvi->fpt) {