Outliner: Port sequencer elements to new tree-element design
Continuation of work started in2e221de4ce
and249e4df110
. Adds new tree-element classes for sequences, strips and strip duplicates.
This commit is contained in:
parent
d74c2b5c1f
commit
da1b6c4c02
|
@ -67,6 +67,7 @@ set(SRC
|
|||
tree/tree_element_overrides.cc
|
||||
tree/tree_element_rna.cc
|
||||
tree/tree_element_scene_objects.cc
|
||||
tree/tree_element_seq.cc
|
||||
tree/tree_element_view_layer.cc
|
||||
|
||||
outliner_intern.hh
|
||||
|
@ -84,6 +85,7 @@ set(SRC
|
|||
tree/tree_element_overrides.hh
|
||||
tree/tree_element_rna.hh
|
||||
tree/tree_element_scene_objects.hh
|
||||
tree/tree_element_seq.hh
|
||||
tree/tree_element_view_layer.hh
|
||||
)
|
||||
|
||||
|
|
|
@ -928,57 +928,12 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
|
|||
TSE_GP_LAYER,
|
||||
TSE_RNA_STRUCT,
|
||||
TSE_RNA_PROPERTY,
|
||||
TSE_RNA_ARRAY_ELEM)) {
|
||||
TSE_RNA_ARRAY_ELEM,
|
||||
TSE_SEQUENCE,
|
||||
TSE_SEQ_STRIP,
|
||||
TSE_SEQUENCE_DUP)) {
|
||||
BLI_assert_msg(false, "Element type should already use new AbstractTreeElement design");
|
||||
}
|
||||
else if (type == TSE_SEQUENCE) {
|
||||
Sequence *seq = (Sequence *)idv;
|
||||
|
||||
/*
|
||||
* The idcode is a little hack, but the outliner
|
||||
* only check te->idcode if te->type is equal to zero,
|
||||
* so this is "safe".
|
||||
*/
|
||||
te->idcode = seq->type;
|
||||
te->directdata = seq;
|
||||
te->name = seq->name + 2;
|
||||
|
||||
if (!(seq->type & SEQ_TYPE_EFFECT)) {
|
||||
/*
|
||||
* This work like the sequence.
|
||||
* If the sequence have a name (not default name)
|
||||
* show it, in other case put the filename.
|
||||
*/
|
||||
|
||||
if (seq->type == SEQ_TYPE_META) {
|
||||
LISTBASE_FOREACH (Sequence *, p, &seq->seqbase) {
|
||||
outliner_add_element(space_outliner, &te->subtree, (void *)p, te, TSE_SEQUENCE, index);
|
||||
}
|
||||
}
|
||||
else {
|
||||
outliner_add_element(
|
||||
space_outliner, &te->subtree, (void *)seq->strip, te, TSE_SEQ_STRIP, index);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (type == TSE_SEQ_STRIP) {
|
||||
Strip *strip = (Strip *)idv;
|
||||
|
||||
if (strip->dir[0] != '\0') {
|
||||
te->name = strip->dir;
|
||||
}
|
||||
else {
|
||||
te->name = IFACE_("Strip None");
|
||||
}
|
||||
te->directdata = strip;
|
||||
}
|
||||
else if (type == TSE_SEQUENCE_DUP) {
|
||||
Sequence *seq = (Sequence *)idv;
|
||||
|
||||
te->idcode = seq->type;
|
||||
te->directdata = seq;
|
||||
te->name = seq->strip->stripdata->name;
|
||||
}
|
||||
|
||||
if (tree_element_warnings_get(te, nullptr, nullptr)) {
|
||||
te->flag |= TE_HAS_WARNING;
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "tree_element_overrides.hh"
|
||||
#include "tree_element_rna.hh"
|
||||
#include "tree_element_scene_objects.hh"
|
||||
#include "tree_element_seq.hh"
|
||||
#include "tree_element_view_layer.hh"
|
||||
|
||||
#include "../outliner_intern.hh"
|
||||
|
@ -96,6 +97,14 @@ std::unique_ptr<AbstractTreeElement> AbstractTreeElement::createFromType(const i
|
|||
case TSE_RNA_ARRAY_ELEM:
|
||||
return std::make_unique<TreeElementRNAArrayElement>(
|
||||
legacy_te, *reinterpret_cast<PointerRNA *>(idv), legacy_te.index);
|
||||
case TSE_SEQUENCE:
|
||||
return std::make_unique<TreeElementSequence>(legacy_te, *reinterpret_cast<Sequence *>(idv));
|
||||
case TSE_SEQ_STRIP:
|
||||
return std::make_unique<TreeElementSequenceStrip>(legacy_te,
|
||||
*reinterpret_cast<Strip *>(idv));
|
||||
case TSE_SEQUENCE_DUP:
|
||||
return std::make_unique<TreeElementSequenceStripDuplicate>(
|
||||
legacy_te, *reinterpret_cast<Sequence *>(idv));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \ingroup spoutliner
|
||||
*/
|
||||
|
||||
#include "DNA_outliner_types.h"
|
||||
#include "DNA_sequence_types.h"
|
||||
|
||||
#include "BLI_listbase.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "../outliner_intern.hh"
|
||||
#include "tree_element_seq.hh"
|
||||
|
||||
namespace blender::ed::outliner {
|
||||
|
||||
TreeElementSequence::TreeElementSequence(TreeElement &legacy_te, Sequence &sequence)
|
||||
: AbstractTreeElement(legacy_te), sequence_(sequence)
|
||||
{
|
||||
BLI_assert(legacy_te.store_elem->type == TSE_SEQUENCE);
|
||||
|
||||
/*
|
||||
* The idcode is a little hack, but the outliner
|
||||
* only check te->idcode if te->type is equal to zero,
|
||||
* so this is "safe".
|
||||
*/
|
||||
legacy_te.idcode = sequence_.type;
|
||||
legacy_te.directdata = &sequence_;
|
||||
legacy_te.name = sequence_.name + 2;
|
||||
}
|
||||
|
||||
bool TreeElementSequence::expandPoll(const SpaceOutliner & /*space_outliner*/) const
|
||||
{
|
||||
return !(sequence_.type & SEQ_TYPE_EFFECT);
|
||||
}
|
||||
|
||||
void TreeElementSequence::expand(SpaceOutliner &space_outliner) const
|
||||
{
|
||||
/*
|
||||
* This work like the sequence.
|
||||
* If the sequence have a name (not default name)
|
||||
* show it, in other case put the filename.
|
||||
*/
|
||||
|
||||
if (sequence_.type == SEQ_TYPE_META) {
|
||||
LISTBASE_FOREACH (Sequence *, child, &sequence_.seqbase) {
|
||||
outliner_add_element(
|
||||
&space_outliner, &legacy_te_.subtree, child, &legacy_te_, TSE_SEQUENCE, 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
outliner_add_element(
|
||||
&space_outliner, &legacy_te_.subtree, sequence_.strip, &legacy_te_, TSE_SEQ_STRIP, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Strip */
|
||||
|
||||
TreeElementSequenceStrip::TreeElementSequenceStrip(TreeElement &legacy_te, Strip &strip)
|
||||
: AbstractTreeElement(legacy_te)
|
||||
{
|
||||
BLI_assert(legacy_te.store_elem->type == TSE_SEQ_STRIP);
|
||||
|
||||
if (strip.dir[0] != '\0') {
|
||||
legacy_te_.name = strip.dir;
|
||||
}
|
||||
else {
|
||||
legacy_te_.name = IFACE_("Strip None");
|
||||
}
|
||||
legacy_te_.directdata = &strip;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Strip Duplicate */
|
||||
|
||||
TreeElementSequenceStripDuplicate::TreeElementSequenceStripDuplicate(TreeElement &legacy_te,
|
||||
Sequence &sequence)
|
||||
: AbstractTreeElement(legacy_te)
|
||||
{
|
||||
BLI_assert(legacy_te.store_elem->type == TSE_SEQUENCE_DUP);
|
||||
|
||||
legacy_te_.idcode = sequence.type;
|
||||
legacy_te_.directdata = &sequence;
|
||||
legacy_te_.name = sequence.strip->stripdata->name;
|
||||
}
|
||||
|
||||
} // namespace blender::ed::outliner
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \ingroup spoutliner
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tree_element.hh"
|
||||
|
||||
struct Sequence;
|
||||
struct Strip;
|
||||
|
||||
namespace blender::ed::outliner {
|
||||
|
||||
class TreeElementSequence : public AbstractTreeElement {
|
||||
Sequence &sequence_;
|
||||
|
||||
public:
|
||||
TreeElementSequence(TreeElement &legacy_te, Sequence &sequence);
|
||||
|
||||
bool expandPoll(const SpaceOutliner &) const override;
|
||||
void expand(SpaceOutliner &) const override;
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
class TreeElementSequenceStrip : public AbstractTreeElement {
|
||||
public:
|
||||
TreeElementSequenceStrip(TreeElement &legacy_te, Strip &strip);
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
class TreeElementSequenceStripDuplicate : public AbstractTreeElement {
|
||||
public:
|
||||
TreeElementSequenceStripDuplicate(TreeElement &legacy_te, Sequence &sequence);
|
||||
};
|
||||
|
||||
} // namespace blender::ed::outliner
|
Loading…
Reference in New Issue