Blender V5.0
tree_element_anim_data.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
9#include "DNA_anim_types.h"
10#include "DNA_outliner_types.h"
11
12#include "BLI_listbase.h"
13
14#include "BLT_translation.hh"
15
16#include "../outliner_intern.hh"
17
19
20namespace blender::ed::outliner {
21
23 : AbstractTreeElement(legacy_te), anim_data_(anim_data)
24{
26 /* this element's info */
27 legacy_te.name = IFACE_("Animation");
28 legacy_te.directdata = &anim_data_;
29}
30
31void TreeElementAnimData::expand(SpaceOutliner & /*space_outliner*/) const
32{
33
34 if (anim_data_.action) {
35 /* Animation data-block itself. */
36 add_element(&legacy_te_.subtree,
37 reinterpret_cast<ID *>(anim_data_.action),
38 nullptr,
41 0);
42 }
43
44 expand_drivers();
45 expand_NLA_tracks();
46}
47
49{
50 return this->anim_data_.slot_handle;
51}
52
53void TreeElementAnimData::expand_drivers() const
54{
55 if (BLI_listbase_is_empty(&anim_data_.drivers)) {
56 return;
57 }
58 add_element(&legacy_te_.subtree, nullptr, &anim_data_, &legacy_te_, TSE_DRIVER_BASE, 0);
59}
60
61void TreeElementAnimData::expand_NLA_tracks() const
62{
63 if (BLI_listbase_is_empty(&anim_data_.nla_tracks)) {
64 return;
65 }
66 add_element(&legacy_te_.subtree, nullptr, &anim_data_, &legacy_te_, TSE_NLA, 0);
67}
68
69} // namespace blender::ed::outliner
#define BLI_assert(a)
Definition BLI_assert.h:46
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
#define IFACE_(msgid)
@ TSE_ANIM_DATA
@ TSE_NLA
@ TSE_SOME_ID
@ TSE_DRIVER_BASE
TreeElement * add_element(ListBase *lb, ID *owner_id, void *create_data, TreeElement *parent, short type, short index, const bool expand=true) const
void expand(SpaceOutliner &space_outliner) const override
TreeElementAnimData(TreeElement &legacy_te, AnimData &anim_data)
decltype(::ActionSlot::handle) slot_handle_t
ListBase drivers
ListBase nla_tracks
Definition DNA_ID.h:414