Blender  V2.93
tree_element_anim_data.cc
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #include "BLI_listbase_wrapper.hh"
22 
23 #include "DNA_anim_types.h"
24 #include "DNA_listBase.h"
25 
26 #include "BLT_translation.h"
27 
28 #include "../outliner_intern.h"
29 #include "tree_display.h"
30 
32 
33 namespace blender::ed::outliner {
34 
36  : AbstractTreeElement(legacy_te), anim_data_(anim_data)
37 {
38  BLI_assert(legacy_te.store_elem->type == TSE_ANIM_DATA);
39  /* this element's info */
40  legacy_te.name = IFACE_("Animation");
41  legacy_te.directdata = &anim_data_;
42 }
43 
44 void TreeElementAnimData::expand(SpaceOutliner &space_outliner) const
45 {
46  /* Animation data-block itself. */
48  &space_outliner, &legacy_te_.subtree, anim_data_.action, &legacy_te_, TSE_SOME_ID, 0);
49 
50  expand_drivers(space_outliner);
51  expand_NLA_tracks(space_outliner);
52 }
53 
54 void TreeElementAnimData::expand_drivers(SpaceOutliner &space_outliner) const
55 {
56  if (BLI_listbase_is_empty(&anim_data_.drivers)) {
57  return;
58  }
60  &space_outliner, &legacy_te_.subtree, &anim_data_, &legacy_te_, TSE_DRIVER_BASE, 0);
61 }
62 
63 void TreeElementAnimData::expand_NLA_tracks(SpaceOutliner &space_outliner) const
64 {
65  if (BLI_listbase_is_empty(&anim_data_.nla_tracks)) {
66  return;
67  }
68  outliner_add_element(&space_outliner, &legacy_te_.subtree, &anim_data_, &legacy_te_, TSE_NLA, 0);
69 }
70 
71 } // namespace blender::ed::outliner
#define BLI_assert(a)
Definition: BLI_assert.h:58
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
Definition: BLI_listbase.h:124
#define IFACE_(msgid)
These structs are the foundation for all linked lists in the library system.
@ TSE_ANIM_DATA
@ TSE_NLA
@ TSE_SOME_ID
@ TSE_DRIVER_BASE
void expand(SpaceOutliner &space_outliner) const override
TreeElementAnimData(TreeElement &legacy_te, AnimData &anim_data)
TreeElement * outliner_add_element(SpaceOutliner *space_outliner, ListBase *lb, void *idv, TreeElement *parent, short type, short index)
bAction * action
ListBase drivers
ListBase nla_tracks
ListBase subtree
TreeStoreElem * store_elem
void * directdata
const char * name