fixed gizmos underneath other videos

This commit is contained in:
itsmattkc
2018-11-30 09:52:29 +11:00
parent 9d4339512e
commit 6f84e47c2c
3 changed files with 241 additions and 39 deletions
-1
View File
@@ -1 +0,0 @@
olive.pro
+193
View File
@@ -0,0 +1,193 @@
#-------------------------------------------------
#
# Project created by QtCreator 2018-05-11T10:31:59
#
#-------------------------------------------------
QT += core gui multimedia opengl
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Olive
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp \
mainwindow.cpp \
panels/project.cpp \
panels/effectcontrols.cpp \
panels/viewer.cpp \
panels/timeline.cpp \
ui/sourcetable.cpp \
dialogs/aboutdialog.cpp \
ui/timelinewidget.cpp \
io/media.cpp \
project/sequence.cpp \
project/clip.cpp \
playback/playback.cpp \
playback/audio.cpp \
io/config.cpp \
dialogs/newsequencedialog.cpp \
ui/viewerwidget.cpp \
ui/viewercontainer.cpp \
dialogs/exportdialog.cpp \
ui/collapsiblewidget.cpp \
panels/panels.cpp \
playback/cacher.cpp \
io/exportthread.cpp \
ui/timelineheader.cpp \
io/previewgenerator.cpp \
ui/labelslider.cpp \
dialogs/preferencesdialog.cpp \
ui/audiomonitor.cpp \
project/undo.cpp \
ui/scrollarea.cpp \
ui/comboboxex.cpp \
ui/colorbutton.cpp \
dialogs/replaceclipmediadialog.cpp \
ui/fontcombobox.cpp \
ui/checkboxex.cpp \
ui/keyframeview.cpp \
ui/texteditex.cpp \
dialogs/demonotice.cpp \
project/marker.cpp \
dialogs/speeddialog.cpp \
dialogs/mediapropertiesdialog.cpp \
io/crc32.cpp \
dialogs/loaddialog.cpp \
debug.cpp \
io/path.cpp \
effects/internal/linearfadetransition.cpp \
effects/internal/transformeffect.cpp \
effects/internal/solideffect.cpp \
effects/internal/texteffect.cpp \
effects/internal/audionoiseeffect.cpp \
effects/internal/paneffect.cpp \
effects/internal/toneeffect.cpp \
effects/internal/volumeeffect.cpp \
effects/internal/crossdissolvetransition.cpp \
effects/internal/shakeeffect.cpp \
effects/internal/exponentialfadetransition.cpp \
effects/internal/logarithmicfadetransition.cpp \
effects/internal/cornerpineffect.cpp \
io/math.cpp \
io/qpainterwrapper.cpp \
project/effect.cpp \
project/transition.cpp \
project/effectrow.cpp \
project/effectfield.cpp \
effects/internal/cubetransition.cpp \
project/effectgizmo.cpp \
io/clipboard.cpp
HEADERS += \
mainwindow.h \
panels/project.h \
panels/effectcontrols.h \
panels/viewer.h \
panels/timeline.h \
ui/sourcetable.h \
dialogs/aboutdialog.h \
ui/timelinewidget.h \
io/media.h \
project/sequence.h \
project/clip.h \
playback/playback.h \
playback/audio.h \
io/config.h \
dialogs/newsequencedialog.h \
ui/viewerwidget.h \
ui/viewercontainer.h \
dialogs/exportdialog.h \
ui/collapsiblewidget.h \
panels/panels.h \
playback/cacher.h \
io/exportthread.h \
ui/timelinetools.h \
ui/timelineheader.h \
io/previewgenerator.h \
ui/labelslider.h \
dialogs/preferencesdialog.h \
ui/audiomonitor.h \
project/undo.h \
ui/scrollarea.h \
ui/comboboxex.h \
ui/colorbutton.h \
dialogs/replaceclipmediadialog.h \
ui/fontcombobox.h \
ui/checkboxex.h \
ui/keyframeview.h \
ui/texteditex.h \
dialogs/demonotice.h \
project/marker.h \
project/selection.h \
dialogs/speeddialog.h \
dialogs/mediapropertiesdialog.h \
io/crc32.h \
dialogs/loaddialog.h \
debug.h \
io/path.h \
effects/internal/transformeffect.h \
effects/internal/solideffect.h \
effects/internal/texteffect.h \
effects/internal/audionoiseeffect.h \
effects/internal/paneffect.h \
effects/internal/toneeffect.h \
effects/internal/volumeeffect.h \
effects/internal/shakeeffect.h \
effects/internal/linearfadetransition.h \
effects/internal/crossdissolvetransition.h \
effects/internal/exponentialfadetransition.h \
effects/internal/logarithmicfadetransition.h \
effects/internal/cornerpineffect.h \
io/math.h \
io/qpainterwrapper.h \
project/effect.h \
project/transition.h \
project/effectrow.h \
project/effectfield.h \
effects/internal/cubetransition.h \
project/effectgizmo.h \
io/clipboard.h
FORMS += \
mainwindow.ui \
panels/project.ui \
panels/effectcontrols.ui \
panels/viewer.ui \
panels/timeline.ui \
dialogs/aboutdialog.ui \
dialogs/newsequencedialog.ui \
dialogs/exportdialog.ui \
dialogs/preferencesdialog.ui \
dialogs/demonotice.ui
win32 {
RC_FILE = icons/resources.rc
LIBS += -lavutil -lavformat -lavcodec -lavfilter -lswscale -lswresample -lopengl32
}
mac {
LIBS += -L/usr/local/lib -lavutil -lavformat -lavcodec -lavfilter -lswscale -lswresample
ICON = icons/olive.icns
INCLUDEPATH = /usr/local/include
}
linux {
LIBS += -lavutil -lavformat -lavcodec -lavfilter -lswscale -lswresample
}
RESOURCES += \
icons/icons.qrc
+47 -38
View File
@@ -429,7 +429,7 @@ GLuint ViewerWidget::compose_sequence(QVector<Clip*>& nests, bool render_audio)
glPushMatrix();
glLoadIdentity();
glOrtho(-half_width, half_width, half_height, -half_height, -1, 1);
glOrtho(-half_width, half_width, half_height, -half_height, -1, 10);
for (int i=0;i<current_clips.size();i++) {
GL_DEFAULT_BLEND
@@ -587,7 +587,7 @@ GLuint ViewerWidget::compose_sequence(QVector<Clip*>& nests, bool render_audio)
glBegin(GL_QUADS);
if (coords.grid_size <= 1) {
float z = 0.5f;
float z = 0.0f;
glTexCoord2f(coords.textureTopLeftX, coords.textureTopLeftY); // top left
glVertex3f(coords.vertexTopLeftX, coords.vertexTopLeftY, z); // top left
@@ -634,45 +634,11 @@ GLuint ViewerWidget::compose_sequence(QVector<Clip*>& nests, bool render_audio)
glBindTexture(GL_TEXTURE_2D, 0); // unbind texture
if (gizmos != NULL) {
float color[4];
glGetFloatv(GL_CURRENT_COLOR, color);
float dot_size = GIZMO_DOT_SIZE / width() * viewer->seq->width;
if (gizmos != NULL && !drawn_gizmos) {
gizmos->gizmo_draw(timecode, coords); // set correct gizmo coords
gizmos->gizmo_world_to_screen();
glPushMatrix();
glLoadIdentity();
glOrtho(0, viewer->seq->width, viewer->seq->height, 0, -1, 1);
for (int j=0;j<gizmos->gizmo_count();j++) {
EffectGizmo* g = gizmos->gizmo(j);
glColor4f(g->color.redF(), g->color.greenF(), g->color.blueF(), 1.0);
switch (g->get_type()) {
case GIZMO_TYPE_DOT: // draw dot
glBegin(GL_QUADS);
glVertex2f(g->screen_pos[0].x()-dot_size, g->screen_pos[0].y()-dot_size);
glVertex2f(g->screen_pos[0].x()+dot_size, g->screen_pos[0].y()-dot_size);
glVertex2f(g->screen_pos[0].x()+dot_size, g->screen_pos[0].y()+dot_size);
glVertex2f(g->screen_pos[0].x()-dot_size, g->screen_pos[0].y()+dot_size);
glEnd();
break;
case GIZMO_TYPE_POLY: // draw lines
glBegin(GL_LINES);
for (int k=1;k<g->get_point_count();k++) {
glVertex2f(g->screen_pos[k-1].x(), g->screen_pos[k-1].y());
glVertex2f(g->screen_pos[k].x(), g->screen_pos[k].y());
}
glVertex2f(g->screen_pos[g->get_point_count()-1].x(), g->screen_pos[g->get_point_count()-1].y());
glVertex2f(g->screen_pos[0].x(), g->screen_pos[0].y());
glEnd();
break;
}
}
glPopMatrix();
glColor4f(color[0], color[1], color[2], color[3]);
drawn_gizmos = true;
}
if (!nests.isEmpty()) {
@@ -741,6 +707,7 @@ GLuint ViewerWidget::compose_sequence(QVector<Clip*>& nests, bool render_audio)
}
void ViewerWidget::paintGL() {
drawn_gizmos = false;
if (viewer->seq != NULL) {
gizmos = NULL;
@@ -802,6 +769,48 @@ void ViewerWidget::paintGL() {
drawTitleSafeArea();
}
if (gizmos != NULL && drawn_gizmos) {
float color[4];
glGetFloatv(GL_CURRENT_COLOR, color);
float dot_size = GIZMO_DOT_SIZE / width() * viewer->seq->width;
glPushMatrix();
glLoadIdentity();
glOrtho(0, viewer->seq->width, viewer->seq->height, 0, -1, 10);
float gizmo_z = 0.0f;
for (int j=0;j<gizmos->gizmo_count();j++) {
EffectGizmo* g = gizmos->gizmo(j);
glColor4f(g->color.redF(), g->color.greenF(), g->color.blueF(), 1.0);
switch (g->get_type()) {
case GIZMO_TYPE_DOT: // draw dot
glBegin(GL_QUADS);
glVertex3f(g->screen_pos[0].x()-dot_size, g->screen_pos[0].y()-dot_size, gizmo_z);
glVertex3f(g->screen_pos[0].x()+dot_size, g->screen_pos[0].y()-dot_size, gizmo_z);
glVertex3f(g->screen_pos[0].x()+dot_size, g->screen_pos[0].y()+dot_size, gizmo_z);
glVertex3f(g->screen_pos[0].x()-dot_size, g->screen_pos[0].y()+dot_size, gizmo_z);
glEnd();
break;
case GIZMO_TYPE_POLY: // draw lines
glBegin(GL_LINES);
for (int k=1;k<g->get_point_count();k++) {
glVertex3f(g->screen_pos[k-1].x(), g->screen_pos[k-1].y(), gizmo_z);
glVertex3f(g->screen_pos[k].x(), g->screen_pos[k].y(), gizmo_z);
}
glVertex3f(g->screen_pos[g->get_point_count()-1].x(), g->screen_pos[g->get_point_count()-1].y(), gizmo_z);
glVertex3f(g->screen_pos[0].x(), g->screen_pos[0].y(), gizmo_z);
glEnd();
break;
}
}
glPopMatrix();
glColor4f(color[0], color[1], color[2], color[3]);
drawn_gizmos = true;
}
glDisable(GL_DEPTH);
glDisable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
} while (loop);
+1
View File
@@ -53,6 +53,7 @@ private:
int drag_start_y;
EffectGizmo* selected_gizmo;
EffectGizmo* get_gizmo_from_mouse(int x, int y);
bool drawn_gizmos;
private slots:
void retry();
void show_context_menu();