diff --git a/source/blender/editors/animation/anim_channels_defines.cc b/source/blender/editors/animation/anim_channels_defines.cc index b813478c8e8..3c1327a09ad 100644 --- a/source/blender/editors/animation/anim_channels_defines.cc +++ b/source/blender/editors/animation/anim_channels_defines.cc @@ -1133,7 +1133,7 @@ static void acf_nla_controls_name(bAnimListElem * /*ale*/, char *name) BLI_strncpy_utf8(name, IFACE_("NLA Strip Controls"), ANIM_CHAN_NAME_SIZE); } -/* check if some setting exists for this channel */ +/* check if some setting exists for this track */ static bool acf_nla_controls_setting_valid(bAnimContext * /*ac*/, bAnimListElem * /*ale*/, eAnimChannel_Settings setting) @@ -1189,7 +1189,7 @@ static int acf_nla_controls_icon(bAnimListElem * /*ale*/) /** NLA Control F-Curves expander type define. */ static bAnimChannelType ACF_NLACONTROLS = { /*channel_type_name*/ "NLA Controls Expander", - /*channel_role*/ ACHANNEL_ROLE_EXPANDER, + /*track_role*/ ACHANNEL_ROLE_EXPANDER, /*get_backdrop_color*/ acf_nla_controls_color, /*get_channel_color*/ nullptr, @@ -4080,7 +4080,7 @@ static int acf_nlaaction_icon(bAnimListElem *ale) return ICON_ACTION; } -/* Backdrop color for nla action channel +/* Backdrop color for nla action track * Although this can't be used directly for NLA Action drawing, * it is still needed for use behind the RHS toggles */ @@ -4090,19 +4090,19 @@ static void acf_nlaaction_color(bAnimContext * /*ac*/, bAnimListElem *ale, float /* Action Line * The alpha values action_get_color returns are only useful for drawing - * strips backgrounds but here we're doing channel list backgrounds instead + * strips backgrounds but here we're doing track list backgrounds instead * so we ignore that and use our own when needed */ nla_action_get_color(ale->adt, (bAction *)ale->data, color); /* NOTE: since the return types only allow rgb, we cannot do the alpha-blending we'd * like for the solo-drawing case. Hence, this method isn't actually used for drawing - * most of the channel... + * most of the track... */ copy_v3_v3(r_color, color); } -/* backdrop for nla action channel */ +/* backdrop for nla action track */ static void acf_nlaaction_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc) { const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale); @@ -4113,7 +4113,7 @@ static void acf_nlaaction_backdrop(bAnimContext *ac, bAnimListElem *ale, float y /* Action Line * The alpha values action_get_color returns are only useful for drawing - * strips backgrounds but here we're doing channel list backgrounds instead + * strips backgrounds but here we're doing track list backgrounds instead * so we ignore that and use our own when needed */ nla_action_get_color(adt, (bAction *)ale->data, color); @@ -4125,19 +4125,19 @@ static void acf_nlaaction_backdrop(bAnimContext *ac, bAnimListElem *ale, float y color[3] = (adt && (adt->flag & ADT_NLA_SOLO_TRACK)) ? 0.3f : 1.0f; } - /* only on top left corner, to show that this channel sits on top of the preceding ones + /* only on top left corner, to show that this track sits on top of the preceding ones * while still linking into the action line strip to the right */ UI_draw_roundbox_corner_set(UI_CNR_TOP_LEFT); - /* draw slightly shifted up vertically to look like it has more separation from other channels, + /* draw slightly shifted up vertically to look like it has more separation from other tracks, * but we then need to slightly shorten it so that it doesn't look like it overlaps */ rctf box; box.xmin = offset; box.xmax = float(v2d->cur.xmax); - box.ymin = yminc + NLACHANNEL_SKIP; - box.ymax = ymaxc + NLACHANNEL_SKIP - 1; + box.ymin = yminc + NLATRACK_SKIP; + box.ymax = ymaxc + NLATRACK_SKIP - 1; UI_draw_roundbox_4fv(&box, true, 8, color); } @@ -4170,7 +4170,7 @@ static bool acf_nlaaction_name_prop(bAnimListElem *ale, PointerRNA *r_ptr, Prope return false; } -/* check if some setting exists for this channel */ +/* check if some setting exists for this track */ static bool acf_nlaaction_setting_valid(bAnimContext * /*ac*/, bAnimListElem *ale, eAnimChannel_Settings setting) @@ -4853,9 +4853,9 @@ void ANIM_channel_draw( /* NOTE: technically, NLA Action "pushdown" should be here too, * but there are no sliders there. */ - /* NLA action channels have slightly different spacing requirements... */ + /* NLA action tracks have slightly different spacing requirements... */ if (ale->type == ANIMTYPE_NLAACTION) { - ymin_ofs = NLACHANNEL_SKIP; + ymin_ofs = NLATRACK_SKIP; } } diff --git a/source/blender/editors/animation/anim_channels_edit.cc b/source/blender/editors/animation/anim_channels_edit.cc index 4fd07486bbb..0ecd140fc4f 100644 --- a/source/blender/editors/animation/anim_channels_edit.cc +++ b/source/blender/editors/animation/anim_channels_edit.cc @@ -1340,7 +1340,7 @@ static bool rearrange_animchannel_islands(ListBase *list, * ! NLA tracks are displayed in opposite order, so directions need care * mode: REARRANGE_ANIMCHAN_* */ -static void rearrange_nla_channels(bAnimContext *ac, AnimData *adt, eRearrangeAnimChan_Mode mode) +static void rearrange_nla_tracks(bAnimContext *ac, AnimData *adt, eRearrangeAnimChan_Mode mode) { AnimChanRearrangeFp rearrange_func; ListBase anim_data_visible = {nullptr, nullptr}; @@ -1773,7 +1773,7 @@ static int animchannels_rearrange_exec(bContext *C, wmOperator *op) switch (ac.datatype) { case ANIMCONT_NLA: /* NLA-tracks only */ - rearrange_nla_channels(&ac, adt, mode); + rearrange_nla_tracks(&ac, adt, mode); DEG_id_tag_update(ale->id, ID_RECALC_ANIMATION); break; @@ -2983,7 +2983,7 @@ static void box_select_anim_channels(bAnimContext *ac, rcti *rect, short selectm float ymax; if (ac->datatype == ANIMCONT_NLA) { - ymax = NLACHANNEL_FIRST_TOP(ac); + ymax = NLATRACK_FIRST_TOP(ac); } else { ymax = ANIM_UI_get_first_channel_top(v2d); @@ -2999,7 +2999,7 @@ static void box_select_anim_channels(bAnimContext *ac, rcti *rect, short selectm } if (ac->datatype == ANIMCONT_NLA) { - ymin = ymax - NLACHANNEL_STEP(snla); + ymin = ymax - NLATRACK_STEP(snla); } else { ymin = ymax - ANIM_UI_get_channel_step(); @@ -3209,10 +3209,10 @@ static int animchannels_channel_get(bAnimContext *ac, const int mval[2]) if (ac->datatype == ANIMCONT_NLA) { SpaceNla *snla = (SpaceNla *)ac->sl; - UI_view2d_listview_view_to_cell(NLACHANNEL_NAMEWIDTH, - NLACHANNEL_STEP(snla), + UI_view2d_listview_view_to_cell(NLATRACK_NAMEWIDTH, + NLATRACK_STEP(snla), 0, - NLACHANNEL_FIRST_TOP(ac), + NLATRACK_FIRST_TOP(ac), x, y, nullptr, @@ -3821,7 +3821,7 @@ static int mouse_anim_channels(bContext *C, } /* action to take depends on what channel we've got */ - /* WARNING: must keep this in sync with the equivalent function in `nla_channels.cc`. */ + /* WARNING: must keep this in sync with the equivalent function in `nla_tracks.cc`. */ switch (ale->type) { case ANIMTYPE_SCENE: notifierFlags |= click_select_channel_scene(ale, selectmode); diff --git a/source/blender/editors/include/ED_anim_api.hh b/source/blender/editors/include/ED_anim_api.hh index ec506a07903..ac15b4680d0 100644 --- a/source/blender/editors/include/ED_anim_api.hh +++ b/source/blender/editors/include/ED_anim_api.hh @@ -440,22 +440,22 @@ ENUM_OPERATORS(eAnimFilter_Flags, ANIMFILTER_TMP_IGNORE_ONLYSEL); * \{ */ /** NLA track heights */ -#define NLACHANNEL_FIRST_TOP(ac) \ - (UI_view2d_scale_get_y(&(ac)->region->v2d) * -UI_TIME_SCRUB_MARGIN_Y - NLACHANNEL_SKIP) -#define NLACHANNEL_HEIGHT(snla) \ +#define NLATRACK_FIRST_TOP(ac) \ + (UI_view2d_scale_get_y(&(ac)->region->v2d) * -UI_TIME_SCRUB_MARGIN_Y - NLATRACK_SKIP) +#define NLATRACK_HEIGHT(snla) \ (((snla) && ((snla)->flag & SNLA_NOSTRIPCURVES)) ? (0.8f * U.widget_unit) : \ (1.2f * U.widget_unit)) -#define NLACHANNEL_SKIP (0.1f * U.widget_unit) -#define NLACHANNEL_STEP(snla) (NLACHANNEL_HEIGHT(snla) + NLACHANNEL_SKIP) +#define NLATRACK_SKIP (0.1f * U.widget_unit) +#define NLATRACK_STEP(snla) (NLATRACK_HEIGHT(snla) + NLATRACK_SKIP) /** Additional offset to give some room at the end. */ -#define NLACHANNEL_TOT_HEIGHT(ac, item_amount) \ - (-NLACHANNEL_FIRST_TOP(ac) + NLACHANNEL_STEP(((SpaceNla *)(ac)->sl)) * (item_amount + 1)) +#define NLATRACK_TOT_HEIGHT(ac, item_amount) \ + (-NLATRACK_FIRST_TOP(ac) + NLATRACK_STEP(((SpaceNla *)(ac)->sl)) * (item_amount + 1)) -/** Channel widths */ -#define NLACHANNEL_NAMEWIDTH (10 * U.widget_unit) +/** Track widths */ +#define NLATRACK_NAMEWIDTH (10 * U.widget_unit) -/** Channel toggle-buttons */ -#define NLACHANNEL_BUTTON_WIDTH (0.8f * U.widget_unit) +/** Track toggle-buttons */ +#define NLATRACK_BUTTON_WIDTH (0.8f * U.widget_unit) /** \} */ diff --git a/source/blender/editors/space_nla/CMakeLists.txt b/source/blender/editors/space_nla/CMakeLists.txt index 50f5a218dfc..25166fc60a1 100644 --- a/source/blender/editors/space_nla/CMakeLists.txt +++ b/source/blender/editors/space_nla/CMakeLists.txt @@ -21,7 +21,7 @@ set(INC_SYS set(SRC nla_buttons.cc - nla_channels.cc + nla_tracks.cc nla_draw.cc nla_edit.cc nla_ops.cc @@ -38,7 +38,6 @@ set(LIB PRIVATE bf::intern::guardedalloc ) - blender_add_lib(bf_editor_space_nla "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") # RNA_prototypes.h dna_type_offsets.h diff --git a/source/blender/editors/space_nla/nla_draw.cc b/source/blender/editors/space_nla/nla_draw.cc index bd54660b4de..520a88d64ea 100644 --- a/source/blender/editors/space_nla/nla_draw.cc +++ b/source/blender/editors/space_nla/nla_draw.cc @@ -793,35 +793,36 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *region) const float pixelx = BLI_rctf_size_x(&v2d->cur) / BLI_rcti_size_x(&v2d->mask); const float text_margin_x = (8 * UI_SCALE_FAC) * pixelx; - /* build list of channels to draw */ + /* build list of tracks to draw */ ListBase anim_data = {nullptr, nullptr}; eAnimFilter_Flags filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_FCURVESONLY); size_t items = ANIM_animdata_filter( ac, &anim_data, filter, ac->data, eAnimCont_Types(ac->datatype)); - /* Update max-extent of channels here (taking into account scrollers): - * - this is done to allow the channel list to be scrollable, but must be done here - * to avoid regenerating the list again and/or also because channels list is drawn first - * - offset of NLACHANNEL_HEIGHT*2 is added to the height of the channels, as first is for + /* Update max-extent of tracks here (taking into account scrollers): + * - this is done to allow the track list to be scrollable, but must be done here + * to avoid regenerating the list again and/or also because tracks list is drawn first + * - offset of NLATRACK_HEIGHT*2 is added to the height of the tracks, as first is for * start of list offset, and the second is as a correction for the scrollers. */ - int height = NLACHANNEL_TOT_HEIGHT(ac, items); + int height = NLATRACK_TOT_HEIGHT(ac, items); v2d->tot.ymin = -height; - /* Loop through channels, and set up drawing depending on their type. */ - float ymax = NLACHANNEL_FIRST_TOP(ac); + /* Loop through tracks, and set up drawing depending on their type. */ + float ymax = NLATRACK_FIRST_TOP(ac); for (bAnimListElem *ale = static_cast(anim_data.first); ale; - ale = ale->next, ymax -= NLACHANNEL_STEP(snla)) + ale = ale->next, ymax -= NLATRACK_STEP(snla)) { - float ymin = ymax - NLACHANNEL_HEIGHT(snla); + float ymin = ymax - NLATRACK_HEIGHT(snla); float ycenter = (ymax + ymin) / 2.0f; /* check if visible */ if (IN_RANGE(ymin, v2d->cur.ymin, v2d->cur.ymax) || - IN_RANGE(ymax, v2d->cur.ymin, v2d->cur.ymax)) { - /* data to draw depends on the type of channel */ + IN_RANGE(ymax, v2d->cur.ymin, v2d->cur.ymax)) + { + /* data to draw depends on the type of track */ switch (ale->type) { case ANIMTYPE_NLATRACK: { AnimData *adt = ale->adt; @@ -873,16 +874,13 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *region) nla_action_get_color(adt, static_cast(ale->data), color); immUniformColor4fv(color); - /* draw slightly shifted up for greater separation from standard channels, + /* draw slightly shifted up for greater separation from standard tracks, * but also slightly shorter for some more contrast when viewing the strips */ switch (adt->act_extendmode) { case NLASTRIP_EXTEND_HOLD: { - immRectf(pos, - v2d->cur.xmin, - ymin + NLACHANNEL_SKIP, - v2d->cur.xmax, - ymax - NLACHANNEL_SKIP); + immRectf( + pos, v2d->cur.xmin, ymin + NLATRACK_SKIP, v2d->cur.xmax, ymax - NLATRACK_SKIP); break; } case NLASTRIP_EXTEND_HOLD_FORWARD: { @@ -891,7 +889,7 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *region) BKE_action_frame_range_get(static_cast(ale->data), &r_start, &r_end); BKE_nla_clip_length_ensure_nonzero(&r_start, &r_end); - immRectf(pos, r_end, ymin + NLACHANNEL_SKIP, v2d->cur.xmax, ymax - NLACHANNEL_SKIP); + immRectf(pos, r_end, ymin + NLATRACK_SKIP, v2d->cur.xmax, ymax - NLATRACK_SKIP); break; } case NLASTRIP_EXTEND_NOTHING: @@ -905,8 +903,8 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *region) adt, static_cast(ale->data), ycenter, - ymin + NLACHANNEL_SKIP, - ymax - NLACHANNEL_SKIP); + ymin + NLATRACK_SKIP, + ymax - NLATRACK_SKIP); GPU_blend(GPU_BLEND_NONE); break; @@ -915,14 +913,14 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *region) } } - /* Free temporary channels. */ + /* Free temporary tracks. */ ANIM_animdata_freelist(&anim_data); } /* *********************************************** */ -/* Channel List */ +/* Track List */ -void draw_nla_channel_list(const bContext *C, bAnimContext *ac, ARegion *region) +void draw_nla_track_list(const bContext *C, bAnimContext *ac, ARegion *region) { ListBase anim_data = {nullptr, nullptr}; @@ -930,63 +928,65 @@ void draw_nla_channel_list(const bContext *C, bAnimContext *ac, ARegion *region) View2D *v2d = ®ion->v2d; size_t items; - /* build list of channels to draw */ + /* build list of tracks to draw */ eAnimFilter_Flags filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_FCURVESONLY); items = ANIM_animdata_filter(ac, &anim_data, filter, ac->data, eAnimCont_Types(ac->datatype)); - /* Update max-extent of channels here (taking into account scrollers): - * - this is done to allow the channel list to be scrollable, but must be done here - * to avoid regenerating the list again and/or also because channels list is drawn first - * - offset of NLACHANNEL_HEIGHT*2 is added to the height of the channels, as first is for + /* Update max-extent of tracks here (taking into account scrollers): + * - this is done to allow the track list to be scrollable, but must be done here + * to avoid regenerating the list again and/or also because tracks list is drawn first + * - offset of NLATRACK_HEIGHT*2 is added to the height of the tracks, as first is for * start of list offset, and the second is as a correction for the scrollers. */ - int height = NLACHANNEL_TOT_HEIGHT(ac, items); + int height = NLATRACK_TOT_HEIGHT(ac, items); v2d->tot.ymin = -height; /* need to do a view-sync here, so that the keys area doesn't jump around * (it must copy this) */ UI_view2d_sync(nullptr, ac->area, v2d, V2D_LOCK_COPY); - /* draw channels */ + /* draw tracks */ { /* first pass: just the standard GL-drawing for backdrop + text */ - size_t channel_index = 0; - float ymax = NLACHANNEL_FIRST_TOP(ac); + size_t track_index = 0; + float ymax = NLATRACK_FIRST_TOP(ac); for (bAnimListElem *ale = static_cast(anim_data.first); ale; - ale = ale->next, ymax -= NLACHANNEL_STEP(snla), channel_index++) + ale = ale->next, ymax -= NLATRACK_STEP(snla), track_index++) { - float ymin = ymax - NLACHANNEL_HEIGHT(snla); + float ymin = ymax - NLATRACK_HEIGHT(snla); /* check if visible */ if (IN_RANGE(ymin, v2d->cur.ymin, v2d->cur.ymax) || - IN_RANGE(ymax, v2d->cur.ymin, v2d->cur.ymax)) { - /* draw all channels using standard channel-drawing API */ - ANIM_channel_draw(ac, ale, ymin, ymax, channel_index); + IN_RANGE(ymax, v2d->cur.ymin, v2d->cur.ymax)) + { + /* draw all tracks using standard channel-drawing API */ + ANIM_channel_draw(ac, ale, ymin, ymax, track_index); } } } { /* second pass: UI widgets */ uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS); - size_t channel_index = 0; - float ymax = NLACHANNEL_FIRST_TOP(ac); + size_t track_index = 0; + float ymax = NLATRACK_FIRST_TOP(ac); /* set blending again, as may not be set in previous step */ GPU_blend(GPU_BLEND_ALPHA); - /* Loop through channels, and set up drawing depending on their type. */ + /* Loop through tracks, and set up drawing depending on their type. */ for (bAnimListElem *ale = static_cast(anim_data.first); ale; - ale = ale->next, ymax -= NLACHANNEL_STEP(snla), channel_index++) + ale = ale->next, ymax -= NLATRACK_STEP(snla), track_index++) { - float ymin = ymax - NLACHANNEL_HEIGHT(snla); + float ymin = ymax - NLATRACK_HEIGHT(snla); /* check if visible */ if (IN_RANGE(ymin, v2d->cur.ymin, v2d->cur.ymax) || - IN_RANGE(ymax, v2d->cur.ymin, v2d->cur.ymax)) { - /* draw all channels using standard channel-drawing API */ - rctf channel_rect; - BLI_rctf_init(&channel_rect, 0, v2d->cur.xmax, ymin, ymax); - ANIM_channel_draw_widgets(C, ac, ale, block, &channel_rect, channel_index); + IN_RANGE(ymax, v2d->cur.ymin, v2d->cur.ymax)) + { + /* draw all tracks using standard channel-drawing API */ + rctf track_rect; + BLI_rctf_init(&track_rect, 0, v2d->cur.xmax, ymin, ymax); + ANIM_channel_draw_widgets(C, ac, ale, block, &track_rect, track_index); } } @@ -996,7 +996,7 @@ void draw_nla_channel_list(const bContext *C, bAnimContext *ac, ARegion *region) GPU_blend(GPU_BLEND_NONE); } - /* free temporary channels */ + /* free temporary tracks */ ANIM_animdata_freelist(&anim_data); } diff --git a/source/blender/editors/space_nla/nla_edit.cc b/source/blender/editors/space_nla/nla_edit.cc index 30a050c33f1..19eabb1e0bf 100644 --- a/source/blender/editors/space_nla/nla_edit.cc +++ b/source/blender/editors/space_nla/nla_edit.cc @@ -322,9 +322,9 @@ static void get_nlastrip_extents(bAnimContext *ac, float *min, float *max, const *min = 999999999.0f; *max = -999999999.0f; - /* check if any channels to set range with */ + /* check if any tracks to set range with */ if (anim_data.first) { - /* go through channels, finding max extents */ + /* go through tracks, finding max extents */ LISTBASE_FOREACH (bAnimListElem *, ale, &anim_data) { NlaTrack *nlt = static_cast(ale->data); @@ -415,18 +415,18 @@ void NLA_OT_previewrange_set(wmOperatorType *ot) * \{ */ /** - * Find the extents of the active channel + * Find the extents of the active track * - * \param r_min: Bottom y-extent of channel. - * \param r_max: Top y-extent of channel. - * \return Success of finding a selected channel. + * \param r_min: Bottom y-extent of track. + * \param r_max: Top y-extent of track. + * \return Success of finding a selected track. */ -static bool nla_channels_get_selected_extents(bAnimContext *ac, float *r_min, float *r_max) +static bool nla_tracks_get_selected_extents(bAnimContext *ac, float *r_min, float *r_max) { ListBase anim_data = {nullptr, nullptr}; SpaceNla *snla = reinterpret_cast(ac->sl); - /* NOTE: not bool, since we want prioritize individual channels over expanders. */ + /* NOTE: not bool, since we want prioritize individual tracks over expanders. */ short found = 0; /* get all items - we need to do it this way */ @@ -434,11 +434,11 @@ static bool nla_channels_get_selected_extents(bAnimContext *ac, float *r_min, fl ANIMFILTER_LIST_CHANNELS | ANIMFILTER_FCURVESONLY); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, eAnimCont_Types(ac->datatype)); - /* loop through all channels, finding the first one that's selected */ - float ymax = NLACHANNEL_FIRST_TOP(ac); + /* loop through all tracks, finding the first one that's selected */ + float ymax = NLATRACK_FIRST_TOP(ac); for (bAnimListElem *ale = static_cast(anim_data.first); ale; - ale = ale->next, ymax -= NLACHANNEL_STEP(snla)) + ale = ale->next, ymax -= NLATRACK_STEP(snla)) { const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale); @@ -447,13 +447,13 @@ static bool nla_channels_get_selected_extents(bAnimContext *ac, float *r_min, fl ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_SELECT)) { /* update best estimate */ - *r_min = ymax - NLACHANNEL_HEIGHT(snla); + *r_min = ymax - NLATRACK_HEIGHT(snla); *r_max = ymax; /* is this high enough priority yet? */ found = acf->channel_role; - /* only stop our search when we've found an actual channel + /* only stop our search when we've found an actual track * - data-block expanders get less priority so that we don't abort prematurely */ if (found == ACHANNEL_ROLE_CHANNEL) { @@ -489,17 +489,17 @@ static int nlaedit_viewall(bContext *C, const bool only_sel) /* set vertical range */ if (only_sel == false) { - /* view all -> the summary channel is usually the shows everything, + /* view all -> the summary track is usually the shows everything, * and resides right at the top... */ v2d->cur.ymax = 0.0f; v2d->cur.ymin = float(-BLI_rcti_size_y(&v2d->mask)); } else { - /* locate first selected channel (or the active one), and frame those */ + /* locate first selected track (or the active one), and frame those */ float ymin = v2d->cur.ymin; float ymax = v2d->cur.ymax; - if (nla_channels_get_selected_extents(&ac, &ymin, &ymax)) { + if (nla_tracks_get_selected_extents(&ac, &ymin, &ymax)) { /* recenter the view so that this range is in the middle */ float ymid = (ymax - ymin) / 2.0f + ymin; float x_center; @@ -2164,7 +2164,8 @@ static int nlaedit_apply_scale_exec(bContext *C, wmOperator * /*op*/) * (transitions don't have scale) */ if ((strip->flag & NLASTRIP_FLAG_SELECT) && (strip->type == NLASTRIP_TYPE_CLIP)) { if (strip->act == nullptr || ID_IS_OVERRIDE_LIBRARY(strip->act) || - ID_IS_LINKED(strip->act)) { + ID_IS_LINKED(strip->act)) + { continue; } /* if the referenced action is used by other strips, diff --git a/source/blender/editors/space_nla/nla_intern.hh b/source/blender/editors/space_nla/nla_intern.hh index 22285027b50..f629c0f96b4 100644 --- a/source/blender/editors/space_nla/nla_intern.hh +++ b/source/blender/editors/space_nla/nla_intern.hh @@ -27,7 +27,7 @@ void nla_buttons_register(ARegionType *art); /* `nla_draw.cc` */ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *region); -void draw_nla_channel_list(const bContext *C, bAnimContext *ac, ARegion *region); +void draw_nla_track_list(const bContext *C, bAnimContext *ac, ARegion *region); /* **************************************** */ /* `nla_select.cc` */ @@ -107,7 +107,7 @@ void NLA_OT_fmodifier_copy(wmOperatorType *ot); void NLA_OT_fmodifier_paste(wmOperatorType *ot); /* **************************************** */ -/* `nla_channels.cc` */ +/* `nla_tracks.cc` */ /** * Helper - add NLA Tracks alongside existing ones. diff --git a/source/blender/editors/space_nla/nla_select.cc b/source/blender/editors/space_nla/nla_select.cc index f8a8dfe96ba..892c9282c31 100644 --- a/source/blender/editors/space_nla/nla_select.cc +++ b/source/blender/editors/space_nla/nla_select.cc @@ -194,7 +194,7 @@ void NLA_OT_select_all(wmOperatorType *ot) * - BKEY - 1: all strips within region are selected #NLAEDIT_BOX_ALLSTRIPS. * - ALT-BKEY - depending on which axis of the region was larger. * - 2: x-axis, so select all frames within frame range #NLAEDIT_BOXSEL_FRAMERANGE. - * - 3: y-axis, so select all frames within channels that region included + * - 3: y-axis, so select all frames within tracks that region included * #NLAEDIT_BOXSEL_CHANNELS. */ @@ -226,11 +226,11 @@ static void box_select_nla_strips(bAnimContext *ac, rcti rect, short mode, short selectmode = selmodes_to_flagmodes(selectmode); /* loop over data, doing box select */ - float ymax = NLACHANNEL_FIRST_TOP(ac); + float ymax = NLATRACK_FIRST_TOP(ac); for (bAnimListElem *ale = static_cast(anim_data.first); ale; - ale = ale->next, ymax -= NLACHANNEL_STEP(snla)) + ale = ale->next, ymax -= NLATRACK_STEP(snla)) { - float ymin = ymax - NLACHANNEL_HEIGHT(snla); + float ymin = ymax - NLATRACK_HEIGHT(snla); /* perform vertical suitability check (if applicable) */ if ((mode == NLA_BOXSEL_FRAMERANGE) || !((ymax < rectf.ymin) || (ymin > rectf.ymax))) { @@ -241,7 +241,8 @@ static void box_select_nla_strips(bAnimContext *ac, rcti rect, short mode, short /* only select strips if they fall within the required ranges (if applicable) */ LISTBASE_FOREACH (NlaStrip *, strip, &nlt->strips) { if ((mode == NLA_BOXSEL_CHANNELS) || - BKE_nlastrip_within_bounds(strip, rectf.xmin, rectf.xmax)) { + BKE_nlastrip_within_bounds(strip, rectf.xmin, rectf.xmax)) + { /* set selection */ ACHANNEL_SET_FLAG(strip, selectmode, NLASTRIP_FLAG_SELECT); @@ -269,16 +270,10 @@ static void nlaedit_strip_at_region_position( View2D *v2d = &ac->region->v2d; float view_x, view_y; - int channel_index; + int track_index; UI_view2d_region_to_view(v2d, region_x, region_y, &view_x, &view_y); - UI_view2d_listview_view_to_cell(0, - NLACHANNEL_STEP(snla), - 0, - NLACHANNEL_FIRST_TOP(ac), - view_x, - view_y, - nullptr, - &channel_index); + UI_view2d_listview_view_to_cell( + 0, NLATRACK_STEP(snla), 0, NLATRACK_FIRST_TOP(ac), view_x, view_y, nullptr, &track_index); ListBase anim_data = {nullptr, nullptr}; eAnimFilter_Flags filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | @@ -292,7 +287,7 @@ static void nlaedit_strip_at_region_position( const float xmin = UI_view2d_region_to_view_x(v2d, region_x - 7); const float xmax = UI_view2d_region_to_view_x(v2d, region_x + 7); - bAnimListElem *ale = static_cast(BLI_findlink(&anim_data, channel_index)); + bAnimListElem *ale = static_cast(BLI_findlink(&anim_data, track_index)); if (ale != nullptr) { if (ale->type == ANIMTYPE_NLATRACK) { NlaTrack *nlt = static_cast(ale->data); @@ -378,9 +373,9 @@ static int nlaedit_box_select_exec(bContext *C, wmOperator *op) /* mode depends on which axis of the range is larger to determine which axis to use. * - Checking this in region-space is fine, * as it's fundamentally still going to be a different rect size. - * - The frame-range select option is favored over the channel one (x over y), + * - The frame-range select option is favored over the track one (x over y), * as frame-range one is often. - * Used for tweaking timing when "blocking", while channels is not that useful. + * Used for tweaking timing when "blocking", while tracks is not that useful. */ if (BLI_rcti_size_x(&rect) >= BLI_rcti_size_y(&rect)) { mode = NLA_BOXSEL_FRAMERANGE; @@ -459,12 +454,12 @@ static void nlaedit_select_leftright(bContext *C, WM_operator_name_call(C, "NLA_OT_tweakmode_exit", WM_OP_EXEC_DEFAULT, nullptr, nullptr); } - /* if select mode is replace, deselect all keyframes (and channels) first */ + /* if select mode is replace, deselect all keyframes (and tracks) first */ if (select_mode == SELECT_REPLACE) { select_mode = SELECT_ADD; /* - deselect all other keyframes, so that just the newly selected remain - * - channels aren't deselected, since we don't re-select any as a consequence + * - tracks aren't deselected, since we don't re-select any as a consequence */ deselect_nla_strips(ac, 0, SELECT_SUBTRACT); } @@ -531,7 +526,7 @@ static int nlaedit_select_leftright_exec(bContext *C, wmOperator *op) /* do the selecting now */ nlaedit_select_leftright(C, &ac, leftright, selectmode); - /* set notifier that keyframe selection (and channels too) have changed */ + /* set notifier that keyframe selection (and tracks too) have changed */ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, nullptr); WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_SELECTED, nullptr); @@ -638,12 +633,12 @@ static int mouse_nla_strips(bContext *C, /* deselect all strips */ deselect_nla_strips(ac, 0, SELECT_SUBTRACT); - /* deselect all other channels first */ + /* deselect all other tracks first */ ANIM_anim_channels_select_set(ac, ACHANNEL_SETFLAG_CLEAR); } } - /* only select strip if we clicked on a valid channel and hit something */ + /* only select strip if we clicked on a valid track and hit something */ if (ale != nullptr) { /* select the strip accordingly (if a matching one was found) */ if (strip != nullptr) { @@ -672,7 +667,7 @@ static int mouse_nla_strips(bContext *C, } } - /* free this channel */ + /* free this track */ MEM_freeN(ale); } diff --git a/source/blender/editors/space_nla/nla_channels.cc b/source/blender/editors/space_nla/nla_tracks.cc similarity index 91% rename from source/blender/editors/space_nla/nla_channels.cc rename to source/blender/editors/space_nla/nla_tracks.cc index 0c1637a889e..9127813ed7f 100644 --- a/source/blender/editors/space_nla/nla_channels.cc +++ b/source/blender/editors/space_nla/nla_tracks.cc @@ -52,40 +52,39 @@ * from the standard Animation Editor ones */ /* ******************** Mouse-Click Operator *********************** */ -/* Depending on the channel that was clicked on, the mouse click will activate whichever - * part of the channel is relevant. +/* Depending on the track that was clicked on, the mouse click will activate whichever + * part of the track is relevant. * * NOTE: eventually, * this should probably be phased out when many of these things are replaced with buttons - * --> Most channels are now selection only. + * --> Most tracks are now selection only. */ -static int mouse_nla_channels(bContext *C, bAnimContext *ac, int channel_index, short selectmode) +static int mouse_nla_tracks(bContext *C, bAnimContext *ac, int track_index, short selectmode) { ListBase anim_data = {nullptr, nullptr}; int notifierFlags = 0; - /* get the channel that was clicked on */ - /* filter channels */ + /* get the track that was clicked on */ + /* filter tracks */ eAnimFilter_Flags filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_FCURVESONLY); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, eAnimCont_Types(ac->datatype)); - /* get channel from index */ - bAnimListElem *ale = static_cast(BLI_findlink(&anim_data, channel_index)); + /* get track from index */ + bAnimListElem *ale = static_cast(BLI_findlink(&anim_data, track_index)); if (ale == nullptr) { - /* channel not found */ + /* track not found */ if (G.debug & G_DEBUG) { - printf("Error: animation channel (index = %d) not found in mouse_anim_channels()\n", - channel_index); + printf("Error: animation track (index = %d) not found in mouse_nla_tracks()\n", track_index); } ANIM_animdata_freelist(&anim_data); return 0; } - /* action to take depends on what channel we've got */ + /* action to take depends on what track we've got */ /* WARNING: must keep this in sync with the equivalent function in `anim_channels_edit.cc`. */ switch (ale->type) { case ANIMTYPE_SCENE: { @@ -128,7 +127,7 @@ static int mouse_nla_channels(bContext *C, bAnimContext *ac, int channel_index, } else { /* deselect all */ - /* TODO: should this deselect all other types of channels too? */ + /* TODO: should this deselect all other types of tracks too? */ BKE_view_layer_synced_ensure(ac->scene, view_layer); LISTBASE_FOREACH (Base *, b, BKE_view_layer_object_bases_get(view_layer)) { ED_object_base_select(b, BA_DESELECT); @@ -151,7 +150,7 @@ static int mouse_nla_channels(bContext *C, bAnimContext *ac, int channel_index, adt->flag |= ADT_UI_ACTIVE; } - /* notifiers - channel was selected */ + /* notifiers - track was selected */ notifierFlags |= (ND_ANIMCHAN | NA_SELECTED); } break; @@ -222,7 +221,7 @@ static int mouse_nla_channels(bContext *C, bAnimContext *ac, int channel_index, ac, ac->data, eAnimCont_Types(ac->datatype), filter, nlt, ANIMTYPE_NLATRACK); } - /* notifier flags - channel was selected */ + /* notifier flags - track was selected */ notifierFlags |= (ND_ANIMCHAN | NA_SELECTED); } break; @@ -269,12 +268,12 @@ static int mouse_nla_channels(bContext *C, bAnimContext *ac, int channel_index, } default: if (G.debug & G_DEBUG) { - printf("Error: Invalid channel type in mouse_nla_channels()\n"); + printf("Error: Invalid track type in mouse_nla_tracks()\n"); } break; } - /* free channels */ + /* free tracks */ ANIM_animdata_update(ac, &anim_data); ANIM_animdata_freelist(&anim_data); @@ -285,12 +284,12 @@ static int mouse_nla_channels(bContext *C, bAnimContext *ac, int channel_index, /* ------------------- */ /* handle clicking */ -static int nlachannels_mouseclick_invoke(bContext *C, wmOperator *op, const wmEvent *event) +static int nlatracks_mouseclick_invoke(bContext *C, wmOperator *op, const wmEvent *event) { bAnimContext ac; ARegion *region; View2D *v2d; - int channel_index; + int track_index; int notifierFlags = 0; short selectmode; float x, y; @@ -313,19 +312,19 @@ static int nlachannels_mouseclick_invoke(bContext *C, wmOperator *op, const wmEv selectmode = SELECT_REPLACE; } - /* Figure out which channel user clicked in. */ + /* Figure out which track user clicked in. */ UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, &y); - UI_view2d_listview_view_to_cell(NLACHANNEL_NAMEWIDTH, - NLACHANNEL_STEP(snla), + UI_view2d_listview_view_to_cell(NLATRACK_NAMEWIDTH, + NLATRACK_STEP(snla), 0, - NLACHANNEL_FIRST_TOP(&ac), + NLATRACK_FIRST_TOP(&ac), x, y, nullptr, - &channel_index); + &track_index); - /* handle mouse-click in the relevant channel then */ - notifierFlags = mouse_nla_channels(C, &ac, channel_index, selectmode); + /* handle mouse-click in the relevant track then */ + notifierFlags = mouse_nla_tracks(C, &ac, track_index, selectmode); /* set notifier that things have changed */ WM_event_add_notifier(C, NC_ANIMATION | notifierFlags, nullptr); @@ -343,7 +342,7 @@ void NLA_OT_channels_click(wmOperatorType *ot) ot->description = "Handle clicks to select NLA tracks"; /* api callbacks */ - ot->invoke = nlachannels_mouseclick_invoke; + ot->invoke = nlatracks_mouseclick_invoke; ot->poll = ED_operator_nla_active; /* flags */ @@ -359,12 +358,12 @@ void NLA_OT_channels_click(wmOperatorType *ot) /* ******************** Action Push Down ******************************** */ -static int nlachannels_pushdown_exec(bContext *C, wmOperator *op) +static int nlatracks_pushdown_exec(bContext *C, wmOperator *op) { bAnimContext ac; ID *id = nullptr; AnimData *adt = nullptr; - int channel_index = RNA_int_get(op->ptr, "channel_index"); + int track_index = RNA_int_get(op->ptr, "track_index"); /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) { @@ -372,7 +371,7 @@ static int nlachannels_pushdown_exec(bContext *C, wmOperator *op) } /* get anim-channel to use (or more specifically, the animdata block behind it) */ - if (channel_index == -1) { + if (track_index == -1) { PointerRNA adt_ptr = {nullptr}; /* active animdata block */ @@ -389,31 +388,31 @@ static int nlachannels_pushdown_exec(bContext *C, wmOperator *op) adt = static_cast(adt_ptr.data); } else { - /* indexed channel */ + /* indexed track */ ListBase anim_data = {nullptr, nullptr}; - /* filter channels */ + /* filter tracks */ eAnimFilter_Flags filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_FCURVESONLY); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, eAnimCont_Types(ac.datatype)); - /* get channel from index */ - bAnimListElem *ale = static_cast(BLI_findlink(&anim_data, channel_index)); + /* get track from index */ + bAnimListElem *ale = static_cast(BLI_findlink(&anim_data, track_index)); if (ale == nullptr) { - BKE_reportf(op->reports, RPT_ERROR, "No animation channel found at index %d", channel_index); + BKE_reportf(op->reports, RPT_ERROR, "No animation track found at index %d", track_index); ANIM_animdata_freelist(&anim_data); return OPERATOR_CANCELLED; } if (ale->type != ANIMTYPE_NLAACTION) { BKE_reportf(op->reports, RPT_ERROR, - "Animation channel at index %d is not a NLA 'Active Action' channel", - channel_index); + "Animation track at index %d is not a NLA 'Active Action' track", + track_index); ANIM_animdata_freelist(&anim_data); return OPERATOR_CANCELLED; } - /* grab AnimData from the channel */ + /* grab AnimData from the track */ adt = ale->adt; id = ale->id; @@ -460,7 +459,7 @@ void NLA_OT_action_pushdown(wmOperatorType *ot) ot->description = "Push action down onto the top of the NLA stack as a new strip"; /* callbacks */ - ot->exec = nlachannels_pushdown_exec; + ot->exec = nlatracks_pushdown_exec; ot->poll = nlaop_poll_tweakmode_off; /* flags */ @@ -468,12 +467,12 @@ void NLA_OT_action_pushdown(wmOperatorType *ot) /* properties */ ot->prop = RNA_def_int(ot->srna, - "channel_index", + "track_index", -1, -1, INT_MAX, - "Channel Index", - "Index of NLA action channel to perform pushdown operation on", + "Track Index", + "Index of NLA action track to perform pushdown operation on", 0, INT_MAX); RNA_def_property_flag(ot->prop, PROP_SKIP_SAVE | PROP_HIDDEN); diff --git a/source/blender/editors/space_nla/space_nla.cc b/source/blender/editors/space_nla/space_nla.cc index 58037ea2db7..f8b26ec4ba2 100644 --- a/source/blender/editors/space_nla/space_nla.cc +++ b/source/blender/editors/space_nla/space_nla.cc @@ -66,8 +66,8 @@ static SpaceLink *nla_create(const ScrArea *area, const Scene *scene) region->regiontype = RGN_TYPE_HEADER; region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; - /* channel list region */ - region = MEM_cnew("channel list for nla"); + /* track list region */ + region = MEM_cnew("track list for nla"); BLI_addtail(&snla->regionbase, region); region->regiontype = RGN_TYPE_CHANNELS; region->alignment = RGN_ALIGN_LEFT; @@ -151,7 +151,7 @@ static SpaceLink *nla_duplicate(SpaceLink *sl) } /* add handlers, stuff you only do once or on area/region changes */ -static void nla_channel_region_init(wmWindowManager *wm, ARegion *region) +static void nla_track_region_init(wmWindowManager *wm, ARegion *region) { wmKeyMap *keymap; @@ -161,7 +161,7 @@ static void nla_channel_region_init(wmWindowManager *wm, ARegion *region) UI_view2d_region_reinit(®ion->v2d, V2D_COMMONVIEW_LIST, region->winx, region->winy); /* own keymap */ - /* own channels map first to override some channel keymaps */ + /* own tracks map first to override some track keymaps */ keymap = WM_keymap_ensure(wm->defaultconf, "NLA Tracks", SPACE_NLA, RGN_TYPE_WINDOW); WM_event_add_keymap_handler_v2d_mask(®ion->handlers, keymap); /* now generic channels map for everything else that can apply */ @@ -173,7 +173,7 @@ static void nla_channel_region_init(wmWindowManager *wm, ARegion *region) } /* draw entirely, view changes should be handled here */ -static void nla_channel_region_draw(const bContext *C, ARegion *region) +static void nla_track_region_draw(const bContext *C, ARegion *region) { bAnimContext ac; View2D *v2d = ®ion->v2d; @@ -185,10 +185,10 @@ static void nla_channel_region_draw(const bContext *C, ARegion *region) /* data */ if (ANIM_animdata_get_context(C, &ac)) { - draw_nla_channel_list(C, &ac, region); + draw_nla_track_list(C, &ac, region); } - /* channel filter next to scrubbing area */ + /* track filter next to scrubbing area */ ED_time_scrub_channel_search_draw(C, region, ac.ads); /* reset view matrix */ @@ -439,12 +439,12 @@ static void nla_main_region_view2d_changed(const bContext *C, ARegion *region) * so bottom strip isn't hidden. */ if (!BLI_listbase_is_empty(ED_context_get_markers(C))) { - v2d->tot.ymin -= (UI_MARKER_MARGIN_Y - NLACHANNEL_STEP(snla)); + v2d->tot.ymin -= (UI_MARKER_MARGIN_Y - NLATRACK_STEP(snla)); } UI_view2d_curRect_clamp_y(v2d); } -static void nla_channel_region_listener(const wmRegionListenerParams *params) +static void nla_track_region_listener(const wmRegionListenerParams *params) { ARegion *region = params->region; const wmNotifier *wmn = params->notifier; @@ -486,7 +486,7 @@ static void nla_channel_region_listener(const wmRegionListenerParams *params) } } -static void nla_channel_region_message_subscribe(const wmRegionMessageSubscribeParams *params) +static void nla_track_region_message_subscribe(const wmRegionMessageSubscribeParams *params) { wmMsgBus *mbus = params->message_bus; ARegion *region = params->region; @@ -641,16 +641,16 @@ void ED_spacetype_nla() BLI_addhead(&st->regiontypes, art); - /* regions: channels */ + /* regions: tracks */ art = MEM_cnew("spacetype nla region"); art->regionid = RGN_TYPE_CHANNELS; art->prefsizex = 200; art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES; - art->init = nla_channel_region_init; - art->draw = nla_channel_region_draw; - art->listener = nla_channel_region_listener; - art->message_subscribe = nla_channel_region_message_subscribe; + art->init = nla_track_region_init; + art->draw = nla_track_region_draw; + art->listener = nla_track_region_listener; + art->message_subscribe = nla_track_region_message_subscribe; BLI_addhead(&st->regiontypes, art); diff --git a/source/blender/editors/transform/transform_convert_nla.cc b/source/blender/editors/transform/transform_convert_nla.cc index 7be4c97c619..d992e77dab8 100644 --- a/source/blender/editors/transform/transform_convert_nla.cc +++ b/source/blender/editors/transform/transform_convert_nla.cc @@ -559,7 +559,7 @@ static void createTransNlaData(bContext *C, TransInfo *t) tdn->trackIndex = BLI_findindex(&adt->nla_tracks, nlt); tdn->signed_track_index = tdn->trackIndex; - yval = float(tdn->trackIndex * NLACHANNEL_STEP(snla)); + yval = float(tdn->trackIndex * NLATRACK_STEP(snla)); tdn->h1[0] = strip->start; tdn->h1[1] = yval; @@ -726,8 +726,8 @@ static void recalcData_nla(TransInfo *t) continue; } - delta_y1 = (int(tdn->h1[1]) / NLACHANNEL_STEP(snla) - tdn->signed_track_index); - delta_y2 = (int(tdn->h2[1]) / NLACHANNEL_STEP(snla) - tdn->signed_track_index); + delta_y1 = (int(tdn->h1[1]) / NLATRACK_STEP(snla) - tdn->signed_track_index); + delta_y2 = (int(tdn->h2[1]) / NLATRACK_STEP(snla) - tdn->signed_track_index); /* Move strip into track in the requested direction. */ /* If we cannot find the strip in the track, this strip has moved tracks already (if multiple @@ -959,7 +959,7 @@ static void special_aftertrans_update__nla(bContext *C, TransInfo *t) ListBase anim_data = {nullptr, nullptr}; short filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_FCURVESONLY); - /* get channels to work on */ + /* get tracks to work on */ ANIM_animdata_filter( &ac, &anim_data, eAnimFilter_Flags(filter), ac.data, eAnimCont_Types(ac.datatype));