added many linking features

This commit is contained in:
itsmattkc
2018-06-13 22:39:05 -07:00
parent 093b68cb67
commit 124b76d58c
16 changed files with 312 additions and 100 deletions
+15 -40
View File
@@ -29,14 +29,15 @@ Clip* Sequence::get_clip(int i) {
void Sequence::delete_clip(int i) {
// remove any potential link references to clip
// for (size_t j=0;j<clip_count();j++) {
// Clip* c = getClip(j);
// for (size_t k=0;k<c->linkedClips.size();k++) {
// if (c->linkedClips[k] == clips[i]) {
// c->linkedClips.erase(c->linkedClips.begin()+k);
// }
// }
// }
for (int j=0;j<clip_count();j++) {
Clip* c = get_clip(j);
for (int k=0;k<c->linked.size();k++) {
if (c->linked[k] == clips[i]) {
c->linked.removeAt(k);
break;
}
}
}
// finally remove from vector
delete clips.at(i);
@@ -69,40 +70,11 @@ void Sequence::get_track_limits(int* video_tracks, int* audio_tracks) {
if (audio_tracks != NULL) *audio_tracks = at;
}
void Sequence::delete_area(long in, long out, int track) {
for (int i=0;i<clip_count();i++) {
Clip* c = get_clip(i);
if (c->track == track && !c->undeletable) {
if (c->timeline_in >= in && c->timeline_out <= out) {
// clips falls entirely within deletion area
delete_clip(i);
i--;
} else if (c->timeline_in < in && c->timeline_out > out) {
// middle of clip is within deletion area
//void Sequence::delete_area(long in, long out, int track) {
// duplicate clip
Clip* pre = get_clip(i);
Clip* post = pre->copy();
//}
pre->timeline_out = in;
post->timeline_in = out;
post->clip_in = pre->clip_in + pre->getLength() + (out - in);
add_clip(post);
} else if (c->timeline_in < in && c->timeline_out > in) {
// only out point is in deletion area
c->timeline_out = in;
} else if (c->timeline_in < out && c->timeline_out > out) {
// only in point is in deletion area
c->clip_in += out - c->timeline_in;
c->timeline_in = out;
}
}
}
}
void Sequence::split_clip(int i, long frame) {
Clip* pre = get_clip(i);
Clip* Sequence::split_clip(Clip* pre, long frame) {
if (pre->timeline_in < frame && pre->timeline_out > frame) { // guard against attempts to split at in/out points
Clip* post = pre->copy();
@@ -111,7 +83,10 @@ void Sequence::split_clip(int i, long frame) {
post->clip_in = pre->clip_in + pre->getLength();
add_clip(post);
return post;
}
return NULL;
}
void Sequence::undo_add_current() {