merged effects into node structure
This commit is contained in:
+10
-10
@@ -22,7 +22,7 @@
|
||||
|
||||
#include <QtMath>
|
||||
|
||||
#include "effects/effect.h"
|
||||
#include "nodes/node.h"
|
||||
#include "effects/transition.h"
|
||||
#include "project/footage.h"
|
||||
#include "global/config.h"
|
||||
@@ -116,7 +116,7 @@ Selection Clip::ToSelection()
|
||||
return Selection(timeline_in(), timeline_out(), track());
|
||||
}
|
||||
|
||||
Track::Type Clip::type()
|
||||
olive::TrackType Clip::type()
|
||||
{
|
||||
return track()->type();
|
||||
}
|
||||
@@ -147,7 +147,7 @@ FootageStream *Clip::media_stream()
|
||||
{
|
||||
if (media() != nullptr
|
||||
&& media()->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
return media()->to_footage()->get_stream_from_file_index(type() == Track::kTypeVideo, media_stream_index());
|
||||
return media()->to_footage()->get_stream_from_file_index(type() == olive::kTypeVideo, media_stream_index());
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
@@ -199,9 +199,9 @@ void Clip::refresh() {
|
||||
if (replaced && media() != nullptr && media()->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
Footage* m = media()->to_footage();
|
||||
|
||||
if (type() == Track::kTypeVideo && m->video_tracks.size() > 0) {
|
||||
if (type() == olive::kTypeVideo && m->video_tracks.size() > 0) {
|
||||
set_media(media(), m->video_tracks.at(0).file_index);
|
||||
} else if (type() == Track::kTypeAudio && m->audio_tracks.size() > 0) {
|
||||
} else if (type() == olive::kTypeAudio && m->audio_tracks.size() > 0) {
|
||||
set_media(media(), m->audio_tracks.at(0).file_index);
|
||||
}
|
||||
}
|
||||
@@ -220,7 +220,7 @@ QVector<Marker> &Clip::get_markers() {
|
||||
return markers;
|
||||
}
|
||||
|
||||
int Clip::IndexOfEffect(Effect *e)
|
||||
int Clip::IndexOfEffect(Node *e)
|
||||
{
|
||||
for (int i=0;i<effects.size();i++) {
|
||||
if (effects.at(i).get() == e) {
|
||||
@@ -427,7 +427,7 @@ long Clip::length() {
|
||||
}
|
||||
|
||||
double Clip::media_frame_rate() {
|
||||
Q_ASSERT(type() == Track::kTypeVideo);
|
||||
Q_ASSERT(type() == olive::kTypeVideo);
|
||||
if (media_ != nullptr) {
|
||||
double rate = media_->get_frame_rate(media_stream_index());
|
||||
if (!qIsNaN(rate)) return rate;
|
||||
@@ -449,7 +449,7 @@ long Clip::media_length() {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
Footage* m = media_->to_footage();
|
||||
const FootageStream* ms = m->get_stream_from_file_index(type() == Track::kTypeVideo, media_stream_index());
|
||||
const FootageStream* ms = m->get_stream_from_file_index(type() == olive::kTypeVideo, media_stream_index());
|
||||
if (ms != nullptr && ms->infinite_length) {
|
||||
return LONG_MAX;
|
||||
} else {
|
||||
@@ -517,7 +517,7 @@ void Clip::refactor_frame_rate(ComboAction* ca, double multiplier, bool change_t
|
||||
|
||||
// move keyframes
|
||||
for (int i=0;i<effects.size();i++) {
|
||||
EffectPtr e = effects.at(i);
|
||||
NodePtr e = effects.at(i);
|
||||
for (int j=0;j<e->row_count();j++) {
|
||||
EffectRow* r = e->row(j);
|
||||
for (int l=0;l<r->FieldCount();l++) {
|
||||
@@ -710,7 +710,7 @@ bool Clip::Retrieve()
|
||||
|
||||
bool Clip::UsesCacher()
|
||||
{
|
||||
return type() == Track::kTypeAudio || (media() != nullptr && media()->get_type() == MEDIA_TYPE_FOOTAGE);
|
||||
return type() == olive::kTypeAudio || (media() != nullptr && media()->get_type() == MEDIA_TYPE_FOOTAGE);
|
||||
}
|
||||
|
||||
ClipSpeed::ClipSpeed() :
|
||||
|
||||
+7
-7
@@ -30,15 +30,17 @@
|
||||
|
||||
#include "rendering/cacher.h"
|
||||
|
||||
#include "effects/effect.h"
|
||||
#include "nodes/node.h"
|
||||
#include "effects/transition.h"
|
||||
#include "undo/comboaction.h"
|
||||
#include "project/media.h"
|
||||
#include "project/footage.h"
|
||||
#include "rendering/framebufferobject.h"
|
||||
#include "marker.h"
|
||||
#include "track.h"
|
||||
#include "nodes/nodegraph.h"
|
||||
#include "selection.h"
|
||||
|
||||
class Track;
|
||||
|
||||
struct ClipSpeed {
|
||||
ClipSpeed();
|
||||
@@ -46,8 +48,6 @@ struct ClipSpeed {
|
||||
bool maintain_audio_pitch;
|
||||
};
|
||||
|
||||
using ClipPtr = std::shared_ptr<Clip>;
|
||||
|
||||
class Clip {
|
||||
public:
|
||||
Clip(Track *s);
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
|
||||
Selection ToSelection();
|
||||
|
||||
Track::Type type();
|
||||
olive::TrackType type();
|
||||
|
||||
const QColor& color();
|
||||
void set_color(int r, int g, int b);
|
||||
@@ -129,8 +129,8 @@ public:
|
||||
QVector<Marker>& get_markers();
|
||||
|
||||
// other variables (should be deep copied/duplicated in copy())
|
||||
int IndexOfEffect(Effect* e);
|
||||
QList<EffectPtr> effects;
|
||||
int IndexOfEffect(Node* e);
|
||||
QList<NodePtr> effects;
|
||||
QVector<Clip*> linked;
|
||||
TransitionPtr opening_transition;
|
||||
TransitionPtr closing_transition;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "effects/transition.h"
|
||||
#include "track.h"
|
||||
#include "project/media.h"
|
||||
|
||||
namespace olive {
|
||||
namespace timeline {
|
||||
|
||||
+14
-14
@@ -36,10 +36,10 @@ Sequence::Sequence() :
|
||||
wrapper_sequence(false)
|
||||
{
|
||||
// Set up tracks
|
||||
track_lists_.resize(Track::kTypeCount);
|
||||
track_lists_.resize(olive::kTypeCount);
|
||||
|
||||
for (int i=0;i<track_lists_.size();i++) {
|
||||
track_lists_[i] = new TrackList(this, static_cast<Track::Type>(i));
|
||||
track_lists_[i] = new TrackList(this, static_cast<olive::TrackType>(i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ QVector<Clip *> Sequence::GetAllClips()
|
||||
return all_clips;
|
||||
}
|
||||
|
||||
TrackList *Sequence::GetTrackList(Track::Type type)
|
||||
TrackList *Sequence::GetTrackList(olive::TrackType type)
|
||||
{
|
||||
return track_lists_.at(type);
|
||||
}
|
||||
@@ -230,13 +230,13 @@ void Sequence::AddClipsFromGhosts(ComboAction* ca, const QVector<Ghost>& ghosts)
|
||||
}
|
||||
|
||||
if (olive::config.add_default_effects_to_clips) {
|
||||
if (c->type() == Track::kTypeVideo) {
|
||||
if (c->type() == olive::kTypeVideo) {
|
||||
// add default video effects
|
||||
c->effects.append(Effect::Create(c.get(), Effect::GetInternalMeta(EFFECT_INTERNAL_TRANSFORM, EFFECT_TYPE_EFFECT)));
|
||||
} else if (c->type() == Track::kTypeAudio) {
|
||||
c->effects.append(olive::node_library[kTransformEffect]->Create(c.get()));
|
||||
} else if (c->type() == olive::kTypeAudio) {
|
||||
// add default audio effects
|
||||
c->effects.append(Effect::Create(c.get(), Effect::GetInternalMeta(EFFECT_INTERNAL_VOLUME, EFFECT_TYPE_EFFECT)));
|
||||
c->effects.append(Effect::Create(c.get(), Effect::GetInternalMeta(EFFECT_INTERNAL_PAN, EFFECT_TYPE_EFFECT)));
|
||||
c->effects.append(olive::node_library[kVolumeEffect]->Create(c.get()));
|
||||
c->effects.append(olive::node_library[kPanEffect]->Create(c.get()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -265,7 +265,7 @@ void Sequence::MoveClip(Clip *c, ComboAction *ca, long iin, long iout, long icli
|
||||
ca->append(new AddTransitionCommand(nullptr,
|
||||
c->opening_transition->secondary_clip,
|
||||
c->opening_transition,
|
||||
nullptr,
|
||||
kInvalidNode,
|
||||
0));
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ void Sequence::MoveClip(Clip *c, ComboAction *ca, long iin, long iout, long icli
|
||||
ca->append(new AddTransitionCommand(nullptr,
|
||||
c,
|
||||
c->closing_transition,
|
||||
nullptr,
|
||||
kInvalidNode,
|
||||
0));
|
||||
}
|
||||
}
|
||||
@@ -905,9 +905,9 @@ void Sequence::RippleDeleteArea(ComboAction* ca, long ripple_point, long ripple_
|
||||
|
||||
}
|
||||
|
||||
Effect *Sequence::GetSelectedGizmo()
|
||||
Node *Sequence::GetSelectedGizmo()
|
||||
{
|
||||
Effect* gizmo_ptr = nullptr;
|
||||
Node* gizmo_ptr = nullptr;
|
||||
|
||||
QVector<Clip*> clips = GetAllClips();
|
||||
|
||||
@@ -923,7 +923,7 @@ Effect *Sequence::GetSelectedGizmo()
|
||||
// none selected
|
||||
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
Effect* e = c->effects.at(j).get();
|
||||
Node* e = c->effects.at(j).get();
|
||||
|
||||
// retrieve gizmo data from effect
|
||||
if (e->are_gizmos_enabled()) {
|
||||
@@ -1156,7 +1156,7 @@ ClipPtr Sequence::SplitClip(ComboAction *ca, bool transitions, Clip* pre, long f
|
||||
ca->append(new AddTransitionCommand(nullptr,
|
||||
pre->opening_transition->secondary_clip,
|
||||
pre->opening_transition,
|
||||
nullptr,
|
||||
kInvalidNode,
|
||||
0)
|
||||
);
|
||||
|
||||
|
||||
+2
-2
@@ -47,7 +47,7 @@ public:
|
||||
|
||||
long GetEndFrame();
|
||||
QVector<Clip*> GetAllClips();
|
||||
TrackList* GetTrackList(Track::Type type);
|
||||
TrackList* GetTrackList(olive::TrackType type);
|
||||
|
||||
/**
|
||||
* @brief Close all open clips in a Sequence
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
void RippleDeleteEmptySpace(ComboAction *ca, Track *track, long point);
|
||||
void RippleDeleteArea(ComboAction* ca, long ripple_point, long ripple_length);
|
||||
|
||||
Effect* GetSelectedGizmo();
|
||||
Node* GetSelectedGizmo();
|
||||
|
||||
bool IsClipSelected(Clip* clip, bool containing = true);
|
||||
bool IsTransitionSelected(Transition* t);
|
||||
|
||||
@@ -119,7 +119,7 @@ QVector<Ghost> olive::timeline::CreateGhostsFromMedia(Sequence *seq,
|
||||
|| import_data.type() == olive::timeline::kImportBoth) {
|
||||
for (int j=0;j<m->audio_tracks.size();j++) {
|
||||
if (m->audio_tracks.at(j).enabled) {
|
||||
g.track = seq->GetTrackList(Track::kTypeAudio)->TrackAt(j);
|
||||
g.track = seq->GetTrackList(olive::kTypeAudio)->TrackAt(j);
|
||||
g.media_stream = m->audio_tracks.at(j).file_index;
|
||||
ghosts.append(g);
|
||||
}
|
||||
@@ -130,7 +130,7 @@ QVector<Ghost> olive::timeline::CreateGhostsFromMedia(Sequence *seq,
|
||||
|| import_data.type() == olive::timeline::kImportBoth) {
|
||||
for (int j=0;j<m->video_tracks.size();j++) {
|
||||
if (m->video_tracks.at(j).enabled) {
|
||||
g.track = seq->GetTrackList(Track::kTypeVideo)->TrackAt(j);
|
||||
g.track = seq->GetTrackList(olive::kTypeVideo)->TrackAt(j);
|
||||
g.media_stream = m->video_tracks.at(j).file_index;
|
||||
ghosts.append(g);
|
||||
}
|
||||
@@ -146,13 +146,13 @@ QVector<Ghost> olive::timeline::CreateGhostsFromMedia(Sequence *seq,
|
||||
|
||||
if (import_data.type() == olive::timeline::kImportVideoOnly
|
||||
|| import_data.type() == olive::timeline::kImportBoth) {
|
||||
g.track = seq->GetTrackList(Track::kTypeVideo)->First();
|
||||
g.track = seq->GetTrackList(olive::kTypeVideo)->First();
|
||||
ghosts.append(g);
|
||||
}
|
||||
|
||||
if (import_data.type() == olive::timeline::kImportAudioOnly
|
||||
|| import_data.type() == olive::timeline::kImportBoth) {
|
||||
g.track = seq->GetTrackList(Track::kTypeAudio)->First();
|
||||
g.track = seq->GetTrackList(olive::kTypeAudio)->First();
|
||||
ghosts.append(g);
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -9,7 +9,7 @@ int olive::timeline::kTrackDefaultHeight = 40;
|
||||
int olive::timeline::kTrackMinHeight = 30;
|
||||
int olive::timeline::kTrackHeightIncrement = 10;
|
||||
|
||||
Track::Track(TrackList* parent, Type type) :
|
||||
Track::Track(TrackList* parent, olive::TrackType type) :
|
||||
parent_(parent),
|
||||
type_(type),
|
||||
muted_(false),
|
||||
@@ -58,7 +58,7 @@ void Track::Save(QXmlStreamWriter &stream)
|
||||
stream.writeEndElement(); // track
|
||||
}
|
||||
|
||||
Track::Type Track::type()
|
||||
olive::TrackType Track::type()
|
||||
{
|
||||
return type_;
|
||||
}
|
||||
@@ -80,11 +80,11 @@ QString Track::name()
|
||||
int display_index = Index() + 1;
|
||||
|
||||
switch (type_) {
|
||||
case kTypeVideo:
|
||||
case olive::kTypeVideo:
|
||||
return tr("Video %1").arg(display_index);
|
||||
case kTypeAudio:
|
||||
case olive::kTypeAudio:
|
||||
return tr("Audio %1").arg(display_index);
|
||||
case kTypeSubtitle:
|
||||
case olive::kTypeSubtitle:
|
||||
return tr("Subtitle %1").arg(display_index);
|
||||
default:
|
||||
return tr("Unknown %1").arg(display_index);
|
||||
|
||||
+11
-12
@@ -4,7 +4,13 @@
|
||||
#include <QVector>
|
||||
#include <memory>
|
||||
|
||||
#include "effects/effect.h"
|
||||
#include "nodes/node.h"
|
||||
#include "tracktypes.h"
|
||||
#include "undo/comboaction.h"
|
||||
#include "timeline/selection.h"
|
||||
|
||||
class Sequence;
|
||||
class Transition;
|
||||
|
||||
namespace olive {
|
||||
namespace timeline {
|
||||
@@ -35,14 +41,7 @@ class Track : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Type {
|
||||
kTypeVideo,
|
||||
kTypeAudio,
|
||||
kTypeSubtitle,
|
||||
kTypeCount
|
||||
};
|
||||
|
||||
Track(TrackList* parent, Type type);
|
||||
Track(TrackList* parent, olive::TrackType type);
|
||||
Track* copy(TrackList* parent);
|
||||
|
||||
Sequence* sequence();
|
||||
@@ -50,7 +49,7 @@ public:
|
||||
|
||||
void Save(QXmlStreamWriter& stream);
|
||||
|
||||
Type type();
|
||||
olive::TrackType type();
|
||||
|
||||
int height();
|
||||
void set_height(int h);
|
||||
@@ -110,10 +109,10 @@ private:
|
||||
void ResizeClipArray(int new_size);
|
||||
|
||||
TrackList* parent_;
|
||||
Type type_;
|
||||
olive::TrackType type_;
|
||||
int height_;
|
||||
QVector<ClipPtr> clips_;
|
||||
QVector<EffectPtr> effects_;
|
||||
QVector<NodePtr> effects_;
|
||||
QVector<Selection> selections_;
|
||||
|
||||
bool muted_;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "timeline/sequence.h"
|
||||
|
||||
TrackList::TrackList(Sequence *parent, Track::Type type) :
|
||||
TrackList::TrackList(Sequence *parent, olive::TrackType type) :
|
||||
QObject(parent),
|
||||
type_(type)
|
||||
{
|
||||
@@ -91,7 +91,7 @@ QVector<Track*> TrackList::tracks()
|
||||
return tracks_;
|
||||
}
|
||||
|
||||
Track::Type TrackList::type()
|
||||
olive::TrackType TrackList::type()
|
||||
{
|
||||
return type_;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ class TrackList : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TrackList(Sequence* parent, Track::Type type);
|
||||
TrackList(Sequence* parent, olive::TrackType type);
|
||||
TrackList* copy(Sequence* parent);
|
||||
|
||||
void Save(QXmlStreamWriter& stream);
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
Track* TrackAt(int i);
|
||||
QVector<Track*> tracks();
|
||||
|
||||
Track::Type type();
|
||||
olive::TrackType type();
|
||||
|
||||
Sequence* GetParent();
|
||||
|
||||
@@ -31,7 +31,7 @@ signals:
|
||||
private:
|
||||
void ResizeTrackArray(int i);
|
||||
|
||||
Track::Type type_;
|
||||
olive::TrackType type_;
|
||||
QVector<Track*> tracks_;
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef TRACKTYPES_H
|
||||
#define TRACKTYPES_H
|
||||
|
||||
namespace olive {
|
||||
enum TrackType {
|
||||
kTypeVideo,
|
||||
kTypeAudio,
|
||||
kTypeSubtitle,
|
||||
kTypeCount
|
||||
};
|
||||
};
|
||||
|
||||
#endif // TRACKTYPES_H
|
||||
Reference in New Issue
Block a user