Blender V4.3
tree_display_sequencer.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
9#include <cstring>
10
11#include "BLI_listbase.h"
13#include "BLI_utildefines.h"
14
15#include "DNA_sequence_types.h"
16#include "DNA_space_types.h"
17
18#include "SEQ_sequencer.hh"
19
20#include "../outliner_intern.hh"
21#include "tree_display.hh"
22
23namespace blender::ed::outliner {
24
25template<typename T> using List = ListBaseWrapper<T>;
26
31
33{
34 ListBase tree = {nullptr};
35
37 if (ed == nullptr) {
38 return tree;
39 }
40
41 for (Sequence *seq : List<Sequence>(ed->seqbasep)) {
42 SequenceAddOp op = need_add_seq_dup(seq);
43 if (op == SEQUENCE_DUPLICATE_NONE) {
44 add_element(&tree, nullptr, seq, nullptr, TSE_SEQUENCE, 0);
45 }
46 else if (op == SEQUENCE_DUPLICATE_ADD) {
47 TreeElement *te = add_element(&tree, nullptr, seq, nullptr, TSE_SEQUENCE_DUP, 0);
48 add_seq_dup(seq, te, 0);
49 }
50 }
51
52 return tree;
53}
54
55SequenceAddOp TreeDisplaySequencer::need_add_seq_dup(Sequence *seq) const
56{
57 if ((!seq->strip) || (!seq->strip->stripdata)) {
59 }
60
61 /*
62 * First check backward, if we found a duplicate
63 * sequence before this, don't need it, just return.
64 */
65 Sequence *p = seq->prev;
66 while (p) {
67 if ((!p->strip) || (!p->strip->stripdata)) {
68 p = p->prev;
69 continue;
70 }
71
74 }
75 p = p->prev;
76 }
77
78 p = seq->next;
79 while (p) {
80 if ((!p->strip) || (!p->strip->stripdata)) {
81 p = p->next;
82 continue;
83 }
84
87 }
88 p = p->next;
89 }
90
92}
93
94void TreeDisplaySequencer::add_seq_dup(Sequence *seq, TreeElement *te, short index)
95{
96 Sequence *p = seq;
97 while (p) {
98 if ((!p->strip) || (!p->strip->stripdata) || (p->strip->stripdata->filename[0] == '\0')) {
99 p = p->next;
100 continue;
101 }
102
104 add_element(&te->subtree, nullptr, (void *)p, te, TSE_SEQUENCE, index);
105 }
106 p = p->next;
107 }
108}
109
110} // namespace blender::ed::outliner
#define STREQ(a, b)
@ TSE_SEQUENCE_DUP
@ TSE_SEQUENCE
Base Class For Tree-Displays.
static TreeElement * add_element(SpaceOutliner *space_outliner, ListBase *lb, ID *owner_id, void *create_data, TreeElement *parent, short type, short index, const bool expand=true)
ListBase build_tree(const TreeSourceData &source_data) override
TreeDisplaySequencer(SpaceOutliner &space_outliner)
GPU_SHADER_INTERFACE_INFO(depth_2d_update_iface, "").smooth(Type fragColor push_constant(Type::VEC2, "extent") .push_constant(Type source_data
KDTree_3d * tree
ListBaseWrapperTemplate< ListBase, T > ListBaseWrapper
Editing * SEQ_editing_get(const Scene *scene)
Definition sequencer.cc:262
ListBase * seqbasep
struct Sequence * prev
struct Sequence * next
char filename[256]
StripElem * stripdata
The data to build the tree from.
Establish and manage Outliner trees for different display modes.