Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_action')
-rw-r--r--source/blender/editors/space_action/action_ops.c32
-rw-r--r--source/blender/editors/space_action/action_select.c80
-rw-r--r--source/blender/editors/space_action/space_action.c2
3 files changed, 95 insertions, 19 deletions
diff --git a/source/blender/editors/space_action/action_ops.c b/source/blender/editors/space_action/action_ops.c
index 7d238bf7887..346ffcbc3e2 100644
--- a/source/blender/editors/space_action/action_ops.c
+++ b/source/blender/editors/space_action/action_ops.c
@@ -97,12 +97,9 @@ void ED_operatormacros_action(void)
ot = WM_operatortype_append_macro("ACTION_OT_duplicate_move", "Duplicate",
"Make a copy of all selected keyframes and move them",
OPTYPE_UNDO | OPTYPE_REGISTER);
- if (ot) {
- WM_operatortype_macro_define(ot, "ACTION_OT_duplicate");
- otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_transform");
- RNA_enum_set(otmacro->ptr, "mode", TFM_TIME_DUPLICATE);
- }
-
+ WM_operatortype_macro_define(ot, "ACTION_OT_duplicate");
+ otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_transform");
+ RNA_enum_set(otmacro->ptr, "mode", TFM_TIME_DUPLICATE);
}
/* ************************** registration - keymaps **********************************/
@@ -112,21 +109,38 @@ static void action_keymap_keyframes(wmKeyConfig *keyconf, wmKeyMap *keymap)
wmKeyMapItem *kmi;
/* action_select.c - selection tools */
- /* click-select */
+ /* click-select: keyframe (replace) */
kmi = WM_keymap_add_item(keymap, "ACTION_OT_clickselect", SELECTMOUSE, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
RNA_boolean_set(kmi->ptr, "column", FALSE);
+ RNA_boolean_set(kmi->ptr, "channel", FALSE);
+ /* click-select: all on same frame (replace) */
kmi = WM_keymap_add_item(keymap, "ACTION_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
RNA_boolean_set(kmi->ptr, "column", TRUE);
+ RNA_boolean_set(kmi->ptr, "channel", FALSE);
+ /* click-select: keyframe (add) */
kmi = WM_keymap_add_item(keymap, "ACTION_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
RNA_boolean_set(kmi->ptr, "column", FALSE);
+ RNA_boolean_set(kmi->ptr, "channel", FALSE);
+ /* click-select: all on same frame (add) */
kmi = WM_keymap_add_item(keymap, "ACTION_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT | KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
RNA_boolean_set(kmi->ptr, "column", TRUE);
+ RNA_boolean_set(kmi->ptr, "channel", FALSE);
+ /* click-select: all on same channel (replace) */
+ kmi = WM_keymap_add_item(keymap, "ACTION_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_CTRL | KM_ALT, 0);
+ RNA_boolean_set(kmi->ptr, "extend", FALSE);
+ RNA_boolean_set(kmi->ptr, "column", FALSE);
+ RNA_boolean_set(kmi->ptr, "channel", TRUE);
+ /* click-select: all on same channel (add) */
+ kmi = WM_keymap_add_item(keymap, "ACTION_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_CTRL | KM_ALT | KM_SHIFT, 0);
+ RNA_boolean_set(kmi->ptr, "extend", TRUE);
+ RNA_boolean_set(kmi->ptr, "column", FALSE);
+ RNA_boolean_set(kmi->ptr, "channel", TRUE);
- /* select left/right */
+ /* click-select: left/right */
kmi = WM_keymap_add_item(keymap, "ACTION_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
RNA_enum_set(kmi->ptr, "mode", ACTKEYS_LRSEL_TEST);
@@ -163,7 +177,7 @@ static void action_keymap_keyframes(wmKeyConfig *keyconf, wmKeyMap *keymap)
WM_keymap_add_item(keymap, "ACTION_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "ACTION_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
- /* select linekd */
+ /* select linked */
WM_keymap_add_item(keymap, "ACTION_OT_select_linked", LKEY, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index 9d124cf08ee..d62dd88418f 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -930,6 +930,7 @@ void ACTION_OT_select_leftright(wmOperatorType *ot)
* - 1) keyframe under mouse - no special modifiers
* - 2) all keyframes on the same side of current frame indicator as mouse - ALT modifier
* - 3) column select all keyframes in frame under mouse - CTRL modifier
+ * - 4) all keyframes in channel under mouse - CTRL+ALT modifiers
*
* In addition to these basic options, the SHIFT modifier can be used to toggle the
* selection mode between replacing the selection (without) and inverting the selection (with).
@@ -949,24 +950,31 @@ static void actkeys_mselect_single(bAnimContext *ac, bAnimListElem *ale, short s
ked.f1 = selx;
/* select the nominated keyframe on the given frame */
- if (ale->type == ANIMTYPE_GPLAYER)
+ if (ale->type == ANIMTYPE_GPLAYER) {
ED_gpencil_select_frame(ale->data, selx, select_mode);
- else if (ale->type == ANIMTYPE_MASKLAYER)
+ }
+ else if (ale->type == ANIMTYPE_MASKLAYER) {
ED_mask_select_frame(ale->data, selx, select_mode);
+ }
else {
if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK) &&
(ale->type == ANIMTYPE_SUMMARY) && (ale->datatype == ALE_ALL))
{
ListBase anim_data = {NULL, NULL};
int filter;
+
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY */ | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+
for (ale = anim_data.first; ale; ale = ale->next) {
- if (ale->type == ANIMTYPE_GPLAYER)
+ if (ale->type == ANIMTYPE_GPLAYER) {
ED_gpencil_select_frame(ale->data, selx, select_mode);
- else if (ale->type == ANIMTYPE_MASKLAYER)
+ }
+ else if (ale->type == ANIMTYPE_MASKLAYER) {
ED_mask_select_frame(ale->data, selx, select_mode);
+ }
}
+
BLI_freelistN(&anim_data);
}
else {
@@ -1023,10 +1031,52 @@ static void actkeys_mselect_column(bAnimContext *ac, short select_mode, float se
BLI_freelistN(&ked.list);
BLI_freelistN(&anim_data);
}
+
+/* option 4) select all keyframes in same channel */
+static void actkeys_mselect_channel_only(bAnimContext *ac, bAnimListElem *ale, short select_mode)
+{
+ KeyframeEditFunc select_cb;
+
+ /* get functions for selecting keyframes */
+ select_cb = ANIM_editkeyframes_select(select_mode);
+
+ /* select all keyframes in this channel */
+ if (ale->type == ANIMTYPE_GPLAYER) {
+ ED_gpencil_select_frames(ale->data, select_mode);
+ }
+ else if (ale->type == ANIMTYPE_MASKLAYER) {
+ ED_mask_select_frames(ale->data, select_mode);
+ }
+ else {
+ if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK) &&
+ (ale->type == ANIMTYPE_SUMMARY) && (ale->datatype == ALE_ALL))
+ {
+ ListBase anim_data = {NULL, NULL};
+ int filter;
+
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY */ | ANIMFILTER_NODUPLIS);
+ ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ if (ale->type == ANIMTYPE_GPLAYER) {
+ ED_gpencil_select_frames(ale->data, select_mode);
+ }
+ else if (ale->type == ANIMTYPE_MASKLAYER) {
+ ED_mask_select_frames(ale->data, select_mode);
+ }
+ }
+
+ BLI_freelistN(&anim_data);
+ }
+ else {
+ ANIM_animchannel_keyframes_loop(NULL, ac->ads, ale, NULL, select_cb, NULL);
+ }
+ }
+}
/* ------------------- */
-static void mouse_action_keys(bAnimContext *ac, const int mval[2], short select_mode, short column)
+static void mouse_action_keys(bAnimContext *ac, const int mval[2], short select_mode, bool column, bool same_channel)
{
ListBase anim_data = {NULL, NULL};
DLRBT_Tree anim_keys;
@@ -1211,6 +1261,10 @@ static void mouse_action_keys(bAnimContext *ac, const int mval[2], short select_
/* select all keyframes in the same frame as the one we hit on the active channel */
actkeys_mselect_column(ac, select_mode, selx);
}
+ else if (same_channel) {
+ /* select all keyframes in the active channel */
+ actkeys_mselect_channel_only(ac, ale, select_mode);
+ }
else {
/* select the nominated keyframe on the given frame */
actkeys_mselect_single(ac, ale, select_mode, selx);
@@ -1227,7 +1281,8 @@ static int actkeys_clickselect_invoke(bContext *C, wmOperator *op, const wmEvent
{
bAnimContext ac;
/* ARegion *ar; */ /* UNUSED */
- short selectmode, column;
+ short selectmode;
+ bool column, channel;
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
@@ -1244,9 +1299,10 @@ static int actkeys_clickselect_invoke(bContext *C, wmOperator *op, const wmEvent
/* column selection */
column = RNA_boolean_get(op->ptr, "column");
+ channel = RNA_boolean_get(op->ptr, "channel");
/* select keyframe(s) based upon mouse position*/
- mouse_action_keys(&ac, event->mval, selectmode, column);
+ mouse_action_keys(&ac, event->mval, selectmode, column, channel);
/* set notifier that keyframe selection (and channels too) have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | ND_ANIMCHAN | NA_SELECTED, NULL);
@@ -1272,10 +1328,16 @@ void ACTION_OT_clickselect(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO;
/* properties */
- prop = RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", ""); // SHIFTKEY
+ prop = RNA_def_boolean(ot->srna, "extend", 0, "Extend Select",
+ "Toggle keyframe selection instead of leaving newly selected keyframes only"); // SHIFTKEY
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+
+ prop = RNA_def_boolean(ot->srna, "column", 0, "Column Select",
+ "Select all keyframes that occur on the same frame as the one under the mouse"); // ALTKEY
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
- prop = RNA_def_boolean(ot->srna, "column", 0, "Column Select", ""); // ALTKEY
+ prop = RNA_def_boolean(ot->srna, "channel", 0, "Only Channel",
+ "Select all the keyframes in the channel under the mouse"); // CTRLKEY + ALTKEY
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index a89a02b7e01..fdccedd9c3c 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -541,7 +541,7 @@ void ED_spacetype_action(void)
art = MEM_callocN(sizeof(ARegionType), "spacetype action region");
art->regionid = RGN_TYPE_CHANNELS;
art->prefsizex = 200;
- art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D;
+ art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES;
art->init = action_channel_area_init;
art->draw = action_channel_area_draw;