Anim: Ctrl-shift channel selection. #118429

Open
Pratik Borhade wants to merge 2 commits from PratikPB2123/blender:anim-ctrl-shift-channels into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
2 changed files with 24 additions and 15 deletions
Showing only changes of commit 90d317bc0f - Show all commits

View File

@ -3595,10 +3595,12 @@ def km_animation_channels(params):
("anim.channels_click", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None),
("anim.channels_click", {"type": 'LEFTMOUSE', "value": 'CLICK', "shift": True},
{"properties": [("extend_range", True)]}),
("anim.channels_click", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True, "ctrl": True},
{"properties": [("extend_range", True), ("extend", True)]}),
("anim.channels_click", {"type": 'LEFTMOUSE', "value": 'CLICK', "ctrl": True},
{"properties": [("extend", True)]}),
("anim.channels_click", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True, "ctrl": True},
{"properties": [("children_only", True)]}),
# ("anim.channels_click", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True, "ctrl": True},
Review

I've commented this keymap. Does anyone have alternative keymap for children_only ? 🙂

I've commented this keymap. Does anyone have alternative keymap for `children_only` ? 🙂

I suggest Ctrl + Alt + LEFTMOUSE
This is also unused in the outliner so we might be able to introduce it there as well. Selecting the hierarchy can be quite useful.
I noticed though in the channels this isn't even working properly. It only works when selecting the FCurve group, not e.g. the action or the object channel. But that's for a different time to fix

I suggest Ctrl + Alt + LEFTMOUSE This is also unused in the outliner so we might be able to introduce it there as well. Selecting the hierarchy can be quite useful. I noticed though in the channels this isn't even working properly. It only works when selecting the FCurve group, not e.g. the action or the object channel. But that's for a different time to fix
# {"properties": [("children_only", True)]}),
# Rename.
("anim.channels_rename", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'}, None),
# Select keys.

View File

@ -3562,14 +3562,16 @@ static int click_select_channel_fcurve(bAnimContext *ac,
FCurve *fcu = (FCurve *)ale->data;
/* select/deselect */
if (selectmode == SELECT_INVERT) {
if (selectmode & SELECT_EXTEND_RANGE) {
if ((selectmode & SELECT_INVERT) == 0) {
ANIM_anim_channels_select_set(ac, ACHANNEL_SETFLAG_EXTEND_RANGE);
}
animchannel_select_range(ac, ale);
}
else if (selectmode & SELECT_INVERT) {
/* inverse selection status of this F-Curve only */
fcu->flag ^= FCURVE_SELECTED;
}
else if (selectmode == SELECT_EXTEND_RANGE) {
ANIM_anim_channels_select_set(ac, ACHANNEL_SETFLAG_EXTEND_RANGE);
animchannel_select_range(ac, ale);
}
else {
/* select F-Curve by itself */
ANIM_anim_channels_select_set(ac, ACHANNEL_SETFLAG_CLEAR);
@ -3578,7 +3580,7 @@ static int click_select_channel_fcurve(bAnimContext *ac,
/* if F-Curve is selected now, make F-Curve the 'active' one in the visible list.
* Similar to outliner, do not change active element when selecting elements in range. */
if ((fcu->flag & FCURVE_SELECTED) && (selectmode != SELECT_EXTEND_RANGE)) {
if ((fcu->flag & FCURVE_SELECTED) && ((selectmode & SELECT_EXTEND_RANGE) == 0)) {
ANIM_set_active_channel(ac,
ac->data,
eAnimCont_Types(ac->datatype),
@ -3915,7 +3917,8 @@ static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, const wmE
View2D *v2d;
int channel_index;
int notifierFlags = 0;
short selectmode;
short selectmode = 0;
bool select_mode_set = false;
float x, y;
/* get editor data */
@ -3929,17 +3932,21 @@ static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, const wmE

This bool doesn't seem necessary. Just initialise short selectmode = SELECT_EXTEND_RANGE and then overwrite that value when necessary.

This `bool` doesn't seem necessary. Just initialise `short selectmode = SELECT_EXTEND_RANGE` and then overwrite that value when necessary.
/* select mode is either replace (deselect all, then add) or add/extend */
if (RNA_boolean_get(op->ptr, "extend")) {
selectmode = SELECT_INVERT;
selectmode |= SELECT_INVERT;
select_mode_set = true;
}
else if (RNA_boolean_get(op->ptr, "extend_range")) {
selectmode = SELECT_EXTEND_RANGE;
if (RNA_boolean_get(op->ptr, "extend_range")) {
selectmode |= SELECT_EXTEND_RANGE;
select_mode_set = true;
}
else if (RNA_boolean_get(op->ptr, "children_only")) {
if (RNA_boolean_get(op->ptr, "children_only")) {
/* this is a bit of a special case for ActionGroups only...
* should it be removed or extended to all instead? */
selectmode = -1;
selectmode |= -1;
select_mode_set = true;
}
else {
if (select_mode_set == false) {
selectmode = SELECT_REPLACE;
}