merge of previous commits
This commit is contained in:
@@ -98,6 +98,11 @@ TransformEffect::TransformEffect(Clip* c, const EffectMeta* em) : Effect(c, em)
|
|||||||
right_center_gizmo->set_cursor(Qt::SizeHorCursor);
|
right_center_gizmo->set_cursor(Qt::SizeHorCursor);
|
||||||
right_center_gizmo->x_field = scale_x;
|
right_center_gizmo->x_field = scale_x;
|
||||||
|
|
||||||
|
anchor_gizmo = add_gizmo(GIZMO_TYPE_TARGET);
|
||||||
|
anchor_gizmo->set_cursor(Qt::SizeAllCursor);
|
||||||
|
anchor_gizmo->x_field = anchor_x_box;
|
||||||
|
anchor_gizmo->y_field = anchor_y_box;
|
||||||
|
|
||||||
rotate_gizmo = add_gizmo(GIZMO_TYPE_DOT);
|
rotate_gizmo = add_gizmo(GIZMO_TYPE_DOT);
|
||||||
rotate_gizmo->color = Qt::green;
|
rotate_gizmo->color = Qt::green;
|
||||||
rotate_gizmo->set_cursor(Qt::SizeAllCursor);
|
rotate_gizmo->set_cursor(Qt::SizeAllCursor);
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ private:
|
|||||||
EffectGizmo* bottom_right_gizmo;
|
EffectGizmo* bottom_right_gizmo;
|
||||||
EffectGizmo* left_center_gizmo;
|
EffectGizmo* left_center_gizmo;
|
||||||
EffectGizmo* right_center_gizmo;
|
EffectGizmo* right_center_gizmo;
|
||||||
|
EffectGizmo* anchor_gizmo;
|
||||||
EffectGizmo* rotate_gizmo;
|
EffectGizmo* rotate_gizmo;
|
||||||
EffectGizmo* rect_gizmo;
|
EffectGizmo* rect_gizmo;
|
||||||
|
|
||||||
|
|||||||
+11
-3
@@ -309,7 +309,11 @@ void MainWindow::on_actionZoom_In_triggered()
|
|||||||
panel_timeline->set_zoom(true);
|
panel_timeline->set_zoom(true);
|
||||||
} else if (panel_effect_controls->keyframe_focus()) {
|
} else if (panel_effect_controls->keyframe_focus()) {
|
||||||
panel_effect_controls->set_zoom(true);
|
panel_effect_controls->set_zoom(true);
|
||||||
}
|
} else if (panel_footage_viewer->is_focused()) {
|
||||||
|
panel_footage_viewer->set_zoom(true);
|
||||||
|
} else if (panel_sequence_viewer->is_focused()) {
|
||||||
|
panel_sequence_viewer->set_zoom(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionZoom_out_triggered()
|
void MainWindow::on_actionZoom_out_triggered()
|
||||||
@@ -318,7 +322,11 @@ void MainWindow::on_actionZoom_out_triggered()
|
|||||||
panel_timeline->set_zoom(false);
|
panel_timeline->set_zoom(false);
|
||||||
} else if (panel_effect_controls->keyframe_focus()) {
|
} else if (panel_effect_controls->keyframe_focus()) {
|
||||||
panel_effect_controls->set_zoom(false);
|
panel_effect_controls->set_zoom(false);
|
||||||
}
|
} else if (panel_footage_viewer->is_focused()) {
|
||||||
|
panel_footage_viewer->set_zoom(false);
|
||||||
|
} else if (panel_sequence_viewer->is_focused()) {
|
||||||
|
panel_sequence_viewer->set_zoom(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionExport_triggered()
|
void MainWindow::on_actionExport_triggered()
|
||||||
@@ -580,7 +588,7 @@ void MainWindow::on_actionEdit_Tool_triggered()
|
|||||||
|
|
||||||
void MainWindow::on_actionToggle_Snapping_triggered()
|
void MainWindow::on_actionToggle_Snapping_triggered()
|
||||||
{
|
{
|
||||||
if (panel_timeline->focused()) panel_timeline->ui->snappingButton->click();
|
if (panel_timeline->focused() || panel_effect_controls->keyframe_focus()) panel_timeline->ui->snappingButton->click();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionPointer_Tool_triggered()
|
void MainWindow::on_actionPointer_Tool_triggered()
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ SOURCES += \
|
|||||||
ui/sourcetable.cpp \
|
ui/sourcetable.cpp \
|
||||||
dialogs/aboutdialog.cpp \
|
dialogs/aboutdialog.cpp \
|
||||||
ui/timelinewidget.cpp \
|
ui/timelinewidget.cpp \
|
||||||
|
io/media.cpp \
|
||||||
project/sequence.cpp \
|
project/sequence.cpp \
|
||||||
project/clip.cpp \
|
project/clip.cpp \
|
||||||
playback/playback.cpp \
|
playback/playback.cpp \
|
||||||
@@ -91,10 +92,7 @@ SOURCES += \
|
|||||||
effects/internal/cubetransition.cpp \
|
effects/internal/cubetransition.cpp \
|
||||||
project/effectgizmo.cpp \
|
project/effectgizmo.cpp \
|
||||||
io/clipboard.cpp \
|
io/clipboard.cpp \
|
||||||
io/loadthread.cpp \
|
effects/internal/maskeffect.cpp
|
||||||
project/footage.cpp \
|
|
||||||
project/media.cpp \
|
|
||||||
project/projectmodel.cpp
|
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
mainwindow.h \
|
mainwindow.h \
|
||||||
@@ -105,6 +103,7 @@ HEADERS += \
|
|||||||
ui/sourcetable.h \
|
ui/sourcetable.h \
|
||||||
dialogs/aboutdialog.h \
|
dialogs/aboutdialog.h \
|
||||||
ui/timelinewidget.h \
|
ui/timelinewidget.h \
|
||||||
|
io/media.h \
|
||||||
project/sequence.h \
|
project/sequence.h \
|
||||||
project/clip.h \
|
project/clip.h \
|
||||||
playback/playback.h \
|
playback/playback.h \
|
||||||
@@ -165,10 +164,7 @@ HEADERS += \
|
|||||||
effects/internal/cubetransition.h \
|
effects/internal/cubetransition.h \
|
||||||
project/effectgizmo.h \
|
project/effectgizmo.h \
|
||||||
io/clipboard.h \
|
io/clipboard.h \
|
||||||
io/loadthread.h \
|
effects/internal/maskeffect.h
|
||||||
project/footage.h \
|
|
||||||
project/media.h \
|
|
||||||
project/projectmodel.h
|
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
mainwindow.ui \
|
mainwindow.ui \
|
||||||
|
|||||||
+3
-13
@@ -417,16 +417,6 @@ bool Timeline::focused() {
|
|||||||
return (sequence != NULL && (ui->headers->hasFocus() || ui->video_area->hasFocus() || ui->audio_area->hasFocus()));
|
return (sequence != NULL && (ui->headers->hasFocus() || ui->video_area->hasFocus() || ui->audio_area->hasFocus()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Timeline::center_scroll_to_playhead() {
|
|
||||||
// returns true is the scroll was changed, false if not
|
|
||||||
int target_scroll = qMin(ui->horizontalScrollBar->maximum(), qMax(0, getScreenPointFromFrame(zoom, sequence->playhead)-(ui->editAreas->width()>>1)));
|
|
||||||
if (target_scroll == ui->horizontalScrollBar->value()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
ui->horizontalScrollBar->setValue(target_scroll);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Timeline::repaint_timeline() {
|
void Timeline::repaint_timeline() {
|
||||||
bool draw = true;
|
bool draw = true;
|
||||||
|
|
||||||
@@ -442,7 +432,7 @@ void Timeline::repaint_timeline() {
|
|||||||
draw = false;
|
draw = false;
|
||||||
}
|
}
|
||||||
} else if (config.autoscroll == AUTOSCROLL_SMOOTH_SCROLL) {
|
} else if (config.autoscroll == AUTOSCROLL_SMOOTH_SCROLL) {
|
||||||
if (center_scroll_to_playhead()) {
|
if (center_scroll_to_playhead(ui->horizontalScrollBar, zoom, sequence->playhead)) {
|
||||||
draw = false;
|
draw = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -458,7 +448,7 @@ void Timeline::repaint_timeline() {
|
|||||||
if (sequence != NULL) {
|
if (sequence != NULL) {
|
||||||
long sequenceEndFrame = sequence->getEndFrame();
|
long sequenceEndFrame = sequence->getEndFrame();
|
||||||
|
|
||||||
ui->horizontalScrollBar->setMaximum(qMax(0, getScreenPointFromFrame(zoom, sequenceEndFrame) - (ui->editAreas->width()/2)));
|
ui->headers->set_scrollbar_max(ui->horizontalScrollBar, sequenceEndFrame, (ui->editAreas->width()/2));
|
||||||
|
|
||||||
if (last_frame != sequence->playhead) {
|
if (last_frame != sequence->playhead) {
|
||||||
ui->audio_monitor->update();
|
ui->audio_monitor->update();
|
||||||
@@ -579,7 +569,7 @@ void Timeline::set_zoom_value(double v) {
|
|||||||
repaint_timeline();
|
repaint_timeline();
|
||||||
|
|
||||||
// TODO find a way to gradually move towards target_scroll instead of just centering it?
|
// TODO find a way to gradually move towards target_scroll instead of just centering it?
|
||||||
center_scroll_to_playhead();
|
center_scroll_to_playhead(ui->horizontalScrollBar, zoom, sequence->playhead);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Timeline::set_zoom(bool in) {
|
void Timeline::set_zoom(bool in) {
|
||||||
|
|||||||
+1
-2
@@ -227,8 +227,7 @@ private:
|
|||||||
void set_zoom_value(double v);
|
void set_zoom_value(double v);
|
||||||
QVector<QPushButton*> tool_buttons;
|
QVector<QPushButton*> tool_buttons;
|
||||||
void decheck_tool_buttons(QObject* sender);
|
void decheck_tool_buttons(QObject* sender);
|
||||||
void set_tool(int tool);
|
void set_tool(int tool);
|
||||||
bool center_scroll_to_playhead();
|
|
||||||
long last_frame;
|
long last_frame;
|
||||||
int scroll;
|
int scroll;
|
||||||
|
|
||||||
|
|||||||
+28
-4
@@ -39,7 +39,8 @@ Viewer::Viewer(QWidget *parent) :
|
|||||||
ui(new Ui::Viewer),
|
ui(new Ui::Viewer),
|
||||||
created_sequence(false),
|
created_sequence(false),
|
||||||
cue_recording_internal(false),
|
cue_recording_internal(false),
|
||||||
panel_name("Viewer: ")
|
panel_name("Viewer: "),
|
||||||
|
minimum_zoom(1.0)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->headers->viewer = this;
|
ui->headers->viewer = this;
|
||||||
@@ -61,6 +62,8 @@ Viewer::Viewer(QWidget *parent) :
|
|||||||
|
|
||||||
connect(&playback_updater, SIGNAL(timeout()), this, SLOT(timer_update()));
|
connect(&playback_updater, SIGNAL(timeout()), this, SLOT(timer_update()));
|
||||||
connect(&recording_flasher, SIGNAL(timeout()), this, SLOT(recording_flasher_update()));
|
connect(&recording_flasher, SIGNAL(timeout()), this, SLOT(recording_flasher_update()));
|
||||||
|
connect(ui->horizontalScrollBar, SIGNAL(valueChanged(int)), ui->headers, SLOT(set_scroll(int)));
|
||||||
|
connect(ui->horizontalScrollBar, SIGNAL(valueChanged(int)), ui->openGLWidget, SLOT(set_waveform_scroll(int)));
|
||||||
|
|
||||||
update_playhead_timecode(0);
|
update_playhead_timecode(0);
|
||||||
update_end_timecode();
|
update_end_timecode();
|
||||||
@@ -382,7 +385,14 @@ void Viewer::update_end_timecode() {
|
|||||||
void Viewer::update_header_zoom() {
|
void Viewer::update_header_zoom() {
|
||||||
if (seq != NULL) {
|
if (seq != NULL) {
|
||||||
long sequenceEndFrame = seq->getEndFrame();
|
long sequenceEndFrame = seq->getEndFrame();
|
||||||
ui->headers->update_zoom((sequenceEndFrame > 0) ? ((double) ui->headers->width() / (double) sequenceEndFrame) : 1);
|
if (cached_end_frame != sequenceEndFrame) {
|
||||||
|
minimum_zoom = (sequenceEndFrame > 0) ? ((double) ui->headers->width() / (double) sequenceEndFrame) : 1;
|
||||||
|
ui->headers->update_zoom(qMax(ui->headers->get_zoom(), minimum_zoom));
|
||||||
|
ui->headers->set_scrollbar_max(ui->horizontalScrollBar, sequenceEndFrame, ui->headers->width());
|
||||||
|
ui->openGLWidget->waveform_zoom = ui->headers->get_zoom();
|
||||||
|
} else {
|
||||||
|
ui->headers->update();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -395,8 +405,8 @@ void Viewer::update_parents() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::update_viewer() {
|
void Viewer::update_viewer() {
|
||||||
|
update_header_zoom();
|
||||||
viewer_widget->update();
|
viewer_widget->update();
|
||||||
update_header_zoom();
|
|
||||||
if (seq != NULL) update_playhead_timecode(seq->playhead);
|
if (seq != NULL) update_playhead_timecode(seq->playhead);
|
||||||
update_end_timecode();
|
update_end_timecode();
|
||||||
}
|
}
|
||||||
@@ -413,7 +423,21 @@ void Viewer::set_in_point() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::set_out_point() {
|
void Viewer::set_out_point() {
|
||||||
ui->headers->set_out_point(seq->playhead);
|
ui->headers->set_out_point(seq->playhead);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Viewer::set_zoom(bool in) {
|
||||||
|
if (in) {
|
||||||
|
ui->headers->update_zoom(ui->headers->get_zoom()*2);
|
||||||
|
} else {
|
||||||
|
ui->headers->update_zoom(qMax(minimum_zoom, ui->headers->get_zoom()*0.5));
|
||||||
|
}
|
||||||
|
if (ui->openGLWidget->waveform) {
|
||||||
|
ui->openGLWidget->waveform_zoom = ui->headers->get_zoom();
|
||||||
|
ui->openGLWidget->update();
|
||||||
|
}
|
||||||
|
ui->headers->set_scrollbar_max(ui->horizontalScrollBar, seq->getEndFrame(), ui->headers->width());
|
||||||
|
center_scroll_to_playhead(ui->horizontalScrollBar, ui->headers->get_zoom(), seq->playhead);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::set_media(Media* m) {
|
void Viewer::set_media(Media* m) {
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ public:
|
|||||||
void clear_inout_point();
|
void clear_inout_point();
|
||||||
void set_in_point();
|
void set_in_point();
|
||||||
void set_out_point();
|
void set_out_point();
|
||||||
|
void set_zoom(bool in);
|
||||||
|
|
||||||
// playback functions
|
// playback functions
|
||||||
void go_to_start();
|
void go_to_start();
|
||||||
@@ -88,7 +89,9 @@ private:
|
|||||||
void set_sequence(bool main, Sequence* s);
|
void set_sequence(bool main, Sequence* s);
|
||||||
bool main_sequence;
|
bool main_sequence;
|
||||||
bool created_sequence;
|
bool created_sequence;
|
||||||
|
long cached_end_frame;
|
||||||
QString panel_name;
|
QString panel_name;
|
||||||
|
double minimum_zoom;
|
||||||
|
|
||||||
bool cue_recording_internal;
|
bool cue_recording_internal;
|
||||||
QTimer recording_flasher;
|
QTimer recording_flasher;
|
||||||
|
|||||||
@@ -64,6 +64,22 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="TimelineHeader" name="headers" native="true"/>
|
<widget class="TimelineHeader" name="headers" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QScrollBar" name="horizontalScrollBar">
|
||||||
|
<property name="maximum">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>20</number>
|
||||||
|
</property>
|
||||||
|
<property name="pageStep">
|
||||||
|
<number>1826</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="playbackControls" native="true">
|
<widget class="QWidget" name="playbackControls" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
|||||||
+27
-2
@@ -106,6 +106,10 @@ void cache_clip(Clip* clip, long playhead, bool reset, bool scrubbing, QVector<C
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double get_timecode(Clip* c, long playhead) {
|
||||||
|
return ((double)(playhead-c->get_timeline_in_with_transition()+c->get_clip_in_with_transition())/(double)c->sequence->frame_rate);
|
||||||
|
}
|
||||||
|
|
||||||
void get_clip_frame(Clip* c, long playhead) {
|
void get_clip_frame(Clip* c, long playhead) {
|
||||||
if (c->finished_opening) {
|
if (c->finished_opening) {
|
||||||
FootageStream* ms = c->media->to_footage()->get_stream_from_file_index(c->track < 0, c->media_stream);
|
FootageStream* ms = c->media->to_footage()->get_stream_from_file_index(c->track < 0, c->media_stream);
|
||||||
@@ -215,8 +219,29 @@ void get_clip_frame(Clip* c, long playhead) {
|
|||||||
|
|
||||||
if (target_frame != NULL) {
|
if (target_frame != NULL) {
|
||||||
// add gate if this is the same frame
|
// add gate if this is the same frame
|
||||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, target_frame->linesize[0]/4);
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, target_frame->linesize[0]/4);
|
||||||
c->texture->setData(0, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8, target_frame->data[0]);
|
|
||||||
|
bool copied = false;
|
||||||
|
uint8_t* data = target_frame->data[0];
|
||||||
|
int frame_size;
|
||||||
|
|
||||||
|
for (int i=0;i<c->effects.size();i++) {
|
||||||
|
Effect* e = c->effects.at(i);
|
||||||
|
if (e->enable_image) {
|
||||||
|
if (!copied) {
|
||||||
|
frame_size = target_frame->linesize[0]*target_frame->height;
|
||||||
|
data = new uint8_t[frame_size];
|
||||||
|
memcpy(data, target_frame->data[0], frame_size);
|
||||||
|
copied = true;
|
||||||
|
}
|
||||||
|
e->process_image(get_timecode(c, playhead), data, frame_size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
c->texture->setData(0, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8, data);
|
||||||
|
|
||||||
|
if (copied) delete [] data;
|
||||||
|
|
||||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ void cache_video_worker(Clip* c, long playhead);
|
|||||||
void handle_media(Sequence* sequence, long playhead, bool multithreaded);
|
void handle_media(Sequence* sequence, long playhead, bool multithreaded);
|
||||||
void reset_cache(Clip* c, long target_frame);
|
void reset_cache(Clip* c, long target_frame);
|
||||||
void get_clip_frame(Clip* c, long playhead);
|
void get_clip_frame(Clip* c, long playhead);
|
||||||
|
double get_timecode(Clip* c, long playhead);
|
||||||
|
|
||||||
long playhead_to_clip_frame(Clip* c, long playhead);
|
long playhead_to_clip_frame(Clip* c, long playhead);
|
||||||
double playhead_to_clip_seconds(Clip* c, long playhead);
|
double playhead_to_clip_seconds(Clip* c, long playhead);
|
||||||
|
|||||||
+15
-10
@@ -27,6 +27,7 @@
|
|||||||
#include "effects/internal/paneffect.h"
|
#include "effects/internal/paneffect.h"
|
||||||
#include "effects/internal/shakeeffect.h"
|
#include "effects/internal/shakeeffect.h"
|
||||||
#include "effects/internal/cornerpineffect.h"
|
#include "effects/internal/cornerpineffect.h"
|
||||||
|
#include "effects/internal/maskeffect.h"
|
||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
@@ -59,6 +60,7 @@ Effect* create_effect(Clip* c, const EffectMeta* em) {
|
|||||||
case EFFECT_INTERNAL_TONE: return new ToneEffect(c, em);
|
case EFFECT_INTERNAL_TONE: return new ToneEffect(c, em);
|
||||||
case EFFECT_INTERNAL_SHAKE: return new ShakeEffect(c, em);
|
case EFFECT_INTERNAL_SHAKE: return new ShakeEffect(c, em);
|
||||||
case EFFECT_INTERNAL_CORNERPIN: return new CornerPinEffect(c, em);
|
case EFFECT_INTERNAL_CORNERPIN: return new CornerPinEffect(c, em);
|
||||||
|
case EFFECT_INTERNAL_MASK: return new MaskEffect(c, em);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dout << "[ERROR] Invalid effect data";
|
dout << "[ERROR] Invalid effect data";
|
||||||
@@ -107,8 +109,15 @@ void load_internal_effects() {
|
|||||||
effects.append(em);
|
effects.append(em);
|
||||||
|
|
||||||
em.name = "Corner Pin";
|
em.name = "Corner Pin";
|
||||||
em.category = "Distort";
|
|
||||||
em.internal = EFFECT_INTERNAL_CORNERPIN;
|
em.internal = EFFECT_INTERNAL_CORNERPIN;
|
||||||
|
effects.append(em);
|
||||||
|
|
||||||
|
em.name = "Mask";
|
||||||
|
em.internal = EFFECT_INTERNAL_MASK;
|
||||||
|
effects.append(em);
|
||||||
|
|
||||||
|
em.name = "Shake";
|
||||||
|
em.internal = EFFECT_INTERNAL_SHAKE;
|
||||||
effects.append(em);
|
effects.append(em);
|
||||||
|
|
||||||
em.name = "Text";
|
em.name = "Text";
|
||||||
@@ -117,20 +126,13 @@ void load_internal_effects() {
|
|||||||
effects.append(em);
|
effects.append(em);
|
||||||
|
|
||||||
em.name = "Timecode";
|
em.name = "Timecode";
|
||||||
em.category = "Render";
|
|
||||||
em.internal = EFFECT_INTERNAL_TIMECODE;
|
em.internal = EFFECT_INTERNAL_TIMECODE;
|
||||||
effects.append(em);
|
effects.append(em);
|
||||||
|
|
||||||
em.name = "Solid";
|
em.name = "Solid";
|
||||||
em.category = "Render";
|
|
||||||
em.internal = EFFECT_INTERNAL_SOLID;
|
em.internal = EFFECT_INTERNAL_SOLID;
|
||||||
effects.append(em);
|
effects.append(em);
|
||||||
|
|
||||||
em.name = "Shake";
|
|
||||||
em.category = "Distort";
|
|
||||||
em.internal = EFFECT_INTERNAL_SHAKE;
|
|
||||||
effects.append(em);
|
|
||||||
|
|
||||||
// internal transitions
|
// internal transitions
|
||||||
em.type = EFFECT_TYPE_TRANSITION;
|
em.type = EFFECT_TYPE_TRANSITION;
|
||||||
em.category = "";
|
em.category = "";
|
||||||
@@ -230,6 +232,7 @@ Effect::Effect(Clip* c, const EffectMeta *em) :
|
|||||||
enable_shader(false),
|
enable_shader(false),
|
||||||
enable_coords(false),
|
enable_coords(false),
|
||||||
enable_superimpose(false),
|
enable_superimpose(false),
|
||||||
|
enable_image(false),
|
||||||
glslProgram(NULL),
|
glslProgram(NULL),
|
||||||
texture(NULL),
|
texture(NULL),
|
||||||
isOpen(false),
|
isOpen(false),
|
||||||
@@ -767,9 +770,11 @@ void Effect::startEffect() {
|
|||||||
|
|
||||||
void Effect::endEffect() {
|
void Effect::endEffect() {
|
||||||
if (bound) glslProgram->release();
|
if (bound) glslProgram->release();
|
||||||
bound = false;
|
bound = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Effect::process_image(double, uint8_t *, int) {}
|
||||||
|
|
||||||
Effect* Effect::copy(Clip* c) {
|
Effect* Effect::copy(Clip* c) {
|
||||||
Effect* copy = create_effect(c, meta);
|
Effect* copy = create_effect(c, meta);
|
||||||
copy->set_enabled(is_enabled());
|
copy->set_enabled(is_enabled());
|
||||||
|
|||||||
+3
-1
@@ -62,7 +62,7 @@ extern QMutex effects_loaded;
|
|||||||
#define EFFECT_INTERNAL_TONE 6
|
#define EFFECT_INTERNAL_TONE 6
|
||||||
#define EFFECT_INTERNAL_SHAKE 7
|
#define EFFECT_INTERNAL_SHAKE 7
|
||||||
#define EFFECT_INTERNAL_TIMECODE 8
|
#define EFFECT_INTERNAL_TIMECODE 8
|
||||||
|
#define EFFECT_INTERNAL_MASK 9
|
||||||
|
|
||||||
|
|
||||||
#define EFFECT_INTERNAL_CORNERPIN 12
|
#define EFFECT_INTERNAL_CORNERPIN 12
|
||||||
@@ -147,12 +147,14 @@ public:
|
|||||||
bool enable_shader;
|
bool enable_shader;
|
||||||
bool enable_coords;
|
bool enable_coords;
|
||||||
bool enable_superimpose;
|
bool enable_superimpose;
|
||||||
|
bool enable_image;
|
||||||
|
|
||||||
int getIterations();
|
int getIterations();
|
||||||
void setIterations(int i);
|
void setIterations(int i);
|
||||||
|
|
||||||
const char* ffmpeg_filter;
|
const char* ffmpeg_filter;
|
||||||
|
|
||||||
|
virtual void process_image(double timecode, uint8_t* data, int size);
|
||||||
virtual void process_shader(double timecode, GLTextureCoords&);
|
virtual void process_shader(double timecode, GLTextureCoords&);
|
||||||
virtual void process_coords(double timecode, GLTextureCoords& coords, int data);
|
virtual void process_coords(double timecode, GLTextureCoords& coords, int data);
|
||||||
virtual GLuint process_superimpose(double timecode);
|
virtual GLuint process_superimpose(double timecode);
|
||||||
|
|||||||
@@ -3,8 +3,10 @@
|
|||||||
|
|
||||||
#define GIZMO_TYPE_DOT 0
|
#define GIZMO_TYPE_DOT 0
|
||||||
#define GIZMO_TYPE_POLY 1
|
#define GIZMO_TYPE_POLY 1
|
||||||
|
#define GIZMO_TYPE_TARGET 2
|
||||||
|
|
||||||
#define GIZMO_DOT_SIZE 2.5F
|
#define GIZMO_DOT_SIZE 2.5F
|
||||||
|
#define GIZMO_TARGET_SIZE 5.0F
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QRect>
|
#include <QRect>
|
||||||
|
|||||||
+20
-2
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QScrollArea>
|
#include <QScrollBar>
|
||||||
#include <QtMath>
|
#include <QtMath>
|
||||||
|
|
||||||
#define CLICK_RANGE 5
|
#define CLICK_RANGE 5
|
||||||
@@ -19,6 +19,16 @@
|
|||||||
#define SUBLINE_MIN_PADDING 50 // TODO play with this
|
#define SUBLINE_MIN_PADDING 50 // TODO play with this
|
||||||
#define MARKER_SIZE 4
|
#define MARKER_SIZE 4
|
||||||
|
|
||||||
|
bool center_scroll_to_playhead(QScrollBar* bar, double zoom, long playhead) {
|
||||||
|
// returns true is the scroll was changed, false if not
|
||||||
|
int target_scroll = qMin(bar->maximum(), qMax(0, getScreenPointFromFrame(zoom, playhead)-(bar->width()>>1)));
|
||||||
|
if (target_scroll == bar->value()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
bar->setValue(target_scroll);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
TimelineHeader::TimelineHeader(QWidget *parent) :
|
TimelineHeader::TimelineHeader(QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
snapping(true),
|
snapping(true),
|
||||||
@@ -87,6 +97,10 @@ void TimelineHeader::set_out_point(long new_out) {
|
|||||||
update_parents();
|
update_parents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TimelineHeader::set_scrollbar_max(QScrollBar* bar, long sequence_end_frame, int offset) {
|
||||||
|
bar->setMaximum(qMax(0, getScreenPointFromFrame(zoom, sequence_end_frame) - offset));
|
||||||
|
}
|
||||||
|
|
||||||
void TimelineHeader::show_text(bool enable) {
|
void TimelineHeader::show_text(bool enable) {
|
||||||
text_enabled = enable;
|
text_enabled = enable;
|
||||||
if (enable) {
|
if (enable) {
|
||||||
@@ -255,7 +269,11 @@ void TimelineHeader::update_parents() {
|
|||||||
|
|
||||||
void TimelineHeader::update_zoom(double z) {
|
void TimelineHeader::update_zoom(double z) {
|
||||||
zoom = z;
|
zoom = z;
|
||||||
update();
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
double TimelineHeader::get_zoom() {
|
||||||
|
return zoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimelineHeader::delete_markers() {
|
void TimelineHeader::delete_markers() {
|
||||||
|
|||||||
+5
-1
@@ -3,8 +3,10 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QFontMetrics>
|
#include <QFontMetrics>
|
||||||
class QScrollArea;
|
|
||||||
class Viewer;
|
class Viewer;
|
||||||
|
class QScrollBar;
|
||||||
|
|
||||||
|
bool center_scroll_to_playhead(QScrollBar* bar, double zoom, long playhead);
|
||||||
|
|
||||||
class TimelineHeader : public QWidget
|
class TimelineHeader : public QWidget
|
||||||
{
|
{
|
||||||
@@ -20,7 +22,9 @@ public:
|
|||||||
|
|
||||||
void show_text(bool enable);
|
void show_text(bool enable);
|
||||||
void update_zoom(double z);
|
void update_zoom(double z);
|
||||||
|
double get_zoom();
|
||||||
void delete_markers();
|
void delete_markers();
|
||||||
|
void set_scrollbar_max(QScrollBar* bar, long sequence_end_frame, int offset);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void set_scroll(int);
|
void set_scroll(int);
|
||||||
|
|||||||
+24
-17
@@ -3,6 +3,8 @@
|
|||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QResizeEvent>
|
#include <QResizeEvent>
|
||||||
|
|
||||||
|
#include "viewerwidget.h"
|
||||||
|
|
||||||
// enforces aspect ratio
|
// enforces aspect ratio
|
||||||
ViewerContainer::ViewerContainer(QWidget *parent) :
|
ViewerContainer::ViewerContainer(QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
@@ -11,26 +13,31 @@ ViewerContainer::ViewerContainer(QWidget *parent) :
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
void ViewerContainer::adjust() {
|
void ViewerContainer::adjust() {
|
||||||
if (child != NULL) {
|
if (child != NULL) {
|
||||||
QSize widget_size = size();
|
if (child->waveform) {
|
||||||
int widget_x = 0;
|
child->move(0, 0);
|
||||||
int widget_y = 0;
|
child->resize(size());
|
||||||
int widget_width = widget_size.width();
|
} else {
|
||||||
int widget_height = widget_size.height();
|
QSize widget_size = size();
|
||||||
float widget_ar = (float) widget_width /(float) widget_height;
|
int widget_x = 0;
|
||||||
|
int widget_y = 0;
|
||||||
|
int widget_width = widget_size.width();
|
||||||
|
int widget_height = widget_size.height();
|
||||||
|
float widget_ar = (float) widget_width /(float) widget_height;
|
||||||
|
|
||||||
bool widget_is_larger_than_sequence = widget_ar > aspect_ratio;
|
bool widget_is_larger_than_sequence = widget_ar > aspect_ratio;
|
||||||
|
|
||||||
if (widget_is_larger_than_sequence) {
|
if (widget_is_larger_than_sequence) {
|
||||||
widget_width = widget_height * aspect_ratio;
|
widget_width = widget_height * aspect_ratio;
|
||||||
widget_x = (widget_size.width() / 2) - (widget_width / 2);
|
widget_x = (widget_size.width() / 2) - (widget_width / 2);
|
||||||
} else {
|
} else {
|
||||||
widget_height = widget_width / aspect_ratio;
|
widget_height = widget_width / aspect_ratio;
|
||||||
widget_y = (widget_size.height() / 2) - (widget_height / 2);
|
widget_y = (widget_size.height() / 2) - (widget_height / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
child->move(widget_x, widget_y);
|
child->move(widget_x, widget_y);
|
||||||
child->resize(widget_width, widget_height);
|
child->resize(widget_width, widget_height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#define VIEWERCONTAINER_H
|
#define VIEWERCONTAINER_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
class ViewerWidget;
|
||||||
|
|
||||||
class ViewerContainer : public QWidget
|
class ViewerContainer : public QWidget
|
||||||
{
|
{
|
||||||
@@ -9,7 +10,7 @@ class ViewerContainer : public QWidget
|
|||||||
public:
|
public:
|
||||||
explicit ViewerContainer(QWidget *parent = 0);
|
explicit ViewerContainer(QWidget *parent = 0);
|
||||||
float aspect_ratio;
|
float aspect_ratio;
|
||||||
QWidget* child;
|
ViewerWidget* child;
|
||||||
void adjust();
|
void adjust();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
+49
-13
@@ -44,7 +44,9 @@ ViewerWidget::ViewerWidget(QWidget *parent) :
|
|||||||
default_fbo(NULL),
|
default_fbo(NULL),
|
||||||
waveform(false),
|
waveform(false),
|
||||||
dragging(false),
|
dragging(false),
|
||||||
selected_gizmo(NULL)
|
selected_gizmo(NULL),
|
||||||
|
waveform_zoom(1.0),
|
||||||
|
waveform_scroll(0)
|
||||||
{
|
{
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
setFocusPolicy(Qt::ClickFocus);
|
setFocusPolicy(Qt::ClickFocus);
|
||||||
@@ -70,6 +72,13 @@ void ViewerWidget::delete_function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ViewerWidget::set_waveform_scroll(int s) {
|
||||||
|
if (waveform) {
|
||||||
|
waveform_scroll = s;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ViewerWidget::show_context_menu() {
|
void ViewerWidget::show_context_menu() {
|
||||||
QMenu menu(this);
|
QMenu menu(this);
|
||||||
|
|
||||||
@@ -142,11 +151,7 @@ void ViewerWidget::paintEvent(QPaintEvent *e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ViewerWidget::seek_from_click(int x) {
|
void ViewerWidget::seek_from_click(int x) {
|
||||||
viewer->seek(getFrameFromScreenPoint((double) width() / (double) waveform_clip->timeline_out, x));
|
viewer->seek(getFrameFromScreenPoint(waveform_zoom, x+waveform_scroll));
|
||||||
}
|
|
||||||
|
|
||||||
double get_timecode(Clip* c, long playhead) {
|
|
||||||
return ((double)(playhead-c->get_timeline_in_with_transition()+c->get_clip_in_with_transition())/(double)c->sequence->frame_rate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EffectGizmo* ViewerWidget::get_gizmo_from_mouse(int x, int y) {
|
EffectGizmo* ViewerWidget::get_gizmo_from_mouse(int x, int y) {
|
||||||
@@ -154,6 +159,7 @@ EffectGizmo* ViewerWidget::get_gizmo_from_mouse(int x, int y) {
|
|||||||
double multiplier = (double) viewer->seq->width / (double) width();
|
double multiplier = (double) viewer->seq->width / (double) width();
|
||||||
QPoint mouse_pos(qRound(x*multiplier), qRound(y*multiplier));
|
QPoint mouse_pos(qRound(x*multiplier), qRound(y*multiplier));
|
||||||
int dot_size = 2 * qRound(GIZMO_DOT_SIZE * multiplier);
|
int dot_size = 2 * qRound(GIZMO_DOT_SIZE * multiplier);
|
||||||
|
int target_size = 2 * qRound(GIZMO_TARGET_SIZE * multiplier);
|
||||||
for (int i=0;i<gizmos->gizmo_count();i++) {
|
for (int i=0;i<gizmos->gizmo_count();i++) {
|
||||||
EffectGizmo* g = gizmos->gizmo(i);
|
EffectGizmo* g = gizmos->gizmo(i);
|
||||||
|
|
||||||
@@ -171,6 +177,14 @@ EffectGizmo* ViewerWidget::get_gizmo_from_mouse(int x, int y) {
|
|||||||
return g;
|
return g;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case GIZMO_TYPE_TARGET:
|
||||||
|
if (mouse_pos.x() > g->screen_pos[0].x() - target_size
|
||||||
|
&& mouse_pos.y() > g->screen_pos[0].y() - target_size
|
||||||
|
&& mouse_pos.x() < g->screen_pos[0].x() + target_size
|
||||||
|
&& mouse_pos.y() < g->screen_pos[0].y() + target_size) {
|
||||||
|
return g;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -761,23 +775,23 @@ void ViewerWidget::paintGL() {
|
|||||||
compose_sequence(nests, render_audio);
|
compose_sequence(nests, render_audio);
|
||||||
|
|
||||||
if (waveform) {
|
if (waveform) {
|
||||||
double waveform_zoom = (double) waveform_ms->audio_preview.size() / (double) width();
|
|
||||||
double timeline_zoom = (double) width() / (double) waveform_clip->timeline_out;
|
|
||||||
|
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
if (viewer->seq->using_workarea) {
|
if (viewer->seq->using_workarea) {
|
||||||
int in_x = getScreenPointFromFrame(timeline_zoom, viewer->seq->workarea_in);
|
int in_x = getScreenPointFromFrame(waveform_zoom, viewer->seq->workarea_in) - waveform_scroll;
|
||||||
int out_x = getScreenPointFromFrame(timeline_zoom, viewer->seq->workarea_out);
|
int out_x = getScreenPointFromFrame(waveform_zoom, viewer->seq->workarea_out) - waveform_scroll;
|
||||||
|
|
||||||
p.fillRect(QRect(in_x, 0, out_x - in_x, height()), QColor(255, 255, 255, 64));
|
p.fillRect(QRect(in_x, 0, out_x - in_x, height()), QColor(255, 255, 255, 64));
|
||||||
p.setPen(Qt::white);
|
p.setPen(Qt::white);
|
||||||
p.drawLine(in_x, 0, in_x, height());
|
p.drawLine(in_x, 0, in_x, height());
|
||||||
p.drawLine(out_x, 0, out_x, height());
|
p.drawLine(out_x, 0, out_x, height());
|
||||||
}
|
}
|
||||||
|
QRect wr = rect();
|
||||||
|
wr.setX(wr.x() - waveform_scroll);
|
||||||
|
|
||||||
p.setPen(Qt::green);
|
p.setPen(Qt::green);
|
||||||
draw_waveform(waveform_clip, waveform_ms, waveform_clip->timeline_out, &p, rect(), 0, width(), waveform_zoom);
|
draw_waveform(waveform_clip, waveform_ms, waveform_clip->timeline_out, &p, wr, waveform_scroll, width()+waveform_scroll, waveform_zoom);
|
||||||
p.setPen(Qt::red);
|
p.setPen(Qt::red);
|
||||||
int playhead_x = getScreenPointFromFrame(timeline_zoom, viewer->seq->playhead);
|
int playhead_x = getScreenPointFromFrame(waveform_zoom, viewer->seq->playhead) - waveform_scroll;
|
||||||
p.drawLine(playhead_x, 0, playhead_x, height());
|
p.drawLine(playhead_x, 0, playhead_x, height());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -800,6 +814,7 @@ void ViewerWidget::paintGL() {
|
|||||||
glGetFloatv(GL_CURRENT_COLOR, color);
|
glGetFloatv(GL_CURRENT_COLOR, color);
|
||||||
|
|
||||||
float dot_size = GIZMO_DOT_SIZE / width() * viewer->seq->width;
|
float dot_size = GIZMO_DOT_SIZE / width() * viewer->seq->width;
|
||||||
|
float target_size = GIZMO_TARGET_SIZE / width() * viewer->seq->width;
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
@@ -827,6 +842,27 @@ void ViewerWidget::paintGL() {
|
|||||||
glVertex3f(g->screen_pos[0].x(), g->screen_pos[0].y(), gizmo_z);
|
glVertex3f(g->screen_pos[0].x(), g->screen_pos[0].y(), gizmo_z);
|
||||||
glEnd();
|
glEnd();
|
||||||
break;
|
break;
|
||||||
|
case GIZMO_TYPE_TARGET: // draw target
|
||||||
|
glBegin(GL_LINES);
|
||||||
|
glVertex3f(g->screen_pos[0].x()-target_size, g->screen_pos[0].y()-target_size, gizmo_z);
|
||||||
|
glVertex3f(g->screen_pos[0].x()+target_size, g->screen_pos[0].y()-target_size, gizmo_z);
|
||||||
|
|
||||||
|
glVertex3f(g->screen_pos[0].x()+target_size, g->screen_pos[0].y()-target_size, gizmo_z);
|
||||||
|
glVertex3f(g->screen_pos[0].x()+target_size, g->screen_pos[0].y()+target_size, gizmo_z);
|
||||||
|
|
||||||
|
glVertex3f(g->screen_pos[0].x()+target_size, g->screen_pos[0].y()+target_size, gizmo_z);
|
||||||
|
glVertex3f(g->screen_pos[0].x()-target_size, g->screen_pos[0].y()+target_size, gizmo_z);
|
||||||
|
|
||||||
|
glVertex3f(g->screen_pos[0].x()-target_size, g->screen_pos[0].y()+target_size, gizmo_z);
|
||||||
|
glVertex3f(g->screen_pos[0].x()-target_size, g->screen_pos[0].y()-target_size, gizmo_z);
|
||||||
|
|
||||||
|
glVertex3f(g->screen_pos[0].x()-target_size, g->screen_pos[0].y(), gizmo_z);
|
||||||
|
glVertex3f(g->screen_pos[0].x()+target_size, g->screen_pos[0].y(), gizmo_z);
|
||||||
|
|
||||||
|
glVertex3f(g->screen_pos[0].x(), g->screen_pos[0].y()-target_size, gizmo_z);
|
||||||
|
glVertex3f(g->screen_pos[0].x(), g->screen_pos[0].y()+target_size, gizmo_z);
|
||||||
|
glEnd();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|||||||
@@ -33,10 +33,13 @@ public:
|
|||||||
bool waveform;
|
bool waveform;
|
||||||
Clip* waveform_clip;
|
Clip* waveform_clip;
|
||||||
FootageStream* waveform_ms;
|
FootageStream* waveform_ms;
|
||||||
|
double waveform_zoom;
|
||||||
|
int waveform_scroll;
|
||||||
|
|
||||||
bool force_quit;
|
bool force_quit;
|
||||||
public slots:
|
public slots:
|
||||||
void delete_function();
|
void delete_function();
|
||||||
|
void set_waveform_scroll(int s);
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *e);
|
void paintEvent(QPaintEvent *e);
|
||||||
// void resizeGL(int w, int h);
|
// void resizeGL(int w, int h);
|
||||||
|
|||||||
Reference in New Issue
Block a user