Blender V5.3
tree_element_nla.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
10
11#include "DNA_anim_types.h"
12#include "DNA_space_types.h"
13
14#include "BLT_translation.hh"
15
16#include "../outliner_intern.hh"
17
18#include "tree_display.hh"
19#include "tree_element_nla.hh"
20
21namespace blender::ed::outliner {
22
24 : AbstractTreeElement(legacy_te), anim_data_(anim_data)
25{
26 BLI_assert(legacy_te.store_elem->type == TSE_NLA);
27 legacy_te.name = IFACE_("NLA Tracks");
28 legacy_te.directdata = &anim_data;
29}
30
31void TreeElementNLA::expand(SpaceOutliner & /*space_outliner*/) const
32{
33 int a = 0;
34 for (NlaTrack *nlt : ListBaseWrapper<NlaTrack>(anim_data_.nla_tracks)) {
35 add_element<TreeElementNLATrack>({.index = a}, *nlt);
36 a++;
37 }
38}
39
40/* -------------------------------------------------------------------- */
41
43 : AbstractTreeElement(legacy_te), track_(track)
44{
46 legacy_te.name = track.name;
47}
48
49void TreeElementNLATrack::expand(SpaceOutliner & /*space_outliner*/) const
50{
51 int a = 0;
52 for (NlaStrip *strip : ListBaseWrapper<NlaStrip>(track_.strips)) {
53 /* A strip may have no Action assigned. */
54 if (strip->act) {
55 add_element<TreeElementNLAAction>({.index = a}, *strip->act);
56 }
57 a++;
58 }
59}
60
61/* -------------------------------------------------------------------- */
62
64{
65 return &const_cast<bAction &>(action).id;
66}
67
69 : AbstractTreeElement(legacy_te)
70{
72 legacy_te.name = action.id.name + 2;
73}
74
75} // namespace blender::ed::outliner
#define IFACE_(msgid)
TreeElement * add_element(const TreeElementAddParams &params, Args &&...args) const
static ID * owner_id(const bAction &action)
TreeElementNLAAction(TreeElement &legacy_te, const bAction &action)
TreeElementNLATrack(TreeElement &legacy_te, NlaTrack &track)
void expand(SpaceOutliner &space_outliner) const override
void expand(SpaceOutliner &space_outliner) const override
TreeElementNLA(TreeElement &legacy_te, AnimData &anim_data)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
ListBaseWrapperTemplate< ListBase, T > ListBaseWrapper
char name[258]
Definition DNA_ID.h:433
Establish and manage Outliner trees for different display modes.