[Bf-blender-cvs] [d62309a20e4] blender-v2.91-release: Fix T81890: Active keyframe changes on deselect of keyframe

Sybren A. Stüvel noreply at git.blender.org
Mon Oct 26 13:52:26 CET 2020


Commit: d62309a20e4855cc0feaf5aa78046d5dc8be638f
Author: Sybren A. Stüvel
Date:   Fri Oct 23 17:39:29 2020 +0200
Branches: blender-v2.91-release
https://developer.blender.org/rBd62309a20e4855cc0feaf5aa78046d5dc8be638f

Fix T81890: Active keyframe changes on deselect of keyframe

Activate an FCurve only on selecting, and not on deselecting a keyframe
or a handle.

Reviewed By: HooglyBoogly, Severin, looch, #animation_rigging

Differential Revision: https://developer.blender.org/D9328

===================================================================

M	source/blender/editors/space_graph/graph_select.c

===================================================================

diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index df89a4ff725..57aaa1fefce 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -1481,6 +1481,7 @@ static int mouse_graph_keys(bAnimContext *ac,
 
   /* if points can be selected on this F-Curve */
   /* TODO: what about those with no keyframes? */
+  bool something_was_selected = false;
   if (!curves_only && ((nvi->fcu->flag & FCURVE_PROTECTED) == 0)) {
     /* only if there's keyframe */
     if (nvi->bezt) {
@@ -1488,14 +1489,17 @@ static int mouse_graph_keys(bAnimContext *ac,
       if (select_mode == SELECT_INVERT) {
         if (nvi->hpoint == NEAREST_HANDLE_KEY) {
           bezt->f2 ^= SELECT;
+          something_was_selected = (bezt->f2 & SELECT);
         }
         else if (nvi->hpoint == NEAREST_HANDLE_LEFT) {
           /* toggle selection */
           bezt->f1 ^= SELECT;
+          something_was_selected = (bezt->f1 & SELECT);
         }
         else {
           /* toggle selection */
           bezt->f3 ^= SELECT;
+          something_was_selected = (bezt->f3 & SELECT);
         }
       }
       else {
@@ -1508,6 +1512,7 @@ static int mouse_graph_keys(bAnimContext *ac,
         else {
           bezt->f3 |= SELECT;
         }
+        something_was_selected = true;
       }
 
       if (!run_modal && BEZT_ISSEL_ANY(bezt) && !already_selected) {
@@ -1558,10 +1563,10 @@ static int mouse_graph_keys(bAnimContext *ac,
     }
   }
 
-  /* Set active F-Curve, except when dragging the selected keys.
-   * needs to be called with (sipo->flag & SIPO_SELCUVERTSONLY)
+  /* Set active F-Curve when something was actually selected (so not on a deselect), except when
+   * dragging the selected keys. Needs to be called with (sipo->flag & SIPO_SELCUVERTSONLY),
    * otherwise the active flag won't be set T26452. */
-  if (!run_modal && nvi->fcu->flag & FCURVE_SELECTED) {
+  if (!run_modal && (nvi->fcu->flag & FCURVE_SELECTED) && something_was_selected) {
     /* NOTE: Sync the filter flags with findnearest_fcurve_vert. */
     int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
     ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, nvi->fcu, nvi->ctype);



More information about the Bf-blender-cvs mailing list