Blender  V2.93
tree_element_driver.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 "BKE_fcurve_driver.h"
24 
25 #include "DNA_anim_types.h"
26 #include "DNA_listBase.h"
27 
28 #include "BLT_translation.h"
29 
30 #include "../outliner_intern.h"
31 #include "tree_display.h"
32 
33 #include "tree_element_driver.hh"
34 
35 namespace blender::ed::outliner {
36 
38  : AbstractTreeElement(legacy_te), anim_data_(anim_data)
39 {
41  legacy_te.name = IFACE_("Drivers");
42 }
43 
44 void TreeElementDriverBase::expand(SpaceOutliner &space_outliner) const
45 {
46  ID *lastadded = nullptr;
47 
48  for (FCurve *fcu : blender::ListBaseWrapper<FCurve>(anim_data_.drivers)) {
49  if (fcu->driver && fcu->driver->variables.first) {
50  ChannelDriver *driver = fcu->driver;
51 
53  /* loop over all targets used here */
55  if (lastadded != dtar->id) {
56  /* XXX this lastadded check is rather lame, and also fails quite badly... */
58  &space_outliner, &legacy_te_.subtree, dtar->id, &legacy_te_, TSE_LINKED_OB, 0);
59  lastadded = dtar->id;
60  }
61  }
63  }
64  }
65  }
66 }
67 
68 } // namespace blender::ed::outliner
#define DRIVER_TARGETS_USED_LOOPER_BEGIN(dvar)
#define DRIVER_TARGETS_LOOPER_END
#define BLI_assert(a)
Definition: BLI_assert.h:58
#define IFACE_(msgid)
These structs are the foundation for all linked lists in the library system.
@ TSE_LINKED_OB
@ TSE_DRIVER_BASE
TreeElementDriverBase(TreeElement &legacy_te, AnimData &anim_data)
void expand(SpaceOutliner &space_outliner) const override
TreeElement * outliner_add_element(SpaceOutliner *space_outliner, ListBase *lb, void *idv, TreeElement *parent, short type, short index)
ListBase drivers
ListBase variables
Definition: DNA_ID.h:273
ListBase subtree
TreeStoreElem * store_elem
const char * name