[Bf-blender-cvs] [70d86d55c39] temp-graph-select-changes: Make box selection Include Handles option only act on visible handles

Julian Eisel noreply at git.blender.org
Tue Nov 12 13:09:15 CET 2019


Commit: 70d86d55c393f11f4ddca907324485b57cc267cc
Author: Julian Eisel
Date:   Tue Nov 12 13:01:05 2019 +0100
Branches: temp-graph-select-changes
https://developer.blender.org/rB70d86d55c393f11f4ddca907324485b57cc267cc

Make box selection Include Handles option only act on visible handles

The option would previously act on invisible handles. Because of this,
it wouldn't be wise to enable it by default, even though it can be
tremendously useful (esp. with `Only Selected Keyframes Handles`
disabled).
This changes things based on animator feedback, so that we can enable
the option by default.

I can see that for some people even the old behavior of acting on
invisible handles could be useful, so we might consider bringing that
option back. `Include Handles` could then become an enum to chose the
behavior.

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

M	source/blender/editors/animation/keyframes_edit.c
M	source/blender/editors/include/ED_keyframes_edit.h
M	source/blender/editors/space_graph/graph_select.c

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

diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index 2a1a76a19f7..920b8163d28 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -501,10 +501,16 @@ void ANIM_editkeyframes_refresh(bAnimContext *ac)
       ok |= KEYFRAME_OK_KEY; \
 \
     if (ked && (ked->iterflags & KEYFRAME_ITER_INCL_HANDLES)) { \
-      if (check(0)) \
-        ok |= KEYFRAME_OK_H1; \
-      if (check(2)) \
-        ok |= KEYFRAME_OK_H2; \
+      /* Only act on visible items, so check handle visiblity state. */ \
+      const bool handles_visible = ((ked->iterflags & KEYFRAME_ITER_HANDLES_DEFAULT_HIDDEN) ? \
+                                        (BEZT_ISSEL_ANY(bezt)) : \
+                                        true); \
+      if (handles_visible) { \
+        if (check(0)) \
+          ok |= KEYFRAME_OK_H1; \
+        if (check(2)) \
+          ok |= KEYFRAME_OK_H2; \
+      } \
     } \
   } \
   (void)0
@@ -1447,8 +1453,13 @@ KeyframeEditFunc ANIM_editkeyframes_easing(short mode)
 
 static short select_bezier_add(KeyframeEditData *ked, BezTriple *bezt)
 {
+  /* Only act on visible items, so check handle visiblity state. */
+  const bool handles_visible = ked && ((ked->iterflags & KEYFRAME_ITER_HANDLES_DEFAULT_HIDDEN) ?
+                                           (BEZT_ISSEL_ANY(bezt)) :
+                                           true);
+
   /* if we've got info on what to select, use it, otherwise select all */
-  if ((ked) && (ked->iterflags & KEYFRAME_ITER_INCL_HANDLES)) {
+  if ((ked) && (ked->iterflags & KEYFRAME_ITER_INCL_HANDLES) && handles_visible) {
     if (ked->curflags & KEYFRAME_OK_KEY) {
       bezt->f2 |= SELECT;
     }
@@ -1468,8 +1479,13 @@ static short select_bezier_add(KeyframeEditData *ked, BezTriple *bezt)
 
 static short select_bezier_subtract(KeyframeEditData *ked, BezTriple *bezt)
 {
+  /* Only act on visible items, so check handle visiblity state. */
+  const bool handles_visible = ked && ((ked->iterflags & KEYFRAME_ITER_HANDLES_DEFAULT_HIDDEN) ?
+                                           (BEZT_ISSEL_ANY(bezt)) :
+                                           true);
+
   /* if we've got info on what to deselect, use it, otherwise deselect all */
-  if ((ked) && (ked->iterflags & KEYFRAME_ITER_INCL_HANDLES)) {
+  if ((ked) && (ked->iterflags & KEYFRAME_ITER_INCL_HANDLES) && handles_visible) {
     if (ked->curflags & KEYFRAME_OK_KEY) {
       bezt->f2 &= ~SELECT;
     }
diff --git a/source/blender/editors/include/ED_keyframes_edit.h b/source/blender/editors/include/ED_keyframes_edit.h
index 99a13dc6a87..9bc2b48db89 100644
--- a/source/blender/editors/include/ED_keyframes_edit.h
+++ b/source/blender/editors/include/ED_keyframes_edit.h
@@ -141,6 +141,10 @@ typedef enum eKeyframeIterFlags {
 
   /* Perform NLA time remapping (global -> strip) for the "f2" parameter */
   KED_F2_NLA_UNMAP = (1 << 2),
+
+  /* By default, the handles iterated over will be hidden. Additional checks are needed to get the
+   * actual visibility state. */
+  KEYFRAME_ITER_HANDLES_DEFAULT_HIDDEN = (1 << 3),
 } eKeyframeIterFlags;
 
 /* --- Generic Properties for Keyframe Edit Tools ----- */
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index a0442213e3c..4e335bdac74 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -552,6 +552,10 @@ static void box_select_graphkeys(bAnimContext *ac,
     ked.data = &scaled_rectf;
   }
 
+  if (sipo->flag & SIPO_SELVHANDLESONLY) {
+    ked.iterflags |= KEYFRAME_ITER_HANDLES_DEFAULT_HIDDEN;
+  }
+
   /* treat handles separately? */
   if (incl_handles) {
     ked.iterflags |= KEYFRAME_ITER_INCL_HANDLES;



More information about the Bf-blender-cvs mailing list