[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19674] branches/blender2.5/blender/source /blender/editors: Graph Editor:
Joshua Leung
aligorith at gmail.com
Sun Apr 12 10:17:47 CEST 2009
Revision: 19674
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19674
Author: aligorith
Date: 2009-04-12 10:17:46 +0200 (Sun, 12 Apr 2009)
Log Message:
-----------
Graph Editor:
* Column select (ALT-RMB) works again, and in conjunction with 'extend' (i.e. SHIFT) to add to selection instead of just replacing
* Select all keyframes in curve (CTRL-ALT-RMB) now works
Modified Paths:
--------------
branches/blender2.5/blender/source/blender/editors/space_action/action_select.c
branches/blender2.5/blender/source/blender/editors/space_graph/graph_ops.c
branches/blender2.5/blender/source/blender/editors/space_graph/graph_select.c
Modified: branches/blender2.5/blender/source/blender/editors/space_action/action_select.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_action/action_select.c 2009-04-12 07:24:04 UTC (rev 19673)
+++ branches/blender2.5/blender/source/blender/editors/space_action/action_select.c 2009-04-12 08:17:46 UTC (rev 19674)
@@ -615,7 +615,7 @@
/* ------------------- */
/* option 1) select keyframe directly under mouse */
-static void actkeys_select_single (bAnimContext *ac, bAnimListElem *ale, short select_mode, float selx)
+static void actkeys_mselect_single (bAnimContext *ac, bAnimListElem *ale, short select_mode, float selx)
{
bDopeSheet *ads= (ac->datatype == ANIMCONT_DOPESHEET) ? ac->data : NULL;
int ds_filter = ((ads) ? (ads->filterflag) : (0));
@@ -634,7 +634,7 @@
}
/* Option 2) Selects all the keyframes on either side of the current frame (depends on which side the mouse is on) */
-static void actkeys_select_leftright (bAnimContext *ac, short leftright, short select_mode)
+static void actkeys_mselect_leftright (bAnimContext *ac, short leftright, short select_mode)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@@ -694,7 +694,7 @@
}
/* Option 3) Selects all visible keyframes in the same frame as the mouse click */
-static void actkeys_select_column(bAnimContext *ac, short select_mode, float selx)
+static void actkeys_mselect_column(bAnimContext *ac, short select_mode, float selx)
{
ListBase anim_data= {NULL, NULL};
bAnimListElem *ale;
@@ -905,11 +905,11 @@
}
else if (column) {
/* select all keyframes in the same frame as the one we hit on the active channel */
- actkeys_select_column(ac, select_mode, selx);
+ actkeys_mselect_column(ac, select_mode, selx);
}
else {
/* select the nominated keyframe on the given frame */
- actkeys_select_single(ac, ale, select_mode, selx);
+ actkeys_mselect_single(ac, ale, select_mode, selx);
}
/* free this channel */
@@ -960,7 +960,7 @@
else
RNA_int_set(op->ptr, "left_right", ACTKEYS_LRSEL_RIGHT);
- actkeys_select_leftright(&ac, RNA_enum_get(op->ptr, "left_right"), selectmode);
+ actkeys_mselect_leftright(&ac, RNA_enum_get(op->ptr, "left_right"), selectmode);
}
else {
/* select keyframe(s) based upon mouse position*/
Modified: branches/blender2.5/blender/source/blender/editors/space_graph/graph_ops.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_graph/graph_ops.c 2009-04-12 07:24:04 UTC (rev 19673)
+++ branches/blender2.5/blender/source/blender/editors/space_graph/graph_ops.c 2009-04-12 08:17:46 UTC (rev 19674)
@@ -141,15 +141,23 @@
static void graphedit_keymap_keyframes (wmWindowManager *wm, ListBase *keymap)
{
+ wmKeymapItem *kmi;
+
/* view */
WM_keymap_add_item(keymap, "GRAPHEDIT_OT_handles_view_toggle", HKEY, KM_PRESS, KM_CTRL, 0);
/* graph_select.c - selection tools */
/* click-select */
WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_clickselect", SELECTMOUSE, KM_PRESS, 0, 0);
- RNA_boolean_set(WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "column", 1);
- RNA_boolean_set(WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_clickselect", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", 1);
- RNA_enum_set(WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_clickselect", SELECTMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "left_right", GRAPHKEYS_LRSEL_TEST);
+ kmi= WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
+ RNA_boolean_set(kmi->ptr, "column", 1);
+ kmi= WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_clickselect", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0);
+ RNA_boolean_set(kmi->ptr, "extend", 1);
+ kmi= WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT|KM_SHIFT, 0);
+ RNA_boolean_set(kmi->ptr, "extend", 1);
+ RNA_boolean_set(kmi->ptr, "column", 1);
+ kmi= WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_clickselect", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
+ RNA_enum_set(kmi->ptr, "left_right", GRAPHKEYS_LRSEL_TEST);
/* deselect all */
WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_select_all_toggle", AKEY, KM_PRESS, 0, 0);
Modified: branches/blender2.5/blender/source/blender/editors/space_graph/graph_select.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_graph/graph_select.c 2009-04-12 07:24:04 UTC (rev 19673)
+++ branches/blender2.5/blender/source/blender/editors/space_graph/graph_select.c 2009-04-12 08:17:46 UTC (rev 19674)
@@ -541,7 +541,7 @@
*/
/* defines for left-right select tool */
-static EnumPropertyItem prop_leftright_select_types[] = {
+static EnumPropertyItem prop_graphkeys_leftright_select_types[] = {
{GRAPHKEYS_LRSEL_TEST, "CHECK", "Check if Select Left or Right", ""},
{GRAPHKEYS_LRSEL_NONE, "OFF", "Don't select", ""},
{GRAPHKEYS_LRSEL_LEFT, "LEFT", "Before current frame", ""},
@@ -651,7 +651,7 @@
}
/* option 1) select keyframe directly under mouse */
-static void mouse_graph_keys (bAnimContext *ac, int mval[], short selectmode)
+static void mouse_graph_keys (bAnimContext *ac, int mval[], short select_mode, short curves_only)
{
FCurve *fcu;
BezTriple *bezt;
@@ -666,17 +666,22 @@
return;
/* deselect all other curves? */
- if (selectmode == SELECT_REPLACE) {
- deselect_graph_keys(ac, 0, SELECT_SUBTRACT); // XXX this should be curves, not keys
- selectmode= SELECT_ADD;
+ if (select_mode == SELECT_REPLACE) {
+ /* reset selection mode */
+ select_mode= SELECT_ADD;
+
+ /* deselect all other channels and keyframes */
+ ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
+ deselect_graph_keys(ac, 0, SELECT_SUBTRACT);
}
- /* if we're selecting points too */
- if ( ((fcu->flag & FCURVE_PROTECTED)==0) /*|| (curvesonly == 0) */) {
+ /* if points can be selected on this F-Curve */
+ // TODO: what about those with no keyframes?
+ if ((curves_only == 0) && ((fcu->flag & FCURVE_PROTECTED)==0)) {
/* only if there's keyframe */
if (bezt) {
/* depends on selection mode */
- if (selectmode == SELECT_INVERT) {
+ if (select_mode == SELECT_INVERT) {
/* keyframe - invert select of all */
if (handle == NEAREST_HANDLE_KEY) {
if (BEZSELECTED(bezt)) {
@@ -698,9 +703,6 @@
}
}
else {
- /* deselect all other keyframes? */
- deselect_graph_keys(ac, 0, SELECT_SUBTRACT);
-
/* if the keyframe was clicked on, select all verts of given beztriple */
if (handle == NEAREST_HANDLE_KEY) {
BEZ_SEL(bezt);
@@ -713,11 +715,24 @@
}
}
}
+ else {
+ BeztEditFunc select_cb;
+ BeztEditData bed;
+ /* initialise keyframe editing data */
+ memset(&bed, 0, sizeof(BeztEditData));
+
+ /* set up BezTriple edit callbacks */
+ select_cb= ANIM_editkeyframes_select(select_mode);
+
+ /* select all keyframes */
+ ANIM_fcurve_keys_bezier_loop(&bed, fcu, NULL, select_cb, NULL);
+ }
+
/* select or deselect curve? */
- if (selectmode == SELECT_INVERT)
+ if (select_mode == SELECT_INVERT)
fcu->flag ^= FCURVE_SELECTED;
- else if (selectmode == SELECT_ADD)
+ else if (select_mode == SELECT_ADD)
fcu->flag |= FCURVE_SELECTED;
/* set active F-Curve (NOTE: sync the filter flags with findnearest_fcurve_vert) */
@@ -728,7 +743,7 @@
}
/* Option 2) Selects all the keyframes on either side of the current frame (depends on which side the mouse is on) */
-static void graphkeys_select_leftright (bAnimContext *ac, short leftright, short select_mode)
+static void graphkeys_mselect_leftright (bAnimContext *ac, short leftright, short select_mode)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@@ -738,9 +753,13 @@
BeztEditData bed;
Scene *scene= ac->scene;
- /* if select mode is replace, deselect all keyframes first */
+ /* if select mode is replace, deselect all keyframes (and channels) first */
if (select_mode==SELECT_REPLACE) {
- select_mode=SELECT_ADD;
+ /* reset selection mode to add to selection */
+ select_mode= SELECT_ADD;
+
+ /* deselect all other channels and keyframes */
+ ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
deselect_graph_keys(ac, 0, SELECT_SUBTRACT);
}
@@ -780,7 +799,7 @@
}
/* Option 3) Selects all visible keyframes in the same frame as the mouse click */
-static void mouse_columnselect_graph_keys (bAnimContext *ac, float selx)
+static void graphkeys_mselect_column (bAnimContext *ac, int mval[2], short select_mode)
{
ListBase anim_data= {NULL, NULL};
bAnimListElem *ale;
@@ -788,12 +807,33 @@
BeztEditFunc select_cb, ok_cb;
BeztEditData bed;
+ FCurve *fcu;
+ BezTriple *bezt;
+ float selx = (float)ac->scene->r.cfra;
+ /* find the beztriple that occurs on this frame, and use his as the frame number we're using */
+ findnearest_fcurve_vert(ac, mval, &fcu, &bezt);
+
+ /* check if anything to select */
+ if (ELEM(NULL, fcu, bezt))
+ return;
+ selx= bezt->vec[1][0];
+
+ /* if select mode is replace, deselect all keyframes (and channels) first */
+ if (select_mode==SELECT_REPLACE) {
+ /* reset selection mode to add to selection */
+ select_mode= SELECT_ADD;
+
+ /* deselect all other channels and keyframes */
+ ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
+ deselect_graph_keys(ac, 0, SELECT_SUBTRACT);
+ }
+
/* initialise keyframe editing data */
memset(&bed, 0, sizeof(BeztEditData));
/* set up BezTriple edit callbacks */
- select_cb= ANIM_editkeyframes_select(SELECT_ADD);
+ select_cb= ANIM_editkeyframes_select(select_mode);
ok_cb= ANIM_editkeyframes_ok(BEZT_OK_FRAME);
/* loop through all of the keys and select additional keyframes
@@ -806,7 +846,6 @@
Object *nob= ANIM_nla_mapping_get(ac, ale);
/* set frame for validation callback to refer to */
- // XXX have a more sensitive range?
if (nob)
bed.f1= get_action_frame(nob, selx);
else
@@ -847,7 +886,6 @@
mval[1]= (event->y - ar->winrct.ymin);
/* select mode is either replace (deselect all, then add) or add/extend */
- // XXX this is currently only available for normal select only
if (RNA_boolean_get(op->ptr, "extend"))
selectmode= SELECT_INVERT;
else
@@ -864,19 +902,19 @@
else
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list