Animation Editors - Part 1 of Code Cleanups

* Fixed a few typos in the code
* Switched the meaning of the Ctrl and Alt modifiers when selecting keyframes. 
- Ctrl is now select all keyframes on one side of time cursor
- Alt is now select all keyframes at same time as a particular keyframe. 

TODO:
While testing these changes, I've found that this column-select is not working yet as the tolerances are too low. This will be rectified soon.
This commit is contained in:
2009-04-10 03:34:20 +00:00
parent 92e17f1fa9
commit 487561882d
7 changed files with 56 additions and 51 deletions

View File

@@ -2513,7 +2513,7 @@ void ANIM_OT_delete_keyframe_button (wmOperatorType *ot)
/* --------------- API/Per-Datablock Handling ------------------- */
/* Checks whether an IPO-block has a keyframe for a given frame
/* Checks whether an Action has a keyframe for a given frame
* Since we're only concerned whether a keyframe exists, we can simply loop until a match is found...
*/
short action_frame_has_keyframe (bAction *act, float frame, short filter)

View File

@@ -300,7 +300,7 @@ static int actkeys_copy_exec(bContext *C, wmOperator *op)
}
}
/* set notifier tha things have changed */
/* set notifier that things have changed */
ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
return OPERATOR_FINISHED;
@@ -344,7 +344,7 @@ static int actkeys_paste_exec(bContext *C, wmOperator *op)
/* validate keyframes after editing */
ANIM_editkeyframes_refresh(&ac);
/* set notifier tha things have changed */
/* set notifier that things have changed */
ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
return OPERATOR_FINISHED;
@@ -440,7 +440,7 @@ static int actkeys_insertkey_exec(bContext *C, wmOperator *op)
/* validate keyframes after editing */
ANIM_editkeyframes_refresh(&ac);
/* set notifier tha things have changed */
/* set notifier that things have changed */
ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
return OPERATOR_FINISHED;
@@ -507,7 +507,7 @@ static int actkeys_duplicate_exec(bContext *C, wmOperator *op)
/* validate keyframes after editing */
ANIM_editkeyframes_refresh(&ac);
/* set notifier tha things have changed */
/* set notifier that things have changed */
ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
return OPERATOR_FINISHED; // xxx - start transform
@@ -584,7 +584,7 @@ static int actkeys_delete_exec(bContext *C, wmOperator *op)
/* validate keyframes after editing */
ANIM_editkeyframes_refresh(&ac);
/* set notifier tha things have changed */
/* set notifier that things have changed */
ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
return OPERATOR_FINISHED;
@@ -647,7 +647,7 @@ static int actkeys_clean_exec(bContext *C, wmOperator *op)
/* validate keyframes after editing */
ANIM_editkeyframes_refresh(&ac);
/* set notifier tha things have changed */
/* set notifier that things have changed */
ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
return OPERATOR_FINISHED;
@@ -771,7 +771,7 @@ static int actkeys_sample_exec(bContext *C, wmOperator *op)
/* validate keyframes after editing */
ANIM_editkeyframes_refresh(&ac);
/* set notifier tha things have changed */
/* set notifier that things have changed */
ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
return OPERATOR_FINISHED;
@@ -846,7 +846,7 @@ static int actkeys_expo_exec(bContext *C, wmOperator *op)
/* validate keyframes after editing */
ANIM_editkeyframes_refresh(&ac);
/* set notifier tha things have changed */
/* set notifier that things have changed */
ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
return OPERATOR_FINISHED;
@@ -924,7 +924,7 @@ static int actkeys_ipo_exec(bContext *C, wmOperator *op)
/* validate keyframes after editing */
ANIM_editkeyframes_refresh(&ac);
/* set notifier tha things have changed */
/* set notifier that things have changed */
ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
return OPERATOR_FINISHED;
@@ -1022,7 +1022,7 @@ static int actkeys_handletype_exec(bContext *C, wmOperator *op)
/* validate keyframes after editing */
ANIM_editkeyframes_refresh(&ac);
/* set notifier tha things have changed */
/* set notifier that things have changed */
ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
return OPERATOR_FINISHED;
@@ -1098,7 +1098,7 @@ static int actkeys_cfrasnap_exec(bContext *C, wmOperator *op)
CFRA= (int)floor((bed.f1 / bed.i1) + 0.5f);
}
/* set notifier tha things have changed */
/* set notifier that things have changed */
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, ac.scene);
return OPERATOR_FINISHED;
@@ -1189,7 +1189,7 @@ static int actkeys_snap_exec(bContext *C, wmOperator *op)
/* validate keyframes after editing */
ANIM_editkeyframes_refresh(&ac);
/* set notifier tha things have changed */
/* set notifier that things have changed */
ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
return OPERATOR_FINISHED;
@@ -1304,7 +1304,7 @@ static int actkeys_mirror_exec(bContext *C, wmOperator *op)
/* validate keyframes after editing */
ANIM_editkeyframes_refresh(&ac);
/* set notifier tha things have changed */
/* set notifier that things have changed */
ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
return OPERATOR_FINISHED;

