ghosts can traverse tracks again

This commit is contained in:
itsmattkc
2019-04-05 02:16:12 +11:00
parent d7091c2b10
commit 9f029bedfa
9 changed files with 103 additions and 48 deletions
+1 -1
View File
@@ -2,5 +2,5 @@
Selection Ghost::ToSelection() const
{
return Selection(in, out, track);
return Selection(in, out, track->Sibling(track_movement));
}
+4 -2
View File
@@ -18,16 +18,18 @@ enum TrimType {
struct Ghost {
Clip* clip;
long in;
long out;
Track* track;
long clip_in;
long old_in;
long old_out;
Track* old_track;
long old_clip_in;
Track* track;
int track_movement;
// importing variables
Media* media;
int media_stream;
+1 -2
View File
@@ -189,12 +189,11 @@ void Sequence::AddClipsFromGhosts(ComboAction* ca, const QVector<Ghost>& ghosts)
earliest_point = qMin(earliest_point, g.in);
ClipPtr c = std::make_shared<Clip>(g.track);
ClipPtr c = std::make_shared<Clip>(g.track->Sibling(g.track_movement));
c->set_media(g.media, g.media_stream);
c->set_timeline_in(g.in);
c->set_timeline_out(g.out);
c->set_clip_in(g.clip_in);
c->set_track(g.track);
if (c->media()->get_type() == MEDIA_TYPE_FOOTAGE) {
Footage* m = c->media()->to_footage();
if (m->video_tracks.size() == 0) {
+1 -1
View File
@@ -165,7 +165,7 @@ QVector<Ghost> olive::timeline::CreateGhostsFromMedia(Sequence *seq,
Ghost& g = ghosts[i];
g.old_in = g.in;
g.old_out = g.out;
g.old_track = g.track;
g.track_movement = 0;
}
return ghosts;
+25
View File
@@ -195,6 +195,31 @@ Clip *Track::GetClipFromPoint(long point)
return nullptr;
}
Track *Track::Previous()
{
int index = Index();
if (index == 0) {
return nullptr;
}
return parent_->TrackAt(index - 1);
}
Track *Track::Next()
{
return parent_->TrackAt(Index() + 1);
}
Track *Track::Sibling(int diff)
{
if (diff == 0) {
return this;
}
return track_list()->TrackAt(qMax(0, Index() + diff));
}
int Track::Index()
{
return parent_->IndexOfTrack(this);
+4
View File
@@ -68,6 +68,10 @@ public:
ClipPtr GetClipObjectFromRawPtr(Clip* c);
Clip* GetClipFromPoint(long point);
Track* Previous();
Track* Next();
Track* Sibling(int diff);
int Index();
bool IsClipSelected(int clip_index, bool containing = true);