Blender  V3.3
tree_element_seq.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #include "DNA_outliner_types.h"
8 #include "DNA_sequence_types.h"
9 
10 #include "BLI_listbase.h"
11 
12 #include "BLT_translation.h"
13 
14 #include "../outliner_intern.hh"
15 #include "tree_element_seq.hh"
16 
17 namespace blender::ed::outliner {
18 
20  : AbstractTreeElement(legacy_te), sequence_(sequence)
21 {
22  BLI_assert(legacy_te.store_elem->type == TSE_SEQUENCE);
23 
24  /*
25  * The idcode is a little hack, but the outliner
26  * only check te->idcode if te->type is equal to zero,
27  * so this is "safe".
28  */
29  legacy_te.idcode = sequence_.type;
30  legacy_te.name = sequence_.name + 2;
31 }
32 
33 bool TreeElementSequence::expandPoll(const SpaceOutliner & /*space_outliner*/) const
34 {
35  return !(sequence_.type & SEQ_TYPE_EFFECT);
36 }
37 
38 void TreeElementSequence::expand(SpaceOutliner &space_outliner) const
39 {
40  /*
41  * This work like the sequence.
42  * If the sequence have a name (not default name)
43  * show it, in other case put the filename.
44  */
45 
46  if (sequence_.type == SEQ_TYPE_META) {
47  LISTBASE_FOREACH (Sequence *, child, &sequence_.seqbase) {
49  &space_outliner, &legacy_te_.subtree, child, &legacy_te_, TSE_SEQUENCE, 0);
50  }
51  }
52  else {
54  &space_outliner, &legacy_te_.subtree, sequence_.strip, &legacy_te_, TSE_SEQ_STRIP, 0);
55  }
56 }
57 
59 {
60  return sequence_;
61 }
62 
63 /* -------------------------------------------------------------------- */
64 /* Strip */
65 
67  : AbstractTreeElement(legacy_te)
68 {
69  BLI_assert(legacy_te.store_elem->type == TSE_SEQ_STRIP);
70 
71  if (strip.dir[0] != '\0') {
72  legacy_te_.name = strip.dir;
73  }
74  else {
75  legacy_te_.name = IFACE_("Strip None");
76  }
77 }
78 
79 /* -------------------------------------------------------------------- */
80 /* Strip Duplicate */
81 
83  Sequence &sequence)
84  : AbstractTreeElement(legacy_te), sequence_(sequence)
85 {
87 
88  legacy_te_.idcode = sequence.type;
89  legacy_te_.name = sequence.strip->stripdata->name;
90 }
91 
93 {
94  return sequence_;
95 }
96 
97 } // namespace blender::ed::outliner
#define BLI_assert(a)
Definition: BLI_assert.h:46
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
#define IFACE_(msgid)
@ TSE_SEQUENCE_DUP
@ TSE_SEQUENCE
@ TSE_SEQ_STRIP
@ SEQ_TYPE_META
@ SEQ_TYPE_EFFECT
TreeElementSequenceStripDuplicate(TreeElement &legacy_te, Sequence &sequence)
TreeElementSequenceStrip(TreeElement &legacy_te, Strip &strip)
void expand(SpaceOutliner &) const override
TreeElementSequence(TreeElement &legacy_te, Sequence &sequence)
bool expandPoll(const SpaceOutliner &) const override
TreeElement * outliner_add_element(SpaceOutliner *space_outliner, ListBase *lb, void *idv, TreeElement *parent, short type, short index, const bool expand)
ListBase seqbase
char name[256]
StripElem * stripdata
char dir[768]
ListBase subtree
TreeStoreElem * store_elem
const char * name