diff --git a/effects/findedges.frag b/effects/findedges.frag
index 9641cf398..c8fe24c5e 100644
--- a/effects/findedges.frag
+++ b/effects/findedges.frag
@@ -1,121 +1,53 @@
#version 110
-uniform vec2 resolution;
+/*varying vec4 vertColor;
+varying vec4 vertTexCoord;
+uniform sampler2D texture;
+//uniform vec2 texOffset;
-vec3 mod289(vec3 x) {
- return x - floor(x * (1.0 / 289.0)) * 289.0;
-}
+void main(void) {
+ // Grouping texcoord variables in order to make it work in the GMA 950. See post #13
+ // in this thread:
+ // http://www.idevgames.com/forums/thread-3467.html
+ vec2 texOffset = vec2(1.0);
-vec4 mod289(vec4 x) {
- return x - floor(x * (1.0 / 289.0)) * 289.0;
-}
+ vec2 tc0 = vertTexCoord.st + vec2(-texOffset.s, -texOffset.t);
+ vec2 tc1 = vertTexCoord.st + vec2( 0.0, -texOffset.t);
+ vec2 tc2 = vertTexCoord.st + vec2(+texOffset.s, -texOffset.t);
+ vec2 tc3 = vertTexCoord.st + vec2(-texOffset.s, 0.0);
+ vec2 tc4 = vertTexCoord.st + vec2( 0.0, 0.0);
+ vec2 tc5 = vertTexCoord.st + vec2(+texOffset.s, 0.0);
+ vec2 tc6 = vertTexCoord.st + vec2(-texOffset.s, +texOffset.t);
+ vec2 tc7 = vertTexCoord.st + vec2( 0.0, +texOffset.t);
+ vec2 tc8 = vertTexCoord.st + vec2(+texOffset.s, +texOffset.t);
-vec4 permute(vec4 x) {
- return mod289(((x * 34.0) + 1.0) * x);
-}
+ vec4 col0 = texture2D(texture, tc0);
+ vec4 col1 = texture2D(texture, tc1);
+ vec4 col2 = texture2D(texture, tc2);
+ vec4 col3 = texture2D(texture, tc3);
+ vec4 col4 = texture2D(texture, tc4);
+ vec4 col5 = texture2D(texture, tc5);
+ vec4 col6 = texture2D(texture, tc6);
+ vec4 col7 = texture2D(texture, tc7);
+ vec4 col8 = texture2D(texture, tc8);
-vec4 taylorInvSqrt(vec4 r) {
- return 1.79284291400159 - 0.85373472095314 * r;
-}
+ vec4 sum = 8.0 * col4 - (col0 + col1 + col2 + col3 + col5 + col6 + col7 + col8);
+ gl_FragColor = vec4(sum.rgb, 1.0);// * vertColor;
+}*/
-vec3 fade(vec3 t) {
- return t * t * t * (t * (t * 6.0 - 15.0) + 10.0);
-}
+varying vec4 vertTexCoord;
+uniform sampler2D texture;
+//uniform vec2 pixels;
-float noise(vec3 P) {
- vec3 Pi0 = floor(P),
- Pi1 = Pi0 + vec3(1.0);
-
- Pi0 = mod289(Pi0);
- Pi1 = mod289(Pi1);
-
- vec3 Pf0 = fract(P),
- Pf1 = Pf0 - vec3(1.0);
-
- vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x),
- iy = vec4(Pi0.yy, Pi1.yy),
- iz0 = Pi0.zzzz,
- iz1 = Pi1.zzzz,
- ixy = permute(permute(ix) + iy),
- ixy0 = permute(ixy + iz0),
- ixy1 = permute(ixy + iz1),
- gx0 = ixy0 * (1.0 / 7.0),
- gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;
-
- gx0 = fract(gx0);
-
- vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0),
- sz0 = step(gz0, vec4(0.0));
-
- gx0 -= sz0 * (step(0.0, gx0) - 0.5);
- gy0 -= sz0 * (step(0.0, gy0) - 0.5);
-
- vec4 gx1 = ixy1 * (1.0 / 7.0),
- gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;
-
- gx1 = fract(gx1);
-
- vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1),
- sz1 = step(gz1, vec4(0.0));
-
- gx1 -= sz1 * (step(0.0, gx1) - 0.5);
- gy1 -= sz1 * (step(0.0, gy1) - 0.5);
-
- vec3 g000 = vec3(gx0.x, gy0.x, gz0.x),
- g100 = vec3(gx0.y, gy0.y, gz0.y),
- g010 = vec3(gx0.z, gy0.z, gz0.z),
- g110 = vec3(gx0.w, gy0.w, gz0.w),
- g001 = vec3(gx1.x, gy1.x, gz1.x),
- g101 = vec3(gx1.y, gy1.y, gz1.y),
- g011 = vec3(gx1.z, gy1.z, gz1.z),
- g111 = vec3(gx1.w, gy1.w, gz1.w);
-
- vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
- g000 *= norm0.x;
- g010 *= norm0.y;
- g100 *= norm0.z;
- g110 *= norm0.w;
-
- vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
- g001 *= norm1.x;
- g011 *= norm1.y;
- g101 *= norm1.z;
- g111 *= norm1.w;
-
- float n000 = dot(g000, Pf0),
- n100 = dot(g100, vec3(Pf1.x, Pf0.yz)),
- n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z)),
- n110 = dot(g110, vec3(Pf1.xy, Pf0.z)),
- n001 = dot(g001, vec3(Pf0.xy, Pf1.z)),
- n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z)),
- n011 = dot(g011, vec3(Pf0.x, Pf1.yz)),
- n111 = dot(g111, Pf1);
-
- vec3 fade_xyz = fade(Pf0);
- vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);
- vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);
-
- return mix(n_yz.x, n_yz.y, fade_xyz.x);
-}
+void main(void)
+{
+ vec2 pixels = vec2(16.0, 9.0);
-void main( void ) {
- float time = 2.0;
- vec2 noiseFactor = vec2(2.0, 2.0);
- float noiseFactorTime = 2.0;
-
- vec2 p = gl_FragCoord.xy / resolution.y;
- //p *= vec2(800, 600);
- //p += mouse * 1.0;
- //float z = 1.0;
- //float speed = 1.0;
-
- //p.y += time * 0.1;
-
- vec2 nx = vec2(p.x * noiseFactor.x, p.y * noiseFactor.y);
-
- float v = noise(vec3(nx, time * noiseFactorTime) * 3.0) * 6.28318531;
- v = v * 0.15 + 0.5;
-
- gl_FragColor = vec4(vec3(v), 1.0);
+ vec2 p = vertTexCoord.st;
+ p.x -= mod(p.x, 1.0 / pixels.x);
+ p.y -= mod(p.y, 1.0 / pixels.y);
+
+ vec3 col = texture2D(texture, p).rgb;
+ gl_FragColor = vec4(col, 1.0);
}
\ No newline at end of file
diff --git a/effects/internal/cornerpineffect.cpp b/effects/internal/cornerpineffect.cpp
index 0e4d38870..a0206946d 100644
--- a/effects/internal/cornerpineffect.cpp
+++ b/effects/internal/cornerpineffect.cpp
@@ -33,7 +33,7 @@ CornerPinEffect::CornerPinEffect(Clip *c, const EffectMeta *em) : Effect(c, em)
bottom_right_y->id = "bottomrighty";
perspective = add_row("Perspective:")->add_field(EFFECT_FIELD_BOOL);
- perspective->set_bool_value(false);
+ perspective->set_bool_value(true);
connect(top_left_x, SIGNAL(changed()), this, SLOT(field_changed()));
connect(top_left_y, SIGNAL(changed()), this, SLOT(field_changed()));
diff --git a/effects/pixelate.frag b/effects/pixelate.frag
new file mode 100644
index 000000000..9a1f49ed8
--- /dev/null
+++ b/effects/pixelate.frag
@@ -0,0 +1,20 @@
+#version 110
+
+varying vec2 vTexCoord;
+uniform sampler2D texture;
+uniform float pixels_x;
+uniform float pixels_y;
+uniform bool bypass;
+
+void main(void) {
+ if (bypass) {
+ gl_FragColor = texture2D(texture, vTexCoord);
+ } else {
+ vec2 p = vTexCoord;
+
+ p.x -= mod(p.x, 1.0 / pixels_x);
+ p.y -= mod(p.y, 1.0 / pixels_y);
+
+ gl_FragColor = texture2D(texture, p);
+ }
+}
\ No newline at end of file
diff --git a/effects/pixelate.xml b/effects/pixelate.xml
new file mode 100644
index 000000000..414c54c8d
--- /dev/null
+++ b/effects/pixelate.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/io/previewgenerator.cpp b/io/previewgenerator.cpp
index 883343ed9..034301199 100644
--- a/io/previewgenerator.cpp
+++ b/io/previewgenerator.cpp
@@ -126,7 +126,7 @@ bool PreviewGenerator::retrieve_preview(const QString& hash) {
QString thumb_path = get_thumbnail_path(hash, ms);
QFile f(thumb_path);
if (f.exists()) {
- dout << "loaded thumb" << ms->file_index << "from" << thumb_path;
+ //dout << "loaded thumb" << ms->file_index << "from" << thumb_path;
ms->video_preview.load(thumb_path);
ms->preview_done = true;
} else {
@@ -139,7 +139,7 @@ bool PreviewGenerator::retrieve_preview(const QString& hash) {
QString waveform_path = get_waveform_path(hash, ms);
QFile f(waveform_path);
if (f.exists()) {
- dout << "loaded wave" << ms->file_index << "from" << waveform_path;
+ //dout << "loaded wave" << ms->file_index << "from" << waveform_path;
f.open(QFile::ReadOnly);
QByteArray data = f.readAll();
ms->audio_preview.resize(data.size());
@@ -430,7 +430,7 @@ void PreviewGenerator::run() {
for (int i=0;ivideo_tracks.size();i++) {
MediaStream* ms = media->video_tracks.at(i);
if (ms->video_preview.save(get_thumbnail_path(hash, ms), "PNG")) {
- dout << "saved" << ms->file_index << "thumb to" << get_thumbnail_path(hash, ms);
+ //dout << "saved" << ms->file_index << "thumb to" << get_thumbnail_path(hash, ms);
}
}
for (int i=0;iaudio_tracks.size();i++) {
@@ -439,7 +439,7 @@ void PreviewGenerator::run() {
f.open(QFile::WriteOnly);
f.write(ms->audio_preview.constData(), ms->audio_preview.size());
f.close();
- dout << "saved" << ms->file_index << "waveform to" << get_waveform_path(hash, ms);
+ //dout << "saved" << ms->file_index << "waveform to" << get_waveform_path(hash, ms);
}
}
@@ -451,6 +451,7 @@ void PreviewGenerator::run() {
if (error) {
update_footage_tooltip(item, media, errorStr);
emit set_icon(ICON_TYPE_ERROR, replace);
+ media->ready_lock.unlock();
} else {
update_footage_tooltip(item, media);
}
diff --git a/panels/timeline.cpp b/panels/timeline.cpp
index 3ab8312e7..2751746e5 100644
--- a/panels/timeline.cpp
+++ b/panels/timeline.cpp
@@ -16,6 +16,7 @@
#include "project/undo.h"
#include "io/config.h"
#include "project/effect.h"
+#include "io/media.h"
#include "debug.h"
#include
@@ -155,6 +156,187 @@ void Timeline::toggle_show_all() {
}
}
+void Timeline::create_ghosts_from_media(Sequence* seq, long entry_point, QVector& media_list, QVector& type_list) {
+ video_ghosts = false;
+ audio_ghosts = false;
+
+ for (int i=0;i(media_list.at(i));
+ media = m;
+ can_import = m->ready;
+ if (m->using_inout) {
+ double source_fr = 30;
+ if (m->video_tracks.size() > 0) source_fr = m->video_tracks.at(0)->video_frame_rate;
+ default_clip_in = refactor_frame_number(m->in, source_fr, seq->frame_rate);
+ default_clip_out = refactor_frame_number(m->out, source_fr, seq->frame_rate);
+ }
+ break;
+ case MEDIA_TYPE_SEQUENCE:
+ s = static_cast(media_list.at(i));
+ sequence_length = s->getEndFrame();
+ if (seq != NULL) sequence_length = refactor_frame_number(sequence_length, s->frame_rate, seq->frame_rate);
+ media = s;
+ can_import = (s != seq && sequence_length != 0);
+ if (s->using_workarea) {
+ default_clip_in = refactor_frame_number(s->workarea_in, s->frame_rate, seq->frame_rate);
+ default_clip_out = refactor_frame_number(s->workarea_out, s->frame_rate, seq->frame_rate);
+ }
+ break;
+ default:
+ can_import = false;
+ }
+
+ if (can_import) {
+ Ghost g;
+ g.clip = -1;
+ g.media_type = type_list.at(i);
+ g.trimming = false;
+ g.old_clip_in = g.clip_in = default_clip_in;
+ g.media = media;
+ g.in = entry_point;
+ g.transition = NULL;
+
+ switch (type_list.at(i)) {
+ case MEDIA_TYPE_FOOTAGE:
+ // is video source a still image?
+ if (m->video_tracks.size() > 0 && m->video_tracks[0]->infinite_length && m->audio_tracks.size() == 0) {
+ g.out = g.in + 100;
+ } else {
+ long length = m->get_length_in_frames(seq->frame_rate);
+ g.out = entry_point + length - default_clip_in;
+ if (m->using_inout) {
+ g.out -= (length - default_clip_out);
+ }
+ }
+
+ for (int j=0;jaudio_tracks.size();j++) {
+ g.track = j;
+ g.media_stream = m->audio_tracks.at(j)->file_index;
+ ghosts.append(g);
+ audio_ghosts = true;
+ }
+ for (int j=0;jvideo_tracks.size();j++) {
+ g.track = -1-j;
+ g.media_stream = m->video_tracks.at(j)->file_index;
+ ghosts.append(g);
+ video_ghosts = true;
+ }
+ break;
+ case MEDIA_TYPE_SEQUENCE:
+ g.out = entry_point + sequence_length - default_clip_in;
+
+ if (s->using_workarea) {
+ g.out -= (sequence_length - default_clip_out);
+ }
+
+ g.track = -1;
+ ghosts.append(g);
+ g.track = 0;
+ ghosts.append(g);
+
+ video_ghosts = true;
+ audio_ghosts = true;
+ break;
+ }
+ entry_point = g.out;
+ }
+ }
+ for (int i=0;i added_clips;
+ for (int i=0;imedia = g.media;
+ c->media_type = g.media_type;
+ c->media_stream = g.media_stream;
+ c->timeline_in = g.in;
+ c->timeline_out = g.out;
+ c->clip_in = g.clip_in;
+ c->track = g.track;
+ if (c->media_type == MEDIA_TYPE_FOOTAGE) {
+ Media* m = static_cast(c->media);
+ if (m->video_tracks.size() == 0) {
+ // audio only (greenish)
+ c->color_r = 128;
+ c->color_g = 192;
+ c->color_b = 128;
+ } else if (m->audio_tracks.size() == 0) {
+ // video only (orangeish)
+ c->color_r = 192;
+ c->color_g = 160;
+ c->color_b = 128;
+ } else {
+ // video and audio (blueish)
+ c->color_r = 128;
+ c->color_g = 128;
+ c->color_b = 192;
+ }
+ c->name = m->name;
+ } else if (c->media_type == MEDIA_TYPE_SEQUENCE) {
+ // sequence (red?ish?)
+ c->color_r = 192;
+ c->color_g = 128;
+ c->color_b = 128;
+
+ Sequence* media = static_cast(c->media);
+ c->name = media->name;
+ }
+ c->recalculateMaxLength();
+ added_clips.append(c);
+ }
+ ca->append(new AddClipCommand(s, added_clips));
+
+ // link clips from the same media
+ for (int i=0;imedia == cc->media) {
+ c->linked.append(j);
+ }
+ }
+
+ if (c->track < 0) {
+ // add default video effects
+ c->effects.append(create_effect(c, get_internal_meta(EFFECT_INTERNAL_TRANSFORM)));
+ } else {
+ // add default audio effects
+ c->effects.append(create_effect(c, get_internal_meta(EFFECT_INTERNAL_VOLUME)));
+ c->effects.append(create_effect(c, get_internal_meta(EFFECT_INTERNAL_PAN)));
+ }
+ }
+ if (config.enable_seek_to_import) {
+ panel_sequence_viewer->seek(earliest_point);
+ }
+ panel_timeline->ghosts.clear();
+ panel_timeline->importing = false;
+ panel_timeline->snapped = false;
+}
+
int Timeline::get_track_height_size(bool video) {
if (video) {
return video_track_heights.size();
@@ -239,7 +421,7 @@ void Timeline::repaint_timeline() {
if (sequence != NULL) {
long sequenceEndFrame = sequence->getEndFrame();
- panel_timeline->ui->horizontalScrollBar->setMaximum(qMax(0, getScreenPointFromFrame(panel_timeline->zoom, sequenceEndFrame) - (ui->editAreas->width()/2)));
+ ui->horizontalScrollBar->setMaximum(qMax(0, getScreenPointFromFrame(zoom, sequenceEndFrame) - (ui->editAreas->width()/2)));
if (last_frame != sequence->playhead) {
ui->audio_monitor->update();
diff --git a/panels/timeline.h b/panels/timeline.h
index 8af2cab63..68acbb46f 100644
--- a/panels/timeline.h
+++ b/panels/timeline.h
@@ -98,6 +98,9 @@ public:
void next_cut();
void toggle_show_all();
+ void create_ghosts_from_media(Sequence *seq, long entry_point, QVector &media_list, QVector &type_list);
+ void add_clips_from_ghosts(ComboAction *ca, Sequence *s);
+
int getTimelineScreenPointFromFrame(long frame);
long getTimelineFrameFromScreenPoint(int x);
int getDisplayScreenPointFromFrame(long frame);
diff --git a/ui/sourcetable.cpp b/ui/sourcetable.cpp
index dc184da98..78af77453 100644
--- a/ui/sourcetable.cpp
+++ b/ui/sourcetable.cpp
@@ -7,6 +7,7 @@
#include "panels/panels.h"
#include "playback/playback.h"
#include "project/undo.h"
+#include "project/sequence.h"
#include "mainwindow.h"
#include
@@ -118,11 +119,13 @@ void SourceTable::create_seq_from_selected() {
type_list.append(get_type_from_tree(item));
}
+ ComboAction* ca = new ComboAction();
Sequence* s = create_sequence_from_media(media_list, type_list);
// add clips to it
+ panel_timeline->create_ghosts_from_media(s, 0, media_list, type_list);
+ panel_timeline->add_clips_from_ghosts(ca, s);
- ComboAction* ca = new ComboAction();
panel_project->new_sequence(ca, s, true, NULL);
undo_stack.push(ca);
}
diff --git a/ui/timelinewidget.cpp b/ui/timelinewidget.cpp
index d02610057..a9602adda 100644
--- a/ui/timelinewidget.cpp
+++ b/ui/timelinewidget.cpp
@@ -277,136 +277,42 @@ void TimelineWidget::dragEnterEvent(QDragEnterEvent *event) {
panel_project->last_imported_media.at(i)->ready_lock.lock();
panel_project->last_imported_media.at(i)->ready_lock.unlock();
- media_list.append(panel_project->last_imported_media.at(i));
- type_list.append(MEDIA_TYPE_FOOTAGE);
+ if (panel_project->last_imported_media.at(i)->ready) {
+ media_list.append(panel_project->last_imported_media.at(i));
+ type_list.append(MEDIA_TYPE_FOOTAGE);
+ }
}
- import_init = true;
- panel_timeline->importing_files = true;
+ if (media_list.isEmpty()) {
+ undo_stack.undo();
+ } else {
+ import_init = true;
+ panel_timeline->importing_files = true;
+ }
}
}
if (import_init) {
- event->accept();
+ event->accept();
- panel_timeline->video_ghosts = false;
- panel_timeline->audio_ghosts = false;
- QPoint pos = event->pos();
- long entry_point;
+ long entry_point;
+ Sequence* seq = sequence;
- double using_fr;
-
- if (sequence == NULL) {
- // if no sequence, we're going to create a new one using the clips as a reference
- entry_point = 0;
+ if (seq == NULL) {
+ // if no sequence, we're going to create a new one using the clips as a reference
+ entry_point = 0;
self_created_sequence = create_sequence_from_media(media_list, type_list);
- using_fr = self_created_sequence->frame_rate;
- } else {
- entry_point = panel_timeline->getTimelineFrameFromScreenPoint(pos.x());
+ seq = self_created_sequence;
+ } else {
+ entry_point = panel_timeline->getTimelineFrameFromScreenPoint(event->pos().x());
panel_timeline->drag_frame_start = entry_point + getFrameFromScreenPoint(panel_timeline->zoom, 50);
- panel_timeline->drag_track_start = (bottom_align) ? -1 : 0;
- using_fr = sequence->frame_rate;
- }
- for (int i=0;idrag_track_start = (bottom_align) ? -1 : 0;
+ }
- Media* m = NULL;
- Sequence* s = NULL;
- void* media = NULL;
- long sequence_length;
- long default_clip_in = 0;
- long default_clip_out = 0;
+ panel_timeline->create_ghosts_from_media(seq, entry_point, media_list, type_list);
- switch (type_list.at(i)) {
- case MEDIA_TYPE_FOOTAGE:
- m = static_cast(media_list.at(i));
- media = m;
- can_import = m->ready;
- if (m->using_inout) {
- double source_fr = 30;
- if (m->video_tracks.size() > 0) source_fr = m->video_tracks.at(0)->video_frame_rate;
- default_clip_in = refactor_frame_number(m->in, source_fr, using_fr);
- default_clip_out = refactor_frame_number(m->out, source_fr, using_fr);
- }
- break;
- case MEDIA_TYPE_SEQUENCE:
- s = static_cast(media_list.at(i));
- sequence_length = s->getEndFrame();
- if (sequence != NULL) sequence_length = refactor_frame_number(sequence_length, s->frame_rate, using_fr);
- media = s;
- can_import = (s != sequence && sequence_length != 0);
- if (s->using_workarea) {
- default_clip_in = refactor_frame_number(s->workarea_in, s->frame_rate, using_fr);
- default_clip_out = refactor_frame_number(s->workarea_out, s->frame_rate, using_fr);
- }
- break;
- default:
- can_import = false;
- }
-
- if (can_import) {
- Ghost g;
- g.clip = -1;
- g.media_type = type_list.at(i);
- g.trimming = false;
- g.old_clip_in = g.clip_in = default_clip_in;
- g.media = media;
- g.in = entry_point;
- g.transition = NULL;
-
- switch (type_list.at(i)) {
- case MEDIA_TYPE_FOOTAGE:
- // is video source a still image?
- if (m->video_tracks.size() > 0 && m->video_tracks[0]->infinite_length && m->audio_tracks.size() == 0) {
- g.out = g.in + 100;
- } else {
- long length = m->get_length_in_frames(using_fr);
- g.out = entry_point + length - default_clip_in;
- if (m->using_inout) {
- g.out -= (length - default_clip_out);
- }
- }
-
- for (int j=0;jaudio_tracks.size();j++) {
- g.track = j;
- g.media_stream = m->audio_tracks.at(j)->file_index;
- panel_timeline->ghosts.append(g);
- panel_timeline->audio_ghosts = true;
- }
- for (int j=0;jvideo_tracks.size();j++) {
- g.track = -1-j;
- g.media_stream = m->video_tracks.at(j)->file_index;
- panel_timeline->ghosts.append(g);
- panel_timeline->video_ghosts = true;
- }
- break;
- case MEDIA_TYPE_SEQUENCE:
- g.out = entry_point + sequence_length - default_clip_in;
-
- if (s->using_workarea) {
- g.out -= (sequence_length - default_clip_out);
- }
-
- g.track = -1;
- panel_timeline->ghosts.append(g);
- g.track = 0;
- panel_timeline->ghosts.append(g);
-
- panel_timeline->video_ghosts = true;
- panel_timeline->audio_ghosts = true;
- break;
- }
- entry_point = g.out;
- }
- }
- for (int i=0;ighosts.size();i++) {
- Ghost& g = panel_timeline->ghosts[i];
- g.old_in = g.in;
- g.old_out = g.out;
- g.old_track = g.track;
- }
- panel_timeline->importing = true;
+ panel_timeline->importing = true;
}
}
@@ -442,9 +348,9 @@ void TimelineWidget::dragLeaveEvent(QDragLeaveEvent*) {
if (panel_timeline->importing_files) {
undo_stack.undo();
}
+ panel_timeline->importing_files = false;
panel_timeline->ghosts.clear();
panel_timeline->importing = false;
- panel_timeline->importing_files = false;
update_ui(false);
}
if (self_created_sequence != NULL) {
@@ -542,8 +448,6 @@ void TimelineWidget::dropEvent(QDropEvent* event) {
ComboAction* ca = new ComboAction();
- QVector added_clips;
-
Sequence* s = sequence;
// if we're dropping into nothing, create a new sequences based on the clip being dragged
@@ -557,86 +461,13 @@ void TimelineWidget::dropEvent(QDropEvent* event) {
delete_area_under_ghosts(ca);
}
- // add clips
- long earliest_point = LONG_MAX;
- for (int i=0;ighosts.size();i++) {
- const Ghost& g = panel_timeline->ghosts.at(i);
-
- earliest_point = qMin(earliest_point, g.in);
-
- Clip* c = new Clip(s);
- c->media = g.media;
- c->media_type = g.media_type;
- c->media_stream = g.media_stream;
- c->timeline_in = g.in;
- c->timeline_out = g.out;
- c->clip_in = g.clip_in;
- c->track = g.track;
- if (c->media_type == MEDIA_TYPE_FOOTAGE) {
- Media* m = static_cast(c->media);
- if (m->video_tracks.size() == 0) {
- // audio only (greenish)
- c->color_r = 128;
- c->color_g = 192;
- c->color_b = 128;
- } else if (m->audio_tracks.size() == 0) {
- // video only (orangeish)
- c->color_r = 192;
- c->color_g = 160;
- c->color_b = 128;
- } else {
- // video and audio (blueish)
- c->color_r = 128;
- c->color_g = 128;
- c->color_b = 192;
- }
- c->name = m->name;
- } else if (c->media_type == MEDIA_TYPE_SEQUENCE) {
- // sequence (red?ish?)
- c->color_r = 192;
- c->color_g = 128;
- c->color_b = 128;
-
- Sequence* media = static_cast(c->media);
- c->name = media->name;
- }
- c->recalculateMaxLength();
- added_clips.append(c);
- }
-
- ca->append(new AddClipCommand(s, added_clips));
-
- // link clips from the same media
- for (int i=0;imedia == cc->media) {
- c->linked.append(j);
- }
- }
-
- if (c->track < 0) {
- // add default video effects
- c->effects.append(create_effect(c, get_internal_meta(EFFECT_INTERNAL_TRANSFORM)));
- } else {
- // add default audio effects
- c->effects.append(create_effect(c, get_internal_meta(EFFECT_INTERNAL_VOLUME)));
- c->effects.append(create_effect(c, get_internal_meta(EFFECT_INTERNAL_PAN)));
- }
- }
-
- panel_timeline->ghosts.clear();
- panel_timeline->importing = false;
- panel_timeline->snapped = false;
+ panel_timeline->add_clips_from_ghosts(ca, s);
undo_stack.push(ca);
setFocus();
update_ui(true);
-
- if (config.enable_seek_to_import) panel_sequence_viewer->seek(earliest_point);
}
}