began transition rewrite
This commit is contained in:
@@ -29,8 +29,8 @@ CrossDissolveTransition::CrossDissolveTransition(ClipPtr c, ClipPtr s, const Eff
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CrossDissolveTransition::process_coords(double progress, GLTextureCoords& coords, int data) {
|
void CrossDissolveTransition::process_coords(double progress, GLTextureCoords& coords, int data) {
|
||||||
if (!(data == TA_CLOSING_TRANSITION && secondary_clip != nullptr)) {
|
if (!(data == kTransitionClosing && secondary_clip != nullptr)) {
|
||||||
if (data == TA_CLOSING_TRANSITION) progress = 1.0 - progress;
|
if (data == kTransitionClosing) progress = 1.0 - progress;
|
||||||
coords.opacity *= progress;
|
coords.opacity *= progress;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,10 +41,10 @@ void ExponentialFadeTransition::process_audio(double timecode_start, double time
|
|||||||
break;
|
break;
|
||||||
}*/
|
}*/
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TA_OPENING_TRANSITION:
|
case kTransitionOpening:
|
||||||
samp *= qPow(timecode_start + (interval * i), 2);
|
samp *= qPow(timecode_start + (interval * i), 2);
|
||||||
break;
|
break;
|
||||||
case TA_CLOSING_TRANSITION:
|
case kTransitionClosing:
|
||||||
samp *= qPow(1 - (timecode_start + (interval * i)), 2);
|
samp *= qPow(1 - (timecode_start + (interval * i)), 2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,10 +29,10 @@ void LinearFadeTransition::process_audio(double timecode_start, double timecode_
|
|||||||
qint16 samp = (qint16) (((samples[i+1] & 0xFF) << 8) | (samples[i] & 0xFF));
|
qint16 samp = (qint16) (((samples[i+1] & 0xFF) << 8) | (samples[i] & 0xFF));
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TA_OPENING_TRANSITION:
|
case kTransitionOpening:
|
||||||
samp *= timecode_start + (interval * i);
|
samp *= timecode_start + (interval * i);
|
||||||
break;
|
break;
|
||||||
case TA_CLOSING_TRANSITION:
|
case kTransitionClosing:
|
||||||
samp *= 1 - (timecode_start + (interval * i));
|
samp *= 1 - (timecode_start + (interval * i));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,10 +31,10 @@ void LogarithmicFadeTransition::process_audio(double timecode_start, double time
|
|||||||
qint16 samp = (qint16) (((samples[i+1] & 0xFF) << 8) | (samples[i] & 0xFF));
|
qint16 samp = (qint16) (((samples[i+1] & 0xFF) << 8) | (samples[i] & 0xFF));
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TA_OPENING_TRANSITION:
|
case kTransitionOpening:
|
||||||
samp *= qSqrt(timecode_start + (interval * i));
|
samp *= qSqrt(timecode_start + (interval * i));
|
||||||
break;
|
break;
|
||||||
case TA_CLOSING_TRANSITION:
|
case kTransitionClosing:
|
||||||
samp *= qSqrt(1 - (timecode_start + (interval * i)));
|
samp *= qSqrt(1 - (timecode_start + (interval * i)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-8
@@ -80,11 +80,11 @@ void LoadThread::load_effect(QXmlStreamReader& stream, ClipPtr c) {
|
|||||||
|
|
||||||
int type;
|
int type;
|
||||||
if (tag == "opening") {
|
if (tag == "opening") {
|
||||||
type = TA_OPENING_TRANSITION;
|
type = kTransitionOpening;
|
||||||
} else if (tag == "closing") {
|
} else if (tag == "closing") {
|
||||||
type = TA_CLOSING_TRANSITION;
|
type = kTransitionClosing;
|
||||||
} else {
|
} else {
|
||||||
type = TA_NO_TRANSITION;
|
type = kTransitionNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
emit start_create_effect_ui(&stream, c, type, &effect_name, meta, effect_length, effect_enabled);
|
emit start_create_effect_ui(&stream, c, type, &effect_name, meta, effect_length, effect_enabled);
|
||||||
@@ -391,11 +391,11 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
|||||||
} else if (attr.name() == "track") {
|
} else if (attr.name() == "track") {
|
||||||
c->track = attr.value().toInt();
|
c->track = attr.value().toInt();
|
||||||
} else if (attr.name() == "r") {
|
} else if (attr.name() == "r") {
|
||||||
c->color_r = attr.value().toInt();
|
c->color_r = quint8(attr.value().toInt());
|
||||||
} else if (attr.name() == "g") {
|
} else if (attr.name() == "g") {
|
||||||
c->color_g = attr.value().toInt();
|
c->color_g = quint8(attr.value().toInt());
|
||||||
} else if (attr.name() == "b") {
|
} else if (attr.name() == "b") {
|
||||||
c->color_b = attr.value().toInt();
|
c->color_b = quint8(attr.value().toInt());
|
||||||
} else if (attr.name() == "autoscale") {
|
} else if (attr.name() == "autoscale") {
|
||||||
c->autoscale = (attr.value() == "1");
|
c->autoscale = (attr.value() == "1");
|
||||||
} else if (attr.name() == "media") {
|
} else if (attr.name() == "media") {
|
||||||
@@ -409,10 +409,12 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
|||||||
c->maintain_audio_pitch = (attr.value() == "1");
|
c->maintain_audio_pitch = (attr.value() == "1");
|
||||||
} else if (attr.name() == "reverse") {
|
} else if (attr.name() == "reverse") {
|
||||||
c->reverse = (attr.value() == "1");
|
c->reverse = (attr.value() == "1");
|
||||||
|
/*
|
||||||
} else if (attr.name() == "opening") {
|
} else if (attr.name() == "opening") {
|
||||||
c->opening_transition = attr.value().toInt();
|
c->opening_transition = attr.value().toInt();
|
||||||
} else if (attr.name() == "closing") {
|
} else if (attr.name() == "closing") {
|
||||||
c->closing_transition = attr.value().toInt();
|
c->closing_transition = attr.value().toInt();
|
||||||
|
*/
|
||||||
} else if (attr.name() == "sequence") {
|
} else if (attr.name() == "sequence") {
|
||||||
media_type = MEDIA_TYPE_SEQUENCE;
|
media_type = MEDIA_TYPE_SEQUENCE;
|
||||||
|
|
||||||
@@ -514,6 +516,7 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
// re-link clips to transitions
|
// re-link clips to transitions
|
||||||
if (correct_clip->opening_transition > -1) {
|
if (correct_clip->opening_transition > -1) {
|
||||||
for (int j=0;j<transition_data.size();j++) {
|
for (int j=0;j<transition_data.size();j++) {
|
||||||
@@ -552,6 +555,7 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
|||||||
waitCond.wait(&mutex);
|
waitCond.wait(&mutex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
Media* m = panel_project->create_sequence_internal(nullptr, s, false, parent);
|
Media* m = panel_project->create_sequence_internal(nullptr, s, false, parent);
|
||||||
@@ -792,7 +796,7 @@ void LoadThread::create_effect_ui(
|
|||||||
mutex.lock();
|
mutex.lock();
|
||||||
|
|
||||||
if (cancelled) return;
|
if (cancelled) return;
|
||||||
if (type == TA_NO_TRANSITION) {
|
if (type == kTransitionNone) {
|
||||||
if (meta == nullptr) {
|
if (meta == nullptr) {
|
||||||
// create void effect
|
// create void effect
|
||||||
EffectPtr ve(new VoidEffect(c, *effect_name));
|
EffectPtr ve(new VoidEffect(c, *effect_name));
|
||||||
@@ -807,17 +811,19 @@ void LoadThread::create_effect_ui(
|
|||||||
c->effects.append(e);
|
c->effects.append(e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
/*
|
||||||
int transition_index = create_transition(c, nullptr, meta);
|
int transition_index = create_transition(c, nullptr, meta);
|
||||||
TransitionPtr t = c->sequence->transitions.at(transition_index);
|
TransitionPtr t = c->sequence->transitions.at(transition_index);
|
||||||
if (effect_length > -1) t->set_length(effect_length);
|
if (effect_length > -1) t->set_length(effect_length);
|
||||||
t->set_enabled(effect_enabled);
|
t->set_enabled(effect_enabled);
|
||||||
t->load(*stream);
|
t->load(*stream);
|
||||||
|
|
||||||
if (type == TA_OPENING_TRANSITION) {
|
if (type == kTransitionOpening) {
|
||||||
c->opening_transition = transition_index;
|
c->opening_transition = transition_index;
|
||||||
} else {
|
} else {
|
||||||
c->closing_transition = transition_index;
|
c->closing_transition = transition_index;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex.unlock();
|
mutex.unlock();
|
||||||
@@ -829,10 +835,12 @@ void LoadThread::create_dual_transition(const TransitionData* td, ClipPtr primar
|
|||||||
// lock mutex - ensures the load thread is suspended while this happens
|
// lock mutex - ensures the load thread is suspended while this happens
|
||||||
mutex.lock();
|
mutex.lock();
|
||||||
|
|
||||||
|
/*
|
||||||
int transition_index = create_transition(primary, secondary, meta);
|
int transition_index = create_transition(primary, secondary, meta);
|
||||||
primary->sequence->transitions.at(transition_index)->set_length(td->length);
|
primary->sequence->transitions.at(transition_index)->set_length(td->length);
|
||||||
if (td->otc != nullptr) td->otc->opening_transition = transition_index;
|
if (td->otc != nullptr) td->otc->opening_transition = transition_index;
|
||||||
if (td->ctc != nullptr) td->ctc->closing_transition = transition_index;
|
if (td->ctc != nullptr) td->ctc->closing_transition = transition_index;
|
||||||
|
*/
|
||||||
|
|
||||||
mutex.unlock();
|
mutex.unlock();
|
||||||
|
|
||||||
|
|||||||
+465
-477
File diff suppressed because it is too large
Load Diff
+22
-22
@@ -29,34 +29,34 @@
|
|||||||
#include "project/media.h"
|
#include "project/media.h"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <libavformat/avformat.h>
|
#include <libavformat/avformat.h>
|
||||||
#include <libavcodec/avcodec.h>
|
#include <libavcodec/avcodec.h>
|
||||||
#include <libswscale/swscale.h>
|
#include <libswscale/swscale.h>
|
||||||
#include <libswresample/swresample.h>
|
#include <libswresample/swresample.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
class PreviewGenerator : public QThread
|
class PreviewGenerator : public QThread
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
PreviewGenerator(Media*, FootagePtr, bool);
|
PreviewGenerator(Media*, FootagePtr, bool);
|
||||||
void run();
|
void run();
|
||||||
void cancel();
|
void cancel();
|
||||||
private:
|
private:
|
||||||
void parse_media();
|
void parse_media();
|
||||||
bool retrieve_preview(const QString &hash);
|
bool retrieve_preview(const QString &hash);
|
||||||
void generate_waveform();
|
void generate_waveform();
|
||||||
void finalize_media();
|
void finalize_media();
|
||||||
AVFormatContext* fmt_ctx;
|
AVFormatContext* fmt_ctx;
|
||||||
Media* media;
|
Media* media;
|
||||||
FootagePtr footage;
|
FootagePtr footage;
|
||||||
bool retrieve_duration;
|
bool retrieve_duration;
|
||||||
bool contains_still_image;
|
bool contains_still_image;
|
||||||
bool replace;
|
bool replace;
|
||||||
bool cancelled;
|
bool cancelled;
|
||||||
QDir data_dir;
|
QDir data_dir;
|
||||||
QString get_thumbnail_path(const QString &hash, const FootageStream &ms);
|
QString get_thumbnail_path(const QString &hash, const FootageStream &ms);
|
||||||
QString get_waveform_path(const QString& hash, const FootageStream &ms);
|
QString get_waveform_path(const QString& hash, const FootageStream &ms);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PREVIEWGENERATOR_H
|
#endif // PREVIEWGENERATOR_H
|
||||||
|
|||||||
@@ -29,107 +29,114 @@
|
|||||||
#include "io/config.h"
|
#include "io/config.h"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <libavformat/avformat.h>
|
#include <libavformat/avformat.h>
|
||||||
#include <libavfilter/avfilter.h>
|
#include <libavfilter/avfilter.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
olive::Global = std::unique_ptr<OliveGlobal>(new OliveGlobal);
|
olive::Global = std::unique_ptr<OliveGlobal>(new OliveGlobal);
|
||||||
|
|
||||||
bool launch_fullscreen = false;
|
bool launch_fullscreen = false;
|
||||||
QString load_proj;
|
QString load_proj;
|
||||||
|
|
||||||
bool use_internal_logger = true;
|
bool use_internal_logger = true;
|
||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
for (int i=1;i<argc;i++) {
|
for (int i=1;i<argc;i++) {
|
||||||
if (argv[i][0] == '-') {
|
if (argv[i][0] == '-') {
|
||||||
if (!strcmp(argv[i], "--version") || !strcmp(argv[i], "-v")) {
|
if (!strcmp(argv[i], "--version") || !strcmp(argv[i], "-v")) {
|
||||||
#ifndef GITHASH
|
#ifndef GITHASH
|
||||||
qWarning() << "No Git commit information found";
|
qWarning() << "No Git commit information found";
|
||||||
#endif
|
#endif
|
||||||
printf("%s\n", olive::AppName.toUtf8().constData());
|
printf("%s\n", olive::AppName.toUtf8().constData());
|
||||||
return 0;
|
return 0;
|
||||||
} else if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) {
|
} else if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) {
|
||||||
printf("Usage: %s [options] [filename]\n\n"
|
printf("Usage: %s [options] [filename]\n\n"
|
||||||
"[filename] is the file to open on startup.\n\n"
|
"[filename] is the file to open on startup.\n\n"
|
||||||
"Options:\n"
|
"Options:\n"
|
||||||
"\t-v, --version\t\tShow version information\n"
|
"\t-v, --version\t\tShow version information\n"
|
||||||
"\t-h, --help\t\tShow this help\n"
|
"\t-h, --help\t\tShow this help\n"
|
||||||
"\t-f, --fullscreen\tStart in full screen mode\n"
|
"\t-f, --fullscreen\tStart in full screen mode\n"
|
||||||
"\t--disable-shaders\tDisable OpenGL shaders (for debugging)\n"
|
"\t--disable-shaders\tDisable OpenGL shaders (for debugging)\n"
|
||||||
"\t--no-debug\t\tDisable internal debug log and output directly to console\n"
|
"\t--no-debug\t\tDisable internal debug log and output directly to console\n"
|
||||||
"\t--disable-blend-modes\tDisable shader-based blending for older GPUs\n"
|
"\t--disable-blend-modes\tDisable shader-based blending for older GPUs\n"
|
||||||
"\t--translation <file>\tSet an external language file to use\n"
|
"\t--translation <file>\tSet an external language file to use\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Environment Variables:\n"
|
"Environment Variables:\n"
|
||||||
"\tOLIVE_EFFECTS_PATH\tSpecify a path to search for GLSL shader effects\n"
|
"\tOLIVE_EFFECTS_PATH\tSpecify a path to search for GLSL shader effects\n"
|
||||||
"\tFREI0R_PATH\t\tSpecify a path to search for Frei0r effects\n"
|
"\tFREI0R_PATH\t\tSpecify a path to search for Frei0r effects\n"
|
||||||
"\tOLIVE_LANG_PATH\t\tSpecify a path to search for translation files\n"
|
"\tOLIVE_LANG_PATH\t\tSpecify a path to search for translation files\n"
|
||||||
"\n", argv[0]);
|
"\n", argv[0]);
|
||||||
return 0;
|
return 0;
|
||||||
} else if (!strcmp(argv[i], "--fullscreen") || !strcmp(argv[i], "-f")) {
|
} else if (!strcmp(argv[i], "--fullscreen") || !strcmp(argv[i], "-f")) {
|
||||||
launch_fullscreen = true;
|
launch_fullscreen = true;
|
||||||
} else if (!strcmp(argv[i], "--disable-shaders")) {
|
} else if (!strcmp(argv[i], "--disable-shaders")) {
|
||||||
olive::CurrentRuntimeConfig.shaders_are_enabled = false;
|
olive::CurrentRuntimeConfig.shaders_are_enabled = false;
|
||||||
} else if (!strcmp(argv[i], "--no-debug")) {
|
} else if (!strcmp(argv[i], "--no-debug")) {
|
||||||
use_internal_logger = false;
|
use_internal_logger = false;
|
||||||
} else if (!strcmp(argv[i], "--disable-blend-modes")) {
|
} else if (!strcmp(argv[i], "--disable-blend-modes")) {
|
||||||
olive::CurrentRuntimeConfig.disable_blending = true;
|
olive::CurrentRuntimeConfig.disable_blending = true;
|
||||||
} else if (!strcmp(argv[i], "--translation")) {
|
} else if (!strcmp(argv[i], "--translation")) {
|
||||||
if (i + 1 < argc && argv[i + 1][0] != '-') {
|
if (i + 1 < argc && argv[i + 1][0] != '-') {
|
||||||
// load translation file
|
// load translation file
|
||||||
olive::CurrentRuntimeConfig.external_translation_file = argv[i + 1];
|
olive::CurrentRuntimeConfig.external_translation_file = argv[i + 1];
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
} else {
|
} else {
|
||||||
printf("[ERROR] No translation file specified\n");
|
printf("[ERROR] No translation file specified\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
printf("[ERROR] Unknown argument '%s'\n", argv[1]);
|
printf("[ERROR] Unknown argument '%s'\n", argv[1]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else if (load_proj.isEmpty()) {
|
} else if (load_proj.isEmpty()) {
|
||||||
load_proj = argv[i];
|
load_proj = argv[i];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (use_internal_logger) {
|
|
||||||
qInstallMessageHandler(debug_message_handler);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize ffmpeg subsystem
|
if (use_internal_logger) {
|
||||||
// (these have been deprecated in FFmpeg 4, but are still necessary for FFmpeg 3)
|
qInstallMessageHandler(debug_message_handler);
|
||||||
av_register_all();
|
}
|
||||||
avfilter_register_all();
|
|
||||||
|
|
||||||
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
|
// Initialize ffmpeg subsystem
|
||||||
|
// (these have been deprecated in FFmpeg 4, but are still necessary for FFmpeg 3)
|
||||||
|
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(58, 9, 100)
|
||||||
|
av_register_all();
|
||||||
|
#endif
|
||||||
|
|
||||||
QApplication a(argc, argv);
|
#if LIBAVFILTER_VERSION_INT < AV_VERSION_INT(7, 14, 100)
|
||||||
a.setWindowIcon(QIcon(":/icons/olive64.png"));
|
avfilter_register_all();
|
||||||
|
#endif
|
||||||
|
|
||||||
olive::media_icon_service = std::unique_ptr<MediaIconService>(new MediaIconService());
|
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
|
||||||
|
|
||||||
QCoreApplication::setOrganizationName("olivevideoeditor.org");
|
QApplication a(argc, argv);
|
||||||
QCoreApplication::setOrganizationDomain("olivevideoeditor.org");
|
a.setWindowIcon(QIcon(":/icons/olive64.png"));
|
||||||
QCoreApplication::setApplicationName("Olive");
|
|
||||||
QGuiApplication::setDesktopFileName("org.olivevideoeditor.Olive");
|
|
||||||
|
|
||||||
MainWindow w(nullptr);
|
// start media icon service (uses QPixmaps which require a QGuiApplication to have been created)
|
||||||
|
olive::media_icon_service = std::unique_ptr<MediaIconService>(new MediaIconService());
|
||||||
|
|
||||||
// connect main window's first paint to global's init finished function
|
// set app name data
|
||||||
QObject::connect(&w, SIGNAL(finished_first_paint()), olive::Global.get(), SLOT(finished_initialize()));
|
QCoreApplication::setOrganizationName("olivevideoeditor.org");
|
||||||
|
QCoreApplication::setOrganizationDomain("olivevideoeditor.org");
|
||||||
|
QCoreApplication::setApplicationName("Olive");
|
||||||
|
QGuiApplication::setDesktopFileName("org.olivevideoeditor.Olive");
|
||||||
|
|
||||||
if (!load_proj.isEmpty()) {
|
MainWindow w(nullptr);
|
||||||
olive::Global->load_project_on_launch(load_proj);
|
|
||||||
}
|
|
||||||
if (launch_fullscreen) {
|
|
||||||
w.showFullScreen();
|
|
||||||
} else {
|
|
||||||
w.showMaximized();
|
|
||||||
}
|
|
||||||
|
|
||||||
return a.exec();
|
// connect main window's first paint to global's init finished function
|
||||||
|
QObject::connect(&w, SIGNAL(finished_first_paint()), olive::Global.get(), SLOT(finished_initialize()));
|
||||||
|
|
||||||
|
if (!load_proj.isEmpty()) {
|
||||||
|
olive::Global->load_project_on_launch(load_proj);
|
||||||
|
}
|
||||||
|
if (launch_fullscreen) {
|
||||||
|
w.showFullScreen();
|
||||||
|
} else {
|
||||||
|
w.showMaximized();
|
||||||
|
}
|
||||||
|
|
||||||
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|||||||
+394
-394
@@ -52,567 +52,567 @@
|
|||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
EffectControls::EffectControls(QWidget *parent) :
|
EffectControls::EffectControls(QWidget *parent) :
|
||||||
QDockWidget(parent),
|
QDockWidget(parent),
|
||||||
multiple(false),
|
multiple(false),
|
||||||
zoom(1),
|
zoom(1),
|
||||||
panel_name(tr("Effects: ")),
|
panel_name(tr("Effects: ")),
|
||||||
mode(TA_NO_TRANSITION)
|
mode(kTransitionNone)
|
||||||
{
|
{
|
||||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||||
|
|
||||||
setup_ui();
|
setup_ui();
|
||||||
|
|
||||||
clear_effects(false);
|
clear_effects(false);
|
||||||
headers->viewer = panel_sequence_viewer;
|
headers->viewer = panel_sequence_viewer;
|
||||||
headers->snapping = false;
|
headers->snapping = false;
|
||||||
|
|
||||||
effects_area->parent_widget = scrollArea;
|
effects_area->parent_widget = scrollArea;
|
||||||
effects_area->keyframe_area = keyframeView;
|
effects_area->keyframe_area = keyframeView;
|
||||||
effects_area->header = headers;
|
effects_area->header = headers;
|
||||||
keyframeView->header = headers;
|
keyframeView->header = headers;
|
||||||
|
|
||||||
lblMultipleClipsSelected->setVisible(false);
|
lblMultipleClipsSelected->setVisible(false);
|
||||||
|
|
||||||
connect(keyframeView, SIGNAL(wheel_event_signal(QWheelEvent*)), effects_area, SLOT(receive_wheel_event(QWheelEvent*)));
|
connect(keyframeView, SIGNAL(wheel_event_signal(QWheelEvent*)), effects_area, SLOT(receive_wheel_event(QWheelEvent*)));
|
||||||
connect(horizontalScrollBar, SIGNAL(valueChanged(int)), headers, SLOT(set_scroll(int)));
|
connect(horizontalScrollBar, SIGNAL(valueChanged(int)), headers, SLOT(set_scroll(int)));
|
||||||
connect(horizontalScrollBar, SIGNAL(resize_move(double)), keyframeView, SLOT(resize_move(double)));
|
connect(horizontalScrollBar, SIGNAL(resize_move(double)), keyframeView, SLOT(resize_move(double)));
|
||||||
connect(horizontalScrollBar, SIGNAL(valueChanged(int)), keyframeView, SLOT(set_x_scroll(int)));
|
connect(horizontalScrollBar, SIGNAL(valueChanged(int)), keyframeView, SLOT(set_x_scroll(int)));
|
||||||
connect(verticalScrollBar, SIGNAL(valueChanged(int)), keyframeView, SLOT(set_y_scroll(int)));
|
connect(verticalScrollBar, SIGNAL(valueChanged(int)), keyframeView, SLOT(set_y_scroll(int)));
|
||||||
connect(verticalScrollBar, SIGNAL(valueChanged(int)), scrollArea->verticalScrollBar(), SLOT(setValue(int)));
|
connect(verticalScrollBar, SIGNAL(valueChanged(int)), scrollArea->verticalScrollBar(), SLOT(setValue(int)));
|
||||||
connect(scrollArea->verticalScrollBar(), SIGNAL(valueChanged(int)), verticalScrollBar, SLOT(setValue(int)));
|
connect(scrollArea->verticalScrollBar(), SIGNAL(valueChanged(int)), verticalScrollBar, SLOT(setValue(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
EffectControls::~EffectControls() {}
|
EffectControls::~EffectControls() {}
|
||||||
|
|
||||||
int EffectControls::get_mode() {
|
int EffectControls::get_mode() {
|
||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EffectControls::keyframe_focus() {
|
bool EffectControls::keyframe_focus() {
|
||||||
return headers->hasFocus() || keyframeView->hasFocus();
|
return headers->hasFocus() || keyframeView->hasFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::set_zoom(bool in) {
|
void EffectControls::set_zoom(bool in) {
|
||||||
zoom *= (in) ? 2 : 0.5;
|
zoom *= (in) ? 2 : 0.5;
|
||||||
update_keyframes();
|
update_keyframes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::menu_select(QAction* q) {
|
void EffectControls::menu_select(QAction* q) {
|
||||||
ComboAction* ca = new ComboAction();
|
ComboAction* ca = new ComboAction();
|
||||||
for (int i=0;i<selected_clips.size();i++) {
|
for (int i=0;i<selected_clips.size();i++) {
|
||||||
const ClipPtr& c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
const ClipPtr& c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||||
if ((c->track < 0) == (effect_menu_subtype == EFFECT_TYPE_VIDEO)) {
|
if ((c->track < 0) == (effect_menu_subtype == EFFECT_TYPE_VIDEO)) {
|
||||||
const EffectMeta* meta = reinterpret_cast<const EffectMeta*>(q->data().value<quintptr>());
|
const EffectMeta* meta = reinterpret_cast<const EffectMeta*>(q->data().value<quintptr>());
|
||||||
if (effect_menu_type == EFFECT_TYPE_TRANSITION) {
|
if (effect_menu_type == EFFECT_TYPE_TRANSITION) {
|
||||||
if (c->get_opening_transition() == nullptr) {
|
if (c->opening_transition == nullptr) {
|
||||||
ca->append(new AddTransitionCommand(c, nullptr, nullptr, meta, TA_OPENING_TRANSITION, 30));
|
ca->append(new AddTransitionCommand(c, nullptr, nullptr, meta, kTransitionOpening, 30));
|
||||||
}
|
}
|
||||||
if (c->get_closing_transition() == nullptr) {
|
if (c->closing_transition == nullptr) {
|
||||||
ca->append(new AddTransitionCommand(c, nullptr, nullptr, meta, TA_CLOSING_TRANSITION, 30));
|
ca->append(new AddTransitionCommand(c, nullptr, nullptr, meta, kTransitionClosing, 30));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ca->append(new AddEffectCommand(c, nullptr, meta));
|
ca->append(new AddEffectCommand(c, nullptr, meta));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
olive::UndoStack.push(ca);
|
olive::UndoStack.push(ca);
|
||||||
if (effect_menu_type == EFFECT_TYPE_TRANSITION) {
|
if (effect_menu_type == EFFECT_TYPE_TRANSITION) {
|
||||||
update_ui(true);
|
update_ui(true);
|
||||||
} else {
|
} else {
|
||||||
reload_clips();
|
reload_clips();
|
||||||
panel_sequence_viewer->viewer_widget->frame_update();
|
panel_sequence_viewer->viewer_widget->frame_update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::update_keyframes() {
|
void EffectControls::update_keyframes() {
|
||||||
headers->update_zoom(zoom);
|
headers->update_zoom(zoom);
|
||||||
keyframeView->update();
|
keyframeView->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::delete_selected_keyframes() {
|
void EffectControls::delete_selected_keyframes() {
|
||||||
keyframeView->delete_selected_keyframes();
|
keyframeView->delete_selected_keyframes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::copy(bool del) {
|
void EffectControls::copy(bool del) {
|
||||||
if (mode == TA_NO_TRANSITION) {
|
if (mode == kTransitionNone) {
|
||||||
bool cleared = false;
|
bool cleared = false;
|
||||||
|
|
||||||
ComboAction* ca = new ComboAction();
|
ComboAction* ca = new ComboAction();
|
||||||
EffectDeleteCommand* del_com = (del) ? new EffectDeleteCommand() : nullptr;
|
EffectDeleteCommand* del_com = (del) ? new EffectDeleteCommand() : nullptr;
|
||||||
for (int i=0;i<selected_clips.size();i++) {
|
for (int i=0;i<selected_clips.size();i++) {
|
||||||
const ClipPtr& c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
const ClipPtr& c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||||
for (int j=0;j<c->effects.size();j++) {
|
for (int j=0;j<c->effects.size();j++) {
|
||||||
EffectPtr effect = c->effects.at(j);
|
EffectPtr effect = c->effects.at(j);
|
||||||
if (effect->container->selected) {
|
if (effect->container->selected) {
|
||||||
if (!cleared) {
|
if (!cleared) {
|
||||||
clear_clipboard();
|
clear_clipboard();
|
||||||
cleared = true;
|
cleared = true;
|
||||||
clipboard_type = CLIPBOARD_TYPE_EFFECT;
|
clipboard_type = CLIPBOARD_TYPE_EFFECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
clipboard.append(EffectPtr(effect->copy(nullptr)));
|
clipboard.append(EffectPtr(effect->copy(nullptr)));
|
||||||
|
|
||||||
if (del_com != nullptr) {
|
if (del_com != nullptr) {
|
||||||
del_com->clips.append(c);
|
del_com->clips.append(c);
|
||||||
del_com->fx.append(j);
|
del_com->fx.append(j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (del_com != nullptr) {
|
if (del_com != nullptr) {
|
||||||
if (del_com->clips.size() > 0) {
|
if (del_com->clips.size() > 0) {
|
||||||
ca->append(del_com);
|
ca->append(del_com);
|
||||||
} else {
|
} else {
|
||||||
delete del_com;
|
delete del_com;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
olive::UndoStack.push(ca);
|
olive::UndoStack.push(ca);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::scroll_to_frame(long frame) {
|
void EffectControls::scroll_to_frame(long frame) {
|
||||||
scroll_to_frame_internal(horizontalScrollBar, frame, zoom, keyframeView->width());
|
scroll_to_frame_internal(horizontalScrollBar, frame, zoom, keyframeView->width());
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::add_effect_paste_action(QMenu *menu) {
|
void EffectControls::add_effect_paste_action(QMenu *menu) {
|
||||||
QAction* paste_action = menu->addAction(tr("&Paste"), panel_timeline, SLOT(paste(bool)));
|
QAction* paste_action = menu->addAction(tr("&Paste"), panel_timeline, SLOT(paste(bool)));
|
||||||
paste_action->setEnabled(clipboard.size() > 0 && clipboard_type == CLIPBOARD_TYPE_EFFECT);
|
paste_action->setEnabled(clipboard.size() > 0 && clipboard_type == CLIPBOARD_TYPE_EFFECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::cut() {
|
void EffectControls::cut() {
|
||||||
copy(true);
|
copy(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::show_effect_menu(int type, int subtype) {
|
void EffectControls::show_effect_menu(int type, int subtype) {
|
||||||
effect_menu_type = type;
|
effect_menu_type = type;
|
||||||
effect_menu_subtype = subtype;
|
effect_menu_subtype = subtype;
|
||||||
|
|
||||||
effects_loaded.lock();
|
effects_loaded.lock();
|
||||||
|
|
||||||
QMenu effects_menu(this);
|
QMenu effects_menu(this);
|
||||||
effects_menu.setToolTipsVisible(true);
|
effects_menu.setToolTipsVisible(true);
|
||||||
|
|
||||||
for (int i=0;i<effects.size();i++) {
|
for (int i=0;i<effects.size();i++) {
|
||||||
const EffectMeta& em = effects.at(i);
|
const EffectMeta& em = effects.at(i);
|
||||||
|
|
||||||
if (em.type == type && em.subtype == subtype) {
|
if (em.type == type && em.subtype == subtype) {
|
||||||
QAction* action = new QAction(&effects_menu);
|
QAction* action = new QAction(&effects_menu);
|
||||||
action->setText(em.name);
|
action->setText(em.name);
|
||||||
action->setData(reinterpret_cast<quintptr>(&em));
|
action->setData(reinterpret_cast<quintptr>(&em));
|
||||||
if (!em.tooltip.isEmpty()) {
|
if (!em.tooltip.isEmpty()) {
|
||||||
action->setToolTip(em.tooltip);
|
action->setToolTip(em.tooltip);
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenu* parent = &effects_menu;
|
||||||
|
if (!em.category.isEmpty()) {
|
||||||
|
bool found = false;
|
||||||
|
for (int j=0;j<effects_menu.actions().size();j++) {
|
||||||
|
QAction* action = effects_menu.actions().at(j);
|
||||||
|
if (action->menu() != nullptr) {
|
||||||
|
if (action->menu()->title() == em.category) {
|
||||||
|
parent = action->menu();
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
QMenu* parent = &effects_menu;
|
|
||||||
if (!em.category.isEmpty()) {
|
|
||||||
bool found = false;
|
|
||||||
for (int j=0;j<effects_menu.actions().size();j++) {
|
|
||||||
QAction* action = effects_menu.actions().at(j);
|
|
||||||
if (action->menu() != nullptr) {
|
|
||||||
if (action->menu()->title() == em.category) {
|
|
||||||
parent = action->menu();
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!found) {
|
|
||||||
parent = new QMenu(&effects_menu);
|
|
||||||
parent->setToolTipsVisible(true);
|
|
||||||
parent->setTitle(em.category);
|
|
||||||
|
|
||||||
bool found = false;
|
|
||||||
for (int i=0;i<effects_menu.actions().size();i++) {
|
|
||||||
QAction* comp_action = effects_menu.actions().at(i);
|
|
||||||
if (comp_action->text() > em.category) {
|
|
||||||
effects_menu.insertMenu(comp_action, parent);
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!found) effects_menu.addMenu(parent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool found = false;
|
|
||||||
for (int i=0;i<parent->actions().size();i++) {
|
|
||||||
QAction* comp_action = parent->actions().at(i);
|
|
||||||
if (comp_action->text() > action->text()) {
|
|
||||||
parent->insertAction(comp_action, action);
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!found) parent->addAction(action);
|
|
||||||
}
|
}
|
||||||
|
if (!found) {
|
||||||
|
parent = new QMenu(&effects_menu);
|
||||||
|
parent->setToolTipsVisible(true);
|
||||||
|
parent->setTitle(em.category);
|
||||||
|
|
||||||
|
bool found = false;
|
||||||
|
for (int i=0;i<effects_menu.actions().size();i++) {
|
||||||
|
QAction* comp_action = effects_menu.actions().at(i);
|
||||||
|
if (comp_action->text() > em.category) {
|
||||||
|
effects_menu.insertMenu(comp_action, parent);
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) effects_menu.addMenu(parent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool found = false;
|
||||||
|
for (int i=0;i<parent->actions().size();i++) {
|
||||||
|
QAction* comp_action = parent->actions().at(i);
|
||||||
|
if (comp_action->text() > action->text()) {
|
||||||
|
parent->insertAction(comp_action, action);
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) parent->addAction(action);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
effects_loaded.unlock();
|
effects_loaded.unlock();
|
||||||
|
|
||||||
connect(&effects_menu, SIGNAL(triggered(QAction*)), this, SLOT(menu_select(QAction*)));
|
connect(&effects_menu, SIGNAL(triggered(QAction*)), this, SLOT(menu_select(QAction*)));
|
||||||
effects_menu.exec(QCursor::pos());
|
effects_menu.exec(QCursor::pos());
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::clear_effects(bool clear_cache) {
|
void EffectControls::clear_effects(bool clear_cache) {
|
||||||
// clear existing clips
|
// clear existing clips
|
||||||
deselect_all_effects(nullptr);
|
deselect_all_effects(nullptr);
|
||||||
|
|
||||||
// clear graph editor
|
// clear graph editor
|
||||||
if (panel_graph_editor != nullptr) panel_graph_editor->set_row(nullptr);
|
if (panel_graph_editor != nullptr) panel_graph_editor->set_row(nullptr);
|
||||||
|
|
||||||
QVBoxLayout* video_layout = static_cast<QVBoxLayout*>(video_effect_area->layout());
|
QVBoxLayout* video_layout = static_cast<QVBoxLayout*>(video_effect_area->layout());
|
||||||
QVBoxLayout* audio_layout = static_cast<QVBoxLayout*>(audio_effect_area->layout());
|
QVBoxLayout* audio_layout = static_cast<QVBoxLayout*>(audio_effect_area->layout());
|
||||||
QLayoutItem* item;
|
QLayoutItem* item;
|
||||||
while ((item = video_layout->takeAt(0))) {
|
while ((item = video_layout->takeAt(0))) {
|
||||||
item->widget()->setParent(nullptr);
|
item->widget()->setParent(nullptr);
|
||||||
disconnect(static_cast<CollapsibleWidget*>(item->widget()), SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
|
disconnect(static_cast<CollapsibleWidget*>(item->widget()), SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
|
||||||
}
|
}
|
||||||
while ((item = audio_layout->takeAt(0))) {
|
while ((item = audio_layout->takeAt(0))) {
|
||||||
item->widget()->setParent(nullptr);
|
item->widget()->setParent(nullptr);
|
||||||
disconnect(static_cast<CollapsibleWidget*>(item->widget()), SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
|
disconnect(static_cast<CollapsibleWidget*>(item->widget()), SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
|
||||||
}
|
}
|
||||||
lblMultipleClipsSelected->setVisible(false);
|
lblMultipleClipsSelected->setVisible(false);
|
||||||
vcontainer->setVisible(false);
|
vcontainer->setVisible(false);
|
||||||
acontainer->setVisible(false);
|
acontainer->setVisible(false);
|
||||||
headers->setVisible(false);
|
headers->setVisible(false);
|
||||||
keyframeView->setEnabled(false);
|
keyframeView->setEnabled(false);
|
||||||
if (clear_cache) selected_clips.clear();
|
if (clear_cache) selected_clips.clear();
|
||||||
setWindowTitle(panel_name + "(none)");
|
setWindowTitle(panel_name + "(none)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::deselect_all_effects(QWidget* sender) {
|
void EffectControls::deselect_all_effects(QWidget* sender) {
|
||||||
for (int i=0;i<selected_clips.size();i++) {
|
for (int i=0;i<selected_clips.size();i++) {
|
||||||
const ClipPtr& c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
const ClipPtr& c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||||
for (int j=0;j<c->effects.size();j++) {
|
for (int j=0;j<c->effects.size();j++) {
|
||||||
if (c->effects.at(j)->container != sender) {
|
if (c->effects.at(j)->container != sender) {
|
||||||
c->effects.at(j)->container->header_click(false, false);
|
c->effects.at(j)->container->header_click(false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
panel_sequence_viewer->viewer_widget->update();
|
panel_sequence_viewer->viewer_widget->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::open_effect(QVBoxLayout* layout, EffectPtr e) {
|
void EffectControls::open_effect(QVBoxLayout* layout, EffectPtr e) {
|
||||||
CollapsibleWidget* container = e->container;
|
CollapsibleWidget* container = e->container;
|
||||||
layout->addWidget(container);
|
layout->addWidget(container);
|
||||||
connect(container, SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
|
connect(container, SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::setup_ui() {
|
void EffectControls::setup_ui() {
|
||||||
QWidget* contents = new QWidget(this);
|
QWidget* contents = new QWidget(this);
|
||||||
|
|
||||||
QHBoxLayout* hlayout = new QHBoxLayout(contents);
|
QHBoxLayout* hlayout = new QHBoxLayout(contents);
|
||||||
hlayout->setSpacing(0);
|
hlayout->setSpacing(0);
|
||||||
hlayout->setMargin(0);
|
hlayout->setMargin(0);
|
||||||
|
|
||||||
QSplitter* splitter = new QSplitter();
|
QSplitter* splitter = new QSplitter();
|
||||||
splitter->setOrientation(Qt::Horizontal);
|
splitter->setOrientation(Qt::Horizontal);
|
||||||
splitter->setChildrenCollapsible(false);
|
splitter->setChildrenCollapsible(false);
|
||||||
|
|
||||||
scrollArea = new QScrollArea();
|
scrollArea = new QScrollArea();
|
||||||
scrollArea->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding);
|
scrollArea->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding);
|
||||||
scrollArea->setFrameShape(QFrame::NoFrame);
|
scrollArea->setFrameShape(QFrame::NoFrame);
|
||||||
scrollArea->setFrameShadow(QFrame::Plain);
|
scrollArea->setFrameShadow(QFrame::Plain);
|
||||||
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||||
scrollArea->setWidgetResizable(true);
|
scrollArea->setWidgetResizable(true);
|
||||||
|
|
||||||
QWidget* scrollAreaWidgetContents = new QWidget();
|
QWidget* scrollAreaWidgetContents = new QWidget();
|
||||||
|
|
||||||
QHBoxLayout* scrollAreaLayout = new QHBoxLayout(scrollAreaWidgetContents);
|
QHBoxLayout* scrollAreaLayout = new QHBoxLayout(scrollAreaWidgetContents);
|
||||||
scrollAreaLayout->setSpacing(0);
|
scrollAreaLayout->setSpacing(0);
|
||||||
scrollAreaLayout->setMargin(0);
|
scrollAreaLayout->setMargin(0);
|
||||||
|
|
||||||
effects_area = new EffectsArea();
|
effects_area = new EffectsArea();
|
||||||
effects_area->setContextMenuPolicy(Qt::CustomContextMenu);
|
effects_area->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
connect(effects_area, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(effects_area_context_menu()));
|
connect(effects_area, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(effects_area_context_menu()));
|
||||||
|
|
||||||
QVBoxLayout* effects_area_layout = new QVBoxLayout(effects_area);
|
QVBoxLayout* effects_area_layout = new QVBoxLayout(effects_area);
|
||||||
effects_area_layout->setSpacing(0);
|
effects_area_layout->setSpacing(0);
|
||||||
effects_area_layout->setMargin(0);
|
effects_area_layout->setMargin(0);
|
||||||
|
|
||||||
vcontainer = new QWidget();
|
vcontainer = new QWidget();
|
||||||
QVBoxLayout* vcontainerLayout = new QVBoxLayout(vcontainer);
|
QVBoxLayout* vcontainerLayout = new QVBoxLayout(vcontainer);
|
||||||
vcontainerLayout->setSpacing(0);
|
vcontainerLayout->setSpacing(0);
|
||||||
vcontainerLayout->setMargin(0);
|
vcontainerLayout->setMargin(0);
|
||||||
|
|
||||||
QWidget* veHeader = new QWidget();
|
QWidget* veHeader = new QWidget();
|
||||||
veHeader->setObjectName(QStringLiteral("veHeader"));
|
veHeader->setObjectName(QStringLiteral("veHeader"));
|
||||||
veHeader->setStyleSheet(QLatin1String("#veHeader { background: rgba(0, 0, 0, 0.25); }"));
|
veHeader->setStyleSheet(QLatin1String("#veHeader { background: rgba(0, 0, 0, 0.25); }"));
|
||||||
|
|
||||||
QHBoxLayout* veHeaderLayout = new QHBoxLayout(veHeader);
|
QHBoxLayout* veHeaderLayout = new QHBoxLayout(veHeader);
|
||||||
veHeaderLayout->setSpacing(0);
|
veHeaderLayout->setSpacing(0);
|
||||||
veHeaderLayout->setMargin(0);
|
veHeaderLayout->setMargin(0);
|
||||||
|
|
||||||
QPushButton* btnAddVideoEffect = new QPushButton();
|
QPushButton* btnAddVideoEffect = new QPushButton();
|
||||||
btnAddVideoEffect->setIcon(QIcon(":/icons/add-effect.png"));
|
btnAddVideoEffect->setIcon(QIcon(":/icons/add-effect.png"));
|
||||||
btnAddVideoEffect->setToolTip(tr("Add Video Effect"));
|
btnAddVideoEffect->setToolTip(tr("Add Video Effect"));
|
||||||
veHeaderLayout->addWidget(btnAddVideoEffect);
|
veHeaderLayout->addWidget(btnAddVideoEffect);
|
||||||
connect(btnAddVideoEffect, SIGNAL(clicked(bool)), this, SLOT(video_effect_click()));
|
connect(btnAddVideoEffect, SIGNAL(clicked(bool)), this, SLOT(video_effect_click()));
|
||||||
|
|
||||||
veHeaderLayout->addStretch();
|
veHeaderLayout->addStretch();
|
||||||
|
|
||||||
QLabel* lblVideoEffects = new QLabel();
|
QLabel* lblVideoEffects = new QLabel();
|
||||||
QFont font;
|
QFont font;
|
||||||
font.setPointSize(9);
|
font.setPointSize(9);
|
||||||
lblVideoEffects->setFont(font);
|
lblVideoEffects->setFont(font);
|
||||||
lblVideoEffects->setAlignment(Qt::AlignCenter);
|
lblVideoEffects->setAlignment(Qt::AlignCenter);
|
||||||
lblVideoEffects->setText(tr("VIDEO EFFECTS"));
|
lblVideoEffects->setText(tr("VIDEO EFFECTS"));
|
||||||
veHeaderLayout->addWidget(lblVideoEffects);
|
veHeaderLayout->addWidget(lblVideoEffects);
|
||||||
|
|
||||||
veHeaderLayout->addStretch();
|
veHeaderLayout->addStretch();
|
||||||
|
|
||||||
QPushButton* btnAddVideoTransition = new QPushButton();
|
QPushButton* btnAddVideoTransition = new QPushButton();
|
||||||
btnAddVideoTransition->setIcon(QIcon(":/icons/add-transition.png"));
|
btnAddVideoTransition->setIcon(QIcon(":/icons/add-transition.png"));
|
||||||
btnAddVideoTransition->setToolTip(tr("Add Video Transition"));
|
btnAddVideoTransition->setToolTip(tr("Add Video Transition"));
|
||||||
connect(btnAddVideoTransition, SIGNAL(clicked(bool)), this, SLOT(video_transition_click()));
|
connect(btnAddVideoTransition, SIGNAL(clicked(bool)), this, SLOT(video_transition_click()));
|
||||||
veHeaderLayout->addWidget(btnAddVideoTransition);
|
veHeaderLayout->addWidget(btnAddVideoTransition);
|
||||||
|
|
||||||
vcontainerLayout->addWidget(veHeader);
|
vcontainerLayout->addWidget(veHeader);
|
||||||
|
|
||||||
video_effect_area = new QWidget();
|
video_effect_area = new QWidget();
|
||||||
QVBoxLayout* veAreaLayout = new QVBoxLayout(video_effect_area);
|
QVBoxLayout* veAreaLayout = new QVBoxLayout(video_effect_area);
|
||||||
veAreaLayout->setSpacing(0);
|
veAreaLayout->setSpacing(0);
|
||||||
veAreaLayout->setMargin(0);
|
veAreaLayout->setMargin(0);
|
||||||
|
|
||||||
vcontainerLayout->addWidget(video_effect_area);
|
vcontainerLayout->addWidget(video_effect_area);
|
||||||
|
|
||||||
effects_area_layout->addWidget(vcontainer);
|
effects_area_layout->addWidget(vcontainer);
|
||||||
|
|
||||||
acontainer = new QWidget();
|
acontainer = new QWidget();
|
||||||
QVBoxLayout* acontainerLayout = new QVBoxLayout(acontainer);
|
QVBoxLayout* acontainerLayout = new QVBoxLayout(acontainer);
|
||||||
acontainerLayout->setSpacing(0);
|
acontainerLayout->setSpacing(0);
|
||||||
acontainerLayout->setMargin(0);
|
acontainerLayout->setMargin(0);
|
||||||
QWidget* aeHeader = new QWidget();
|
QWidget* aeHeader = new QWidget();
|
||||||
aeHeader->setObjectName(QStringLiteral("aeHeader"));
|
aeHeader->setObjectName(QStringLiteral("aeHeader"));
|
||||||
aeHeader->setStyleSheet(QLatin1String("#aeHeader { background: rgba(0, 0, 0, 0.25); }"));
|
aeHeader->setStyleSheet(QLatin1String("#aeHeader { background: rgba(0, 0, 0, 0.25); }"));
|
||||||
|
|
||||||
QHBoxLayout* aeHeaderLayout = new QHBoxLayout(aeHeader);
|
QHBoxLayout* aeHeaderLayout = new QHBoxLayout(aeHeader);
|
||||||
aeHeaderLayout->setSpacing(0);
|
aeHeaderLayout->setSpacing(0);
|
||||||
aeHeaderLayout->setMargin(0);
|
aeHeaderLayout->setMargin(0);
|
||||||
|
|
||||||
QPushButton* btnAddAudioEffect = new QPushButton();
|
QPushButton* btnAddAudioEffect = new QPushButton();
|
||||||
btnAddAudioEffect->setIcon(QIcon(":/icons/add-effect.png"));
|
btnAddAudioEffect->setIcon(QIcon(":/icons/add-effect.png"));
|
||||||
btnAddAudioEffect->setToolTip(tr("Add Audio Effect"));
|
btnAddAudioEffect->setToolTip(tr("Add Audio Effect"));
|
||||||
connect(btnAddAudioEffect, SIGNAL(clicked(bool)), this, SLOT(audio_effect_click()));
|
connect(btnAddAudioEffect, SIGNAL(clicked(bool)), this, SLOT(audio_effect_click()));
|
||||||
aeHeaderLayout->addWidget(btnAddAudioEffect);
|
aeHeaderLayout->addWidget(btnAddAudioEffect);
|
||||||
|
|
||||||
aeHeaderLayout->addStretch();
|
aeHeaderLayout->addStretch();
|
||||||
|
|
||||||
QLabel* lblAudioEffects = new QLabel();
|
QLabel* lblAudioEffects = new QLabel();
|
||||||
lblAudioEffects->setFont(font);
|
lblAudioEffects->setFont(font);
|
||||||
lblAudioEffects->setAlignment(Qt::AlignCenter);
|
lblAudioEffects->setAlignment(Qt::AlignCenter);
|
||||||
lblAudioEffects->setText(tr("AUDIO EFFECTS"));
|
lblAudioEffects->setText(tr("AUDIO EFFECTS"));
|
||||||
aeHeaderLayout->addWidget(lblAudioEffects);
|
aeHeaderLayout->addWidget(lblAudioEffects);
|
||||||
|
|
||||||
aeHeaderLayout->addStretch();
|
aeHeaderLayout->addStretch();
|
||||||
|
|
||||||
QPushButton* btnAddAudioTransition = new QPushButton();
|
QPushButton* btnAddAudioTransition = new QPushButton();
|
||||||
btnAddAudioTransition->setIcon(QIcon(":/icons/add-transition.png"));
|
btnAddAudioTransition->setIcon(QIcon(":/icons/add-transition.png"));
|
||||||
btnAddAudioTransition->setToolTip(tr("Add Audio Transition"));
|
btnAddAudioTransition->setToolTip(tr("Add Audio Transition"));
|
||||||
connect(btnAddAudioTransition, SIGNAL(clicked(bool)), this, SLOT(audio_transition_click()));
|
connect(btnAddAudioTransition, SIGNAL(clicked(bool)), this, SLOT(audio_transition_click()));
|
||||||
aeHeaderLayout->addWidget(btnAddAudioTransition);
|
aeHeaderLayout->addWidget(btnAddAudioTransition);
|
||||||
|
|
||||||
acontainerLayout->addWidget(aeHeader);
|
acontainerLayout->addWidget(aeHeader);
|
||||||
|
|
||||||
audio_effect_area = new QWidget();
|
audio_effect_area = new QWidget();
|
||||||
QVBoxLayout* aeAreaLayout = new QVBoxLayout(audio_effect_area);
|
QVBoxLayout* aeAreaLayout = new QVBoxLayout(audio_effect_area);
|
||||||
aeAreaLayout->setSpacing(0);
|
aeAreaLayout->setSpacing(0);
|
||||||
aeAreaLayout->setMargin(0);
|
aeAreaLayout->setMargin(0);
|
||||||
|
|
||||||
acontainerLayout->addWidget(audio_effect_area);
|
acontainerLayout->addWidget(audio_effect_area);
|
||||||
|
|
||||||
effects_area_layout->addWidget(acontainer);
|
effects_area_layout->addWidget(acontainer);
|
||||||
|
|
||||||
lblMultipleClipsSelected = new QLabel();
|
lblMultipleClipsSelected = new QLabel();
|
||||||
lblMultipleClipsSelected->setAlignment(Qt::AlignCenter);
|
lblMultipleClipsSelected->setAlignment(Qt::AlignCenter);
|
||||||
lblMultipleClipsSelected->setText(tr("(Multiple clips selected)"));
|
lblMultipleClipsSelected->setText(tr("(Multiple clips selected)"));
|
||||||
effects_area_layout->addWidget(lblMultipleClipsSelected);
|
effects_area_layout->addWidget(lblMultipleClipsSelected);
|
||||||
|
|
||||||
effects_area_layout->addStretch();
|
effects_area_layout->addStretch();
|
||||||
|
|
||||||
scrollAreaLayout->addWidget(effects_area);
|
scrollAreaLayout->addWidget(effects_area);
|
||||||
|
|
||||||
scrollArea->setWidget(scrollAreaWidgetContents);
|
scrollArea->setWidget(scrollAreaWidgetContents);
|
||||||
splitter->addWidget(scrollArea);
|
splitter->addWidget(scrollArea);
|
||||||
|
|
||||||
QWidget* keyframeArea = new QWidget();
|
QWidget* keyframeArea = new QWidget();
|
||||||
|
|
||||||
QSizePolicy keyframe_sp;
|
QSizePolicy keyframe_sp;
|
||||||
keyframe_sp.setHorizontalPolicy(QSizePolicy::Minimum);
|
keyframe_sp.setHorizontalPolicy(QSizePolicy::Minimum);
|
||||||
keyframe_sp.setVerticalPolicy(QSizePolicy::Preferred);
|
keyframe_sp.setVerticalPolicy(QSizePolicy::Preferred);
|
||||||
keyframe_sp.setHorizontalStretch(1);
|
keyframe_sp.setHorizontalStretch(1);
|
||||||
keyframeArea->setSizePolicy(keyframe_sp);
|
keyframeArea->setSizePolicy(keyframe_sp);
|
||||||
|
|
||||||
QVBoxLayout* keyframeAreaLayout = new QVBoxLayout(keyframeArea);
|
QVBoxLayout* keyframeAreaLayout = new QVBoxLayout(keyframeArea);
|
||||||
keyframeAreaLayout->setSpacing(0);
|
keyframeAreaLayout->setSpacing(0);
|
||||||
keyframeAreaLayout->setMargin(0);
|
keyframeAreaLayout->setMargin(0);
|
||||||
|
|
||||||
headers = new TimelineHeader();
|
headers = new TimelineHeader();
|
||||||
keyframeAreaLayout->addWidget(headers);
|
keyframeAreaLayout->addWidget(headers);
|
||||||
|
|
||||||
QWidget* keyframeCenterWidget = new QWidget();
|
QWidget* keyframeCenterWidget = new QWidget();
|
||||||
|
|
||||||
QHBoxLayout* keyframeCenterLayout = new QHBoxLayout(keyframeCenterWidget);
|
QHBoxLayout* keyframeCenterLayout = new QHBoxLayout(keyframeCenterWidget);
|
||||||
keyframeCenterLayout->setSpacing(0);
|
keyframeCenterLayout->setSpacing(0);
|
||||||
keyframeCenterLayout->setMargin(0);
|
keyframeCenterLayout->setMargin(0);
|
||||||
|
|
||||||
keyframeView = new KeyframeView();
|
keyframeView = new KeyframeView();
|
||||||
|
|
||||||
keyframeCenterLayout->addWidget(keyframeView);
|
keyframeCenterLayout->addWidget(keyframeView);
|
||||||
|
|
||||||
verticalScrollBar = new QScrollBar();
|
verticalScrollBar = new QScrollBar();
|
||||||
verticalScrollBar->setOrientation(Qt::Vertical);
|
verticalScrollBar->setOrientation(Qt::Vertical);
|
||||||
|
|
||||||
keyframeCenterLayout->addWidget(verticalScrollBar);
|
keyframeCenterLayout->addWidget(verticalScrollBar);
|
||||||
|
|
||||||
|
|
||||||
keyframeAreaLayout->addWidget(keyframeCenterWidget);
|
keyframeAreaLayout->addWidget(keyframeCenterWidget);
|
||||||
|
|
||||||
horizontalScrollBar = new ResizableScrollBar();
|
horizontalScrollBar = new ResizableScrollBar();
|
||||||
horizontalScrollBar->setOrientation(Qt::Horizontal);
|
horizontalScrollBar->setOrientation(Qt::Horizontal);
|
||||||
|
|
||||||
keyframeAreaLayout->addWidget(horizontalScrollBar);
|
keyframeAreaLayout->addWidget(horizontalScrollBar);
|
||||||
|
|
||||||
splitter->addWidget(keyframeArea);
|
splitter->addWidget(keyframeArea);
|
||||||
|
|
||||||
hlayout->addWidget(splitter);
|
hlayout->addWidget(splitter);
|
||||||
|
|
||||||
setWidget(contents);
|
setWidget(contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::update_scrollbar() {
|
void EffectControls::update_scrollbar() {
|
||||||
verticalScrollBar->setMaximum(qMax(0, effects_area->height() - keyframeView->height() - headers->height()));
|
verticalScrollBar->setMaximum(qMax(0, effects_area->height() - keyframeView->height() - headers->height()));
|
||||||
verticalScrollBar->setPageStep(verticalScrollBar->height());
|
verticalScrollBar->setPageStep(verticalScrollBar->height());
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::queue_post_update() {
|
void EffectControls::queue_post_update() {
|
||||||
keyframeView->update();
|
keyframeView->update();
|
||||||
update_scrollbar();
|
update_scrollbar();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::effects_area_context_menu() {
|
void EffectControls::effects_area_context_menu() {
|
||||||
QMenu menu(this);
|
QMenu menu(this);
|
||||||
|
|
||||||
add_effect_paste_action(&menu);
|
add_effect_paste_action(&menu);
|
||||||
|
|
||||||
menu.exec(QCursor::pos());
|
menu.exec(QCursor::pos());
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::load_effects() {
|
void EffectControls::load_effects() {
|
||||||
lblMultipleClipsSelected->setVisible(multiple);
|
lblMultipleClipsSelected->setVisible(multiple);
|
||||||
|
|
||||||
if (!multiple) {
|
if (!multiple) {
|
||||||
// load in new clips
|
// load in new clips
|
||||||
for (int i=0;i<selected_clips.size();i++) {
|
for (int i=0;i<selected_clips.size();i++) {
|
||||||
ClipPtr c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
ClipPtr c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||||
QVBoxLayout* layout;
|
QVBoxLayout* layout;
|
||||||
if (c->track < 0) {
|
if (c->track < 0) {
|
||||||
vcontainer->setVisible(true);
|
vcontainer->setVisible(true);
|
||||||
layout = static_cast<QVBoxLayout*>(video_effect_area->layout());
|
layout = static_cast<QVBoxLayout*>(video_effect_area->layout());
|
||||||
} else {
|
} else {
|
||||||
acontainer->setVisible(true);
|
acontainer->setVisible(true);
|
||||||
layout = static_cast<QVBoxLayout*>(audio_effect_area->layout());
|
layout = static_cast<QVBoxLayout*>(audio_effect_area->layout());
|
||||||
}
|
}
|
||||||
if (mode == TA_NO_TRANSITION) {
|
if (mode == kTransitionNone) {
|
||||||
for (int j=0;j<c->effects.size();j++) {
|
for (int j=0;j<c->effects.size();j++) {
|
||||||
open_effect(layout, c->effects.at(j));
|
open_effect(layout, c->effects.at(j));
|
||||||
}
|
}
|
||||||
} else if (mode == TA_OPENING_TRANSITION && c->get_opening_transition() != nullptr) {
|
} else if (mode == kTransitionOpening && c->opening_transition != nullptr) {
|
||||||
open_effect(layout, c->get_opening_transition());
|
open_effect(layout, c->opening_transition);
|
||||||
} else if (mode == TA_CLOSING_TRANSITION && c->get_closing_transition() != nullptr) {
|
} else if (mode == kTransitionClosing && c->closing_transition != nullptr) {
|
||||||
open_effect(layout, c->get_closing_transition());
|
open_effect(layout, c->closing_transition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (selected_clips.size() > 0) {
|
if (selected_clips.size() > 0) {
|
||||||
setWindowTitle(panel_name + olive::ActiveSequence->clips.at(selected_clips.at(0))->name);
|
setWindowTitle(panel_name + olive::ActiveSequence->clips.at(selected_clips.at(0))->name);
|
||||||
keyframeView->setEnabled(true);
|
keyframeView->setEnabled(true);
|
||||||
headers->setVisible(true);
|
headers->setVisible(true);
|
||||||
|
|
||||||
QTimer::singleShot(50, this, SLOT(queue_post_update()));
|
QTimer::singleShot(50, this, SLOT(queue_post_update()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::delete_effects() {
|
void EffectControls::delete_effects() {
|
||||||
// load in new clips
|
// load in new clips
|
||||||
if (mode == TA_NO_TRANSITION) {
|
if (mode == kTransitionNone) {
|
||||||
EffectDeleteCommand* command = new EffectDeleteCommand();
|
EffectDeleteCommand* command = new EffectDeleteCommand();
|
||||||
for (int i=0;i<selected_clips.size();i++) {
|
for (int i=0;i<selected_clips.size();i++) {
|
||||||
ClipPtr c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
ClipPtr c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||||
for (int j=0;j<c->effects.size();j++) {
|
for (int j=0;j<c->effects.size();j++) {
|
||||||
EffectPtr effect = c->effects.at(j);
|
EffectPtr effect = c->effects.at(j);
|
||||||
if (effect->container->selected) {
|
if (effect->container->selected) {
|
||||||
command->clips.append(c);
|
command->clips.append(c);
|
||||||
command->fx.append(j);
|
command->fx.append(j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (command->clips.size() > 0) {
|
if (command->clips.size() > 0) {
|
||||||
olive::UndoStack.push(command);
|
olive::UndoStack.push(command);
|
||||||
panel_sequence_viewer->viewer_widget->frame_update();
|
panel_sequence_viewer->viewer_widget->frame_update();
|
||||||
} else {
|
} else {
|
||||||
delete command;
|
delete command;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::reload_clips() {
|
void EffectControls::reload_clips() {
|
||||||
clear_effects(false);
|
clear_effects(false);
|
||||||
load_effects();
|
load_effects();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::set_clips(QVector<int>& clips, int m) {
|
void EffectControls::set_clips(QVector<int>& clips, int m) {
|
||||||
clear_effects(true);
|
clear_effects(true);
|
||||||
|
|
||||||
// replace clip vector
|
// replace clip vector
|
||||||
selected_clips = clips;
|
selected_clips = clips;
|
||||||
mode = m;
|
mode = m;
|
||||||
|
|
||||||
load_effects();
|
load_effects();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::video_effect_click() {
|
void EffectControls::video_effect_click() {
|
||||||
show_effect_menu(EFFECT_TYPE_EFFECT, EFFECT_TYPE_VIDEO);
|
show_effect_menu(EFFECT_TYPE_EFFECT, EFFECT_TYPE_VIDEO);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::audio_effect_click() {
|
void EffectControls::audio_effect_click() {
|
||||||
show_effect_menu(EFFECT_TYPE_EFFECT, EFFECT_TYPE_AUDIO);
|
show_effect_menu(EFFECT_TYPE_EFFECT, EFFECT_TYPE_AUDIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::video_transition_click() {
|
void EffectControls::video_transition_click() {
|
||||||
show_effect_menu(EFFECT_TYPE_TRANSITION, EFFECT_TYPE_VIDEO);
|
show_effect_menu(EFFECT_TYPE_TRANSITION, EFFECT_TYPE_VIDEO);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::audio_transition_click() {
|
void EffectControls::audio_transition_click() {
|
||||||
show_effect_menu(EFFECT_TYPE_TRANSITION, EFFECT_TYPE_AUDIO);
|
show_effect_menu(EFFECT_TYPE_TRANSITION, EFFECT_TYPE_AUDIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::resizeEvent(QResizeEvent*) {
|
void EffectControls::resizeEvent(QResizeEvent*) {
|
||||||
update_scrollbar();
|
update_scrollbar();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EffectControls::is_focused() {
|
bool EffectControls::is_focused() {
|
||||||
if (this->hasFocus()) return true;
|
if (this->hasFocus()) return true;
|
||||||
for (int i=0;i<selected_clips.size();i++) {
|
for (int i=0;i<selected_clips.size();i++) {
|
||||||
ClipPtr c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
ClipPtr c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||||
if (c != nullptr) {
|
if (c != nullptr) {
|
||||||
for (int j=0;j<c->effects.size();j++) {
|
for (int j=0;j<c->effects.size();j++) {
|
||||||
if (c->effects.at(j)->container->is_focused()) {
|
if (c->effects.at(j)->container->is_focused()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "Tried to check focus of a nullptr clip";
|
qWarning() << "Tried to check focus of a nullptr clip";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
EffectsArea::EffectsArea(QWidget* parent) :
|
EffectsArea::EffectsArea(QWidget* parent) :
|
||||||
QWidget(parent)
|
QWidget(parent)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void EffectsArea::receive_wheel_event(QWheelEvent *e) {
|
void EffectsArea::receive_wheel_event(QWheelEvent *e) {
|
||||||
QApplication::sendEvent(this, e);
|
QApplication::sendEvent(this, e);
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -47,7 +47,7 @@ void update_effect_controls() {
|
|||||||
int vclip = -1;
|
int vclip = -1;
|
||||||
int aclip = -1;
|
int aclip = -1;
|
||||||
QVector<int> selected_clips;
|
QVector<int> selected_clips;
|
||||||
int mode = TA_NO_TRANSITION;
|
int mode = kTransitionNone;
|
||||||
if (olive::ActiveSequence != nullptr) {
|
if (olive::ActiveSequence != nullptr) {
|
||||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||||
ClipPtr clip = olive::ActiveSequence->clips.at(i);
|
ClipPtr clip = olive::ActiveSequence->clips.at(i);
|
||||||
@@ -56,11 +56,11 @@ void update_effect_controls() {
|
|||||||
const Selection& s = olive::ActiveSequence->selections.at(j);
|
const Selection& s = olive::ActiveSequence->selections.at(j);
|
||||||
bool add = true;
|
bool add = true;
|
||||||
if (clip->timeline_in >= s.in && clip->timeline_out <= s.out && clip->track == s.track) {
|
if (clip->timeline_in >= s.in && clip->timeline_out <= s.out && clip->track == s.track) {
|
||||||
mode = TA_NO_TRANSITION;
|
mode = kTransitionNone;
|
||||||
} else if (selection_contains_transition(s, clip, TA_OPENING_TRANSITION)) {
|
} else if (selection_contains_transition(s, clip, kTransitionOpening)) {
|
||||||
mode = TA_OPENING_TRANSITION;
|
mode = kTransitionOpening;
|
||||||
} else if (selection_contains_transition(s, clip, TA_CLOSING_TRANSITION)) {
|
} else if (selection_contains_transition(s, clip, kTransitionClosing)) {
|
||||||
mode = TA_CLOSING_TRANSITION;
|
mode = kTransitionClosing;
|
||||||
} else {
|
} else {
|
||||||
add = false;
|
add = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1081,6 +1081,7 @@ void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only,
|
|||||||
stream.writeAttribute("workareaIn", QString::number(s->workarea_in));
|
stream.writeAttribute("workareaIn", QString::number(s->workarea_in));
|
||||||
stream.writeAttribute("workareaOut", QString::number(s->workarea_out));
|
stream.writeAttribute("workareaOut", QString::number(s->workarea_out));
|
||||||
|
|
||||||
|
/*
|
||||||
for (int j=0;j<s->transitions.size();j++) {
|
for (int j=0;j<s->transitions.size();j++) {
|
||||||
TransitionPtr t = s->transitions.at(j);
|
TransitionPtr t = s->transitions.at(j);
|
||||||
if (t != nullptr) {
|
if (t != nullptr) {
|
||||||
@@ -1091,6 +1092,7 @@ void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only,
|
|||||||
stream.writeEndElement(); // transition
|
stream.writeEndElement(); // transition
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
for (int j=0;j<s->clips.size();j++) {
|
for (int j=0;j<s->clips.size();j++) {
|
||||||
const ClipPtr& c = s->clips.at(j);
|
const ClipPtr& c = s->clips.at(j);
|
||||||
@@ -1103,8 +1105,10 @@ void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only,
|
|||||||
stream.writeAttribute("in", QString::number(c->timeline_in));
|
stream.writeAttribute("in", QString::number(c->timeline_in));
|
||||||
stream.writeAttribute("out", QString::number(c->timeline_out));
|
stream.writeAttribute("out", QString::number(c->timeline_out));
|
||||||
stream.writeAttribute("track", QString::number(c->track));
|
stream.writeAttribute("track", QString::number(c->track));
|
||||||
|
/*
|
||||||
stream.writeAttribute("opening", QString::number(c->opening_transition));
|
stream.writeAttribute("opening", QString::number(c->opening_transition));
|
||||||
stream.writeAttribute("closing", QString::number(c->closing_transition));
|
stream.writeAttribute("closing", QString::number(c->closing_transition));
|
||||||
|
*/
|
||||||
|
|
||||||
stream.writeAttribute("r", QString::number(c->color_r));
|
stream.writeAttribute("r", QString::number(c->color_r));
|
||||||
stream.writeAttribute("g", QString::number(c->color_g));
|
stream.writeAttribute("g", QString::number(c->color_g));
|
||||||
|
|||||||
+17
-19
@@ -371,11 +371,11 @@ void Timeline::add_transition() {
|
|||||||
if (c != nullptr && is_clip_selected(c, true)) {
|
if (c != nullptr && is_clip_selected(c, true)) {
|
||||||
int transition_to_add = (c->track < 0) ? TRANSITION_INTERNAL_CROSSDISSOLVE : TRANSITION_INTERNAL_LINEARFADE;
|
int transition_to_add = (c->track < 0) ? TRANSITION_INTERNAL_CROSSDISSOLVE : TRANSITION_INTERNAL_LINEARFADE;
|
||||||
if (c->get_opening_transition() == nullptr) {
|
if (c->get_opening_transition() == nullptr) {
|
||||||
ca->append(new AddTransitionCommand(c, nullptr, nullptr, get_internal_meta(transition_to_add, EFFECT_TYPE_TRANSITION), TA_OPENING_TRANSITION, 30));
|
ca->append(new AddTransitionCommand(c, nullptr, nullptr, get_internal_meta(transition_to_add, EFFECT_TYPE_TRANSITION), kTransitionOpening, 30));
|
||||||
adding = true;
|
adding = true;
|
||||||
}
|
}
|
||||||
if (c->get_closing_transition() == nullptr) {
|
if (c->get_closing_transition() == nullptr) {
|
||||||
ca->append(new AddTransitionCommand(c, nullptr, nullptr, get_internal_meta(transition_to_add, EFFECT_TYPE_TRANSITION), TA_CLOSING_TRANSITION, 30));
|
ca->append(new AddTransitionCommand(c, nullptr, nullptr, get_internal_meta(transition_to_add, EFFECT_TYPE_TRANSITION), kTransitionClosing, 30));
|
||||||
adding = true;
|
adding = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -843,19 +843,17 @@ ClipPtr Timeline::split_clip(ComboAction* ca, bool transitions, int p, long fram
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
if (pre->get_opening_transition()->get_true_length() > new_clip_length) {
|
if (pre->get_opening_transition()->get_true_length() > new_clip_length) {
|
||||||
ca->append(new ModifyTransitionCommand(pre, TA_OPENING_TRANSITION, new_clip_length));
|
ca->append(new ModifyTransitionCommand(pre->get_opening_transition(), new_clip_length));
|
||||||
}
|
}
|
||||||
|
|
||||||
post->sequence->hard_delete_transition(post, TA_OPENING_TRANSITION);
|
|
||||||
}
|
}
|
||||||
if (pre->get_closing_transition() != nullptr) {
|
if (pre->get_closing_transition() != nullptr) {
|
||||||
if (splitting_closing_dual_transition) {
|
if (splitting_closing_dual_transition) {
|
||||||
// just move closing transition to post clip
|
// just move closing transition to post clip
|
||||||
|
|
||||||
// WORKAROUND
|
// WORKAROUND
|
||||||
ca->append(new DeleteTransitionCommand(pre->sequence, pre->closing_transition));
|
ca->append(new DeleteTransitionCommand(pre->closing_transition));
|
||||||
} else {
|
} else {
|
||||||
ca->append(new DeleteTransitionCommand(pre->sequence, pre->closing_transition));
|
ca->append(new DeleteTransitionCommand(pre->closing_transition));
|
||||||
|
|
||||||
if (post->get_closing_transition() != nullptr) {
|
if (post->get_closing_transition() != nullptr) {
|
||||||
if (pre->get_closing_transition()->secondary_clip == nullptr) {
|
if (pre->get_closing_transition()->secondary_clip == nullptr) {
|
||||||
@@ -964,7 +962,7 @@ void Timeline::clean_up_selections(QVector<Selection>& areas) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool selection_contains_transition(const Selection& s, ClipPtr c, int type) {
|
bool selection_contains_transition(const Selection& s, ClipPtr c, int type) {
|
||||||
if (type == TA_OPENING_TRANSITION) {
|
if (type == kTransitionOpening) {
|
||||||
return c->get_opening_transition() != nullptr
|
return c->get_opening_transition() != nullptr
|
||||||
&& s.out == c->timeline_in + c->get_opening_transition()->get_true_length()
|
&& s.out == c->timeline_in + c->get_opening_transition()->get_true_length()
|
||||||
&& ((c->get_opening_transition()->secondary_clip == nullptr && s.in == c->timeline_in)
|
&& ((c->get_opening_transition()->secondary_clip == nullptr && s.in == c->timeline_in)
|
||||||
@@ -989,12 +987,12 @@ void Timeline::delete_areas_and_relink(ComboAction* ca, QVector<Selection>& area
|
|||||||
for (int j=0;j<olive::ActiveSequence->clips.size();j++) {
|
for (int j=0;j<olive::ActiveSequence->clips.size();j++) {
|
||||||
ClipPtr c = olive::ActiveSequence->clips.at(j);
|
ClipPtr c = olive::ActiveSequence->clips.at(j);
|
||||||
if (c != nullptr && c->track == s.track && !c->undeletable) {
|
if (c != nullptr && c->track == s.track && !c->undeletable) {
|
||||||
if (selection_contains_transition(s, c, TA_OPENING_TRANSITION)) {
|
if (selection_contains_transition(s, c, kTransitionOpening)) {
|
||||||
// delete opening transition
|
// delete opening transition
|
||||||
ca->append(new DeleteTransitionCommand(c->sequence, c->opening_transition));
|
ca->append(new DeleteTransitionCommand(c->opening_transition));
|
||||||
} else if (selection_contains_transition(s, c, TA_CLOSING_TRANSITION)) {
|
} else if (selection_contains_transition(s, c, kTransitionClosing)) {
|
||||||
// delete closing transition
|
// delete closing transition
|
||||||
ca->append(new DeleteTransitionCommand(c->sequence, c->closing_transition));
|
ca->append(new DeleteTransitionCommand(c->closing_transition));
|
||||||
} else if (c->timeline_in >= s.in && c->timeline_out <= s.out) {
|
} else if (c->timeline_in >= s.in && c->timeline_out <= s.out) {
|
||||||
// clips falls entirely within deletion area
|
// clips falls entirely within deletion area
|
||||||
ca->append(new DeleteClipAction(olive::ActiveSequence, j));
|
ca->append(new DeleteClipAction(olive::ActiveSequence, j));
|
||||||
@@ -1012,9 +1010,9 @@ void Timeline::delete_areas_and_relink(ComboAction* ca, QVector<Selection>& area
|
|||||||
|
|
||||||
if (c->get_closing_transition() != nullptr) {
|
if (c->get_closing_transition() != nullptr) {
|
||||||
if (s.in < c->timeline_out - c->get_closing_transition()->get_true_length()) {
|
if (s.in < c->timeline_out - c->get_closing_transition()->get_true_length()) {
|
||||||
ca->append(new DeleteTransitionCommand(c->sequence, c->closing_transition));
|
ca->append(new DeleteTransitionCommand(c->closing_transition));
|
||||||
} else {
|
} else {
|
||||||
ca->append(new ModifyTransitionCommand(c, TA_CLOSING_TRANSITION, c->get_closing_transition()->get_true_length() - (c->timeline_out - s.in)));
|
ca->append(new ModifyTransitionCommand(c->closing_transition, c->get_closing_transition()->get_true_length() - (c->timeline_out - s.in)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (c->timeline_in < s.out && c->timeline_out > s.out) {
|
} else if (c->timeline_in < s.out && c->timeline_out > s.out) {
|
||||||
@@ -1023,9 +1021,9 @@ void Timeline::delete_areas_and_relink(ComboAction* ca, QVector<Selection>& area
|
|||||||
|
|
||||||
if (c->get_opening_transition() != nullptr) {
|
if (c->get_opening_transition() != nullptr) {
|
||||||
if (s.out > c->timeline_in + c->get_opening_transition()->get_true_length()) {
|
if (s.out > c->timeline_in + c->get_opening_transition()->get_true_length()) {
|
||||||
ca->append(new DeleteTransitionCommand(c->sequence, c->opening_transition));
|
ca->append(new DeleteTransitionCommand(c->opening_transition));
|
||||||
} else {
|
} else {
|
||||||
ca->append(new ModifyTransitionCommand(c, TA_OPENING_TRANSITION, c->get_opening_transition()->get_true_length() - (s.out - c->timeline_in)));
|
ca->append(new ModifyTransitionCommand(c->opening_transition, c->get_opening_transition()->get_true_length() - (s.out - c->timeline_in)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2070,13 +2068,13 @@ void move_clip(ComboAction* ca, ClipPtr c, long iin, long iout, long iclip_in, i
|
|||||||
if (c->get_opening_transition() != nullptr && c->get_opening_transition()->secondary_clip != nullptr && c->get_opening_transition()->secondary_clip->timeline_out != iin) {
|
if (c->get_opening_transition() != nullptr && c->get_opening_transition()->secondary_clip != nullptr && c->get_opening_transition()->secondary_clip->timeline_out != iin) {
|
||||||
// separate transition
|
// separate transition
|
||||||
ca->append(new SetPointer(reinterpret_cast<void**>(&c->get_opening_transition()->secondary_clip), nullptr));
|
ca->append(new SetPointer(reinterpret_cast<void**>(&c->get_opening_transition()->secondary_clip), nullptr));
|
||||||
ca->append(new AddTransitionCommand(c->get_opening_transition()->secondary_clip, nullptr, c->get_opening_transition(), nullptr, TA_CLOSING_TRANSITION, 0));
|
ca->append(new AddTransitionCommand(c->get_opening_transition()->secondary_clip, nullptr, c->get_opening_transition(), nullptr, kTransitionClosing, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c->get_closing_transition() != nullptr && c->get_closing_transition()->secondary_clip != nullptr && c->get_closing_transition()->parent_clip->timeline_in != iout) {
|
if (c->get_closing_transition() != nullptr && c->get_closing_transition()->secondary_clip != nullptr && c->get_closing_transition()->parent_clip->timeline_in != iout) {
|
||||||
// separate transition
|
// separate transition
|
||||||
ca->append(new SetPointer(reinterpret_cast<void**>(&c->get_closing_transition()->secondary_clip), nullptr));
|
ca->append(new SetPointer(reinterpret_cast<void**>(&c->get_closing_transition()->secondary_clip), nullptr));
|
||||||
ca->append(new AddTransitionCommand(c, nullptr, c->get_closing_transition(), nullptr, TA_CLOSING_TRANSITION, 0));
|
ca->append(new AddTransitionCommand(c, nullptr, c->get_closing_transition(), nullptr, kTransitionClosing, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -79,7 +79,7 @@ void apply_audio_effects(ClipPtr c, double timecode_start, AVFrame* frame, int n
|
|||||||
double adjustment = transition_end - transition_start;
|
double adjustment = transition_end - transition_start;
|
||||||
double adjusted_range_start = (timecode_start - transition_start) / adjustment;
|
double adjusted_range_start = (timecode_start - transition_start) / adjustment;
|
||||||
double adjusted_range_end = (timecode_end - transition_start) / adjustment;
|
double adjusted_range_end = (timecode_end - transition_start) / adjustment;
|
||||||
c->get_opening_transition()->process_audio(adjusted_range_start, adjusted_range_end, frame->data[0], nb_bytes, TA_OPENING_TRANSITION);
|
c->get_opening_transition()->process_audio(adjusted_range_start, adjusted_range_end, frame->data[0], nb_bytes, kTransitionOpening);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,7 +92,7 @@ void apply_audio_effects(ClipPtr c, double timecode_start, AVFrame* frame, int n
|
|||||||
double adjustment = transition_end - transition_start;
|
double adjustment = transition_end - transition_start;
|
||||||
double adjusted_range_start = (timecode_start - transition_start) / adjustment;
|
double adjusted_range_start = (timecode_start - transition_start) / adjustment;
|
||||||
double adjusted_range_end = (timecode_end - transition_start) / adjustment;
|
double adjusted_range_end = (timecode_end - transition_start) / adjustment;
|
||||||
c->get_closing_transition()->process_audio(adjusted_range_start, adjusted_range_end, frame->data[0], nb_bytes, TA_CLOSING_TRANSITION);
|
c->get_closing_transition()->process_audio(adjusted_range_start, adjusted_range_end, frame->data[0], nb_bytes, kTransitionClosing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+219
-232
@@ -35,312 +35,299 @@
|
|||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
Clip::Clip(SequencePtr s) :
|
Clip::Clip(SequencePtr s) :
|
||||||
sequence(s),
|
sequence(s),
|
||||||
enabled(true),
|
enabled(true),
|
||||||
clip_in(0),
|
clip_in(0),
|
||||||
timeline_in(0),
|
timeline_in(0),
|
||||||
timeline_out(0),
|
timeline_out(0),
|
||||||
track(0),
|
track(0),
|
||||||
media(nullptr),
|
media(nullptr),
|
||||||
speed(1.0),
|
speed(1.0),
|
||||||
reverse(false),
|
reverse(false),
|
||||||
maintain_audio_pitch(false),
|
maintain_audio_pitch(false),
|
||||||
autoscale(olive::CurrentConfig.autoscale_by_default),
|
autoscale(olive::CurrentConfig.autoscale_by_default),
|
||||||
opening_transition(-1),
|
opening_transition(nullptr),
|
||||||
closing_transition(-1),
|
closing_transition(nullptr),
|
||||||
undeletable(false),
|
undeletable(false),
|
||||||
replaced(false),
|
replaced(false),
|
||||||
ignore_reverse(false),
|
ignore_reverse(false),
|
||||||
use_existing_frame(false),
|
use_existing_frame(false),
|
||||||
filter_graph(nullptr),
|
filter_graph(nullptr),
|
||||||
fbo(nullptr),
|
fbo(nullptr),
|
||||||
opts(nullptr)
|
opts(nullptr)
|
||||||
{
|
{
|
||||||
pkt = av_packet_alloc();
|
pkt = av_packet_alloc();
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
ClipPtr Clip::copy(SequencePtr s, bool duplicate_transitions) {
|
ClipPtr Clip::copy(SequencePtr s, bool duplicate_transitions) {
|
||||||
ClipPtr copy(new Clip(s));
|
ClipPtr copy(new Clip(s));
|
||||||
|
|
||||||
copy->enabled = enabled;
|
copy->enabled = enabled;
|
||||||
copy->name = QString(name);
|
copy->name = QString(name);
|
||||||
copy->clip_in = clip_in;
|
copy->clip_in = clip_in;
|
||||||
copy->timeline_in = timeline_in;
|
copy->timeline_in = timeline_in;
|
||||||
copy->timeline_out = timeline_out;
|
copy->timeline_out = timeline_out;
|
||||||
copy->track = track;
|
copy->track = track;
|
||||||
copy->color_r = color_r;
|
copy->color_r = color_r;
|
||||||
copy->color_g = color_g;
|
copy->color_g = color_g;
|
||||||
copy->color_b = color_b;
|
copy->color_b = color_b;
|
||||||
copy->media = media;
|
copy->media = media;
|
||||||
copy->media_stream = media_stream;
|
copy->media_stream = media_stream;
|
||||||
copy->autoscale = autoscale;
|
copy->autoscale = autoscale;
|
||||||
copy->speed = speed;
|
copy->speed = speed;
|
||||||
copy->maintain_audio_pitch = maintain_audio_pitch;
|
copy->maintain_audio_pitch = maintain_audio_pitch;
|
||||||
copy->reverse = reverse;
|
copy->reverse = reverse;
|
||||||
|
|
||||||
for (int i=0;i<effects.size();i++) {
|
for (int i=0;i<effects.size();i++) {
|
||||||
copy->effects.append(effects.at(i)->copy(copy));
|
copy->effects.append(effects.at(i)->copy(copy));
|
||||||
}
|
}
|
||||||
|
|
||||||
copy->cached_fr = (this->sequence == nullptr) ? cached_fr : this->sequence->frame_rate;
|
copy->cached_fr = (this->sequence == nullptr) ? cached_fr : this->sequence->frame_rate;
|
||||||
|
|
||||||
if (duplicate_transitions) {
|
if (duplicate_transitions) {
|
||||||
if (get_opening_transition() != nullptr && get_opening_transition()->secondary_clip == nullptr) copy->opening_transition = get_opening_transition()->copy(copy, nullptr);
|
if (get_opening_transition() != nullptr && get_opening_transition()->secondary_clip == nullptr) {
|
||||||
if (get_closing_transition() != nullptr && get_closing_transition()->secondary_clip == nullptr) copy->closing_transition = get_closing_transition()->copy(copy, nullptr);
|
copy->opening_transition = get_opening_transition()->copy(copy, nullptr);
|
||||||
}
|
}
|
||||||
|
if (get_closing_transition() != nullptr && get_closing_transition()->secondary_clip == nullptr) {
|
||||||
|
copy->closing_transition = get_closing_transition()->copy(copy, nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
copy->recalculateMaxLength();
|
copy->recalculateMaxLength();
|
||||||
|
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clip::reset() {
|
void Clip::reset() {
|
||||||
audio_just_reset = false;
|
audio_just_reset = false;
|
||||||
open = false;
|
open = false;
|
||||||
finished_opening = false;
|
finished_opening = false;
|
||||||
pkt_written = false;
|
pkt_written = false;
|
||||||
audio_reset = false;
|
audio_reset = false;
|
||||||
frame_sample_index = -1;
|
frame_sample_index = -1;
|
||||||
audio_buffer_write = false;
|
audio_buffer_write = false;
|
||||||
texture_frame = -1;
|
texture_frame = -1;
|
||||||
formatCtx = nullptr;
|
formatCtx = nullptr;
|
||||||
stream = nullptr;
|
stream = nullptr;
|
||||||
codec = nullptr;
|
codec = nullptr;
|
||||||
codecCtx = nullptr;
|
codecCtx = nullptr;
|
||||||
texture = nullptr;
|
texture = nullptr;
|
||||||
last_invalid_ts = -1;
|
last_invalid_ts = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clip::reset_audio() {
|
void Clip::reset_audio() {
|
||||||
if (media == nullptr || media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
if (media == nullptr || media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||||
audio_reset = true;
|
audio_reset = true;
|
||||||
frame_sample_index = -1;
|
frame_sample_index = -1;
|
||||||
audio_buffer_write = 0;
|
audio_buffer_write = 0;
|
||||||
} else if (media->get_type() == MEDIA_TYPE_SEQUENCE) {
|
} else if (media->get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||||
SequencePtr nested_sequence = media->to_sequence();
|
SequencePtr nested_sequence = media->to_sequence();
|
||||||
for (int i=0;i<nested_sequence->clips.size();i++) {
|
for (int i=0;i<nested_sequence->clips.size();i++) {
|
||||||
ClipPtr c = nested_sequence->clips.at(i);
|
ClipPtr c = nested_sequence->clips.at(i);
|
||||||
if (c != nullptr) c->reset_audio();
|
if (c != nullptr) c->reset_audio();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clip::refresh() {
|
void Clip::refresh() {
|
||||||
// validates media if it was replaced
|
// validates media if it was replaced
|
||||||
if (replaced && media != nullptr && media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
if (replaced && media != nullptr && media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||||
FootagePtr m = media->to_footage();
|
FootagePtr m = media->to_footage();
|
||||||
|
|
||||||
if (track < 0 && m->video_tracks.size() > 0) {
|
if (track < 0 && m->video_tracks.size() > 0) {
|
||||||
media_stream = m->video_tracks.at(0).file_index;
|
media_stream = m->video_tracks.at(0).file_index;
|
||||||
} else if (track >= 0 && m->audio_tracks.size() > 0) {
|
} else if (track >= 0 && m->audio_tracks.size() > 0) {
|
||||||
media_stream = m->audio_tracks.at(0).file_index;
|
media_stream = m->audio_tracks.at(0).file_index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
replaced = false;
|
replaced = false;
|
||||||
|
|
||||||
// reinitializes all effects... just in case
|
// reinitializes all effects... just in case
|
||||||
for (int i=0;i<effects.size();i++) {
|
for (int i=0;i<effects.size();i++) {
|
||||||
effects.at(i)->refresh();
|
effects.at(i)->refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
recalculateMaxLength();
|
recalculateMaxLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clip::queue_clear() {
|
void Clip::queue_clear() {
|
||||||
while (queue.size() > 0) {
|
while (queue.size() > 0) {
|
||||||
av_frame_free(&queue.first());
|
av_frame_free(&queue.first());
|
||||||
queue.removeFirst();
|
queue.removeFirst();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clip::queue_remove_earliest() {
|
void Clip::queue_remove_earliest() {
|
||||||
int earliest_frame = 0;
|
int earliest_frame = 0;
|
||||||
for (int i=1;i<queue.size();i++) {
|
for (int i=1;i<queue.size();i++) {
|
||||||
// TODO/NOTE: this will not work on sped up AND reversed video
|
// TODO/NOTE: this will not work on sped up AND reversed video
|
||||||
if (queue.at(i)->pts < queue.at(earliest_frame)->pts) {
|
if (queue.at(i)->pts < queue.at(earliest_frame)->pts) {
|
||||||
earliest_frame = i;
|
earliest_frame = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
av_frame_free(&queue[earliest_frame]);
|
av_frame_free(&queue[earliest_frame]);
|
||||||
queue.removeAt(earliest_frame);
|
queue.removeAt(earliest_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<Marker> &Clip::get_markers() {
|
QVector<Marker> &Clip::get_markers() {
|
||||||
if (media != nullptr) {
|
if (media != nullptr) {
|
||||||
return media->get_markers();
|
return media->get_markers();
|
||||||
}
|
}
|
||||||
return markers;
|
return markers;
|
||||||
}
|
}
|
||||||
|
|
||||||
TransitionPtr Clip::get_opening_transition() {
|
TransitionPtr Clip::get_opening_transition() {
|
||||||
if (opening_transition > -1) {
|
return opening_transition;
|
||||||
if (this->sequence == nullptr) {
|
|
||||||
return clipboard_transitions.at(opening_transition);
|
|
||||||
} else {
|
|
||||||
return this->sequence->transitions.at(opening_transition);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TransitionPtr Clip::get_closing_transition() {
|
TransitionPtr Clip::get_closing_transition() {
|
||||||
if (closing_transition > -1) {
|
return closing_transition;
|
||||||
if (this->sequence == nullptr) {
|
|
||||||
return clipboard_transitions.at(closing_transition);
|
|
||||||
} else {
|
|
||||||
return this->sequence->transitions.at(closing_transition);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Clip::~Clip() {
|
Clip::~Clip() {
|
||||||
if (open) {
|
if (open) {
|
||||||
close_clip(ClipPtr(this), true);
|
close_clip(ClipPtr(this), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opening_transition != -1) this->sequence->hard_delete_transition(ClipPtr(this), TA_OPENING_TRANSITION);
|
effects.clear();
|
||||||
if (closing_transition != -1) this->sequence->hard_delete_transition(ClipPtr(this), TA_CLOSING_TRANSITION);
|
av_packet_free(&pkt);
|
||||||
|
|
||||||
effects.clear();
|
|
||||||
av_packet_free(&pkt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
long Clip::get_clip_in_with_transition() {
|
long Clip::get_clip_in_with_transition() {
|
||||||
if (get_opening_transition() != nullptr && get_opening_transition()->secondary_clip != nullptr) {
|
if (get_opening_transition() != nullptr && get_opening_transition()->secondary_clip != nullptr) {
|
||||||
// we must be the secondary clip, so return (timeline in - length)
|
// we must be the secondary clip, so return (timeline in - length)
|
||||||
return clip_in - get_opening_transition()->get_true_length();
|
return clip_in - get_opening_transition()->get_true_length();
|
||||||
}
|
}
|
||||||
return clip_in;
|
return clip_in;
|
||||||
}
|
}
|
||||||
|
|
||||||
long Clip::get_timeline_in_with_transition() {
|
long Clip::get_timeline_in_with_transition() {
|
||||||
if (get_opening_transition() != nullptr && get_opening_transition()->secondary_clip != nullptr) {
|
if (get_opening_transition() != nullptr && get_opening_transition()->secondary_clip != nullptr) {
|
||||||
// we must be the secondary clip, so return (timeline in - length)
|
// we must be the secondary clip, so return (timeline in - length)
|
||||||
return timeline_in - get_opening_transition()->get_true_length();
|
return timeline_in - get_opening_transition()->get_true_length();
|
||||||
}
|
}
|
||||||
return timeline_in;
|
return timeline_in;
|
||||||
}
|
}
|
||||||
|
|
||||||
long Clip::get_timeline_out_with_transition() {
|
long Clip::get_timeline_out_with_transition() {
|
||||||
if (get_closing_transition() != nullptr && get_closing_transition()->secondary_clip != nullptr) {
|
if (get_closing_transition() != nullptr && get_closing_transition()->secondary_clip != nullptr) {
|
||||||
// we must be the primary clip, so return (timeline out + length2)
|
// we must be the primary clip, so return (timeline out + length2)
|
||||||
return timeline_out + get_closing_transition()->get_true_length();
|
return timeline_out + get_closing_transition()->get_true_length();
|
||||||
} else {
|
} else {
|
||||||
return timeline_out;
|
return timeline_out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// timeline functions
|
// timeline functions
|
||||||
long Clip::getLength() {
|
long Clip::getLength() {
|
||||||
return timeline_out - timeline_in;
|
return timeline_out - timeline_in;
|
||||||
}
|
}
|
||||||
|
|
||||||
double Clip::getMediaFrameRate() {
|
double Clip::getMediaFrameRate() {
|
||||||
Q_ASSERT(track < 0);
|
Q_ASSERT(track < 0);
|
||||||
if (media != nullptr) {
|
if (media != nullptr) {
|
||||||
double rate = media->get_frame_rate(media_stream);
|
double rate = media->get_frame_rate(media_stream);
|
||||||
if (!qIsNaN(rate)) return rate;
|
if (!qIsNaN(rate)) return rate;
|
||||||
}
|
}
|
||||||
if (sequence != nullptr) return sequence->frame_rate;
|
if (sequence != nullptr) return sequence->frame_rate;
|
||||||
return qSNaN();
|
return qSNaN();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clip::recalculateMaxLength() {
|
void Clip::recalculateMaxLength() {
|
||||||
if (this->sequence != nullptr) {
|
if (this->sequence != nullptr) {
|
||||||
double fr = this->sequence->frame_rate;
|
double fr = this->sequence->frame_rate;
|
||||||
|
|
||||||
fr /= speed;
|
fr /= speed;
|
||||||
|
|
||||||
calculated_length = LONG_MAX;
|
calculated_length = LONG_MAX;
|
||||||
|
|
||||||
if (media != nullptr) {
|
if (media != nullptr) {
|
||||||
switch (media->get_type()) {
|
switch (media->get_type()) {
|
||||||
case MEDIA_TYPE_FOOTAGE:
|
case MEDIA_TYPE_FOOTAGE:
|
||||||
{
|
{
|
||||||
FootagePtr m = media->to_footage();
|
FootagePtr m = media->to_footage();
|
||||||
const FootageStream* ms = m->get_stream_from_file_index(track < 0, media_stream);
|
const FootageStream* ms = m->get_stream_from_file_index(track < 0, media_stream);
|
||||||
if (ms != nullptr && ms->infinite_length) {
|
if (ms != nullptr && ms->infinite_length) {
|
||||||
calculated_length = LONG_MAX;
|
calculated_length = LONG_MAX;
|
||||||
} else {
|
} else {
|
||||||
calculated_length = m->get_length_in_frames(fr);
|
calculated_length = m->get_length_in_frames(fr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MEDIA_TYPE_SEQUENCE:
|
case MEDIA_TYPE_SEQUENCE:
|
||||||
{
|
{
|
||||||
SequencePtr s = media->to_sequence();
|
SequencePtr s = media->to_sequence();
|
||||||
calculated_length = refactor_frame_number(s->getEndFrame(), s->frame_rate, fr);
|
calculated_length = refactor_frame_number(s->getEndFrame(), s->frame_rate, fr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long Clip::getMaximumLength() {
|
long Clip::getMaximumLength() {
|
||||||
return calculated_length;
|
return calculated_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Clip::getWidth() {
|
int Clip::getWidth() {
|
||||||
if (media == nullptr && sequence != nullptr) return sequence->width;
|
if (media == nullptr && sequence != nullptr) return sequence->width;
|
||||||
switch (media->get_type()) {
|
switch (media->get_type()) {
|
||||||
case MEDIA_TYPE_FOOTAGE:
|
case MEDIA_TYPE_FOOTAGE:
|
||||||
{
|
{
|
||||||
const FootageStream* ms = media->to_footage()->get_stream_from_file_index(track < 0, media_stream);
|
const FootageStream* ms = media->to_footage()->get_stream_from_file_index(track < 0, media_stream);
|
||||||
if (ms != nullptr) return ms->video_width;
|
if (ms != nullptr) return ms->video_width;
|
||||||
if (sequence != nullptr) return sequence->width;
|
if (sequence != nullptr) return sequence->width;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MEDIA_TYPE_SEQUENCE:
|
case MEDIA_TYPE_SEQUENCE:
|
||||||
{
|
{
|
||||||
SequencePtr s = media->to_sequence();
|
SequencePtr s = media->to_sequence();
|
||||||
return s->width;
|
return s->width;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Clip::getHeight() {
|
int Clip::getHeight() {
|
||||||
if (media == nullptr && sequence != nullptr) return sequence->height;
|
if (media == nullptr && sequence != nullptr) return sequence->height;
|
||||||
switch (media->get_type()) {
|
switch (media->get_type()) {
|
||||||
case MEDIA_TYPE_FOOTAGE:
|
case MEDIA_TYPE_FOOTAGE:
|
||||||
{
|
{
|
||||||
const FootageStream* ms = media->to_footage()->get_stream_from_file_index(track < 0, media_stream);
|
const FootageStream* ms = media->to_footage()->get_stream_from_file_index(track < 0, media_stream);
|
||||||
if (ms != nullptr) return ms->video_height;
|
if (ms != nullptr) return ms->video_height;
|
||||||
if (sequence != nullptr) return sequence->height;
|
if (sequence != nullptr) return sequence->height;
|
||||||
}
|
}
|
||||||
case MEDIA_TYPE_SEQUENCE:
|
case MEDIA_TYPE_SEQUENCE:
|
||||||
{
|
{
|
||||||
SequencePtr s = media->to_sequence();
|
SequencePtr s = media->to_sequence();
|
||||||
return s->height;
|
return s->height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clip::refactor_frame_rate(ComboAction* ca, double multiplier, bool change_timeline_points) {
|
void Clip::refactor_frame_rate(ComboAction* ca, double multiplier, bool change_timeline_points) {
|
||||||
if (change_timeline_points) {
|
if (change_timeline_points) {
|
||||||
move_clip(ca, ClipPtr(this),
|
move_clip(ca, ClipPtr(this),
|
||||||
qRound((double) timeline_in * multiplier),
|
qRound((double) timeline_in * multiplier),
|
||||||
qRound((double) timeline_out * multiplier),
|
qRound((double) timeline_out * multiplier),
|
||||||
qRound((double) clip_in * multiplier),
|
qRound((double) clip_in * multiplier),
|
||||||
track);
|
track);
|
||||||
}
|
}
|
||||||
|
|
||||||
// move keyframes
|
// move keyframes
|
||||||
for (int i=0;i<effects.size();i++) {
|
for (int i=0;i<effects.size();i++) {
|
||||||
EffectPtr e = effects.at(i);
|
EffectPtr e = effects.at(i);
|
||||||
for (int j=0;j<e->row_count();j++) {
|
for (int j=0;j<e->row_count();j++) {
|
||||||
EffectRow* r = e->row(j);
|
EffectRow* r = e->row(j);
|
||||||
for (int l=0;l<r->fieldCount();l++) {
|
for (int l=0;l<r->fieldCount();l++) {
|
||||||
EffectField* f = r->field(l);
|
EffectField* f = r->field(l);
|
||||||
for (int k=0;k<f->keyframes.size();k++) {
|
for (int k=0;k<f->keyframes.size();k++) {
|
||||||
ca->append(new SetLong(&f->keyframes[k].time, f->keyframes[k].time, f->keyframes[k].time * multiplier));
|
ca->append(new SetLong(&f->keyframes[k].time, f->keyframes[k].time, f->keyframes[k].time * multiplier));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+94
-94
@@ -38,8 +38,8 @@
|
|||||||
#include "marker.h"
|
#include "marker.h"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <libavformat/avformat.h>
|
#include <libavformat/avformat.h>
|
||||||
#include <libavfilter/avfilter.h>
|
#include <libavfilter/avfilter.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
using ClipPtr = std::shared_ptr<Clip>;
|
using ClipPtr = std::shared_ptr<Clip>;
|
||||||
@@ -49,109 +49,109 @@ using SequencePtr = std::shared_ptr<Sequence>;
|
|||||||
|
|
||||||
class Clip {
|
class Clip {
|
||||||
public:
|
public:
|
||||||
Clip(SequencePtr s);
|
Clip(SequencePtr s);
|
||||||
~Clip();
|
~Clip();
|
||||||
ClipPtr copy(SequencePtr s, bool duplicate_transitions = true);
|
ClipPtr copy(SequencePtr s, bool duplicate_transitions = true);
|
||||||
void reset_audio();
|
void reset_audio();
|
||||||
void reset();
|
void reset();
|
||||||
void refresh();
|
void refresh();
|
||||||
long get_clip_in_with_transition();
|
long get_clip_in_with_transition();
|
||||||
long get_timeline_in_with_transition();
|
long get_timeline_in_with_transition();
|
||||||
long get_timeline_out_with_transition();
|
long get_timeline_out_with_transition();
|
||||||
long getLength();
|
long getLength();
|
||||||
double getMediaFrameRate();
|
double getMediaFrameRate();
|
||||||
long getMaximumLength();
|
long getMaximumLength();
|
||||||
void recalculateMaxLength();
|
void recalculateMaxLength();
|
||||||
int getWidth();
|
int getWidth();
|
||||||
int getHeight();
|
int getHeight();
|
||||||
void refactor_frame_rate(ComboAction* ca, double multiplier, bool change_timeline_points);
|
void refactor_frame_rate(ComboAction* ca, double multiplier, bool change_timeline_points);
|
||||||
SequencePtr sequence;
|
SequencePtr sequence;
|
||||||
|
|
||||||
// queue functions
|
// queue functions
|
||||||
void queue_clear();
|
void queue_clear();
|
||||||
void queue_remove_earliest();
|
void queue_remove_earliest();
|
||||||
|
|
||||||
// timeline variables (should be copied in copy())
|
// timeline variables (should be copied in copy())
|
||||||
bool enabled;
|
bool enabled;
|
||||||
long clip_in;
|
long clip_in;
|
||||||
long timeline_in;
|
long timeline_in;
|
||||||
long timeline_out;
|
long timeline_out;
|
||||||
int track;
|
int track;
|
||||||
QString name;
|
QString name;
|
||||||
quint8 color_r;
|
quint8 color_r;
|
||||||
quint8 color_g;
|
quint8 color_g;
|
||||||
quint8 color_b;
|
quint8 color_b;
|
||||||
Media* media;
|
Media* media;
|
||||||
int media_stream;
|
int media_stream;
|
||||||
double speed;
|
double speed;
|
||||||
double cached_fr;
|
double cached_fr;
|
||||||
bool reverse;
|
bool reverse;
|
||||||
bool maintain_audio_pitch;
|
bool maintain_audio_pitch;
|
||||||
bool autoscale;
|
bool autoscale;
|
||||||
|
|
||||||
// markers
|
// markers
|
||||||
QVector<Marker>& get_markers();
|
QVector<Marker>& get_markers();
|
||||||
|
|
||||||
// other variables (should be deep copied/duplicated in copy())
|
// other variables (should be deep copied/duplicated in copy())
|
||||||
QList<EffectPtr> effects;
|
QList<EffectPtr> effects;
|
||||||
QVector<int> linked;
|
QVector<int> linked;
|
||||||
int opening_transition;
|
TransitionPtr opening_transition;
|
||||||
TransitionPtr get_opening_transition();
|
TransitionPtr get_opening_transition();
|
||||||
int closing_transition;
|
TransitionPtr closing_transition;
|
||||||
TransitionPtr get_closing_transition();
|
TransitionPtr get_closing_transition();
|
||||||
|
|
||||||
// media handling
|
// media handling
|
||||||
AVFormatContext* formatCtx;
|
AVFormatContext* formatCtx;
|
||||||
AVStream* stream;
|
AVStream* stream;
|
||||||
AVCodec* codec;
|
AVCodec* codec;
|
||||||
AVCodecContext* codecCtx;
|
AVCodecContext* codecCtx;
|
||||||
AVPacket* pkt;
|
AVPacket* pkt;
|
||||||
AVFrame* frame;
|
AVFrame* frame;
|
||||||
AVDictionary* opts;
|
AVDictionary* opts;
|
||||||
long calculated_length;
|
long calculated_length;
|
||||||
|
|
||||||
// temporary variables
|
// temporary variables
|
||||||
int load_id;
|
int load_id;
|
||||||
bool undeletable;
|
bool undeletable;
|
||||||
bool reached_end;
|
bool reached_end;
|
||||||
bool pkt_written;
|
bool pkt_written;
|
||||||
bool open;
|
bool open;
|
||||||
bool finished_opening;
|
bool finished_opening;
|
||||||
bool replaced;
|
bool replaced;
|
||||||
bool ignore_reverse;
|
bool ignore_reverse;
|
||||||
int pix_fmt;
|
int pix_fmt;
|
||||||
|
|
||||||
// caching functions
|
// caching functions
|
||||||
bool use_existing_frame;
|
bool use_existing_frame;
|
||||||
bool multithreaded;
|
bool multithreaded;
|
||||||
Cacher* cacher;
|
Cacher* cacher;
|
||||||
QWaitCondition can_cache;
|
QWaitCondition can_cache;
|
||||||
int max_queue_size;
|
int max_queue_size;
|
||||||
QVector<AVFrame*> queue;
|
QVector<AVFrame*> queue;
|
||||||
QMutex queue_lock;
|
QMutex queue_lock;
|
||||||
QMutex lock;
|
QMutex lock;
|
||||||
QMutex open_lock;
|
QMutex open_lock;
|
||||||
int64_t last_invalid_ts;
|
int64_t last_invalid_ts;
|
||||||
|
|
||||||
// converters/filters
|
// converters/filters
|
||||||
AVFilterGraph* filter_graph;
|
AVFilterGraph* filter_graph;
|
||||||
AVFilterContext* buffersink_ctx;
|
AVFilterContext* buffersink_ctx;
|
||||||
AVFilterContext* buffersrc_ctx;
|
AVFilterContext* buffersrc_ctx;
|
||||||
|
|
||||||
// video playback variables
|
// video playback variables
|
||||||
QOpenGLFramebufferObject** fbo;
|
QOpenGLFramebufferObject** fbo;
|
||||||
QOpenGLTexture* texture;
|
QOpenGLTexture* texture;
|
||||||
long texture_frame;
|
long texture_frame;
|
||||||
|
|
||||||
// audio playback variables
|
// audio playback variables
|
||||||
int64_t reverse_target;
|
int64_t reverse_target;
|
||||||
int frame_sample_index;
|
int frame_sample_index;
|
||||||
qint64 audio_buffer_write;
|
qint64 audio_buffer_write;
|
||||||
bool audio_reset;
|
bool audio_reset;
|
||||||
bool audio_just_reset;
|
bool audio_just_reset;
|
||||||
long audio_target_frame;
|
long audio_target_frame;
|
||||||
private:
|
private:
|
||||||
QVector<Marker> markers;
|
QVector<Marker> markers;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CLIP_H
|
#endif // CLIP_H
|
||||||
|
|||||||
@@ -67,42 +67,6 @@ long Sequence::getEndFrame() {
|
|||||||
return end;
|
return end;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sequence::hard_delete_transition(ClipPtr c, int type) {
|
|
||||||
int transition_index = (type == TA_OPENING_TRANSITION) ? c->opening_transition : c->closing_transition;
|
|
||||||
if (transition_index > -1) {
|
|
||||||
bool del = true;
|
|
||||||
|
|
||||||
TransitionPtr t = transitions.at(transition_index);
|
|
||||||
if (t->secondary_clip != nullptr) {
|
|
||||||
for (int i=0;i<clips.size();i++) {
|
|
||||||
ClipPtr comp = clips.at(i);
|
|
||||||
if (comp != nullptr
|
|
||||||
&& c != comp
|
|
||||||
&& (c->opening_transition == transition_index
|
|
||||||
|| c->closing_transition == transition_index)) {
|
|
||||||
if (type == TA_OPENING_TRANSITION) {
|
|
||||||
// convert to closing transition
|
|
||||||
t->parent_clip = t->secondary_clip;
|
|
||||||
}
|
|
||||||
|
|
||||||
del = false;
|
|
||||||
t->secondary_clip = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (del) {
|
|
||||||
transitions[transition_index].reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type == TA_OPENING_TRANSITION) {
|
|
||||||
c->opening_transition = -1;
|
|
||||||
} else {
|
|
||||||
c->closing_transition = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Sequence::getTrackLimits(int* video_tracks, int* audio_tracks) {
|
void Sequence::getTrackLimits(int* video_tracks, int* audio_tracks) {
|
||||||
int vt = 0;
|
int vt = 0;
|
||||||
int at = 0;
|
int at = 0;
|
||||||
|
|||||||
+1
-3
@@ -35,8 +35,7 @@ public:
|
|||||||
SequencePtr copy();
|
SequencePtr copy();
|
||||||
QString name;
|
QString name;
|
||||||
void getTrackLimits(int* video_tracks, int* audio_tracks);
|
void getTrackLimits(int* video_tracks, int* audio_tracks);
|
||||||
long getEndFrame();
|
long getEndFrame();
|
||||||
void hard_delete_transition(ClipPtr c, int type);
|
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
double frame_rate;
|
double frame_rate;
|
||||||
@@ -56,7 +55,6 @@ public:
|
|||||||
|
|
||||||
QVector<Marker> markers;
|
QVector<Marker> markers;
|
||||||
QVector<ClipPtr> clips;
|
QVector<ClipPtr> clips;
|
||||||
QVector<TransitionPtr> transitions;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
using SequencePtr = std::shared_ptr<Sequence>;
|
using SequencePtr = std::shared_ptr<Sequence>;
|
||||||
|
|||||||
+67
-49
@@ -42,74 +42,92 @@
|
|||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
|
||||||
Transition::Transition(ClipPtr c, ClipPtr s, const EffectMeta* em) :
|
Transition::Transition(ClipPtr c, ClipPtr s, const EffectMeta* em) :
|
||||||
Effect(c, em), secondary_clip(s),
|
Effect(c, em), secondary_clip(s),
|
||||||
length(30)
|
length(30)
|
||||||
{
|
{
|
||||||
length_field = add_row(tr("Length"), false)->add_field(EFFECT_FIELD_DOUBLE, "length");
|
length_field = add_row(tr("Length"), false)->add_field(EFFECT_FIELD_DOUBLE, "length");
|
||||||
connect(length_field, SIGNAL(changed()), this, SLOT(set_length_from_slider()));
|
connect(length_field, SIGNAL(changed()), this, SLOT(set_length_from_slider()));
|
||||||
length_field->set_double_default_value(30);
|
length_field->set_double_default_value(30);
|
||||||
length_field->set_double_minimum_value(0);
|
length_field->set_double_minimum_value(0);
|
||||||
|
|
||||||
LabelSlider* length_ui_ele = static_cast<LabelSlider*>(length_field->ui_element);
|
LabelSlider* length_ui_ele = static_cast<LabelSlider*>(length_field->ui_element);
|
||||||
length_ui_ele->set_display_type(LABELSLIDER_FRAMENUMBER);
|
length_ui_ele->set_display_type(LABELSLIDER_FRAMENUMBER);
|
||||||
length_ui_ele->set_frame_rate(parent_clip->sequence == nullptr ? parent_clip->cached_fr : parent_clip->sequence->frame_rate);
|
length_ui_ele->set_frame_rate(parent_clip->sequence == nullptr ? parent_clip->cached_fr : parent_clip->sequence->frame_rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Transition::copy(ClipPtr c, ClipPtr s) {
|
TransitionPtr Transition::copy(ClipPtr c, ClipPtr s) {
|
||||||
return create_transition(c, s, meta, length);
|
return create_transition(c, s, meta, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transition::set_length(long l) {
|
void Transition::set_length(long l) {
|
||||||
length = l;
|
length = l;
|
||||||
length_field->set_double_value(l);
|
length_field->set_double_value(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
long Transition::get_true_length() {
|
long Transition::get_true_length() {
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
long Transition::get_length() {
|
long Transition::get_length() {
|
||||||
if (secondary_clip != nullptr) {
|
if (secondary_clip != nullptr) {
|
||||||
return length * 2;
|
return length * 2;
|
||||||
}
|
}
|
||||||
return length;
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
ClipPtr Transition::get_opened_clip() {
|
||||||
|
if (parent_clip->opening_transition.get() == this) {
|
||||||
|
return parent_clip;
|
||||||
|
} else if (secondary_clip != nullptr && secondary_clip->opening_transition.get() == this) {
|
||||||
|
return secondary_clip;
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
ClipPtr Transition::get_closed_clip() {
|
||||||
|
if (parent_clip->closing_transition.get() == this) {
|
||||||
|
return parent_clip;
|
||||||
|
} else if (secondary_clip != nullptr && secondary_clip->closing_transition.get() == this) {
|
||||||
|
return secondary_clip;
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transition::set_length_from_slider() {
|
void Transition::set_length_from_slider() {
|
||||||
set_length(length_field->get_double_value(0));
|
set_length(length_field->get_double_value(0));
|
||||||
update_ui(false);
|
update_ui(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
TransitionPtr get_transition_from_meta(ClipPtr c, ClipPtr s, const EffectMeta* em) {
|
TransitionPtr get_transition_from_meta(ClipPtr c, ClipPtr s, const EffectMeta* em) {
|
||||||
if (!em->filename.isEmpty()) {
|
if (!em->filename.isEmpty()) {
|
||||||
// load effect from file
|
// load effect from file
|
||||||
return TransitionPtr(new Transition(c, s, em));
|
return TransitionPtr(new Transition(c, s, em));
|
||||||
} else if (em->internal >= 0 && em->internal < TRANSITION_INTERNAL_COUNT) {
|
} else if (em->internal >= 0 && em->internal < TRANSITION_INTERNAL_COUNT) {
|
||||||
// must be an internal effect
|
// must be an internal effect
|
||||||
switch (em->internal) {
|
switch (em->internal) {
|
||||||
case TRANSITION_INTERNAL_CROSSDISSOLVE: return TransitionPtr(new CrossDissolveTransition(c, s, em));
|
case TRANSITION_INTERNAL_CROSSDISSOLVE: return TransitionPtr(new CrossDissolveTransition(c, s, em));
|
||||||
case TRANSITION_INTERNAL_LINEARFADE: return TransitionPtr(new LinearFadeTransition(c, s, em));
|
case TRANSITION_INTERNAL_LINEARFADE: return TransitionPtr(new LinearFadeTransition(c, s, em));
|
||||||
case TRANSITION_INTERNAL_EXPONENTIALFADE: return TransitionPtr(new ExponentialFadeTransition(c, s, em));
|
case TRANSITION_INTERNAL_EXPONENTIALFADE: return TransitionPtr(new ExponentialFadeTransition(c, s, em));
|
||||||
case TRANSITION_INTERNAL_LOGARITHMICFADE: return TransitionPtr(new LogarithmicFadeTransition(c, s, em));
|
case TRANSITION_INTERNAL_LOGARITHMICFADE: return TransitionPtr(new LogarithmicFadeTransition(c, s, em));
|
||||||
case TRANSITION_INTERNAL_CUBE: return TransitionPtr(new CubeTransition(c, s, em));
|
case TRANSITION_INTERNAL_CUBE: return TransitionPtr(new CubeTransition(c, s, em));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qCritical() << "Invalid transition data";
|
qCritical() << "Invalid transition data";
|
||||||
QMessageBox::critical(olive::MainWindow,
|
QMessageBox::critical(olive::MainWindow,
|
||||||
QCoreApplication::translate("transition", "Invalid transition"),
|
QCoreApplication::translate("transition", "Invalid transition"),
|
||||||
QCoreApplication::translate("transition", "No candidate for transition '%1'. This transition may be corrupt. Try reinstalling it or Olive.").arg(em->name)
|
QCoreApplication::translate("transition", "No candidate for transition '%1'. This transition may be corrupt. Try reinstalling it or Olive.").arg(em->name)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int create_transition(ClipPtr c, ClipPtr s, const EffectMeta* em, long length) {
|
TransitionPtr create_transition(ClipPtr c, ClipPtr s, const EffectMeta* em, long length) {
|
||||||
TransitionPtr t(get_transition_from_meta(c, s, em));
|
TransitionPtr t(get_transition_from_meta(c, s, em));
|
||||||
if (t != nullptr) {
|
if (t != nullptr) {
|
||||||
if (length >= 0) t->set_length(length);
|
if (length > 0) {
|
||||||
QVector<TransitionPtr>& transition_list = (c->sequence == nullptr) ? clipboard_transitions : c->sequence->transitions;
|
t->set_length(length);
|
||||||
transition_list.append(t);
|
}
|
||||||
return transition_list.size() - 1;
|
return t;
|
||||||
}
|
}
|
||||||
return -1;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
+37
-27
@@ -23,35 +23,45 @@
|
|||||||
|
|
||||||
#include "effect.h"
|
#include "effect.h"
|
||||||
|
|
||||||
#define TA_NO_TRANSITION 0
|
enum TransitionType {
|
||||||
#define TA_OPENING_TRANSITION 1
|
kTransitionNone,
|
||||||
#define TA_CLOSING_TRANSITION 2
|
kTransitionOpening,
|
||||||
|
kTransitionClosing
|
||||||
#define TRANSITION_INTERNAL_CROSSDISSOLVE 0
|
|
||||||
#define TRANSITION_INTERNAL_LINEARFADE 1
|
|
||||||
#define TRANSITION_INTERNAL_EXPONENTIALFADE 2
|
|
||||||
#define TRANSITION_INTERNAL_LOGARITHMICFADE 3
|
|
||||||
#define TRANSITION_INTERNAL_CUBE 4
|
|
||||||
#define TRANSITION_INTERNAL_COUNT 5
|
|
||||||
|
|
||||||
int create_transition(ClipPtr c, ClipPtr s, const EffectMeta* em, long length = -1);
|
|
||||||
|
|
||||||
class Transition : public Effect {
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
Transition(ClipPtr c, ClipPtr s, const EffectMeta* em);
|
|
||||||
int copy(ClipPtr c, ClipPtr s);
|
|
||||||
ClipPtr secondary_clip;
|
|
||||||
void set_length(long l);
|
|
||||||
long get_true_length();
|
|
||||||
long get_length();
|
|
||||||
private slots:
|
|
||||||
void set_length_from_slider();
|
|
||||||
private:
|
|
||||||
long length; // used only for transitions
|
|
||||||
EffectField* length_field;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum TransitionInternal {
|
||||||
|
TRANSITION_INTERNAL_CROSSDISSOLVE,
|
||||||
|
TRANSITION_INTERNAL_LINEARFADE,
|
||||||
|
TRANSITION_INTERNAL_EXPONENTIALFADE,
|
||||||
|
TRANSITION_INTERNAL_LOGARITHMICFADE,
|
||||||
|
TRANSITION_INTERNAL_CUBE,
|
||||||
|
TRANSITION_INTERNAL_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
|
class Transition;
|
||||||
using TransitionPtr = std::shared_ptr<Transition>;
|
using TransitionPtr = std::shared_ptr<Transition>;
|
||||||
|
|
||||||
|
TransitionPtr get_transition_from_meta(ClipPtr c, ClipPtr s, const EffectMeta* em);
|
||||||
|
|
||||||
|
TransitionPtr create_transition(ClipPtr c, ClipPtr s, const EffectMeta* em, long length = 0);
|
||||||
|
|
||||||
|
class Transition : public Effect {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
Transition(ClipPtr c, ClipPtr s, const EffectMeta* em);
|
||||||
|
virtual TransitionPtr copy(ClipPtr c, ClipPtr s);
|
||||||
|
ClipPtr secondary_clip;
|
||||||
|
void set_length(long l);
|
||||||
|
long get_true_length();
|
||||||
|
long get_length();
|
||||||
|
|
||||||
|
ClipPtr get_opened_clip();
|
||||||
|
ClipPtr get_closed_clip();
|
||||||
|
private slots:
|
||||||
|
void set_length_from_slider();
|
||||||
|
private:
|
||||||
|
long length; // used only for transitions
|
||||||
|
EffectField* length_field;
|
||||||
|
};
|
||||||
|
|
||||||
#endif // TRANSITION_H
|
#endif // TRANSITION_H
|
||||||
|
|||||||
+616
-651
File diff suppressed because it is too large
Load Diff
+331
-335
@@ -36,594 +36,590 @@
|
|||||||
#include <QModelIndex>
|
#include <QModelIndex>
|
||||||
|
|
||||||
namespace olive {
|
namespace olive {
|
||||||
extern QUndoStack UndoStack;
|
extern QUndoStack UndoStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
class OliveAction : public QUndoCommand {
|
class OliveAction : public QUndoCommand {
|
||||||
public:
|
public:
|
||||||
OliveAction(bool iset_window_modified = true);
|
OliveAction(bool iset_window_modified = true);
|
||||||
virtual ~OliveAction() override;
|
virtual ~OliveAction() override;
|
||||||
|
|
||||||
virtual void undo() override;
|
virtual void undo() override;
|
||||||
virtual void redo() override;
|
virtual void redo() override;
|
||||||
|
|
||||||
virtual void doUndo() = 0;
|
virtual void doUndo() = 0;
|
||||||
virtual void doRedo() = 0;
|
virtual void doRedo() = 0;
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @brief Setting whether to change the windowModified state of MainWindow
|
* @brief Setting whether to change the windowModified state of MainWindow
|
||||||
*/
|
*/
|
||||||
bool set_window_modified;
|
bool set_window_modified;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Cache previous window modified value to return to if the user undoes this action
|
* @brief Cache previous window modified value to return to if the user undoes this action
|
||||||
*/
|
*/
|
||||||
bool old_window_modified;
|
bool old_window_modified;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MoveClipAction : public OliveAction {
|
class MoveClipAction : public OliveAction {
|
||||||
public:
|
public:
|
||||||
MoveClipAction(ClipPtr c, long iin, long iout, long iclip_in, int itrack, bool irelative);
|
MoveClipAction(ClipPtr c, long iin, long iout, long iclip_in, int itrack, bool irelative);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
ClipPtr clip;
|
ClipPtr clip;
|
||||||
|
|
||||||
long old_in;
|
long old_in;
|
||||||
long old_out;
|
long old_out;
|
||||||
long old_clip_in;
|
long old_clip_in;
|
||||||
int old_track;
|
int old_track;
|
||||||
|
|
||||||
long new_in;
|
long new_in;
|
||||||
long new_out;
|
long new_out;
|
||||||
long new_clip_in;
|
long new_clip_in;
|
||||||
int new_track;
|
int new_track;
|
||||||
|
|
||||||
bool relative;
|
bool relative;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RippleAction : public OliveAction {
|
class RippleAction : public OliveAction {
|
||||||
public:
|
public:
|
||||||
RippleAction(SequencePtr is, long ipoint, long ilength, const QVector<int>& iignore);
|
RippleAction(SequencePtr is, long ipoint, long ilength, const QVector<int>& iignore);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
SequencePtr s;
|
SequencePtr s;
|
||||||
long point;
|
long point;
|
||||||
long length;
|
long length;
|
||||||
QVector<int> ignore;
|
QVector<int> ignore;
|
||||||
ComboAction* ca;
|
ComboAction* ca;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DeleteClipAction : public OliveAction {
|
class DeleteClipAction : public OliveAction {
|
||||||
public:
|
public:
|
||||||
DeleteClipAction(SequencePtr s, int clip);
|
DeleteClipAction(SequencePtr s, int clip);
|
||||||
virtual ~DeleteClipAction() override;
|
virtual ~DeleteClipAction() override;
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
SequencePtr seq;
|
SequencePtr seq;
|
||||||
ClipPtr ref;
|
ClipPtr ref;
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
int opening_transition;
|
int opening_transition;
|
||||||
int closing_transition;
|
int closing_transition;
|
||||||
|
|
||||||
QVector<int> linkClipIndex;
|
QVector<int> linkClipIndex;
|
||||||
QVector<int> linkLinkIndex;
|
QVector<int> linkLinkIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ChangeSequenceAction : public OliveAction {
|
class ChangeSequenceAction : public OliveAction {
|
||||||
public:
|
public:
|
||||||
ChangeSequenceAction(SequencePtr s);
|
ChangeSequenceAction(SequencePtr s);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
SequencePtr old_sequence;
|
SequencePtr old_sequence;
|
||||||
SequencePtr new_sequence;
|
SequencePtr new_sequence;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AddEffectCommand : public OliveAction {
|
class AddEffectCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
AddEffectCommand(ClipPtr c, EffectPtr e, const EffectMeta* m, int insert_pos = -1);
|
AddEffectCommand(ClipPtr c, EffectPtr e, const EffectMeta* m, int insert_pos = -1);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
ClipPtr clip;
|
ClipPtr clip;
|
||||||
const EffectMeta* meta;
|
const EffectMeta* meta;
|
||||||
EffectPtr ref;
|
EffectPtr ref;
|
||||||
int pos;
|
int pos;
|
||||||
bool done;
|
bool done;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AddTransitionCommand : public OliveAction {
|
class AddTransitionCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
AddTransitionCommand(ClipPtr c, ClipPtr s, TransitionPtr copy, const EffectMeta* itransition, int itype, int ilength);
|
AddTransitionCommand(ClipPtr c, ClipPtr s, TransitionPtr copy, const EffectMeta* itransition, int itype, int ilength);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
ClipPtr clip;
|
ClipPtr primary;
|
||||||
ClipPtr secondary;
|
ClipPtr secondary;
|
||||||
TransitionPtr transition_to_copy;
|
TransitionPtr transition_to_copy;
|
||||||
const EffectMeta* transition;
|
const EffectMeta* transition_meta_;
|
||||||
int type;
|
int type;
|
||||||
int length;
|
int length;
|
||||||
int old_ptransition;
|
TransitionPtr old_ptransition;
|
||||||
int old_stransition;
|
TransitionPtr old_stransition;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ModifyTransitionCommand : public OliveAction {
|
class ModifyTransitionCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
ModifyTransitionCommand(ClipPtr c, int itype, long ilength);
|
ModifyTransitionCommand(TransitionPtr t, long ilength);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
ClipPtr clip;
|
TransitionPtr transition_ref_;
|
||||||
int type;
|
long new_length_;
|
||||||
long new_length;
|
long old_length_;
|
||||||
long old_length;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DeleteTransitionCommand : public OliveAction {
|
class DeleteTransitionCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
DeleteTransitionCommand(SequencePtr s, int transition_index);
|
DeleteTransitionCommand(TransitionPtr t);
|
||||||
virtual ~DeleteTransitionCommand() override;
|
virtual void doUndo() override;
|
||||||
virtual void doUndo() override;
|
virtual void doRedo() override;
|
||||||
virtual void doRedo() override;
|
|
||||||
private:
|
private:
|
||||||
SequencePtr seq;
|
TransitionPtr transition_ref_;
|
||||||
int index;
|
ClipPtr opened_clip_;
|
||||||
TransitionPtr transition;
|
ClipPtr closed_clip_;
|
||||||
ClipPtr otc;
|
|
||||||
ClipPtr ctc;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SetTimelineInOutCommand : public OliveAction {
|
class SetTimelineInOutCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
SetTimelineInOutCommand(SequencePtr s, bool enabled, long in, long out);
|
SetTimelineInOutCommand(SequencePtr s, bool enabled, long in, long out);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
SequencePtr seq;
|
SequencePtr seq;
|
||||||
|
|
||||||
bool old_enabled;
|
bool old_enabled;
|
||||||
long old_in;
|
long old_in;
|
||||||
long old_out;
|
long old_out;
|
||||||
|
|
||||||
bool new_enabled;
|
bool new_enabled;
|
||||||
long new_in;
|
long new_in;
|
||||||
long new_out;
|
long new_out;
|
||||||
};
|
};
|
||||||
|
|
||||||
class NewSequenceCommand : public OliveAction {
|
class NewSequenceCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
NewSequenceCommand(Media* s, Media* iparent);
|
NewSequenceCommand(Media* s, Media* iparent);
|
||||||
virtual ~NewSequenceCommand() override;
|
virtual ~NewSequenceCommand() override;
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
Media* seq;
|
Media* seq;
|
||||||
Media* parent;
|
Media* parent;
|
||||||
bool done;
|
bool done;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AddMediaCommand : public OliveAction {
|
class AddMediaCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
AddMediaCommand(Media* iitem, Media* iparent);
|
AddMediaCommand(Media* iitem, Media* iparent);
|
||||||
virtual ~AddMediaCommand() override;
|
virtual ~AddMediaCommand() override;
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
Media* item;
|
Media* item;
|
||||||
Media* parent;
|
Media* parent;
|
||||||
bool done;
|
bool done;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DeleteMediaCommand : public OliveAction {
|
class DeleteMediaCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
DeleteMediaCommand(Media *i);
|
DeleteMediaCommand(Media *i);
|
||||||
virtual ~DeleteMediaCommand() override;
|
virtual ~DeleteMediaCommand() override;
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
Media* item;
|
Media* item;
|
||||||
Media* parent;
|
Media* parent;
|
||||||
bool done;
|
bool done;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AddClipCommand : public OliveAction {
|
class AddClipCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
AddClipCommand(SequencePtr s, QVector<ClipPtr>& add);
|
AddClipCommand(SequencePtr s, QVector<ClipPtr>& add);
|
||||||
virtual ~AddClipCommand() override;
|
virtual ~AddClipCommand() override;
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
SequencePtr seq;
|
SequencePtr seq;
|
||||||
QVector<ClipPtr> clips;
|
QVector<ClipPtr> clips;
|
||||||
QVector<ClipPtr> undone_clips;
|
QVector<ClipPtr> undone_clips;
|
||||||
};
|
};
|
||||||
|
|
||||||
class LinkCommand : public OliveAction {
|
class LinkCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
LinkCommand();
|
LinkCommand();
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
SequencePtr s;
|
SequencePtr s;
|
||||||
QVector<int> clips;
|
QVector<int> clips;
|
||||||
bool link;
|
bool link;
|
||||||
private:
|
private:
|
||||||
QVector< QVector<int> > old_links;
|
QVector< QVector<int> > old_links;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CheckboxCommand : public OliveAction {
|
class CheckboxCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
CheckboxCommand(QCheckBox* b);
|
CheckboxCommand(QCheckBox* b);
|
||||||
virtual ~CheckboxCommand() override;
|
virtual ~CheckboxCommand() override;
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
QCheckBox* box;
|
QCheckBox* box;
|
||||||
bool checked;
|
bool checked;
|
||||||
bool done;
|
bool done;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ReplaceMediaCommand : public OliveAction {
|
class ReplaceMediaCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
ReplaceMediaCommand(Media*, QString);
|
ReplaceMediaCommand(Media*, QString);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
Media *item;
|
Media *item;
|
||||||
QString old_filename;
|
QString old_filename;
|
||||||
QString new_filename;
|
QString new_filename;
|
||||||
void replace(QString& filename);
|
void replace(QString& filename);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ReplaceClipMediaCommand : public OliveAction {
|
class ReplaceClipMediaCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
ReplaceClipMediaCommand(Media *, Media *, bool);
|
ReplaceClipMediaCommand(Media *, Media *, bool);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
QVector<ClipPtr> clips;
|
QVector<ClipPtr> clips;
|
||||||
private:
|
private:
|
||||||
Media* old_media;
|
Media* old_media;
|
||||||
Media* new_media;
|
Media* new_media;
|
||||||
bool preserve_clip_ins;
|
bool preserve_clip_ins;
|
||||||
QVector<int> old_clip_ins;
|
QVector<int> old_clip_ins;
|
||||||
void replace(bool undo);
|
void replace(bool undo);
|
||||||
};
|
};
|
||||||
|
|
||||||
class EffectDeleteCommand : public OliveAction {
|
class EffectDeleteCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
EffectDeleteCommand();
|
EffectDeleteCommand();
|
||||||
virtual ~EffectDeleteCommand() override;
|
virtual ~EffectDeleteCommand() override;
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
QVector<ClipPtr> clips;
|
QVector<ClipPtr> clips;
|
||||||
QVector<int> fx;
|
QVector<int> fx;
|
||||||
private:
|
private:
|
||||||
bool done;
|
bool done;
|
||||||
QVector<EffectPtr> deleted_objects;
|
QVector<EffectPtr> deleted_objects;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MediaMove : public OliveAction {
|
class MediaMove : public OliveAction {
|
||||||
public:
|
public:
|
||||||
MediaMove();
|
MediaMove();
|
||||||
QVector<Media*> items;
|
QVector<Media*> items;
|
||||||
Media* to;
|
Media* to;
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
QVector<Media*> froms;
|
QVector<Media*> froms;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MediaRename : public OliveAction {
|
class MediaRename : public OliveAction {
|
||||||
public:
|
public:
|
||||||
MediaRename(Media* iitem, QString to);
|
MediaRename(Media* iitem, QString to);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
Media* item;
|
Media* item;
|
||||||
QString from;
|
QString from;
|
||||||
QString to;
|
QString to;
|
||||||
};
|
};
|
||||||
|
|
||||||
class KeyframeDelete : public OliveAction {
|
class KeyframeDelete : public OliveAction {
|
||||||
public:
|
public:
|
||||||
KeyframeDelete(EffectField* ifield, int iindex);
|
KeyframeDelete(EffectField* ifield, int iindex);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
EffectField* field;
|
EffectField* field;
|
||||||
int index;
|
int index;
|
||||||
bool done;
|
bool done;
|
||||||
EffectKeyframe deleted_key;
|
EffectKeyframe deleted_key;
|
||||||
};
|
};
|
||||||
|
|
||||||
// a more modern version of the above, could probably replace it
|
// a more modern version of the above, could probably replace it
|
||||||
// assumes the keyframe already exists
|
// assumes the keyframe already exists
|
||||||
class KeyframeFieldSet : public OliveAction {
|
class KeyframeFieldSet : public OliveAction {
|
||||||
public:
|
public:
|
||||||
KeyframeFieldSet(EffectField* ifield, int ii);
|
KeyframeFieldSet(EffectField* ifield, int ii);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
EffectField* field;
|
EffectField* field;
|
||||||
int index;
|
int index;
|
||||||
EffectKeyframe key;
|
EffectKeyframe key;
|
||||||
bool done;
|
bool done;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EffectFieldUndo : public OliveAction {
|
class EffectFieldUndo : public OliveAction {
|
||||||
public:
|
public:
|
||||||
EffectFieldUndo(EffectField* field);
|
EffectFieldUndo(EffectField* field);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
EffectField* field;
|
EffectField* field;
|
||||||
QVariant old_val;
|
QVariant old_val;
|
||||||
QVariant new_val;
|
QVariant new_val;
|
||||||
bool done;
|
bool done;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SetAutoscaleAction : public OliveAction {
|
class SetAutoscaleAction : public OliveAction {
|
||||||
public:
|
public:
|
||||||
SetAutoscaleAction();
|
SetAutoscaleAction();
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
QVector<ClipPtr> clips;
|
QVector<ClipPtr> clips;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AddMarkerAction : public OliveAction {
|
class AddMarkerAction : public OliveAction {
|
||||||
public:
|
public:
|
||||||
AddMarkerAction(QVector<Marker>* m, long t, QString n);
|
AddMarkerAction(QVector<Marker>* m, long t, QString n);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
QVector<Marker>* active_array;
|
QVector<Marker>* active_array;
|
||||||
long time;
|
long time;
|
||||||
QString name;
|
QString name;
|
||||||
QString old_name;
|
QString old_name;
|
||||||
int index;
|
int index;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MoveMarkerAction : public OliveAction {
|
class MoveMarkerAction : public OliveAction {
|
||||||
public:
|
public:
|
||||||
MoveMarkerAction(Marker* m, long o, long n);
|
MoveMarkerAction(Marker* m, long o, long n);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
Marker* marker;
|
Marker* marker;
|
||||||
long old_time;
|
long old_time;
|
||||||
long new_time;
|
long new_time;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DeleteMarkerAction : public OliveAction {
|
class DeleteMarkerAction : public OliveAction {
|
||||||
public:
|
public:
|
||||||
DeleteMarkerAction(QVector<Marker>* m);
|
DeleteMarkerAction(QVector<Marker>* m);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
QVector<int> markers;
|
QVector<int> markers;
|
||||||
private:
|
private:
|
||||||
QVector<Marker>* active_array;
|
QVector<Marker>* active_array;
|
||||||
QVector<Marker> copies;
|
QVector<Marker> copies;
|
||||||
bool sorted;
|
bool sorted;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SetSpeedAction : public OliveAction {
|
class SetSpeedAction : public OliveAction {
|
||||||
public:
|
public:
|
||||||
SetSpeedAction(ClipPtr c, double speed);
|
SetSpeedAction(ClipPtr c, double speed);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
ClipPtr clip;
|
ClipPtr clip;
|
||||||
double old_speed;
|
double old_speed;
|
||||||
double new_speed;
|
double new_speed;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SetBool : public OliveAction {
|
class SetBool : public OliveAction {
|
||||||
public:
|
public:
|
||||||
SetBool(bool* b, bool setting);
|
SetBool(bool* b, bool setting);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
bool* boolean;
|
bool* boolean;
|
||||||
bool old_setting;
|
bool old_setting;
|
||||||
bool new_setting;
|
bool new_setting;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SetSelectionsCommand : public OliveAction {
|
class SetSelectionsCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
SetSelectionsCommand(SequencePtr s);
|
SetSelectionsCommand(SequencePtr s);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
QVector<Selection> old_data;
|
QVector<Selection> old_data;
|
||||||
QVector<Selection> new_data;
|
QVector<Selection> new_data;
|
||||||
private:
|
private:
|
||||||
SequencePtr seq;
|
SequencePtr seq;
|
||||||
bool done;
|
bool done;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EditSequenceCommand : public OliveAction {
|
class EditSequenceCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
EditSequenceCommand(Media *i, SequencePtr s);
|
EditSequenceCommand(Media *i, SequencePtr s);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
QString name;
|
QString name;
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
double frame_rate;
|
double frame_rate;
|
||||||
int audio_frequency;
|
int audio_frequency;
|
||||||
int audio_layout;
|
int audio_layout;
|
||||||
private:
|
private:
|
||||||
Media* item;
|
Media* item;
|
||||||
SequencePtr seq;
|
SequencePtr seq;
|
||||||
|
|
||||||
QString old_name;
|
QString old_name;
|
||||||
int old_width;
|
int old_width;
|
||||||
int old_height;
|
int old_height;
|
||||||
double old_frame_rate;
|
double old_frame_rate;
|
||||||
int old_audio_frequency;
|
int old_audio_frequency;
|
||||||
int old_audio_layout;
|
int old_audio_layout;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SetInt : public OliveAction {
|
class SetInt : public OliveAction {
|
||||||
public:
|
public:
|
||||||
SetInt(int* pointer, int new_value);
|
SetInt(int* pointer, int new_value);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
int* p;
|
int* p;
|
||||||
int oldval;
|
int oldval;
|
||||||
int newval;
|
int newval;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SetLong : public OliveAction {
|
class SetLong : public OliveAction {
|
||||||
public:
|
public:
|
||||||
SetLong(long* pointer, long old_value, long new_value);
|
SetLong(long* pointer, long old_value, long new_value);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
long* p;
|
long* p;
|
||||||
long oldval;
|
long oldval;
|
||||||
long newval;
|
long newval;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SetDouble : public OliveAction {
|
class SetDouble : public OliveAction {
|
||||||
public:
|
public:
|
||||||
SetDouble(double* pointer, double old_value, double new_value);
|
SetDouble(double* pointer, double old_value, double new_value);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
double* p;
|
double* p;
|
||||||
double oldval;
|
double oldval;
|
||||||
double newval;
|
double newval;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SetString : public OliveAction {
|
class SetString : public OliveAction {
|
||||||
public:
|
public:
|
||||||
SetString(QString* pointer, QString new_value);
|
SetString(QString* pointer, QString new_value);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
QString* p;
|
QString* p;
|
||||||
QString oldval;
|
QString oldval;
|
||||||
QString newval;
|
QString newval;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CloseAllClipsCommand : public OliveAction {
|
class CloseAllClipsCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class UpdateFootageTooltip : public OliveAction {
|
class UpdateFootageTooltip : public OliveAction {
|
||||||
public:
|
public:
|
||||||
UpdateFootageTooltip(Media* i);
|
UpdateFootageTooltip(Media* i);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
Media* item;
|
Media* item;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MoveEffectCommand : public OliveAction {
|
class MoveEffectCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
MoveEffectCommand();
|
MoveEffectCommand();
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
ClipPtr clip;
|
ClipPtr clip;
|
||||||
int from;
|
int from;
|
||||||
int to;
|
int to;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RemoveClipsFromClipboard : public OliveAction {
|
class RemoveClipsFromClipboard : public OliveAction {
|
||||||
public:
|
public:
|
||||||
RemoveClipsFromClipboard(int index);
|
RemoveClipsFromClipboard(int index);
|
||||||
virtual ~RemoveClipsFromClipboard() override;
|
virtual ~RemoveClipsFromClipboard() override;
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
int pos;
|
int pos;
|
||||||
ClipPtr clip;
|
ClipPtr clip;
|
||||||
bool done;
|
bool done;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RenameClipCommand : public OliveAction {
|
class RenameClipCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
RenameClipCommand();
|
RenameClipCommand();
|
||||||
QVector<ClipPtr> clips;
|
QVector<ClipPtr> clips;
|
||||||
QString new_name;
|
QString new_name;
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
QVector<QString> old_names;
|
QVector<QString> old_names;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SetPointer : public OliveAction {
|
class SetPointer : public OliveAction {
|
||||||
public:
|
public:
|
||||||
SetPointer(void** pointer, void* data);
|
SetPointer(void** pointer, void* data);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
bool old_changed;
|
bool old_changed;
|
||||||
void** p;
|
void** p;
|
||||||
void* new_data;
|
void* new_data;
|
||||||
void* old_data;
|
void* old_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ReloadEffectsCommand : public OliveAction {
|
class ReloadEffectsCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SetQVariant : public OliveAction {
|
class SetQVariant : public OliveAction {
|
||||||
public:
|
public:
|
||||||
SetQVariant(QVariant* itarget, const QVariant& iold, const QVariant& inew);
|
SetQVariant(QVariant* itarget, const QVariant& iold, const QVariant& inew);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
QVariant* target;
|
QVariant* target;
|
||||||
QVariant old_val;
|
QVariant old_val;
|
||||||
QVariant new_val;
|
QVariant new_val;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SetKeyframing : public OliveAction {
|
class SetKeyframing : public OliveAction {
|
||||||
public:
|
public:
|
||||||
SetKeyframing(EffectRow* irow, bool ib);
|
SetKeyframing(EffectRow* irow, bool ib);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
EffectRow* row;
|
EffectRow* row;
|
||||||
bool b;
|
bool b;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RefreshClips : public OliveAction {
|
class RefreshClips : public OliveAction {
|
||||||
public:
|
public:
|
||||||
RefreshClips(Media* m);
|
RefreshClips(Media* m);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
Media* media;
|
Media* media;
|
||||||
};
|
};
|
||||||
|
|
||||||
class UpdateViewer : public OliveAction {
|
class UpdateViewer : public OliveAction {
|
||||||
public:
|
public:
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SetEffectData : public OliveAction {
|
class SetEffectData : public OliveAction {
|
||||||
public:
|
public:
|
||||||
SetEffectData(EffectPtr e, const QByteArray &s);
|
SetEffectData(EffectPtr e, const QByteArray &s);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
EffectPtr effect;
|
EffectPtr effect;
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
QByteArray old_data;
|
QByteArray old_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // UNDO_H
|
#endif // UNDO_H
|
||||||
|
|||||||
@@ -401,7 +401,7 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
|||||||
// run through all of the clip's effects
|
// run through all of the clip's effects
|
||||||
for (int j=0;j<c->effects.size();j++) {
|
for (int j=0;j<c->effects.size();j++) {
|
||||||
EffectPtr e = c->effects.at(j);
|
EffectPtr e = c->effects.at(j);
|
||||||
process_effect(c, e, timecode, coords, textureID, fbo_switcher, params.texture_failed, TA_NO_TRANSITION);
|
process_effect(c, e, timecode, coords, textureID, fbo_switcher, params.texture_failed, kTransitionNone);
|
||||||
|
|
||||||
// retrieve gizmo data from effect
|
// retrieve gizmo data from effect
|
||||||
if (e->are_gizmos_enabled()) {
|
if (e->are_gizmos_enabled()) {
|
||||||
@@ -421,7 +421,7 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
|||||||
if (c->get_opening_transition() != nullptr) {
|
if (c->get_opening_transition() != nullptr) {
|
||||||
int transition_progress = playhead - c->get_timeline_in_with_transition();
|
int transition_progress = playhead - c->get_timeline_in_with_transition();
|
||||||
if (transition_progress < c->get_opening_transition()->get_length()) {
|
if (transition_progress < c->get_opening_transition()->get_length()) {
|
||||||
process_effect(c, c->get_opening_transition(), double(transition_progress)/double(c->get_opening_transition()->get_length()), coords, textureID, fbo_switcher, params.texture_failed, TA_OPENING_TRANSITION);
|
process_effect(c, c->get_opening_transition(), double(transition_progress)/double(c->get_opening_transition()->get_length()), coords, textureID, fbo_switcher, params.texture_failed, kTransitionOpening);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -429,7 +429,7 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
|||||||
if (c->get_closing_transition() != nullptr) {
|
if (c->get_closing_transition() != nullptr) {
|
||||||
int transition_progress = playhead - (c->get_timeline_out_with_transition() - c->get_closing_transition()->get_length());
|
int transition_progress = playhead - (c->get_timeline_out_with_transition() - c->get_closing_transition()->get_length());
|
||||||
if (transition_progress >= 0 && transition_progress < c->get_closing_transition()->get_length()) {
|
if (transition_progress >= 0 && transition_progress < c->get_closing_transition()->get_length()) {
|
||||||
process_effect(c, c->get_closing_transition(), double(transition_progress)/double(c->get_closing_transition()->get_length()), coords, textureID, fbo_switcher, params.texture_failed, TA_CLOSING_TRANSITION);
|
process_effect(c, c->get_closing_transition(), double(transition_progress)/double(c->get_closing_transition()->get_length()), coords, textureID, fbo_switcher, params.texture_failed, kTransitionClosing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+53
-53
@@ -656,7 +656,7 @@ void TimelineWidget::mousePressEvent(QMouseEvent *event) {
|
|||||||
panel_timeline->deselect_area(link->timeline_in, link->timeline_out, link->track);
|
panel_timeline->deselect_area(link->timeline_in, link->timeline_out, link->track);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (panel_timeline->tool == TIMELINE_TOOL_POINTER && panel_timeline->transition_select != TA_NO_TRANSITION) {
|
} else if (panel_timeline->tool == TIMELINE_TOOL_POINTER && panel_timeline->transition_select != kTransitionNone) {
|
||||||
panel_timeline->deselect_area(clip->timeline_in, clip->timeline_out, clip->track);
|
panel_timeline->deselect_area(clip->timeline_in, clip->timeline_out, clip->track);
|
||||||
|
|
||||||
for (int i=0;i<clip->linked.size();i++) {
|
for (int i=0;i<clip->linked.size();i++) {
|
||||||
@@ -667,11 +667,11 @@ void TimelineWidget::mousePressEvent(QMouseEvent *event) {
|
|||||||
Selection s;
|
Selection s;
|
||||||
s.track = clip->track;
|
s.track = clip->track;
|
||||||
|
|
||||||
if (panel_timeline->transition_select == TA_OPENING_TRANSITION && clip->get_opening_transition() != nullptr) {
|
if (panel_timeline->transition_select == kTransitionOpening && clip->get_opening_transition() != nullptr) {
|
||||||
s.in = clip->timeline_in;
|
s.in = clip->timeline_in;
|
||||||
if (clip->get_opening_transition()->secondary_clip != nullptr) s.in -= clip->get_opening_transition()->get_true_length();
|
if (clip->get_opening_transition()->secondary_clip != nullptr) s.in -= clip->get_opening_transition()->get_true_length();
|
||||||
s.out = clip->timeline_in + clip->get_opening_transition()->get_true_length();
|
s.out = clip->timeline_in + clip->get_opening_transition()->get_true_length();
|
||||||
} else if (panel_timeline->transition_select == TA_CLOSING_TRANSITION && clip->get_closing_transition() != nullptr) {
|
} else if (panel_timeline->transition_select == kTransitionClosing && clip->get_closing_transition() != nullptr) {
|
||||||
s.in = clip->timeline_out - clip->get_closing_transition()->get_true_length();
|
s.in = clip->timeline_out - clip->get_closing_transition()->get_true_length();
|
||||||
s.out = clip->timeline_out;
|
s.out = clip->timeline_out;
|
||||||
if (clip->get_closing_transition()->secondary_clip != nullptr) s.out += clip->get_closing_transition()->get_true_length();
|
if (clip->get_closing_transition()->secondary_clip != nullptr) s.out += clip->get_closing_transition()->get_true_length();
|
||||||
@@ -690,12 +690,12 @@ void TimelineWidget::mousePressEvent(QMouseEvent *event) {
|
|||||||
s.out = clip->timeline_out;
|
s.out = clip->timeline_out;
|
||||||
|
|
||||||
if (panel_timeline->tool == TIMELINE_TOOL_POINTER) {
|
if (panel_timeline->tool == TIMELINE_TOOL_POINTER) {
|
||||||
if (panel_timeline->transition_select == TA_OPENING_TRANSITION) {
|
if (panel_timeline->transition_select == kTransitionOpening) {
|
||||||
s.out = clip->timeline_in + clip->get_opening_transition()->get_true_length();
|
s.out = clip->timeline_in + clip->get_opening_transition()->get_true_length();
|
||||||
if (clip->get_opening_transition()->secondary_clip != nullptr) s.in -= clip->get_opening_transition()->get_true_length();
|
if (clip->get_opening_transition()->secondary_clip != nullptr) s.in -= clip->get_opening_transition()->get_true_length();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (panel_timeline->transition_select == TA_CLOSING_TRANSITION) {
|
if (panel_timeline->transition_select == kTransitionClosing) {
|
||||||
s.in = clip->timeline_out - clip->get_closing_transition()->get_true_length();
|
s.in = clip->timeline_out - clip->get_closing_transition()->get_true_length();
|
||||||
if (clip->get_closing_transition()->secondary_clip != nullptr) s.out += clip->get_closing_transition()->get_true_length();
|
if (clip->get_closing_transition()->secondary_clip != nullptr) s.out += clip->get_closing_transition()->get_true_length();
|
||||||
}
|
}
|
||||||
@@ -709,7 +709,7 @@ void TimelineWidget::mousePressEvent(QMouseEvent *event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if alt is not down, select links
|
// if alt is not down, select links
|
||||||
if (!alt && panel_timeline->transition_select == TA_NO_TRANSITION) {
|
if (!alt && panel_timeline->transition_select == kTransitionNone) {
|
||||||
for (int i=0;i<clip->linked.size();i++) {
|
for (int i=0;i<clip->linked.size();i++) {
|
||||||
ClipPtr link = olive::ActiveSequence->clips.at(clip->linked.at(i));
|
ClipPtr link = olive::ActiveSequence->clips.at(clip->linked.at(i));
|
||||||
if (!is_clip_selected(link, true)) {
|
if (!is_clip_selected(link, true)) {
|
||||||
@@ -767,26 +767,26 @@ void TimelineWidget::mousePressEvent(QMouseEvent *event) {
|
|||||||
|
|
||||||
void make_room_for_transition(ComboAction* ca, ClipPtr c, int type, long transition_start, long transition_end, bool delete_old_transitions) {
|
void make_room_for_transition(ComboAction* ca, ClipPtr c, int type, long transition_start, long transition_end, bool delete_old_transitions) {
|
||||||
// make room for transition
|
// make room for transition
|
||||||
if (type == TA_OPENING_TRANSITION) {
|
if (type == kTransitionOpening) {
|
||||||
if (delete_old_transitions && c->get_opening_transition() != nullptr) {
|
if (delete_old_transitions && c->get_opening_transition() != nullptr) {
|
||||||
ca->append(new DeleteTransitionCommand(c->sequence, c->opening_transition));
|
ca->append(new DeleteTransitionCommand(c->opening_transition));
|
||||||
}
|
}
|
||||||
if (c->get_closing_transition() != nullptr) {
|
if (c->get_closing_transition() != nullptr) {
|
||||||
if (transition_end >= c->timeline_out) {
|
if (transition_end >= c->timeline_out) {
|
||||||
ca->append(new DeleteTransitionCommand(c->sequence, c->closing_transition));
|
ca->append(new DeleteTransitionCommand(c->closing_transition));
|
||||||
} else if (transition_end > c->timeline_out - c->get_closing_transition()->get_true_length()) {
|
} else if (transition_end > c->timeline_out - c->get_closing_transition()->get_true_length()) {
|
||||||
ca->append(new ModifyTransitionCommand(c, TA_CLOSING_TRANSITION, c->timeline_out - transition_end));
|
ca->append(new ModifyTransitionCommand(c->closing_transition, c->timeline_out - transition_end));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (delete_old_transitions && c->get_closing_transition() != nullptr) {
|
if (delete_old_transitions && c->get_closing_transition() != nullptr) {
|
||||||
ca->append(new DeleteTransitionCommand(c->sequence, c->closing_transition));
|
ca->append(new DeleteTransitionCommand(c->closing_transition));
|
||||||
}
|
}
|
||||||
if (c->get_opening_transition() != nullptr) {
|
if (c->get_opening_transition() != nullptr) {
|
||||||
if (transition_start <= c->timeline_in) {
|
if (transition_start <= c->timeline_in) {
|
||||||
ca->append(new DeleteTransitionCommand(c->sequence, c->opening_transition));
|
ca->append(new DeleteTransitionCommand(c->opening_transition));
|
||||||
} else if (transition_start < c->timeline_in + c->get_opening_transition()->get_true_length()) {
|
} else if (transition_start < c->timeline_in + c->get_opening_transition()->get_true_length()) {
|
||||||
ca->append(new ModifyTransitionCommand(c, TA_OPENING_TRANSITION, transition_start - c->timeline_in));
|
ca->append(new ModifyTransitionCommand(c->opening_transition, transition_start - c->timeline_in));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1022,9 +1022,9 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
|||||||
max_open_length -= c->get_closing_transition()->get_true_length();
|
max_open_length -= c->get_closing_transition()->get_true_length();
|
||||||
}
|
}
|
||||||
if (max_open_length <= 0) {
|
if (max_open_length <= 0) {
|
||||||
ca->append(new DeleteTransitionCommand(c->sequence, c->opening_transition));
|
ca->append(new DeleteTransitionCommand(c->opening_transition));
|
||||||
} else if (c->get_opening_transition()->get_true_length() > max_open_length) {
|
} else if (c->get_opening_transition()->get_true_length() > max_open_length) {
|
||||||
ca->append(new ModifyTransitionCommand(c, TA_OPENING_TRANSITION, max_open_length));
|
ca->append(new ModifyTransitionCommand(c->opening_transition, max_open_length));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (c->get_closing_transition() != nullptr) {
|
if (c->get_closing_transition() != nullptr) {
|
||||||
@@ -1033,16 +1033,16 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
|||||||
max_open_length -= c->get_opening_transition()->get_true_length();
|
max_open_length -= c->get_opening_transition()->get_true_length();
|
||||||
}
|
}
|
||||||
if (max_open_length <= 0) {
|
if (max_open_length <= 0) {
|
||||||
ca->append(new DeleteTransitionCommand(c->sequence, c->closing_transition));
|
ca->append(new DeleteTransitionCommand(c->closing_transition));
|
||||||
} else if (c->get_closing_transition()->get_true_length() > max_open_length) {
|
} else if (c->get_closing_transition()->get_true_length() > max_open_length) {
|
||||||
ca->append(new ModifyTransitionCommand(c, TA_CLOSING_TRANSITION, max_open_length));
|
ca->append(new ModifyTransitionCommand(c->closing_transition, max_open_length));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
bool is_opening_transition = (g.transition == c->get_opening_transition());
|
bool is_opening_transition = (g.transition == c->get_opening_transition());
|
||||||
long new_transition_length = g.out - g.in;
|
long new_transition_length = g.out - g.in;
|
||||||
if (g.transition->secondary_clip != nullptr) new_transition_length >>= 1;
|
if (g.transition->secondary_clip != nullptr) new_transition_length >>= 1;
|
||||||
ca->append(new ModifyTransitionCommand(c, is_opening_transition ? TA_OPENING_TRANSITION : TA_CLOSING_TRANSITION, new_transition_length));
|
ca->append(new ModifyTransitionCommand(is_opening_transition ? c->opening_transition : c->closing_transition, new_transition_length));
|
||||||
|
|
||||||
long clip_length = c->getLength();
|
long clip_length = c->getLength();
|
||||||
|
|
||||||
@@ -1059,7 +1059,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
|||||||
clip_length -= (g.in - g.old_in);
|
clip_length -= (g.in - g.old_in);
|
||||||
}
|
}
|
||||||
|
|
||||||
make_room_for_transition(ca, c, TA_OPENING_TRANSITION, g.in, g.out, false);
|
make_room_for_transition(ca, c, kTransitionOpening, g.in, g.out, false);
|
||||||
} else {
|
} else {
|
||||||
if (g.out != g.old_out) {
|
if (g.out != g.old_out) {
|
||||||
// if transition is going to make the clip bigger, make the clip bigger
|
// if transition is going to make the clip bigger, make the clip bigger
|
||||||
@@ -1067,7 +1067,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
|||||||
clip_length += (g.out - g.old_out);
|
clip_length += (g.out - g.old_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
make_room_for_transition(ca, c, TA_CLOSING_TRANSITION, g.in, g.out, false);
|
make_room_for_transition(ca, c, kTransitionClosing, g.in, g.out, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1089,7 +1089,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
|||||||
|
|
||||||
if (panel_timeline->transition_tool_post_clip > -1) {
|
if (panel_timeline->transition_tool_post_clip > -1) {
|
||||||
post = olive::ActiveSequence->clips.at(panel_timeline->transition_tool_post_clip);
|
post = olive::ActiveSequence->clips.at(panel_timeline->transition_tool_post_clip);
|
||||||
int opposite_type = (panel_timeline->transition_tool_type == TA_OPENING_TRANSITION) ? TA_CLOSING_TRANSITION : TA_OPENING_TRANSITION;
|
int opposite_type = (panel_timeline->transition_tool_type == kTransitionOpening) ? kTransitionClosing : kTransitionOpening;
|
||||||
make_room_for_transition(
|
make_room_for_transition(
|
||||||
ca,
|
ca,
|
||||||
post,
|
post,
|
||||||
@@ -1099,7 +1099,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
|||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
if (panel_timeline->transition_tool_type == TA_CLOSING_TRANSITION) {
|
if (panel_timeline->transition_tool_type == kTransitionClosing) {
|
||||||
// swap
|
// swap
|
||||||
ClipPtr temp = pre;
|
ClipPtr temp = pre;
|
||||||
pre = post;
|
pre = post;
|
||||||
@@ -1136,7 +1136,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (panel_timeline->transition_tool_post_clip > -1) {
|
if (panel_timeline->transition_tool_post_clip > -1) {
|
||||||
ca->append(new AddTransitionCommand(pre, post, nullptr, panel_timeline->transition_tool_meta, TA_OPENING_TRANSITION, transition_end - pre->timeline_in));
|
ca->append(new AddTransitionCommand(pre, post, nullptr, panel_timeline->transition_tool_meta, kTransitionOpening, transition_end - pre->timeline_in));
|
||||||
} else {
|
} else {
|
||||||
ca->append(new AddTransitionCommand(pre, nullptr, nullptr, panel_timeline->transition_tool_meta, panel_timeline->transition_tool_type, transition_end - transition_start));
|
ca->append(new AddTransitionCommand(pre, nullptr, nullptr, panel_timeline->transition_tool_meta, panel_timeline->transition_tool_type, transition_end - transition_start));
|
||||||
}
|
}
|
||||||
@@ -1241,7 +1241,7 @@ void TimelineWidget::init_ghosts() {
|
|||||||
void validate_transitions(ClipPtr c, int transition_type, long& frame_diff) {
|
void validate_transitions(ClipPtr c, int transition_type, long& frame_diff) {
|
||||||
long validator;
|
long validator;
|
||||||
|
|
||||||
if (transition_type == TA_OPENING_TRANSITION) {
|
if (transition_type == kTransitionOpening) {
|
||||||
// prevent from going below 0 on the timeline
|
// prevent from going below 0 on the timeline
|
||||||
validator = c->timeline_in + frame_diff;
|
validator = c->timeline_in + frame_diff;
|
||||||
if (validator < 0) frame_diff -= validator;
|
if (validator < 0) frame_diff -= validator;
|
||||||
@@ -1274,7 +1274,7 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) {
|
|||||||
|
|
||||||
int mouse_track = getTrackFromScreenPoint(mouse_pos.y());
|
int mouse_track = getTrackFromScreenPoint(mouse_pos.y());
|
||||||
long frame_diff = (lock_frame) ? 0 : panel_timeline->getTimelineFrameFromScreenPoint(mouse_pos.x()) - panel_timeline->drag_frame_start;
|
long frame_diff = (lock_frame) ? 0 : panel_timeline->getTimelineFrameFromScreenPoint(mouse_pos.x()) - panel_timeline->drag_frame_start;
|
||||||
int track_diff = ((effective_tool == TIMELINE_TOOL_SLIDE || panel_timeline->transition_select != TA_NO_TRANSITION) && !panel_timeline->importing) ? 0 : mouse_track - panel_timeline->drag_track_start;
|
int track_diff = ((effective_tool == TIMELINE_TOOL_SLIDE || panel_timeline->transition_select != kTransitionNone) && !panel_timeline->importing) ? 0 : mouse_track - panel_timeline->drag_track_start;
|
||||||
long validator;
|
long validator;
|
||||||
long earliest_in_point = LONG_MAX;
|
long earliest_in_point = LONG_MAX;
|
||||||
|
|
||||||
@@ -1389,12 +1389,12 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) {
|
|||||||
frame_diff += g.transition->get_true_length();
|
frame_diff += g.transition->get_true_length();
|
||||||
}
|
}
|
||||||
|
|
||||||
validate_transitions(otc, TA_OPENING_TRANSITION, frame_diff);
|
validate_transitions(otc, kTransitionOpening, frame_diff);
|
||||||
validate_transitions(ctc, TA_CLOSING_TRANSITION, frame_diff);
|
validate_transitions(ctc, kTransitionClosing, frame_diff);
|
||||||
|
|
||||||
frame_diff = -frame_diff;
|
frame_diff = -frame_diff;
|
||||||
validate_transitions(otc, TA_OPENING_TRANSITION, frame_diff);
|
validate_transitions(otc, kTransitionOpening, frame_diff);
|
||||||
validate_transitions(ctc, TA_CLOSING_TRANSITION, frame_diff);
|
validate_transitions(ctc, kTransitionClosing, frame_diff);
|
||||||
frame_diff = -frame_diff;
|
frame_diff = -frame_diff;
|
||||||
|
|
||||||
if (g.trim_in) {
|
if (g.trim_in) {
|
||||||
@@ -1484,7 +1484,7 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) {
|
|||||||
ClipPtr otc = c; // open transition clip
|
ClipPtr otc = c; // open transition clip
|
||||||
ClipPtr ctc = olive::ActiveSequence->clips.at(panel_timeline->transition_tool_post_clip); // close transition clip
|
ClipPtr ctc = olive::ActiveSequence->clips.at(panel_timeline->transition_tool_post_clip); // close transition clip
|
||||||
|
|
||||||
if (panel_timeline->transition_tool_type == TA_CLOSING_TRANSITION) {
|
if (panel_timeline->transition_tool_type == kTransitionClosing) {
|
||||||
// swap
|
// swap
|
||||||
ClipPtr temp = otc;
|
ClipPtr temp = otc;
|
||||||
otc = ctc;
|
otc = ctc;
|
||||||
@@ -1492,13 +1492,13 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// always gets a positive frame_diff
|
// always gets a positive frame_diff
|
||||||
validate_transitions(otc, TA_OPENING_TRANSITION, frame_diff);
|
validate_transitions(otc, kTransitionOpening, frame_diff);
|
||||||
validate_transitions(ctc, TA_CLOSING_TRANSITION, frame_diff);
|
validate_transitions(ctc, kTransitionClosing, frame_diff);
|
||||||
|
|
||||||
// always gets a negative frame_diff
|
// always gets a negative frame_diff
|
||||||
frame_diff = -frame_diff;
|
frame_diff = -frame_diff;
|
||||||
validate_transitions(otc, TA_OPENING_TRANSITION, frame_diff);
|
validate_transitions(otc, kTransitionOpening, frame_diff);
|
||||||
validate_transitions(ctc, TA_CLOSING_TRANSITION, frame_diff);
|
validate_transitions(ctc, kTransitionClosing, frame_diff);
|
||||||
frame_diff = -frame_diff;
|
frame_diff = -frame_diff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1566,7 +1566,7 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) {
|
|||||||
if (panel_timeline->transition_tool_post_clip > -1) {
|
if (panel_timeline->transition_tool_post_clip > -1) {
|
||||||
g.in = g.old_in - frame_diff;
|
g.in = g.old_in - frame_diff;
|
||||||
g.out = g.old_out + frame_diff;
|
g.out = g.old_out + frame_diff;
|
||||||
} else if (panel_timeline->transition_tool_type == TA_OPENING_TRANSITION) {
|
} else if (panel_timeline->transition_tool_type == kTransitionOpening) {
|
||||||
g.out = g.old_out + frame_diff;
|
g.out = g.old_out + frame_diff;
|
||||||
} else {
|
} else {
|
||||||
g.in = g.old_in + frame_diff;
|
g.in = g.old_in + frame_diff;
|
||||||
@@ -1750,11 +1750,11 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
|||||||
for (int j=0;j<olive::ActiveSequence->selections.size();j++) {
|
for (int j=0;j<olive::ActiveSequence->selections.size();j++) {
|
||||||
const Selection& s = olive::ActiveSequence->selections.at(j);
|
const Selection& s = olive::ActiveSequence->selections.at(j);
|
||||||
if (s.track == c->track) {
|
if (s.track == c->track) {
|
||||||
if (selection_contains_transition(s, c, TA_OPENING_TRANSITION)) {
|
if (selection_contains_transition(s, c, kTransitionOpening)) {
|
||||||
g.transition = c->get_opening_transition();
|
g.transition = c->get_opening_transition();
|
||||||
add = true;
|
add = true;
|
||||||
break;
|
break;
|
||||||
} else if (selection_contains_transition(s, c, TA_CLOSING_TRANSITION)) {
|
} else if (selection_contains_transition(s, c, kTransitionClosing)) {
|
||||||
g.transition = c->get_closing_transition();
|
g.transition = c->get_closing_transition();
|
||||||
add = true;
|
add = true;
|
||||||
break;
|
break;
|
||||||
@@ -2049,7 +2049,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
|||||||
int max_track = INT_MIN;
|
int max_track = INT_MIN;
|
||||||
|
|
||||||
// we default to selecting no transition, but set this accordingly if the cursor is on a transition
|
// we default to selecting no transition, but set this accordingly if the cursor is on a transition
|
||||||
panel_timeline->transition_select = TA_NO_TRANSITION;
|
panel_timeline->transition_select = kTransitionNone;
|
||||||
|
|
||||||
// set currently trimming clip to -1 (aka null)
|
// set currently trimming clip to -1 (aka null)
|
||||||
panel_timeline->trim_target = -1;
|
panel_timeline->trim_target = -1;
|
||||||
@@ -2081,12 +2081,12 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
|||||||
if (c->get_opening_transition() != nullptr
|
if (c->get_opening_transition() != nullptr
|
||||||
&& panel_timeline->cursor_frame <= c->timeline_in + c->get_opening_transition()->get_true_length()) {
|
&& panel_timeline->cursor_frame <= c->timeline_in + c->get_opening_transition()->get_true_length()) {
|
||||||
|
|
||||||
panel_timeline->transition_select = TA_OPENING_TRANSITION;
|
panel_timeline->transition_select = kTransitionOpening;
|
||||||
|
|
||||||
} else if (c->get_closing_transition() != nullptr
|
} else if (c->get_closing_transition() != nullptr
|
||||||
&& panel_timeline->cursor_frame >= c->timeline_out - c->get_closing_transition()->get_true_length()) {
|
&& panel_timeline->cursor_frame >= c->timeline_out - c->get_closing_transition()->get_true_length()) {
|
||||||
|
|
||||||
panel_timeline->transition_select = TA_CLOSING_TRANSITION;
|
panel_timeline->transition_select = kTransitionClosing;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2145,7 +2145,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
|||||||
if (nc < closeness) {
|
if (nc < closeness) {
|
||||||
panel_timeline->trim_target = i;
|
panel_timeline->trim_target = i;
|
||||||
panel_timeline->trim_in_point = false;
|
panel_timeline->trim_in_point = false;
|
||||||
panel_timeline->transition_select = TA_OPENING_TRANSITION;
|
panel_timeline->transition_select = kTransitionOpening;
|
||||||
closeness = nc;
|
closeness = nc;
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
@@ -2166,7 +2166,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
|||||||
if (nc < closeness) {
|
if (nc < closeness) {
|
||||||
panel_timeline->trim_target = i;
|
panel_timeline->trim_target = i;
|
||||||
panel_timeline->trim_in_point = true;
|
panel_timeline->trim_in_point = true;
|
||||||
panel_timeline->transition_select = TA_CLOSING_TRANSITION;
|
panel_timeline->transition_select = kTransitionClosing;
|
||||||
closeness = nc;
|
closeness = nc;
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
@@ -2234,7 +2234,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
|||||||
|
|
||||||
Ghost g;
|
Ghost g;
|
||||||
|
|
||||||
g.in = g.old_in = g.out = g.old_out = (panel_timeline->transition_tool_type == TA_OPENING_TRANSITION) ? c->timeline_in : c->timeline_out;
|
g.in = g.old_in = g.out = g.old_out = (panel_timeline->transition_tool_type == kTransitionOpening) ? c->timeline_in : c->timeline_out;
|
||||||
g.track = c->track;
|
g.track = c->track;
|
||||||
g.clip = panel_timeline->transition_tool_pre_clip;
|
g.clip = panel_timeline->transition_tool_pre_clip;
|
||||||
g.media_stream = panel_timeline->transition_tool_type;
|
g.media_stream = panel_timeline->transition_tool_type;
|
||||||
@@ -2254,9 +2254,9 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
|||||||
long between_range = getFrameFromScreenPoint(panel_timeline->zoom, TRANSITION_BETWEEN_RANGE) + 1;
|
long between_range = getFrameFromScreenPoint(panel_timeline->zoom, TRANSITION_BETWEEN_RANGE) + 1;
|
||||||
|
|
||||||
if (panel_timeline->cursor_frame > halfway) {
|
if (panel_timeline->cursor_frame > halfway) {
|
||||||
panel_timeline->transition_tool_type = TA_CLOSING_TRANSITION;
|
panel_timeline->transition_tool_type = kTransitionClosing;
|
||||||
} else {
|
} else {
|
||||||
panel_timeline->transition_tool_type = TA_OPENING_TRANSITION;
|
panel_timeline->transition_tool_type = kTransitionOpening;
|
||||||
}
|
}
|
||||||
|
|
||||||
panel_timeline->transition_tool_post_clip = -1;
|
panel_timeline->transition_tool_post_clip = -1;
|
||||||
@@ -2334,14 +2334,14 @@ void draw_waveform(ClipPtr clip, const FootageStream* ms, long media_length, QPa
|
|||||||
}
|
}
|
||||||
|
|
||||||
void draw_transition(QPainter& p, ClipPtr c, const QRect& clip_rect, QRect& text_rect, int transition_type) {
|
void draw_transition(QPainter& p, ClipPtr c, const QRect& clip_rect, QRect& text_rect, int transition_type) {
|
||||||
TransitionPtr t = (transition_type == TA_OPENING_TRANSITION) ? c->get_opening_transition() : c->get_closing_transition();
|
TransitionPtr t = (transition_type == kTransitionOpening) ? c->get_opening_transition() : c->get_closing_transition();
|
||||||
if (t != nullptr) {
|
if (t != nullptr) {
|
||||||
QColor transition_color(255, 0, 0, 16);
|
QColor transition_color(255, 0, 0, 16);
|
||||||
int transition_width = getScreenPointFromFrame(panel_timeline->zoom, t->get_true_length());
|
int transition_width = getScreenPointFromFrame(panel_timeline->zoom, t->get_true_length());
|
||||||
int transition_height = clip_rect.height();
|
int transition_height = clip_rect.height();
|
||||||
int tr_y = clip_rect.y();
|
int tr_y = clip_rect.y();
|
||||||
int tr_x = 0;
|
int tr_x = 0;
|
||||||
if (transition_type == TA_OPENING_TRANSITION) {
|
if (transition_type == kTransitionOpening) {
|
||||||
tr_x = clip_rect.x();
|
tr_x = clip_rect.x();
|
||||||
text_rect.setX(text_rect.x()+transition_width);
|
text_rect.setX(text_rect.x()+transition_width);
|
||||||
} else {
|
} else {
|
||||||
@@ -2356,13 +2356,13 @@ void draw_transition(QPainter& p, ClipPtr c, const QRect& clip_rect, QRect& text
|
|||||||
|
|
||||||
p.setPen(QColor(0, 0, 0, 96));
|
p.setPen(QColor(0, 0, 0, 96));
|
||||||
if (t->secondary_clip == nullptr) {
|
if (t->secondary_clip == nullptr) {
|
||||||
if (transition_type == TA_OPENING_TRANSITION) {
|
if (transition_type == kTransitionOpening) {
|
||||||
p.drawLine(transition_rect.bottomLeft(), transition_rect.topRight());
|
p.drawLine(transition_rect.bottomLeft(), transition_rect.topRight());
|
||||||
} else {
|
} else {
|
||||||
p.drawLine(transition_rect.topLeft(), transition_rect.bottomRight());
|
p.drawLine(transition_rect.topLeft(), transition_rect.bottomRight());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (transition_type == TA_OPENING_TRANSITION) {
|
if (transition_type == kTransitionOpening) {
|
||||||
p.drawLine(QPoint(transition_rect.left(), transition_rect.center().y()), transition_rect.topRight());
|
p.drawLine(QPoint(transition_rect.left(), transition_rect.center().y()), transition_rect.topRight());
|
||||||
p.drawLine(QPoint(transition_rect.left(), transition_rect.center().y()), transition_rect.bottomRight());
|
p.drawLine(QPoint(transition_rect.left(), transition_rect.center().y()), transition_rect.bottomRight());
|
||||||
draw_text = false;
|
draw_text = false;
|
||||||
@@ -2577,8 +2577,8 @@ void TimelineWidget::paintEvent(QPaintEvent*) {
|
|||||||
p.setBrush(Qt::NoBrush);
|
p.setBrush(Qt::NoBrush);
|
||||||
|
|
||||||
// draw clip transitions
|
// draw clip transitions
|
||||||
draw_transition(p, clip, clip_rect, text_rect, TA_OPENING_TRANSITION);
|
draw_transition(p, clip, clip_rect, text_rect, kTransitionOpening);
|
||||||
draw_transition(p, clip, clip_rect, text_rect, TA_CLOSING_TRANSITION);
|
draw_transition(p, clip, clip_rect, text_rect, kTransitionClosing);
|
||||||
|
|
||||||
// top left bevel
|
// top left bevel
|
||||||
p.setPen(Qt::white);
|
p.setPen(Qt::white);
|
||||||
@@ -2617,10 +2617,10 @@ void TimelineWidget::paintEvent(QPaintEvent*) {
|
|||||||
int type = panel_timeline->transition_tool_type;
|
int type = panel_timeline->transition_tool_type;
|
||||||
if (panel_timeline->transition_tool_post_clip == i) {
|
if (panel_timeline->transition_tool_post_clip == i) {
|
||||||
// invert transition type
|
// invert transition type
|
||||||
type = (type == TA_CLOSING_TRANSITION) ? TA_OPENING_TRANSITION : TA_CLOSING_TRANSITION;
|
type = (type == kTransitionClosing) ? kTransitionOpening : kTransitionClosing;
|
||||||
}
|
}
|
||||||
QRect transition_tool_rect = clip_rect;
|
QRect transition_tool_rect = clip_rect;
|
||||||
if (type == TA_CLOSING_TRANSITION) {
|
if (type == kTransitionClosing) {
|
||||||
if (panel_timeline->transition_tool_post_clip > -1) {
|
if (panel_timeline->transition_tool_post_clip > -1) {
|
||||||
transition_tool_rect.setLeft(transition_tool_rect.right() - TRANSITION_BETWEEN_RANGE);
|
transition_tool_rect.setLeft(transition_tool_rect.right() - TRANSITION_BETWEEN_RANGE);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user