View File

@@ -93,11 +93,10 @@ static void action_keymap_keyframes (wmWindowManager *wm, ListBase *keymap)
{
/* action_select.c - selection tools */
/* click-select */
// TODO: column to alt, left-right to ctrl (for select-linked consistency)
WM_keymap_add_item(keymap, "ACT_OT_keyframes_clickselect", SELECTMOUSE, KM_PRESS, 0, 0);
RNA_boolean_set(WM_keymap_add_item(keymap, "ACT_OT_keyframes_clickselect", SELECTMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "column", 1);
RNA_boolean_set(WM_keymap_add_item(keymap, "ACT_OT_keyframes_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "column", 1);
RNA_boolean_set(WM_keymap_add_item(keymap, "ACT_OT_keyframes_clickselect", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", 1);
RNA_enum_set(WM_keymap_add_item(keymap, "ACT_OT_keyframes_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "left_right", ACTKEYS_LRSEL_TEST);
RNA_enum_set(WM_keymap_add_item(keymap, "ACT_OT_keyframes_clickselect", SELECTMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "left_right", ACTKEYS_LRSEL_TEST);
/* deselect all */
WM_keymap_add_item(keymap, "ACT_OT_keyframes_select_all_toggle", AKEY, KM_PRESS, 0, 0);

View File

@@ -322,7 +322,7 @@ static int actkeys_deselectall_exec(bContext *C, wmOperator *op)
else
deselect_action_keys(&ac, 1, SELECT_ADD);
/* set notifier tha things have changed */
/* set notifier that things have changed */
ED_area_tag_redraw(CTX_wm_area(C)); // FIXME... should be updating 'keyframes' data context or so instead!
return OPERATOR_FINISHED;
@@ -717,7 +717,7 @@ static int actkeys_columnselect_exec(bContext *C, wmOperator *op)
else
columnselect_action_keys(&ac, mode);
/* set notifier tha things have changed */
/* set notifier that things have changed */
ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_SELECT);
return OPERATOR_FINISHED;
@@ -751,7 +751,7 @@ void ACT_OT_keyframes_select_column (wmOperatorType *ot)
*/
/* defines for left-right select tool */
static EnumPropertyItem prop_leftright_select_types[] = {
static EnumPropertyItem prop_actkeys_leftright_select_types[] = {
{ACTKEYS_LRSEL_TEST, "CHECK", "Check if Select Left or Right", ""},
{ACTKEYS_LRSEL_NONE, "OFF", "Don't select", ""},
{ACTKEYS_LRSEL_LEFT, "LEFT", "Before current frame", ""},
@@ -759,6 +759,9 @@ static EnumPropertyItem prop_leftright_select_types[] = {
{0, NULL, NULL, NULL}
};
/* sensitivity factor for frame-selections */
#define FRAME_CLICK_THRESH 0.1f
/* ------------------- */
/* option 1) select keyframe directly under mouse */
@@ -949,10 +952,10 @@ static void selectkeys_leftright (bAnimContext *ac, short leftright, short selec
memset(&bed, 0, sizeof(BeztEditFunc));
if (leftright == ACTKEYS_LRSEL_LEFT) {
bed.f1 = -MAXFRAMEF;
bed.f2 = (float)(CFRA + 0.1f);
bed.f2 = (float)(CFRA + FRAME_CLICK_THRESH);
}
else {
bed.f1 = (float)(CFRA - 0.1f);
bed.f1 = (float)(CFRA - FRAME_CLICK_THRESH);
bed.f2 = MAXFRAMEF;
}
@@ -997,7 +1000,7 @@ static void mouse_columnselect_action_keys (bAnimContext *ac, float selx)
/* set up BezTriple edit callbacks */
select_cb= ANIM_editkeyframes_select(SELECT_ADD);
ok_cb= ANIM_editkeyframes_ok(BEZT_OK_FRAME);
ok_cb= ANIM_editkeyframes_ok(BEZT_OK_FRAMERANGE);
/* loop through all of the keys and select additional keyframes
* based on the keys found to be selected above
@@ -1013,10 +1016,14 @@ static void mouse_columnselect_action_keys (bAnimContext *ac, float selx)
/* set frame for validation callback to refer to */
// XXX have a more sensitive range?
if (nob)
bed.f1= get_action_frame(nob, selx);
else
bed.f1= selx;
if (nob) {
bed.f1= get_action_frame(nob, selx-FRAME_CLICK_THRESH);
bed.f2= get_action_frame(nob, selx+FRAME_CLICK_THRESH);
}
else {
bed.f1= selx-FRAME_CLICK_THRESH;
bed.f2= selx+FRAME_CLICK_THRESH;
}
/* select elements with frame number matching cfra */
ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, ok_cb, select_cb, NULL);
@@ -1099,7 +1106,7 @@ static int actkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even
// XXX activate transform...
}
/* set notifier tha things have changed */
/* set notifier that things have changed */
ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_BOTH);
/* for tweak grab to work */
@@ -1121,9 +1128,9 @@ void ACT_OT_keyframes_clickselect (wmOperatorType *ot)
/* id-props */
// XXX should we make this into separate operators?
RNA_def_enum(ot->srna, "left_right", NULL /* XXX prop_actkeys_clickselect_items */, 0, "Left Right", ""); // ALTKEY
RNA_def_enum(ot->srna, "left_right", prop_actkeys_leftright_select_types, 0, "Left Right", ""); // CTRLKEY
RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", ""); // SHIFTKEY
RNA_def_boolean(ot->srna, "column", 0, "Column Select", ""); // CTRLKEY
RNA_def_boolean(ot->srna, "column", 0, "Column Select", ""); // ALTKEY
}
/* ************************************************************************** */

View File

@@ -572,7 +572,7 @@ static int graphkeys_paste_exec(bContext *C, wmOperator *op)
/* validate keyframes after editing */
ANIM_editkeyframes_refresh(&ac);
/* set notifier tha things have changed */
/* set notifier that things have changed */
ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
return OPERATOR_FINISHED;
@@ -629,7 +629,7 @@ static int graphkeys_duplicate_exec(bContext *C, wmOperator *op)
/* validate keyframes after editing */
ANIM_editkeyframes_refresh(&ac);
/* set notifier tha things have changed */
/* set notifier that things have changed */
ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
return OPERATOR_FINISHED;
@@ -700,7 +700,7 @@ static int graphkeys_delete_exec(bContext *C, wmOperator *op)
/* validate keyframes after editing */
ANIM_editkeyframes_refresh(&ac);
/* set notifier tha things have changed */
/* set notifier that things have changed */
ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
return OPERATOR_FINISHED;
@@ -761,7 +761,7 @@ static int graphkeys_clean_exec(bContext *C, wmOperator *op)
/* validate keyframes after editing */
ANIM_editkeyframes_refresh(&ac);
/* set notifier tha things have changed */
/* set notifier that things have changed */
ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
return OPERATOR_FINISHED;
@@ -842,7 +842,7 @@ static int graphkeys_bake_exec(bContext *C, wmOperator *op)
/* validate keyframes after editing */
ANIM_editkeyframes_refresh(&ac);
/* set notifier tha things have changed */
/* set notifier that things have changed */
ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
return OPERATOR_FINISHED;
@@ -968,7 +968,7 @@ static int graphkeys_sample_exec(bContext *C, wmOperator *op)
/* validate keyframes after editing */
ANIM_editkeyframes_refresh(&ac);
/* set notifier tha things have changed */
/* set notifier that things have changed */
ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
return OPERATOR_FINISHED;
@@ -1042,7 +1042,7 @@ static int graphkeys_expo_exec(bContext *C, wmOperator *op)
/* validate keyframes after editing */
ANIM_editkeyframes_refresh(&ac);
/* set notifier tha things have changed */
/* set notifier that things have changed */
ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
return OPERATOR_FINISHED;
@@ -1118,7 +1118,7 @@ static int graphkeys_ipo_exec(bContext *C, wmOperator *op)
/* validate keyframes after editing */
ANIM_editkeyframes_refresh(&ac);
/* set notifier tha things have changed */
/* set notifier that things have changed */
ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
return OPERATOR_FINISHED;
@@ -1215,7 +1215,7 @@ static int graphkeys_handletype_exec(bContext *C, wmOperator *op)
/* validate keyframes after editing */
ANIM_editkeyframes_refresh(&ac);
/* set notifier tha things have changed */
/* set notifier that things have changed */
ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
return OPERATOR_FINISHED;
@@ -1376,7 +1376,7 @@ static int graphkeys_cfrasnap_exec(bContext *C, wmOperator *op)
CFRA= (int)floor((bed.f1 / bed.i1) + 0.5f);
}
/* set notifier tha things have changed */
/* set notifier that things have changed */
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, ac.scene);
return OPERATOR_FINISHED;
@@ -1463,7 +1463,7 @@ static int graphkeys_snap_exec(bContext *C, wmOperator *op)
/* validate keyframes after editing */
ANIM_editkeyframes_refresh(&ac);
/* set notifier tha things have changed */
/* set notifier that things have changed */
ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
return OPERATOR_FINISHED;
@@ -1573,7 +1573,7 @@ static int graphkeys_mirror_exec(bContext *C, wmOperator *op)
/* validate keyframes after editing */
ANIM_editkeyframes_refresh(&ac);
/* set notifier tha things have changed */
/* set notifier that things have changed */
ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
return OPERATOR_FINISHED;
@@ -1627,7 +1627,7 @@ static int graphkeys_smooth_exec(bContext *C, wmOperator *op)
/* validate keyframes after editing */
ANIM_editkeyframes_refresh(&ac);
/* set notifier tha things have changed */
/* set notifier that things have changed */
ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_VALUES);
return OPERATOR_FINISHED;

View File

@@ -146,11 +146,10 @@ static void graphedit_keymap_keyframes (wmWindowManager *wm, ListBase *keymap)
/* graph_select.c - selection tools */
/* click-select */
// TODO: column to alt, left-right to ctrl (for select-linked consistency)
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_CTRL, 0)->ptr, "column", 1);
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_ALT, 0)->ptr, "left_right", GRAPHKEYS_LRSEL_TEST);
RNA_enum_set(WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_clickselect", SELECTMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "left_right", GRAPHKEYS_LRSEL_TEST);
/* deselect all */
WM_keymap_add_item(keymap, "GRAPHEDIT_OT_keyframes_select_all_toggle", AKEY, KM_PRESS, 0, 0);

View File

@@ -164,7 +164,7 @@ static int graphkeys_deselectall_exec(bContext *C, wmOperator *op)
else
deselect_graph_keys(&ac, 1, SELECT_ADD);
/* set notifier tha things have changed */
/* set notifier that things have changed */
ED_area_tag_redraw(CTX_wm_area(C)); // FIXME... should be updating 'keyframes' data context or so instead!
return OPERATOR_FINISHED;
@@ -507,7 +507,7 @@ static int graphkeys_columnselect_exec(bContext *C, wmOperator *op)
else
columnselect_graph_keys(&ac, mode);
/* set notifier tha things have changed */
/* set notifier that things have changed */
ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_KEYFRAMES_SELECT);
return OPERATOR_FINISHED;
@@ -879,7 +879,7 @@ static int graphkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *ev
mouse_graph_keys(&ac, mval, selectmode); // xxx curves only should become an arg
}
/* set notifier tha things have changed */
/* set notifier that things have changed */
ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_BOTH);
/* for tweak grab to work */
@@ -898,9 +898,9 @@ void GRAPHEDIT_OT_keyframes_clickselect (wmOperatorType *ot)
/* id-props */
// XXX should we make this into separate operators?
RNA_def_enum(ot->srna, "left_right", NULL /* XXX prop_graphkeys_clickselect_items */, 0, "Left Right", ""); // ALTKEY
RNA_def_enum(ot->srna, "left_right", NULL /* XXX prop_graphkeys_clickselect_items */, 0, "Left Right", ""); // CTRLKEY
RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", ""); // SHIFTKEY
RNA_def_boolean(ot->srna, "column", 0, "Column Select", ""); // CTRLKEY
RNA_def_boolean(ot->srna, "column", 0, "Column Select", ""); // ALTKEY
}
/* ************************************************************************** */