[Bf-blender-cvs] [0578d3e] master: Graph Editor: Ctrl-Click keyframing now deselects all existing keyframes by default

Joshua Leung noreply at git.blender.org
Mon May 9 07:23:59 CEST 2016


Commit: 0578d3ef3e53faa447880bb939aa33272464cef1
Author: Joshua Leung
Date:   Mon May 9 16:58:12 2016 +1200
Branches: master
https://developer.blender.org/rB0578d3ef3e53faa447880bb939aa33272464cef1

Graph Editor: Ctrl-Click keyframing now deselects all existing keyframes by default

Now, when creating new keyframes in the graph editor by ctrl-clicking, only
the newly created keyframes will be selected. This is a little workflow tweak
to make it faster to work, as you no longer have to deselect all, and then
re-select the newly added keys in order to manipulate them.

The old behaviour (not modifying the selection status of the old keys) has been
kept, but is now available via Shift-Ctrl-Click.

Feature request from @Shhlife

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

M	source/blender/editors/space_graph/graph_edit.c
M	source/blender/editors/space_graph/graph_intern.h
M	source/blender/editors/space_graph/graph_ops.c
M	source/blender/editors/space_graph/graph_select.c

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

diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index effcd80..f106399 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -693,6 +693,14 @@ static int graphkeys_click_insert_exec(bContext *C, wmOperator *op)
 		short mapping_flag = ANIM_get_normalization_flags(&ac);
 		float scale, offset;
 		
+		/* preserve selection? */
+		if (RNA_boolean_get(op->ptr, "extend") == false) {
+			/* deselect all keyframes first, so that we can immediately start manipulating the newly added one(s)
+			 * - only affect the keyframes themselves, as we don't want channels popping in and out...
+			 */
+			deselect_graph_keys(&ac, false, SELECT_SUBTRACT, false);
+		}
+		
 		/* get frame and value from props */
 		frame = RNA_float_get(op->ptr, "frame");
 		val = RNA_float_get(op->ptr, "value");
@@ -782,6 +790,8 @@ void GRAPH_OT_click_insert(wmOperatorType *ot)
 	/* properties */
 	RNA_def_float(ot->srna, "frame", 1.0f, -FLT_MAX, FLT_MAX, "Frame Number", "Frame to insert keyframe on", 0, 100);
 	RNA_def_float(ot->srna, "value", 1.0f, -FLT_MAX, FLT_MAX, "Value", "Value for keyframe on", 0, 100);
+	
+	RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend selection instead of deselecting everything first");
 }
 
 /* ******************** Copy/Paste Keyframes Operator ************************* */
diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h
index b6b711e..534b712 100644
--- a/source/blender/editors/space_graph/graph_intern.h
+++ b/source/blender/editors/space_graph/graph_intern.h
@@ -56,6 +56,8 @@ void graph_draw_ghost_curves(struct bAnimContext *ac, struct SpaceIpo *sipo, str
 /* ***************************************** */
 /* graph_select.c */
 
+void deselect_graph_keys(struct bAnimContext *ac, bool test, short sel, bool do_channels);
+
 void GRAPH_OT_select_all_toggle(struct wmOperatorType *ot);
 void GRAPH_OT_select_border(struct wmOperatorType *ot);
 void GRAPH_OT_select_lasso(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c
index 7ffa825..6b86099 100644
--- a/source/blender/editors/space_graph/graph_ops.c
+++ b/source/blender/editors/space_graph/graph_ops.c
@@ -610,7 +610,11 @@ static void graphedit_keymap_keyframes(wmKeyConfig *keyconf, wmKeyMap *keymap)
 	
 	/* insertkey */
 	WM_keymap_add_item(keymap, "GRAPH_OT_keyframe_insert", IKEY, KM_PRESS, 0, 0);
-	WM_keymap_add_item(keymap, "GRAPH_OT_click_insert", ACTIONMOUSE, KM_CLICK, KM_CTRL, 0);
+	
+	kmi = WM_keymap_add_item(keymap, "GRAPH_OT_click_insert", ACTIONMOUSE, KM_CLICK, KM_CTRL, 0);
+	RNA_boolean_set(kmi->ptr, "extend", false);
+	kmi = WM_keymap_add_item(keymap, "GRAPH_OT_click_insert", ACTIONMOUSE, KM_CLICK, KM_CTRL | KM_SHIFT, 0);
+	RNA_boolean_set(kmi->ptr, "extend", true);
 	
 	/* copy/paste */
 	WM_keymap_add_item(keymap, "GRAPH_OT_copy", CKEY, KM_PRESS, KM_CTRL, 0);
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index 6727410..eb786d8 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -83,7 +83,7 @@
  *		2 = invert
  *	- do_channels: whether to affect selection status of channels
  */
-static void deselect_graph_keys(bAnimContext *ac, short test, short sel, short do_channels)
+void deselect_graph_keys(bAnimContext *ac, bool test, short sel, bool do_channels)
 {
 	ListBase anim_data = {NULL, NULL};
 	bAnimListElem *ale;




More information about the Bf-blender-cvs mailing list