Blender V4.3
tree_element_driver.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
10
11#include "BKE_fcurve_driver.h"
12
13#include "DNA_anim_types.h"
14#include "DNA_listBase.h"
15#include "DNA_space_types.h"
16
17#include "BLT_translation.hh"
18
19#include "../outliner_intern.hh"
20
22
23namespace blender::ed::outliner {
24
26 : AbstractTreeElement(legacy_te), anim_data_(anim_data)
27{
29 legacy_te.name = IFACE_("Drivers");
30}
31
32void TreeElementDriverBase::expand(SpaceOutliner & /*space_outliner*/) const
33{
34 ID *lastadded = nullptr;
35
36 for (FCurve *fcu : blender::ListBaseWrapper<FCurve>(anim_data_.drivers)) {
37 if (fcu->driver && fcu->driver->variables.first) {
38 ChannelDriver *driver = fcu->driver;
39
41 /* loop over all targets used here */
43 if (lastadded != dtar->id) {
44 /* XXX this lastadded check is rather lame, and also fails quite badly... */
45 add_element(&legacy_te_.subtree, dtar->id, nullptr, &legacy_te_, TSE_LINKED_OB, 0);
46 lastadded = dtar->id;
47 }
48 }
50 }
51 }
52 }
53}
54
55} // namespace blender::ed::outliner
#define DRIVER_TARGETS_USED_LOOPER_BEGIN(dvar)
#define DRIVER_TARGETS_LOOPER_END
#define BLI_assert(a)
Definition BLI_assert.h:50
#define IFACE_(msgid)
These structs are the foundation for all linked lists in the library system.
@ TSE_LINKED_OB
@ 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
TreeElementDriverBase(TreeElement &legacy_te, AnimData &anim_data)
void expand(SpaceOutliner &space_outliner) const override
ListBaseWrapperTemplate< ListBase, T > ListBaseWrapper
ListBase drivers
Definition DNA_ID.h:413