Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_action/action_select.c
| Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | |||||
| #include "DNA_mask_types.h" | #include "DNA_mask_types.h" | ||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| #include "RNA_define.h" | #include "RNA_define.h" | ||||
| #include "BKE_fcurve.h" | #include "BKE_fcurve.h" | ||||
| #include "BKE_nla.h" | #include "BKE_nla.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_gpencil.h" | |||||
| #include "UI_view2d.h" | #include "UI_view2d.h" | ||||
| #include "ED_anim_api.h" | #include "ED_anim_api.h" | ||||
| #include "ED_gpencil.h" | #include "ED_gpencil.h" | ||||
| #include "ED_mask.h" | #include "ED_mask.h" | ||||
| #include "ED_keyframes_draw.h" | #include "ED_keyframes_draw.h" | ||||
| #include "ED_keyframes_edit.h" | #include "ED_keyframes_edit.h" | ||||
| ▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | if (test) { | ||||
| } | } | ||||
| } | } | ||||
| /* convert sel to selectmode, and use that to get editor */ | /* convert sel to selectmode, and use that to get editor */ | ||||
| sel_cb = ANIM_editkeyframes_select(sel); | sel_cb = ANIM_editkeyframes_select(sel); | ||||
| /* Now set the flags */ | /* Now set the flags */ | ||||
| for (ale = anim_data.first; ale; ale = ale->next) { | for (ale = anim_data.first; ale; ale = ale->next) { | ||||
| if (ale->type == ANIMTYPE_GPLAYER) | if (ale->type == ANIMTYPE_GPLAYER) { | ||||
| ED_gplayer_frame_select_set(ale->data, sel); | ED_gplayer_frame_select_set(ale->data, sel); | ||||
| else if (ale->type == ANIMTYPE_MASKLAYER) | ale->update |= ANIM_UPDATE_DEPS; | ||||
| } | |||||
| else if (ale->type == ANIMTYPE_MASKLAYER) { | |||||
| ED_masklayer_frame_select_set(ale->data, sel); | ED_masklayer_frame_select_set(ale->data, sel); | ||||
| else | } | ||||
| else { | |||||
| ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, sel_cb, NULL); | ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, sel_cb, NULL); | ||||
| } | } | ||||
| } | |||||
| /* Cleanup */ | /* Cleanup */ | ||||
| ANIM_animdata_update(ac, &anim_data); | |||||
| ANIM_animdata_freelist(&anim_data); | ANIM_animdata_freelist(&anim_data); | ||||
| } | } | ||||
| /* ------------------- */ | /* ------------------- */ | ||||
| static int actkeys_deselectall_exec(bContext *C, wmOperator *op) | static int actkeys_deselectall_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| bAnimContext ac; | bAnimContext ac; | ||||
| ▲ Show 20 Lines • Show All 124 Lines • ▼ Show 20 Lines | |||||
| #if 0 /* XXX: Keyframes are not currently shown here */ | #if 0 /* XXX: Keyframes are not currently shown here */ | ||||
| case ANIMTYPE_GPDATABLOCK: | case ANIMTYPE_GPDATABLOCK: | ||||
| { | { | ||||
| bGPdata *gpd = ale->data; | bGPdata *gpd = ale->data; | ||||
| bGPDlayer *gpl; | bGPDlayer *gpl; | ||||
| for (gpl = gpd->layers.first; gpl; gpl = gpl->next) { | for (gpl = gpd->layers.first; gpl; gpl = gpl->next) { | ||||
| ED_gplayer_frames_select_border(gpl, rectf.xmin, rectf.xmax, selectmode); | ED_gplayer_frames_select_border(gpl, rectf.xmin, rectf.xmax, selectmode); | ||||
| } | } | ||||
| ale->update |= ANIM_UPDATE_DEPS; | |||||
| break; | break; | ||||
| } | } | ||||
| #endif | #endif | ||||
| case ANIMTYPE_GPLAYER: | case ANIMTYPE_GPLAYER: | ||||
| { | |||||
| ED_gplayer_frames_select_border(ale->data, rectf.xmin, rectf.xmax, selectmode); | ED_gplayer_frames_select_border(ale->data, rectf.xmin, rectf.xmax, selectmode); | ||||
| ale->update |= ANIM_UPDATE_DEPS; | |||||
| break; | break; | ||||
| } | |||||
| case ANIMTYPE_MASKDATABLOCK: | case ANIMTYPE_MASKDATABLOCK: | ||||
| { | { | ||||
| Mask *mask = ale->data; | Mask *mask = ale->data; | ||||
| MaskLayer *masklay; | MaskLayer *masklay; | ||||
| for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { | for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { | ||||
| ED_masklayer_frames_select_border(masklay, rectf.xmin, rectf.xmax, selectmode); | ED_masklayer_frames_select_border(masklay, rectf.xmin, rectf.xmax, selectmode); | ||||
| } | } | ||||
| break; | break; | ||||
| } | } | ||||
| case ANIMTYPE_MASKLAYER: | case ANIMTYPE_MASKLAYER: | ||||
| ED_masklayer_frames_select_border(ale->data, rectf.xmin, rectf.xmax, selectmode); | ED_masklayer_frames_select_border(ale->data, rectf.xmin, rectf.xmax, selectmode); | ||||
| break; | break; | ||||
| default: | default: | ||||
| ANIM_animchannel_keyframes_loop(&ked, ac->ads, ale, ok_cb, select_cb, NULL); | ANIM_animchannel_keyframes_loop(&ked, ac->ads, ale, ok_cb, select_cb, NULL); | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| /* set minimum extent to be the maximum of the next channel */ | /* set minimum extent to be the maximum of the next channel */ | ||||
| ymax = ymin; | ymax = ymin; | ||||
| } | } | ||||
| /* cleanup */ | /* cleanup */ | ||||
| ANIM_animdata_update(ac, &anim_data); | |||||
| ANIM_animdata_freelist(&anim_data); | ANIM_animdata_freelist(&anim_data); | ||||
| } | } | ||||
| /* ------------------- */ | /* ------------------- */ | ||||
| static int actkeys_borderselect_exec(bContext *C, wmOperator *op) | static int actkeys_borderselect_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| bAnimContext ac; | bAnimContext ac; | ||||
| ▲ Show 20 Lines • Show All 165 Lines • ▼ Show 20 Lines | #if 0 /* XXX: Keyframes are not currently shown here */ | ||||
| ED_gplayer_frames_select_region(&ked, ale->data, mode, selectmode); | ED_gplayer_frames_select_region(&ked, ale->data, mode, selectmode); | ||||
| } | } | ||||
| break; | break; | ||||
| } | } | ||||
| #endif | #endif | ||||
| case ANIMTYPE_GPLAYER: | case ANIMTYPE_GPLAYER: | ||||
| { | { | ||||
| ED_gplayer_frames_select_region(&ked, ale->data, mode, selectmode); | ED_gplayer_frames_select_region(&ked, ale->data, mode, selectmode); | ||||
| ale->update |= ANIM_UPDATE_DEPS; | |||||
| break; | break; | ||||
| } | } | ||||
| case ANIMTYPE_MASKDATABLOCK: | case ANIMTYPE_MASKDATABLOCK: | ||||
| { | { | ||||
| Mask *mask = ale->data; | Mask *mask = ale->data; | ||||
| MaskLayer *masklay; | MaskLayer *masklay; | ||||
| for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { | for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { | ||||
| ED_masklayer_frames_select_region(&ked, masklay, mode, selectmode); | ED_masklayer_frames_select_region(&ked, masklay, mode, selectmode); | ||||
| Show All 11 Lines | #endif | ||||
| } | } | ||||
| } | } | ||||
| /* set minimum extent to be the maximum of the next channel */ | /* set minimum extent to be the maximum of the next channel */ | ||||
| ymax = ymin; | ymax = ymin; | ||||
| } | } | ||||
| /* cleanup */ | /* cleanup */ | ||||
| ANIM_animdata_update(ac, &anim_data); | |||||
| ANIM_animdata_freelist(&anim_data); | ANIM_animdata_freelist(&anim_data); | ||||
| } | } | ||||
| /* ----------------------------------- */ | /* ----------------------------------- */ | ||||
| static int actkeys_lassoselect_exec(bContext *C, wmOperator *op) | static int actkeys_lassoselect_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| bAnimContext ac; | bAnimContext ac; | ||||
| ▲ Show 20 Lines • Show All 171 Lines • ▼ Show 20 Lines | for (ale = anim_data.first; ale; ale = ale->next) { | ||||
| if (adt) { | if (adt) { | ||||
| ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); | ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); | ||||
| ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL); | ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL); | ||||
| ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); | ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); | ||||
| } | } | ||||
| else if (ale->type == ANIMTYPE_GPLAYER) { | else if (ale->type == ANIMTYPE_GPLAYER) { | ||||
| ED_gplayer_frames_select_border(ale->data, min, max, SELECT_ADD); | ED_gplayer_frames_select_border(ale->data, min, max, SELECT_ADD); | ||||
| ale->update |= ANIM_UPDATE_DEPS; | |||||
| } | } | ||||
| else if (ale->type == ANIMTYPE_MASKLAYER) { | else if (ale->type == ANIMTYPE_MASKLAYER) { | ||||
| ED_masklayer_frames_select_border(ale->data, min, max, SELECT_ADD); | ED_masklayer_frames_select_border(ale->data, min, max, SELECT_ADD); | ||||
| } | } | ||||
| else { | else { | ||||
| ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL); | ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL); | ||||
| } | } | ||||
| } | } | ||||
| /* Cleanup */ | /* Cleanup */ | ||||
| ANIM_animdata_update(ac, &anim_data); | |||||
| ANIM_animdata_freelist(&anim_data); | ANIM_animdata_freelist(&anim_data); | ||||
| } | } | ||||
| /* Selects all visible keyframes in the same frames as the specified elements */ | /* Selects all visible keyframes in the same frames as the specified elements */ | ||||
| static void columnselect_action_keys(bAnimContext *ac, short mode) | static void columnselect_action_keys(bAnimContext *ac, short mode) | ||||
| { | { | ||||
| ListBase anim_data = {NULL, NULL}; | ListBase anim_data = {NULL, NULL}; | ||||
| ▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | for (ale = anim_data.first; ale; ale = ale->next) { | ||||
| for (ce = ked.list.first; ce; ce = ce->next) { | for (ce = ked.list.first; ce; ce = ce->next) { | ||||
| /* set frame for validation callback to refer to */ | /* set frame for validation callback to refer to */ | ||||
| if (adt) | if (adt) | ||||
| ked.f1 = BKE_nla_tweakedit_remap(adt, ce->cfra, NLATIME_CONVERT_UNMAP); | ked.f1 = BKE_nla_tweakedit_remap(adt, ce->cfra, NLATIME_CONVERT_UNMAP); | ||||
| else | else | ||||
| ked.f1 = ce->cfra; | ked.f1 = ce->cfra; | ||||
| /* select elements with frame number matching cfraelem */ | /* select elements with frame number matching cfraelem */ | ||||
| if (ale->type == ANIMTYPE_GPLAYER) | if (ale->type == ANIMTYPE_GPLAYER) { | ||||
| ED_gpencil_select_frame(ale->data, ce->cfra, SELECT_ADD); | ED_gpencil_select_frame(ale->data, ce->cfra, SELECT_ADD); | ||||
| else if (ale->type == ANIMTYPE_MASKLAYER) | ale->update |= ANIM_UPDATE_DEPS; | ||||
| } | |||||
| else if (ale->type == ANIMTYPE_MASKLAYER) { | |||||
| ED_mask_select_frame(ale->data, ce->cfra, SELECT_ADD); | ED_mask_select_frame(ale->data, ce->cfra, SELECT_ADD); | ||||
| else | } | ||||
| else { | |||||
| ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL); | ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL); | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| /* free elements */ | /* free elements */ | ||||
| BLI_freelistN(&ked.list); | BLI_freelistN(&ked.list); | ||||
| ANIM_animdata_update(ac, &anim_data); | |||||
| ANIM_animdata_freelist(&anim_data); | ANIM_animdata_freelist(&anim_data); | ||||
| } | } | ||||
| /* ------------------- */ | /* ------------------- */ | ||||
| static int actkeys_columnselect_exec(bContext *C, wmOperator *op) | static int actkeys_columnselect_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| bAnimContext ac; | bAnimContext ac; | ||||
| ▲ Show 20 Lines • Show All 258 Lines • ▼ Show 20 Lines | static void actkeys_select_leftright(bAnimContext *ac, short leftright, short select_mode) | ||||
| for (ale = anim_data.first; ale; ale = ale->next) { | for (ale = anim_data.first; ale; ale = ale->next) { | ||||
| AnimData *adt = ANIM_nla_mapping_get(ac, ale); | AnimData *adt = ANIM_nla_mapping_get(ac, ale); | ||||
| if (adt) { | if (adt) { | ||||
| ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); | ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); | ||||
| ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL); | ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL); | ||||
| ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); | ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); | ||||
| } | } | ||||
| else if (ale->type == ANIMTYPE_GPLAYER) | else if (ale->type == ANIMTYPE_GPLAYER) { | ||||
| ED_gplayer_frames_select_border(ale->data, ked.f1, ked.f2, select_mode); | ED_gplayer_frames_select_border(ale->data, ked.f1, ked.f2, select_mode); | ||||
| else if (ale->type == ANIMTYPE_MASKLAYER) | ale->update |= ANIM_UPDATE_DEPS; | ||||
| } | |||||
| else if (ale->type == ANIMTYPE_MASKLAYER) { | |||||
| ED_masklayer_frames_select_border(ale->data, ked.f1, ked.f2, select_mode); | ED_masklayer_frames_select_border(ale->data, ked.f1, ked.f2, select_mode); | ||||
| else | } | ||||
| else { | |||||
| ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL); | ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL); | ||||
| } | } | ||||
| } | |||||
| /* Sync marker support */ | /* Sync marker support */ | ||||
| if (select_mode == SELECT_ADD) { | if (select_mode == SELECT_ADD) { | ||||
| SpaceAction *saction = (SpaceAction *)ac->sl; | SpaceAction *saction = (SpaceAction *)ac->sl; | ||||
| if ((saction) && (saction->flag & SACTION_MARKERS_MOVE)) { | if ((saction) && (saction->flag & SACTION_MARKERS_MOVE)) { | ||||
| ListBase *markers = ED_animcontext_get_markers(ac); | ListBase *markers = ED_animcontext_get_markers(ac); | ||||
| TimeMarker *marker; | TimeMarker *marker; | ||||
| for (marker = markers->first; marker; marker = marker->next) { | for (marker = markers->first; marker; marker = marker->next) { | ||||
| if (((leftright == ACTKEYS_LRSEL_LEFT) && (marker->frame < CFRA)) || | if (((leftright == ACTKEYS_LRSEL_LEFT) && (marker->frame < CFRA)) || | ||||
| ((leftright == ACTKEYS_LRSEL_RIGHT) && (marker->frame >= CFRA))) | ((leftright == ACTKEYS_LRSEL_RIGHT) && (marker->frame >= CFRA))) | ||||
| { | { | ||||
| marker->flag |= SELECT; | marker->flag |= SELECT; | ||||
| } | } | ||||
| else { | else { | ||||
| marker->flag &= ~SELECT; | marker->flag &= ~SELECT; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* Cleanup */ | /* Cleanup */ | ||||
| ANIM_animdata_update(ac, &anim_data); | |||||
| ANIM_animdata_freelist(&anim_data); | ANIM_animdata_freelist(&anim_data); | ||||
| } | } | ||||
| /* ----------------- */ | /* ----------------- */ | ||||
| static int actkeys_select_leftright_exec(bContext *C, wmOperator *op) | static int actkeys_select_leftright_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| bAnimContext ac; | bAnimContext ac; | ||||
| ▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Lines | static void actkeys_mselect_single(bAnimContext *ac, bAnimListElem *ale, short select_mode, float selx) | ||||
| select_cb = ANIM_editkeyframes_select(select_mode); | select_cb = ANIM_editkeyframes_select(select_mode); | ||||
| ok_cb = ANIM_editkeyframes_ok(BEZT_OK_FRAME); | ok_cb = ANIM_editkeyframes_ok(BEZT_OK_FRAME); | ||||
| ked.f1 = selx; | ked.f1 = selx; | ||||
| ked.iterflags |= KED_F1_NLA_UNMAP; | ked.iterflags |= KED_F1_NLA_UNMAP; | ||||
| /* select the nominated keyframe on the given frame */ | /* 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); | ED_gpencil_select_frame(ale->data, selx, select_mode); | ||||
| ale->update |= ANIM_UPDATE_DEPS; | |||||
| } | } | ||||
| else if (ale->type == ANIMTYPE_MASKLAYER) { | else if (ale->type == ANIMTYPE_MASKLAYER) { | ||||
| ED_mask_select_frame(ale->data, selx, select_mode); | ED_mask_select_frame(ale->data, selx, select_mode); | ||||
| } | } | ||||
| else { | else { | ||||
| if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK) && | if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK) && | ||||
| (ale->type == ANIMTYPE_SUMMARY) && (ale->datatype == ALE_ALL)) | (ale->type == ANIMTYPE_SUMMARY) && (ale->datatype == ALE_ALL)) | ||||
| { | { | ||||
| ListBase anim_data = {NULL, NULL}; | ListBase anim_data = {NULL, NULL}; | ||||
| int filter; | int filter; | ||||
| filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY */ | ANIMFILTER_NODUPLIS); | filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY */ | ANIMFILTER_NODUPLIS); | ||||
| ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); | ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); | ||||
| for (ale = anim_data.first; ale; ale = ale->next) { | 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); | ED_gpencil_select_frame(ale->data, selx, select_mode); | ||||
| ale->update |= ANIM_UPDATE_DEPS; | |||||
| } | } | ||||
| else if (ale->type == ANIMTYPE_MASKLAYER) { | else if (ale->type == ANIMTYPE_MASKLAYER) { | ||||
| ED_mask_select_frame(ale->data, selx, select_mode); | ED_mask_select_frame(ale->data, selx, select_mode); | ||||
| } | } | ||||
| } | } | ||||
| ANIM_animdata_update(ac, &anim_data); | |||||
| ANIM_animdata_freelist(&anim_data); | ANIM_animdata_freelist(&anim_data); | ||||
| } | } | ||||
| else { | else { | ||||
| ANIM_animchannel_keyframes_loop(&ked, ac->ads, ale, ok_cb, select_cb, NULL); | ANIM_animchannel_keyframes_loop(&ked, ac->ads, ale, ok_cb, select_cb, NULL); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| Show All 28 Lines | for (ale = anim_data.first; ale; ale = ale->next) { | ||||
| /* set frame for validation callback to refer to */ | /* set frame for validation callback to refer to */ | ||||
| if (adt) | if (adt) | ||||
| ked.f1 = BKE_nla_tweakedit_remap(adt, selx, NLATIME_CONVERT_UNMAP); | ked.f1 = BKE_nla_tweakedit_remap(adt, selx, NLATIME_CONVERT_UNMAP); | ||||
| else | else | ||||
| ked.f1 = selx; | ked.f1 = selx; | ||||
| /* select elements with frame number matching cfra */ | /* select elements with frame number matching cfra */ | ||||
| if (ale->type == ANIMTYPE_GPLAYER) | if (ale->type == ANIMTYPE_GPLAYER) { | ||||
| ED_gpencil_select_frame(ale->key_data, selx, select_mode); | ED_gpencil_select_frame(ale->key_data, selx, select_mode); | ||||
| else if (ale->type == ANIMTYPE_MASKLAYER) | ale->update |= ANIM_UPDATE_DEPS; | ||||
| } | |||||
| else if (ale->type == ANIMTYPE_MASKLAYER) { | |||||
| ED_mask_select_frame(ale->key_data, selx, select_mode); | ED_mask_select_frame(ale->key_data, selx, select_mode); | ||||
| else | } | ||||
| else { | |||||
| ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL); | ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL); | ||||
| } | } | ||||
| } | |||||
| /* free elements */ | /* free elements */ | ||||
| BLI_freelistN(&ked.list); | BLI_freelistN(&ked.list); | ||||
| ANIM_animdata_update(ac, &anim_data); | |||||
| ANIM_animdata_freelist(&anim_data); | ANIM_animdata_freelist(&anim_data); | ||||
| } | } | ||||
| /* option 4) select all keyframes in same channel */ | /* option 4) select all keyframes in same channel */ | ||||
| static void actkeys_mselect_channel_only(bAnimContext *ac, bAnimListElem *ale, short select_mode) | static void actkeys_mselect_channel_only(bAnimContext *ac, bAnimListElem *ale, short select_mode) | ||||
| { | { | ||||
| KeyframeEditFunc select_cb; | KeyframeEditFunc select_cb; | ||||
| /* get functions for selecting keyframes */ | /* get functions for selecting keyframes */ | ||||
| select_cb = ANIM_editkeyframes_select(select_mode); | select_cb = ANIM_editkeyframes_select(select_mode); | ||||
| /* select all keyframes in this channel */ | /* select all keyframes in this channel */ | ||||
| if (ale->type == ANIMTYPE_GPLAYER) { | if (ale->type == ANIMTYPE_GPLAYER) { | ||||
| ED_gpencil_select_frames(ale->data, select_mode); | ED_gpencil_select_frames(ale->data, select_mode); | ||||
| ale->update = ANIM_UPDATE_DEPS; | |||||
| } | } | ||||
| else if (ale->type == ANIMTYPE_MASKLAYER) { | else if (ale->type == ANIMTYPE_MASKLAYER) { | ||||
| ED_mask_select_frames(ale->data, select_mode); | ED_mask_select_frames(ale->data, select_mode); | ||||
| } | } | ||||
| else { | else { | ||||
| if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK) && | if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK) && | ||||
| (ale->type == ANIMTYPE_SUMMARY) && (ale->datatype == ALE_ALL)) | (ale->type == ANIMTYPE_SUMMARY) && (ale->datatype == ALE_ALL)) | ||||
| { | { | ||||
| ListBase anim_data = {NULL, NULL}; | ListBase anim_data = {NULL, NULL}; | ||||
| int filter; | int filter; | ||||
| filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY */ | ANIMFILTER_NODUPLIS); | filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY */ | ANIMFILTER_NODUPLIS); | ||||
| ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); | ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); | ||||
| for (ale = anim_data.first; ale; ale = ale->next) { | for (ale = anim_data.first; ale; ale = ale->next) { | ||||
| if (ale->type == ANIMTYPE_GPLAYER) { | if (ale->type == ANIMTYPE_GPLAYER) { | ||||
| ED_gpencil_select_frames(ale->data, select_mode); | ED_gpencil_select_frames(ale->data, select_mode); | ||||
| ale->update |= ANIM_UPDATE_DEPS; | |||||
| } | } | ||||
| else if (ale->type == ANIMTYPE_MASKLAYER) { | else if (ale->type == ANIMTYPE_MASKLAYER) { | ||||
| ED_mask_select_frames(ale->data, select_mode); | ED_mask_select_frames(ale->data, select_mode); | ||||
| } | } | ||||
| } | } | ||||
| ANIM_animdata_update(ac, &anim_data); | |||||
| ANIM_animdata_freelist(&anim_data); | ANIM_animdata_freelist(&anim_data); | ||||
| } | } | ||||
| else { | else { | ||||
| ANIM_animchannel_keyframes_loop(NULL, ac->ads, ale, NULL, select_cb, NULL); | ANIM_animchannel_keyframes_loop(NULL, ac->ads, ale, NULL, select_cb, NULL); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 116 Lines • ▼ Show 20 Lines | for (ak = anim_keys.root; ak; ak = akn) { | ||||
| else if (ak->cfra < rectf.xmin) | else if (ak->cfra < rectf.xmin) | ||||
| akn = ak->right; | akn = ak->right; | ||||
| else | else | ||||
| akn = ak->left; | akn = ak->left; | ||||
| } | } | ||||
| /* remove active channel from list of channels for separate treatment (since it's needed later on) */ | /* remove active channel from list of channels for separate treatment (since it's needed later on) */ | ||||
| BLI_remlink(&anim_data, ale); | BLI_remlink(&anim_data, ale); | ||||
| ale->next = ale->prev = NULL; | |||||
| /* cleanup temporary lists */ | /* cleanup temporary lists */ | ||||
| BLI_dlrbTree_free(&anim_keys); | BLI_dlrbTree_free(&anim_keys); | ||||
| /* free list of channels, since it's not used anymore */ | /* free list of channels, since it's not used anymore */ | ||||
| ANIM_animdata_freelist(&anim_data); | ANIM_animdata_freelist(&anim_data); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | if (found) { | ||||
| actkeys_mselect_channel_only(ac, ale, select_mode); | actkeys_mselect_channel_only(ac, ale, select_mode); | ||||
| } | } | ||||
| else { | else { | ||||
| /* select the nominated keyframe on the given frame */ | /* select the nominated keyframe on the given frame */ | ||||
| actkeys_mselect_single(ac, ale, select_mode, selx); | actkeys_mselect_single(ac, ale, select_mode, selx); | ||||
| } | } | ||||
| } | } | ||||
| /* flush tagged updates | |||||
| * NOTE: We temporarily add this channel back to the list so that this can happen | |||||
| */ | |||||
| anim_data.first = anim_data.last = ale; | |||||
| ANIM_animdata_update(ac, &anim_data); | |||||
| /* free this channel */ | /* free this channel */ | ||||
| MEM_freeN(ale); | MEM_freeN(ale); | ||||
| } | } | ||||
| } | } | ||||
| /* handle clicking */ | /* handle clicking */ | ||||
| static int actkeys_clickselect_invoke(bContext *C, wmOperator *op, const wmEvent *event) | static int actkeys_clickselect_invoke(bContext *C, wmOperator *op, const wmEvent *event) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 64 Lines • Show Last 20 Lines | |||||