diff --git a/decoders/decoder.cpp b/decoders/decoder.cpp
new file mode 100644
index 000000000..8de99a7b3
--- /dev/null
+++ b/decoders/decoder.cpp
@@ -0,0 +1,6 @@
+#include "decoder.h"
+
+Decoder::Decoder()
+{
+
+}
diff --git a/decoders/decoder.h b/decoders/decoder.h
new file mode 100644
index 000000000..8c2bd04d0
--- /dev/null
+++ b/decoders/decoder.h
@@ -0,0 +1,11 @@
+#ifndef DECODER_H
+#define DECODER_H
+
+
+class Decoder
+{
+public:
+ Decoder();
+};
+
+#endif // DECODER_H
\ No newline at end of file
diff --git a/decoders/ffmpegdecoder.cpp b/decoders/ffmpegdecoder.cpp
new file mode 100644
index 000000000..26cf3c579
--- /dev/null
+++ b/decoders/ffmpegdecoder.cpp
@@ -0,0 +1,6 @@
+#include "ffmpegdecoder.h"
+
+FFmpegDecoder::FFmpegDecoder()
+{
+
+}
diff --git a/decoders/ffmpegdecoder.h b/decoders/ffmpegdecoder.h
new file mode 100644
index 000000000..52f614f40
--- /dev/null
+++ b/decoders/ffmpegdecoder.h
@@ -0,0 +1,11 @@
+#ifndef FFMPEGDECODER_H
+#define FFMPEGDECODER_H
+
+
+class FFmpegDecoder
+{
+public:
+ FFmpegDecoder();
+};
+
+#endif // FFMPEGDECODER_H
\ No newline at end of file
diff --git a/dialogs/aboutdialog.cpp b/dialogs/aboutdialog.cpp
index 30eeea00a..c116bfe83 100644
--- a/dialogs/aboutdialog.cpp
+++ b/dialogs/aboutdialog.cpp
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
diff --git a/dialogs/aboutdialog.h b/dialogs/aboutdialog.h
index 08ec184e1..d50a1b751 100644
--- a/dialogs/aboutdialog.h
+++ b/dialogs/aboutdialog.h
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
diff --git a/dialogs/actionsearch.cpp b/dialogs/actionsearch.cpp
index c64968322..6803aea81 100644
--- a/dialogs/actionsearch.cpp
+++ b/dialogs/actionsearch.cpp
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
diff --git a/dialogs/actionsearch.h b/dialogs/actionsearch.h
index 54688a71e..af82320ad 100644
--- a/dialogs/actionsearch.h
+++ b/dialogs/actionsearch.h
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
diff --git a/dialogs/advancedvideodialog.cpp b/dialogs/advancedvideodialog.cpp
index c4e910d9d..91a0428e2 100644
--- a/dialogs/advancedvideodialog.cpp
+++ b/dialogs/advancedvideodialog.cpp
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
diff --git a/dialogs/advancedvideodialog.h b/dialogs/advancedvideodialog.h
index 70cd92142..5ea80ea91 100644
--- a/dialogs/advancedvideodialog.h
+++ b/dialogs/advancedvideodialog.h
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
diff --git a/dialogs/autocutsilencedialog.cpp b/dialogs/autocutsilencedialog.cpp
index 9280dbe66..e5176bcb2 100644
--- a/dialogs/autocutsilencedialog.cpp
+++ b/dialogs/autocutsilencedialog.cpp
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
@@ -31,7 +31,7 @@
#include "panels/panels.h"
#include "panels/timeline.h"
-AutoCutSilenceDialog::AutoCutSilenceDialog(QWidget *parent, QVector clips) :
+AutoCutSilenceDialog::AutoCutSilenceDialog(QWidget *parent, QVector clips) :
QDialog(parent),
clips_(clips)
{
@@ -124,16 +124,16 @@ void AutoCutSilenceDialog::cut_silence() {
// Loop over clips provided to this dialog
for (int j=0;jclips.at(clips_.at(j)).get();
+ Clip* clip = clips_.at(j);
// Check if this clip is an audio footage clip
- if (clip->track() >= 0
+ if (clip->type() == olive::kTypeAudio
&& clip->media() != nullptr
&& clip->media_stream()->preview_done) { // TODO provide warning for preview not being done
QVector split_positions;
- int clip_start = clip->timeline_in();
+ long clip_start = clip->timeline_in();
const FootageStream* ms = clip->media_stream();
long media_length = clip->media_length();
@@ -156,7 +156,7 @@ void AutoCutSilenceDialog::cut_silence() {
// read the current sample into the circular array
qint8 tmp = 0;
- for (int k=start; kaudio_preview.at(k)))));
}
vols[circular_index] = tmp;
@@ -202,13 +202,13 @@ void AutoCutSilenceDialog::cut_silence() {
}
}
- panel_timeline->split_clip_at_positions(ca, clips_.at(j), split_positions);
+ clip->track()->sequence()->SplitClipAtPositions(ca, clips_.at(j), split_positions);
}
}
if (ca->hasActions()) {
- olive::UndoStack.push(ca);
+ olive::undo_stack.push(ca);
} else {
delete ca;
}
diff --git a/dialogs/autocutsilencedialog.h b/dialogs/autocutsilencedialog.h
index 6f156679c..37fe57a61 100644
--- a/dialogs/autocutsilencedialog.h
+++ b/dialogs/autocutsilencedialog.h
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
@@ -31,7 +31,7 @@ class AutoCutSilenceDialog : public QDialog
{
Q_OBJECT
public:
- AutoCutSilenceDialog(QWidget* parent, QVector clips);
+ AutoCutSilenceDialog(QWidget* parent, QVector clips);
public slots:
virtual int exec() override;
private slots:
@@ -39,7 +39,7 @@ private slots:
private:
void cut_silence();
- QVector clips_;
+ QVector clips_;
LabelSlider* attack_threshold;
LabelSlider* release_threshold;
diff --git a/dialogs/clippropertiesdialog.cpp b/dialogs/clippropertiesdialog.cpp
index 545ec7ca6..9a5f51f43 100644
--- a/dialogs/clippropertiesdialog.cpp
+++ b/dialogs/clippropertiesdialog.cpp
@@ -1,3 +1,23 @@
+/***
+
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+***/
+
#include "clippropertiesdialog.h"
#include
@@ -72,7 +92,7 @@ ClipPropertiesDialog::ClipPropertiesDialog(QWidget *parent, QVector clip
}
// it's assumed all the clips come from the same sequence
- duration_field_->SetFrameRate(first_clip->sequence->frame_rate);
+ duration_field_->SetFrameRate(first_clip->track()->sequence()->frame_rate);
if (all_clips_have_same_duration) {
duration_field_->SetDefault(first_clip->length());
@@ -104,7 +124,7 @@ void ClipPropertiesDialog::accept()
long clip_duration_rounded = qRound(clip_duration);
if (clip->length() != clip_duration_rounded) {
- clip->move(ca,
+ clip->Move(ca,
clip->timeline_in(),
clip->timeline_in() + clip_duration_rounded,
clip->clip_in(),
@@ -115,7 +135,7 @@ void ClipPropertiesDialog::accept()
}
if (ca->hasActions()) {
- olive::UndoStack.push(ca);
+ olive::undo_stack.push(ca);
update_ui(false);
} else {
delete ca;
diff --git a/dialogs/clippropertiesdialog.h b/dialogs/clippropertiesdialog.h
index 439f870de..0a08d9de8 100644
--- a/dialogs/clippropertiesdialog.h
+++ b/dialogs/clippropertiesdialog.h
@@ -1,3 +1,23 @@
+/***
+
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+***/
+
#ifndef CLIPPROPERTIESDIALOG_H
#define CLIPPROPERTIESDIALOG_H
diff --git a/dialogs/debugdialog.cpp b/dialogs/debugdialog.cpp
index 6205d661a..817ee452d 100644
--- a/dialogs/debugdialog.cpp
+++ b/dialogs/debugdialog.cpp
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
diff --git a/dialogs/debugdialog.h b/dialogs/debugdialog.h
index 6d5797dc0..d6bade443 100644
--- a/dialogs/debugdialog.h
+++ b/dialogs/debugdialog.h
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
diff --git a/dialogs/demonotice.cpp b/dialogs/demonotice.cpp
index e91570131..818208211 100644
--- a/dialogs/demonotice.cpp
+++ b/dialogs/demonotice.cpp
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
diff --git a/dialogs/demonotice.h b/dialogs/demonotice.h
index 0407864ab..39f14dc0b 100644
--- a/dialogs/demonotice.h
+++ b/dialogs/demonotice.h
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
diff --git a/dialogs/exportdialog.cpp b/dialogs/exportdialog.cpp
index db4b69345..797bcf946 100644
--- a/dialogs/exportdialog.cpp
+++ b/dialogs/exportdialog.cpp
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
@@ -68,14 +68,15 @@ enum ExportFormats {
FORMAT_SIZE
};
-ExportDialog::ExportDialog(QWidget *parent) :
- QDialog(parent)
+ExportDialog::ExportDialog(QWidget *parent, Sequence* sequence) :
+ QDialog(parent),
+ sequence_(sequence)
{
- setWindowTitle(tr("Export \"%1\"").arg(olive::ActiveSequence->name));
+ setWindowTitle(tr("Export \"%1\"").arg(sequence->name));
setup_ui();
rangeCombobox->setCurrentIndex(0);
- if (olive::ActiveSequence->using_workarea) {
+ if (sequence->using_workarea) {
rangeCombobox->setEnabled(true);
rangeCombobox->setCurrentIndex(1);
}
@@ -109,10 +110,10 @@ ExportDialog::ExportDialog(QWidget *parent) :
formatCombobox->setCurrentIndex(FORMAT_MPEG4);
// default to sequence's native dimensions
- widthSpinbox->setValue(olive::ActiveSequence->width);
- heightSpinbox->setValue(olive::ActiveSequence->height);
- samplingRateSpinbox->setValue(olive::ActiveSequence->audio_frequency);
- framerateSpinbox->setValue(olive::ActiveSequence->frame_rate);
+ widthSpinbox->setValue(sequence->width);
+ heightSpinbox->setValue(sequence->height);
+ samplingRateSpinbox->setValue(sequence->audio_frequency);
+ framerateSpinbox->setValue(sequence->frame_rate);
// set some advanced defaults
vcodec_params.threads = 0;
@@ -351,8 +352,8 @@ void ExportDialog::export_thread_finished() {
prep_ui_for_render(false);
// Move OpenGL context back to the sequence viewer
- panel_sequence_viewer->viewer_widget->makeCurrent();
- panel_sequence_viewer->viewer_widget->initializeGL();
+ panel_sequence_viewer->viewer_widget()->makeCurrent();
+ panel_sequence_viewer->viewer_widget()->initializeGL();
// Update the application UI
update_ui(false);
@@ -537,6 +538,7 @@ void ExportDialog::StartExport() {
// Set up export parameters to send to the ExportThread
ExportParams params;
+ params.sequence = sequence_;
params.filename = filename;
params.video_enabled = videoGroupbox->isChecked();
if (params.video_enabled) {
@@ -555,10 +557,10 @@ void ExportDialog::StartExport() {
}
params.start_frame = 0;
- params.end_frame = olive::ActiveSequence->getEndFrame(); // entire sequence
+ params.end_frame = sequence_->GetEndFrame(); // entire sequence
if (rangeCombobox->currentIndex() == 1) {
- params.start_frame = qMax(olive::ActiveSequence->workarea_in, params.start_frame);
- params.end_frame = qMin(olive::ActiveSequence->workarea_out, params.end_frame);
+ params.start_frame = qMax(sequence_->workarea_in, params.start_frame);
+ params.end_frame = qMin(sequence_->workarea_out, params.end_frame);
}
// Create export thread
@@ -572,10 +574,10 @@ void ExportDialog::StartExport() {
// Close all effects in effect controls (prevents UI threading issues)
panel_effect_controls->Clear();
- olive::Global->set_rendering_state(true);
-
// Close all currently open clips
- close_active_clips(olive::ActiveSequence.get());
+ sequence_->Close();
+
+ olive::Global->set_export_state(true);
olive::Global->save_autorecovery_file();
@@ -654,11 +656,11 @@ void ExportDialog::comp_type_changed(int) {
case COMPRESSION_TYPE_CBR:
case COMPRESSION_TYPE_TARGETBR:
videoBitrateLabel->setText(tr("Bitrate (Mbps):"));
- videobitrateSpinbox->setValue(qMax(0.5, (double) qRound((0.01528 * olive::ActiveSequence->height) - 4.5)));
+ videobitrateSpinbox->setValue(qMax(0.5, (double) qRound((0.01528 * sequence_->height) - 4.5)));
break;
case COMPRESSION_TYPE_CFR:
videoBitrateLabel->setText(tr("Quality (CRF):"));
- videobitrateSpinbox->setValue(36);
+ videobitrateSpinbox->setValue(23);
videobitrateSpinbox->setMaximum(51);
videobitrateSpinbox->setToolTip(tr("Quality Factor:\n\n0 = lossless\n17-18 = visually lossless (compressed, but unnoticeable)\n23 = high quality\n51 = lowest quality possible"));
break;
diff --git a/dialogs/exportdialog.h b/dialogs/exportdialog.h
index bb5a4e486..d76d359f3 100644
--- a/dialogs/exportdialog.h
+++ b/dialogs/exportdialog.h
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
@@ -50,7 +50,7 @@ public:
*
* QWidget parent. Usually MainWindow.
*/
- explicit ExportDialog(QWidget *parent);
+ explicit ExportDialog(QWidget *parent, Sequence *sequence);
private slots:
/**
@@ -270,6 +270,8 @@ private:
* @brief Time value set when exporting begins to determine the total duration of the export
*/
qint64 total_export_time_start;
+
+ Sequence* sequence_;
};
#endif // EXPORTDIALOG_H
diff --git a/dialogs/loaddialog.cpp b/dialogs/loaddialog.cpp
index dfcbb7f5b..198ca3651 100644
--- a/dialogs/loaddialog.cpp
+++ b/dialogs/loaddialog.cpp
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
diff --git a/dialogs/loaddialog.h b/dialogs/loaddialog.h
index ea13f515f..24acca8af 100644
--- a/dialogs/loaddialog.h
+++ b/dialogs/loaddialog.h
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
diff --git a/dialogs/mediapropertiesdialog.cpp b/dialogs/mediapropertiesdialog.cpp
index 3ea790c55..01154ffb6 100644
--- a/dialogs/mediapropertiesdialog.cpp
+++ b/dialogs/mediapropertiesdialog.cpp
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
@@ -30,6 +30,8 @@
#include
#include
#include
+#include
+namespace OCIO = OCIO_NAMESPACE::v1;
#include "project/footage.h"
#include "project/media.h"
@@ -103,7 +105,7 @@ MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent, Media *i) :
// premultiplied alpha mode
premultiply_alpha_setting = new QCheckBox(tr("Alpha is Premultiplied"), this);
- premultiply_alpha_setting->setChecked(f->alpha_is_premultiplied);
+ premultiply_alpha_setting->setChecked(f->alpha_is_associated);
grid->addWidget(premultiply_alpha_setting, row, 0);
row++;
@@ -112,12 +114,12 @@ MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent, Media *i) :
interlacing_box = new QComboBox(this);
interlacing_box->addItem(
tr("Auto (%1)").arg(
- get_interlacing_name(f->video_tracks.at(0).video_auto_interlacing)
+ Footage::get_interlacing_name(f->video_tracks.at(0).video_auto_interlacing)
)
);
- interlacing_box->addItem(get_interlacing_name(VIDEO_PROGRESSIVE));
- interlacing_box->addItem(get_interlacing_name(VIDEO_TOP_FIELD_FIRST));
- interlacing_box->addItem(get_interlacing_name(VIDEO_BOTTOM_FIELD_FIRST));
+ interlacing_box->addItem(Footage::get_interlacing_name(VIDEO_PROGRESSIVE));
+ interlacing_box->addItem(Footage::get_interlacing_name(VIDEO_TOP_FIELD_FIRST));
+ interlacing_box->addItem(Footage::get_interlacing_name(VIDEO_BOTTOM_FIELD_FIRST));
interlacing_box->setCurrentIndex(
(f->video_tracks.at(0).video_auto_interlacing == f->video_tracks.at(0).video_interlacing)
@@ -128,6 +130,28 @@ MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent, Media *i) :
grid->addWidget(interlacing_box, row, 1);
row++;
+
+ input_color_space = new QComboBox(this);
+
+ OCIO::ConstConfigRcPtr config = OCIO::GetCurrentConfig();
+
+ QString footage_colorspace = f->Colorspace();
+
+ for (int i=0;igetNumColorSpaces();i++) {
+ QString colorspace = config->getColorSpaceNameByIndex(i);
+
+ input_color_space->addItem(colorspace);
+
+ if (colorspace == footage_colorspace) {
+ input_color_space->setCurrentIndex(i);
+ }
+ }
+
+ grid->addWidget(new QLabel(tr("Color Space:")), row, 0);
+ grid->addWidget(input_color_space, row, 1);
+
+ row++;
+
}
name_box = new QLineEdit(item->get_name(), this);
@@ -192,9 +216,11 @@ void MediaPropertiesDialog::accept() {
}
// set premultiplied alpha
- f->alpha_is_premultiplied = premultiply_alpha_setting->isChecked();
+ f->alpha_is_associated = premultiply_alpha_setting->isChecked();
}
+ f->SetColorspace(input_color_space->currentText());
+
// set name
MediaRename* mr = new MediaRename(item, name_box->text());
@@ -206,7 +232,7 @@ void MediaPropertiesDialog::accept() {
}
ca->appendPost(new UpdateViewer());
- olive::UndoStack.push(ca);
+ olive::undo_stack.push(ca);
QDialog::accept();
}
diff --git a/dialogs/mediapropertiesdialog.h b/dialogs/mediapropertiesdialog.h
index a13d5e7ec..6e964e6ed 100644
--- a/dialogs/mediapropertiesdialog.h
+++ b/dialogs/mediapropertiesdialog.h
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
@@ -82,6 +82,11 @@ private:
* @brief Setting for associated/premultiplied alpha
*/
QCheckBox* premultiply_alpha_setting;
+
+ /**
+ * @brief Setting for this media's color space
+ */
+ QComboBox* input_color_space;
private slots:
/**
* @brief Overridden accept function for saving the properties back to the Media class
diff --git a/dialogs/newsequencedialog.cpp b/dialogs/newsequencedialog.cpp
index 67b3537c0..940c046cb 100644
--- a/dialogs/newsequencedialog.cpp
+++ b/dialogs/newsequencedialog.cpp
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
@@ -108,8 +108,8 @@ void NewSequenceDialog::accept() {
s->audio_layout = AV_CH_LAYOUT_STEREO;
ComboAction* ca = new ComboAction();
- panel_project->create_sequence_internal(ca, s, true, nullptr);
- olive::UndoStack.push(ca);
+ olive::project_model.CreateSequence(ca, s, true, nullptr);
+ olive::undo_stack.push(ca);
} else if (existing_item != nullptr) {
@@ -128,14 +128,12 @@ void NewSequenceDialog::accept() {
esc->audio_layout = AV_CH_LAYOUT_STEREO;
ca->append(esc);
- for (int i=0;iclips.size();i++) {
- ClipPtr c = existing_sequence->clips.at(i);
- if (c != nullptr) {
- c->refactor_frame_rate(ca, multiplier, true);
- }
+ QVector existing_sequence_clips = existing_sequence->GetAllClips();
+ for (int i=0;irefactor_frame_rate(ca, multiplier, true);
}
- olive::UndoStack.push(ca);
+ olive::undo_stack.push(ca);
} else if (existing_sequence != nullptr) {
@@ -235,13 +233,13 @@ void NewSequenceDialog::setup_ui() {
videoLayout->addWidget(new QLabel(tr("Width:"), this), 0, 0, 1, 1);
width_numeric = new QSpinBox(videoGroupBox);
width_numeric->setMaximum(9999);
- width_numeric->setValue(olive::CurrentConfig.default_sequence_width);
+ width_numeric->setValue(olive::config.default_sequence_width);
videoLayout->addWidget(width_numeric, 0, 2, 1, 2);
videoLayout->addWidget(new QLabel(tr("Height:"), this), 1, 0, 1, 2);
height_numeric = new QSpinBox(videoGroupBox);
height_numeric->setMaximum(9999);
- height_numeric->setValue(olive::CurrentConfig.default_sequence_height);
+ height_numeric->setValue(olive::config.default_sequence_height);
videoLayout->addWidget(height_numeric, 1, 2, 1, 2);
videoLayout->addWidget(new QLabel(tr("Frame Rate:"), this), 2, 0, 1, 1);
@@ -258,7 +256,7 @@ void NewSequenceDialog::setup_ui() {
frame_rate_combobox->addItem("59.94 FPS", 59.94);
frame_rate_combobox->addItem("60 FPS", 60.0);
for (int i=0;icount();i++) {
- if (qFuzzyCompare(frame_rate_combobox->itemData(i).toDouble(), olive::CurrentConfig.default_sequence_framerate)) {
+ if (qFuzzyCompare(frame_rate_combobox->itemData(i).toDouble(), olive::config.default_sequence_framerate)) {
frame_rate_combobox->setCurrentIndex(i);
}
}
@@ -272,8 +270,6 @@ void NewSequenceDialog::setup_ui() {
videoLayout->addWidget(new QLabel(tr("Interlacing:"), this), 6, 0, 1, 1);
interlacing_combobox = new QComboBox(videoGroupBox);
interlacing_combobox->addItem(tr("None (Progressive)"));
- // interlacing_combobox->addItem("Upper Field First");
- // interlacing_combobox->addItem("Lower Field First");
videoLayout->addWidget(interlacing_combobox, 6, 2, 1, 2);
verticalLayout->addWidget(videoGroupBox);
@@ -288,7 +284,7 @@ void NewSequenceDialog::setup_ui() {
audio_frequency_combobox = new QComboBox(audioGroupBox);
combobox_audio_sample_rates(audio_frequency_combobox);
for (int i=0;icount();i++) {
- if (audio_frequency_combobox->itemData(i) == olive::CurrentConfig.default_sequence_audio_frequency) {
+ if (audio_frequency_combobox->itemData(i) == olive::config.default_sequence_audio_frequency) {
audio_frequency_combobox->setCurrentIndex(i);
}
}
diff --git a/dialogs/newsequencedialog.h b/dialogs/newsequencedialog.h
index 4e5ad8c34..301173b32 100644
--- a/dialogs/newsequencedialog.h
+++ b/dialogs/newsequencedialog.h
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
diff --git a/dialogs/preferencesdialog.cpp b/dialogs/preferencesdialog.cpp
index 628e1f610..7b1ce1a3f 100644
--- a/dialogs/preferencesdialog.cpp
+++ b/dialogs/preferencesdialog.cpp
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
@@ -48,6 +48,7 @@
#include "global/config.h"
#include "global/path.h"
#include "rendering/audio.h"
+#include "rendering/pixelformats.h"
#include "panels/panels.h"
#include "ui/columnedgridlayout.h"
#include "ui/mainwindow.h"
@@ -89,11 +90,11 @@ PreferencesDialog::PreferencesDialog(QWidget *parent) :
// set up default sequence
default_sequence.name = tr("Default Sequence");
- default_sequence.width = olive::CurrentConfig.default_sequence_width;
- default_sequence.height = olive::CurrentConfig.default_sequence_height;
- default_sequence.frame_rate = olive::CurrentConfig.default_sequence_framerate;
- default_sequence.audio_frequency = olive::CurrentConfig.default_sequence_audio_frequency;
- default_sequence.audio_layout = olive::CurrentConfig.default_sequence_audio_channel_layout;
+ default_sequence.width = olive::config.default_sequence_width;
+ default_sequence.height = olive::config.default_sequence_height;
+ default_sequence.frame_rate = olive::config.default_sequence_framerate;
+ default_sequence.audio_frequency = olive::config.default_sequence_audio_frequency;
+ default_sequence.audio_layout = olive::config.default_sequence_audio_channel_layout;
}
void PreferencesDialog::setup_kbd_shortcut_worker(QMenu* menu, QTreeWidgetItem* parent) {
@@ -118,12 +119,28 @@ void PreferencesDialog::setup_kbd_shortcut_worker(QMenu* menu, QTreeWidgetItem*
}
}
-void PreferencesDialog::delete_previews(char type) {
- if (type != 't' && type != 'w' && type != 1) return;
+void PreferencesDialog::delete_previews(PreviewDeleteTypes type) {
+ char delete_char = 0;
+
+ switch (type) {
+ case DELETE_WAVEFORMS:
+ delete_char = 'w';
+ break;
+ case DELETE_THUMBNAILS:
+ delete_char = 't';
+ break;
+ case DELETE_BOTH:
+ delete_char = 1;
+ break;
+ case DELETE_NONE:
+ break;
+ }
+
+ if (delete_char != 't' && delete_char != 'w' && delete_char != 1) return;
QDir preview_path(get_data_path() + "/previews");
- if (type == 1) {
+ if (delete_char == 1) {
// indiscriminately delete everything
preview_path.removeRecursively();
} else {
@@ -144,13 +161,124 @@ void PreferencesDialog::delete_previews(char type) {
// thumbnails will have a 't' towards the end of the filenames, waveforms will have a 'w'
// if they match the type of preview we're deleting, remove them
- if (preview_file_str.at(identifier_char_index) == type) {
+ if (preview_file_str.at(identifier_char_index) == delete_char) {
QFile::remove(preview_path.filePath(preview_file_str));
}
}
}
}
+void PreferencesDialog::populate_ocio_menus(OCIO::ConstConfigRcPtr config)
+{
+ if (!config) {
+
+ // Just clear everything
+ ocio_display->clear();
+ ocio_default_input->clear();
+ ocio_view->clear();
+ ocio_look->clear();
+
+ } else {
+
+ // Get input color spaces for setting the default input color space
+ ocio_default_input->clear();
+ for (int i=0;igetNumColorSpaces();i++) {
+ QString colorspace = config->getColorSpaceNameByIndex(i);
+
+ ocio_default_input->addItem(colorspace);
+
+ if (colorspace == olive::config.ocio_default_input_colorspace) {
+ ocio_default_input->setCurrentIndex(i);
+ }
+ }
+
+ // Get current display name (if the config is empty, get the current default display)
+ QString current_display = olive::config.ocio_display;
+ if (current_display.isEmpty()) {
+ current_display = config->getDefaultDisplay();
+ }
+
+ // Populate the display menu
+ ocio_display->clear();
+ for (int i=0;igetNumDisplays();i++) {
+ ocio_display->addItem(config->getDisplay(i));
+
+ // Check if this index is the currently selected
+ if (config->getDisplay(i) == current_display) {
+ ocio_display->setCurrentIndex(i);
+ }
+ }
+
+ update_ocio_view_menu(config);
+
+ // Populate the look menu
+ ocio_look->clear();
+ ocio_look->addItem(tr("(None)"), QString());
+ for (int i=0;igetNumLooks();i++) {
+ const char* look = config->getLookNameByIndex(i);
+
+ ocio_look->addItem(look, look);
+
+ if (look == olive::config.ocio_look) {
+ ocio_look->setCurrentIndex(i);
+ }
+ }
+
+ }
+}
+
+OCIO::ConstConfigRcPtr PreferencesDialog::TestOCIOConfig(const QString &url)
+{
+ // Check whether OCIO can load it
+ OCIO::ConstConfigRcPtr config;
+ try {
+ config = OCIO::Config::CreateFromFile(url.toUtf8());
+ } catch (OCIO::Exception& e) {
+ QMessageBox::critical(this,
+ tr("OpenColorIO Config Error"),
+ tr("Failed to set OpenColorIO configuration: %1").arg(e.what()),
+ QMessageBox::Ok);
+ }
+ return config;
+}
+
+void PreferencesDialog::update_ocio_view_menu(OCIO::ConstConfigRcPtr config)
+{
+
+ // Get views for the current display set in `ocio_display`
+ QString display = ocio_display->currentText();
+
+ // Get current view
+ QString current_view = olive::config.ocio_view;
+ if (current_view.isEmpty()) {
+ current_view = config->getDefaultView(display.toUtf8());
+ }
+
+ // Populate the view menu
+ int ocio_view_count = config->getNumViews(display.toUtf8());
+ ocio_view->clear();
+ for (int i=0;igetView(display.toUtf8(), i);
+
+ ocio_view->addItem(view);
+
+ if (current_view == view) {
+ ocio_view->setCurrentIndex(i);
+ }
+ }
+}
+
+void PreferencesDialog::update_ocio_config(const QString &s)
+{
+ OCIO::ConstConfigRcPtr file_config;
+
+ if (!s.isEmpty() && QFileInfo::exists(s)) {
+ file_config = TestOCIOConfig(s);
+ }
+
+ populate_ocio_menus(file_config);
+}
+
void PreferencesDialog::AddBoolPair(QCheckBox *ui, bool *value, bool restart_required)
{
bool_ui.append(ui);
@@ -188,6 +316,8 @@ void PreferencesDialog::accept() {
bool reinit_audio = false;
bool reload_language = false;
bool reload_effects = false;
+ bool reset_ocio_shaders = false;
+ bool reset_render_threads = false;
// Validate whether the specified CSS file exists
if (!custom_css_fn->text().isEmpty() && !QFileInfo::exists(custom_css_fn->text())) {
@@ -199,11 +329,41 @@ void PreferencesDialog::accept() {
return;
}
- // Validate whether the effects panel should refresh itself
- if (olive::CurrentConfig.effect_textbox_lines != effect_textbox_lines_field->value()) {
- reload_effects = true;
+ // Validate whether the chosen OCIO configuration file
+ if (enable_color_management->isChecked()) {
+
+ // Check whether the file exists
+ if (!QFileInfo::exists(ocio_config_file->text())) {
+
+ QString msg_title = tr("Invalid OpenColorIO Configuration File");
+ QString msg_body;
+
+ if (ocio_config_file->text().isEmpty()) {
+ msg_body = tr("You must specify an OpenColorIO configuration file if color management is enabled.");
+ } else {
+ msg_body = tr("OpenColorIO configuration file '%1' does not exist.").arg(ocio_config_file->text());
+ }
+
+ QMessageBox::critical(
+ this,
+ msg_title,
+ msg_body
+ );
+ return;
+
+ } else if (olive::config.ocio_config_path != ocio_config_file->text()) {
+
+ // Check whether OCIO can load it
+ OCIO::ConstConfigRcPtr file_config = TestOCIOConfig(ocio_config_file->text().toUtf8());
+
+ if (!file_config) {
+ return;
+ }
+
+ }
}
+ // Validate whether one of the bool options requires a restart
bool bool_requires_restart = false;
for (int i=0;ivalue()
- || olive::CurrentConfig.waveform_resolution != waveform_res_spinbox->value()
- || olive::CurrentConfig.css_path != custom_css_fn->text()
- || olive::CurrentConfig.style != static_cast(ui_style->currentData().toInt())) {
+ || olive::config.thumbnail_resolution != thumbnail_res_spinbox->value()
+ || olive::config.waveform_resolution != waveform_res_spinbox->value()
+ || olive::config.css_path != custom_css_fn->text()
+ || olive::config.style != static_cast(ui_style->currentData().toInt())) {
// any changes to these settings will require a restart - ask the user if we should do one now or later
@@ -244,78 +404,107 @@ void PreferencesDialog::accept() {
}
+
+ // Everything checks out, start saving settings from the UI to the backend
+ olive::config.css_path = custom_css_fn->text();
+ olive::config.recording_mode = recordingComboBox->currentIndex() + 1;
+ olive::config.img_seq_formats = imgSeqFormatEdit->text();
+ olive::config.upcoming_queue_size = upcoming_queue_spinbox->value();
+ olive::config.upcoming_queue_type = upcoming_queue_type->currentIndex();
+ olive::config.previous_queue_size = previous_queue_spinbox->value();
+ olive::config.previous_queue_type = previous_queue_type->currentIndex();
+
// Audio settings may require the audio device to be re-initiated.
- if (olive::CurrentConfig.preferred_audio_output != audio_output_devices->currentData().toString()
- || olive::CurrentConfig.preferred_audio_input != audio_input_devices->currentData().toString()
- || olive::CurrentConfig.audio_rate != audio_sample_rate->currentData().toInt()) {
+ if (olive::config.preferred_audio_output != audio_output_devices->currentData().toString()
+ || olive::config.preferred_audio_input != audio_input_devices->currentData().toString()
+ || olive::config.audio_rate != audio_sample_rate->currentData().toInt()) {
reinit_audio = true;
}
+ olive::config.preferred_audio_output = audio_output_devices->currentData().toString();
+ olive::config.preferred_audio_input = audio_input_devices->currentData().toString();
+ olive::config.audio_rate = audio_sample_rate->currentData().toInt();
+
+ olive::config.effect_textbox_lines = effect_textbox_lines_field->value();
// see if the language file should be reloaded (not necessary if the app is restarting anyway)
if (!restart_after_saving
- && olive::CurrentConfig.language_file != language_combobox->currentData().toString()) {
+ && olive::config.language_file != language_combobox->currentData().toString()) {
reload_language = true;
}
+ olive::config.language_file = language_combobox->currentData().toString();
- // save settings from UI to backend
- olive::CurrentConfig.css_path = custom_css_fn->text();
- olive::CurrentConfig.recording_mode = recordingComboBox->currentIndex() + 1;
- olive::CurrentConfig.img_seq_formats = imgSeqFormatEdit->text();
- olive::CurrentConfig.upcoming_queue_size = upcoming_queue_spinbox->value();
- olive::CurrentConfig.upcoming_queue_type = upcoming_queue_type->currentIndex();
- olive::CurrentConfig.previous_queue_size = previous_queue_spinbox->value();
- olive::CurrentConfig.previous_queue_type = previous_queue_type->currentIndex();
+ // Check whether OCIO settings will require a reset of the render threads
+ if (olive::config.playback_bit_depth != playback_bit_depth->currentIndex()
+ || olive::config.export_bit_depth != export_bit_depth->currentIndex()) {
+ reset_render_threads = true;
+ }
+ if (olive::config.ocio_config_path != ocio_config_file->text()
+ || olive::config.ocio_display != ocio_display->currentText()
+ || olive::config.ocio_view != ocio_view->currentText()
+ || olive::config.ocio_look != ocio_look->currentData().toString()) {
+ reset_ocio_shaders = true;
+ }
+ if (olive::config.ocio_config_path != ocio_config_file->text()) {
+ OCIO::SetCurrentConfig(OCIO::Config::CreateFromFile(ocio_config_file->text().toUtf8()));
+ olive::config.ocio_config_path = ocio_config_file->text();
+ }
+ olive::config.enable_color_management = enable_color_management->isChecked();
+ olive::config.playback_bit_depth = playback_bit_depth->currentIndex();
+ olive::config.export_bit_depth = export_bit_depth->currentIndex();
+ olive::config.ocio_display = ocio_display->currentText();
+ olive::config.ocio_default_input_colorspace = ocio_default_input->currentText();
+ olive::config.ocio_view = ocio_view->currentText();
- olive::CurrentConfig.preferred_audio_output = audio_output_devices->currentData().toString();
- olive::CurrentConfig.preferred_audio_input = audio_input_devices->currentData().toString();
- olive::CurrentConfig.audio_rate = audio_sample_rate->currentData().toInt();
+ // We use data here instead of text because there's a "(None)" option with an empty string
+ olive::config.ocio_look = ocio_look->currentData().toString();
- olive::CurrentConfig.effect_textbox_lines = effect_textbox_lines_field->value();
- olive::CurrentConfig.language_file = language_combobox->currentData().toString();
- olive::CurrentConfig.default_sequence_width = default_sequence.width;
- olive::CurrentConfig.default_sequence_height = default_sequence.height;
- olive::CurrentConfig.default_sequence_framerate = default_sequence.frame_rate;
- olive::CurrentConfig.default_sequence_audio_frequency = default_sequence.audio_frequency;
- olive::CurrentConfig.default_sequence_audio_channel_layout = default_sequence.audio_layout;
+ // Set default sequence options
+ olive::config.default_sequence_width = default_sequence.width;
+ olive::config.default_sequence_height = default_sequence.height;
+ olive::config.default_sequence_framerate = default_sequence.frame_rate;
+ olive::config.default_sequence_audio_frequency = default_sequence.audio_frequency;
+ olive::config.default_sequence_audio_channel_layout = default_sequence.audio_layout;
+ // Set all bool options
for (int i=0;iisChecked();
}
- olive::CurrentConfig.style = static_cast(ui_style->currentData().toInt());
+ // Set new style
+ olive::config.style = static_cast(ui_style->currentData().toInt());
- // Check if the thumbnail or waveform icon
- if (olive::CurrentConfig.thumbnail_resolution != thumbnail_res_spinbox->value()
- || olive::CurrentConfig.waveform_resolution != waveform_res_spinbox->value()) {
+ // Check if the thumbnail or waveform icon fields have changed, we may need to recreate the previews if so
+ if (olive::config.thumbnail_resolution != thumbnail_res_spinbox->value()
+ || olive::config.waveform_resolution != waveform_res_spinbox->value()) {
// we're changing the size of thumbnails and waveforms, so let's delete them and regenerate them next start
// delete nothing
- char delete_match = 0;
+ PreviewDeleteTypes delete_type = DELETE_NONE;
- if (olive::CurrentConfig.thumbnail_resolution != thumbnail_res_spinbox->value()) {
+ if (olive::config.thumbnail_resolution != thumbnail_res_spinbox->value()) {
// delete existing thumbnails
- olive::CurrentConfig.thumbnail_resolution = thumbnail_res_spinbox->value();
+ olive::config.thumbnail_resolution = thumbnail_res_spinbox->value();
// delete only thumbnails
- delete_match = 't';
+ delete_type = DELETE_THUMBNAILS;
}
- if (olive::CurrentConfig.waveform_resolution != waveform_res_spinbox->value()) {
+ if (olive::config.waveform_resolution != waveform_res_spinbox->value()) {
// delete existing waveforms
- olive::CurrentConfig.waveform_resolution = waveform_res_spinbox->value();
+ olive::config.waveform_resolution = waveform_res_spinbox->value();
// if we're already deleting thumbnails
- if (delete_match == 't') {
+ if (delete_type == DELETE_THUMBNAILS) {
// delete all
- delete_match = 1;
+ delete_type = DELETE_BOTH;
} else {
// just delete waveforms
- delete_match = 'w';
+ delete_type = DELETE_WAVEFORMS;
}
}
- delete_previews(delete_match);
+ delete_previews(delete_type);
}
// Save keyboard shortcuts
@@ -323,29 +512,46 @@ void PreferencesDialog::accept() {
key_shortcut_fields.at(i)->set_action_shortcut();
}
- // Audio settings may require the audio device to be re-initiated.
- if (reinit_audio) {
- init_audio();
- }
-
- if (reload_effects) {
- panel_effect_controls->Reload();
- }
-
- // reload language file if it changed
- if (reload_language) {
- olive::Global->load_translation_from_config();
- }
-
QDialog::accept();
if (restart_after_saving) {
+
// since we already ran can_close_project(), bypass checking again by running set_modified(false)
olive::Global->set_modified(false);
olive::MainWindow->close();
QProcess::startDetached(QApplication::applicationFilePath(), { olive::ActiveProjectFilename });
+ } else {
+
+ // Audio settings may require the audio device to be re-initiated.
+ if (reinit_audio) {
+ init_audio();
+ }
+
+ if (reload_effects) {
+ panel_effect_controls->Reload();
+ }
+
+ // reload language file if it changed
+ if (reload_language) {
+ olive::Global->load_translation_from_config();
+ }
+
+ if (reset_render_threads) {
+ if (panel_footage_viewer->seq != nullptr) {
+ panel_footage_viewer->seq->Close();
+ }
+ panel_footage_viewer->viewer_widget()->get_renderer()->delete_ctx();
+ if (panel_sequence_viewer->seq != nullptr) {
+ panel_sequence_viewer->seq->Close();
+ }
+ panel_sequence_viewer->viewer_widget()->get_renderer()->delete_ctx();
+ } else if (reset_ocio_shaders) {
+ panel_footage_viewer->viewer_widget()->get_renderer()->destroy_ocio();
+ panel_sequence_viewer->viewer_widget()->get_renderer()->destroy_ocio();
+ }
+
}
}
@@ -471,15 +677,30 @@ void PreferencesDialog::browse_css_file() {
}
}
+void PreferencesDialog::browse_ocio_config()
+{
+ QString fn = QFileDialog::getOpenFileName(this, tr("Browse for OpenColorIO configuration"));
+ if (!fn.isEmpty()) {
+ ocio_config_file->setText(fn);
+ enable_color_management->setChecked(true);
+ }
+}
+
+void PreferencesDialog::update_ocio_view_menu()
+{
+ update_ocio_view_menu(OCIO::GetCurrentConfig());
+}
+
void PreferencesDialog::delete_all_previews() {
if (QMessageBox::question(this,
tr("Delete All Previews"),
tr("Are you sure you want to delete all previews?"),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
- delete_previews(1);
+ delete_previews(DELETE_BOTH);
QMessageBox::information(this,
tr("Previews Deleted"),
- tr("All previews deleted successfully. You may have to re-open your current project for changes to take effect."),
+ tr("All previews deleted successfully. You may have to re-open your current project for "
+ "changes to take effect."),
QMessageBox::Ok);
}
}
@@ -528,7 +749,7 @@ void PreferencesDialog::setup_ui() {
QString locale_str = locale_file_basename.mid(locale_file_basename.lastIndexOf('_')+1);
language_combobox->addItem(QLocale(locale_str).nativeLanguageName(), locale_relative_path);
- if (olive::CurrentConfig.language_file == locale_relative_path) {
+ if (olive::config.language_file == locale_relative_path) {
language_combobox->setCurrentIndex(language_combobox->count() - 1);
}
}
@@ -543,8 +764,7 @@ void PreferencesDialog::setup_ui() {
general_layout->addWidget(new QLabel(tr("Image sequence formats:"), this), row, 0);
imgSeqFormatEdit = new QLineEdit(general_tab);
- imgSeqFormatEdit->setText(olive::CurrentConfig.img_seq_formats);
-
+ imgSeqFormatEdit->setText(olive::config.img_seq_formats);
general_layout->addWidget(imgSeqFormatEdit, row, 1, 1, 4);
row++;
@@ -555,7 +775,7 @@ void PreferencesDialog::setup_ui() {
thumbnail_res_spinbox = new QSpinBox(this);
thumbnail_res_spinbox->setMinimum(0);
thumbnail_res_spinbox->setMaximum(INT_MAX);
- thumbnail_res_spinbox->setValue(olive::CurrentConfig.thumbnail_resolution);
+ thumbnail_res_spinbox->setValue(olive::config.thumbnail_resolution);
general_layout->addWidget(thumbnail_res_spinbox, row, 1);
general_layout->addWidget(new QLabel(tr("Waveform Resolution:"), this), row, 2);
@@ -563,7 +783,7 @@ void PreferencesDialog::setup_ui() {
waveform_res_spinbox = new QSpinBox(this);
waveform_res_spinbox->setMinimum(0);
waveform_res_spinbox->setMaximum(INT_MAX);
- waveform_res_spinbox->setValue(olive::CurrentConfig.waveform_resolution);
+ waveform_res_spinbox->setValue(olive::config.waveform_resolution);
general_layout->addWidget(waveform_res_spinbox, row, 3);
QPushButton* delete_preview_btn = new QPushButton(tr("Delete Previews"));
@@ -572,17 +792,27 @@ void PreferencesDialog::setup_ui() {
row++;
+ QHBoxLayout* misc_general = new QHBoxLayout();
+
// General -> Use Software Fallbacks When Possible
QCheckBox* use_software_fallbacks_checkbox = new QCheckBox(tr("Use Software Fallbacks When Possible"));
- AddBoolPair(use_software_fallbacks_checkbox, &olive::CurrentConfig.use_software_fallback, true);
- general_layout->addWidget(use_software_fallbacks_checkbox, row, 0, 1, 4);
+ AddBoolPair(use_software_fallbacks_checkbox, &olive::config.use_software_fallback, true);
+ misc_general->addWidget(use_software_fallbacks_checkbox);
- row++;
+ // General -> Don't Use Proxies When Exporting
+ QCheckBox* dont_use_proxies_when_exporting = new QCheckBox(tr("Don't Use Proxies When Exporting"));
+ dont_use_proxies_when_exporting->setToolTip(tr("Use originals instead of proxies when exporting"));
+ AddBoolPair(dont_use_proxies_when_exporting, &olive::config.dont_use_proxies_on_export);
+ misc_general->addWidget(dont_use_proxies_when_exporting);
// General -> Default Sequence Settings
QPushButton* default_sequence_settings = new QPushButton(tr("Default Sequence Settings"));
connect(default_sequence_settings, SIGNAL(clicked(bool)), this, SLOT(edit_default_sequence_settings()));
- general_layout->addWidget(default_sequence_settings);
+ misc_general->addWidget(default_sequence_settings);
+
+ general_layout->addLayout(misc_general, row, 0, 1, 5);
+
+ row++;
tabWidget->addTab(general_tab, tr("General"));
@@ -593,68 +823,68 @@ void PreferencesDialog::setup_ui() {
ColumnedGridLayout* behavior_tab_layout = new ColumnedGridLayout(behavior_tab, 2);
QCheckBox* add_default_effects_to_clips = new QCheckBox(tr("Add Default Effects to New Clips"));
- AddBoolPair(add_default_effects_to_clips, &olive::CurrentConfig.add_default_effects_to_clips);
+ AddBoolPair(add_default_effects_to_clips, &olive::config.add_default_effects_to_clips);
behavior_tab_layout->Add(add_default_effects_to_clips);
QCheckBox* auto_seek_to_beginning = new QCheckBox(tr("Automatically Seek to the Beginning When Playing at the End of a Sequence"));
- AddBoolPair(auto_seek_to_beginning, &olive::CurrentConfig.auto_seek_to_beginning);
+ AddBoolPair(auto_seek_to_beginning, &olive::config.auto_seek_to_beginning);
behavior_tab_layout->Add(auto_seek_to_beginning);
QCheckBox* selecting_also_seeks = new QCheckBox(tr("Selecting Also Seeks"));
- AddBoolPair(selecting_also_seeks, &olive::CurrentConfig.select_also_seeks);
+ AddBoolPair(selecting_also_seeks, &olive::config.select_also_seeks);
behavior_tab_layout->Add(selecting_also_seeks);
QCheckBox* edit_tool_also_seeks = new QCheckBox(tr("Edit Tool Also Seeks"));
- AddBoolPair(edit_tool_also_seeks, &olive::CurrentConfig.edit_tool_also_seeks);
+ AddBoolPair(edit_tool_also_seeks, &olive::config.edit_tool_also_seeks);
behavior_tab_layout->Add(edit_tool_also_seeks);
QCheckBox* edit_tool_selects_links = new QCheckBox(tr("Edit Tool Selects Links"));
- AddBoolPair(edit_tool_selects_links, &olive::CurrentConfig.edit_tool_selects_links);
+ AddBoolPair(edit_tool_selects_links, &olive::config.edit_tool_selects_links);
behavior_tab_layout->Add(edit_tool_selects_links);
QCheckBox* seek_also_selects = new QCheckBox(tr("Seek Also Selects"));
- AddBoolPair(seek_also_selects, &olive::CurrentConfig.seek_also_selects);
+ AddBoolPair(seek_also_selects, &olive::config.seek_also_selects);
behavior_tab_layout->Add(seek_also_selects);
QCheckBox* seek_to_end_of_pastes = new QCheckBox(tr("Seek to the End of Pastes"));
- AddBoolPair(seek_to_end_of_pastes, &olive::CurrentConfig.paste_seeks);
+ AddBoolPair(seek_to_end_of_pastes, &olive::config.paste_seeks);
behavior_tab_layout->Add(seek_to_end_of_pastes);
QCheckBox* scroll_wheel_zooms = new QCheckBox(tr("Scroll Wheel Zooms"));
scroll_wheel_zooms->setToolTip(tr("Hold CTRL to toggle this setting"));
- AddBoolPair(scroll_wheel_zooms, &olive::CurrentConfig.scroll_zooms);
+ AddBoolPair(scroll_wheel_zooms, &olive::config.scroll_zooms);
behavior_tab_layout->Add(scroll_wheel_zooms);
QCheckBox* invert_timeline_scroll_axes = new QCheckBox(tr("Invert Timeline Scroll Axes"));
- AddBoolPair(invert_timeline_scroll_axes, &olive::CurrentConfig.invert_timeline_scroll_axes);
+ AddBoolPair(invert_timeline_scroll_axes, &olive::config.invert_timeline_scroll_axes);
behavior_tab_layout->Add(invert_timeline_scroll_axes);
QCheckBox* enable_drag_files_to_timeline = new QCheckBox(tr("Enable Drag Files to Timeline"));
- AddBoolPair(enable_drag_files_to_timeline, &olive::CurrentConfig.enable_drag_files_to_timeline);
+ AddBoolPair(enable_drag_files_to_timeline, &olive::config.enable_drag_files_to_timeline);
behavior_tab_layout->Add(enable_drag_files_to_timeline);
QCheckBox* autoscale_by_default = new QCheckBox(tr("Auto-Scale By Default"));
- AddBoolPair(autoscale_by_default, &olive::CurrentConfig.autoscale_by_default);
+ AddBoolPair(autoscale_by_default, &olive::config.autoscale_by_default);
behavior_tab_layout->Add(autoscale_by_default);
QCheckBox* enable_seek_to_import = new QCheckBox(tr("Auto-Seek to Imported Clips"));
- AddBoolPair(enable_seek_to_import, &olive::CurrentConfig.enable_seek_to_import);
+ AddBoolPair(enable_seek_to_import, &olive::config.enable_seek_to_import);
behavior_tab_layout->Add(enable_seek_to_import);
QCheckBox* enable_audio_scrubbing = new QCheckBox(tr("Audio Scrubbing"));
- AddBoolPair(enable_audio_scrubbing, &olive::CurrentConfig.enable_audio_scrubbing);
+ AddBoolPair(enable_audio_scrubbing, &olive::config.enable_audio_scrubbing);
behavior_tab_layout->Add(enable_audio_scrubbing);
QCheckBox* enable_drop_on_media_to_replace = new QCheckBox(tr("Drop Files on Media to Replace"));
- AddBoolPair(enable_drop_on_media_to_replace, &olive::CurrentConfig.drop_on_media_to_replace);
+ AddBoolPair(enable_drop_on_media_to_replace, &olive::config.drop_on_media_to_replace);
behavior_tab_layout->Add(enable_drop_on_media_to_replace);
QCheckBox* enable_hover_focus = new QCheckBox(tr("Enable Hover Focus"));
- AddBoolPair(enable_hover_focus, &olive::CurrentConfig.hover_focus);
+ AddBoolPair(enable_hover_focus, &olive::config.hover_focus);
behavior_tab_layout->Add(enable_hover_focus);
QCheckBox* set_name_and_marker = new QCheckBox(tr("Ask For Name When Setting Marker"));
- AddBoolPair(set_name_and_marker, &olive::CurrentConfig.set_name_with_marker);
+ AddBoolPair(set_name_and_marker, &olive::config.set_name_with_marker);
behavior_tab_layout->Add(set_name_and_marker);
// Appearance
@@ -673,7 +903,7 @@ void PreferencesDialog::setup_ui() {
ui_style->addItem(tr("Olive Light"), olive::styling::kOliveDefaultLight);
ui_style->addItem(tr("Native"), olive::styling::kNativeDarkIcons);
ui_style->addItem(tr("Native (Light Icons)"), olive::styling::kNativeLightIcons);
- ui_style->setCurrentIndex(olive::CurrentConfig.style);
+ ui_style->setCurrentIndex(olive::config.style);
appearance_layout->addWidget(ui_style, row, 1, 1, 2);
row++;
@@ -682,7 +912,7 @@ void PreferencesDialog::setup_ui() {
// Native menu styling is only available on Windows. Environments like Ubuntu and Mac use the native menu system by
// default
QCheckBox* native_menus = new QCheckBox(tr("Use Native Menu Styling"));
- AddBoolPair(native_menus, &olive::CurrentConfig.use_native_menu_styling, true);
+ AddBoolPair(native_menus, &olive::config.use_native_menu_styling, true);
appearance_layout->addWidget(native_menus, row, 0, 1, 3);
row++;
@@ -692,7 +922,7 @@ void PreferencesDialog::setup_ui() {
appearance_layout->addWidget(new QLabel(tr("Custom CSS:"), this), row, 0);
custom_css_fn = new QLineEdit(general_tab);
- custom_css_fn->setText(olive::CurrentConfig.css_path);
+ custom_css_fn->setText(olive::config.css_path);
appearance_layout->addWidget(custom_css_fn, row, 1);
QPushButton* custom_css_browse = new QPushButton(tr("Browse"), general_tab);
@@ -706,7 +936,7 @@ void PreferencesDialog::setup_ui() {
effect_textbox_lines_field = new QSpinBox(general_tab);
effect_textbox_lines_field->setMinimum(1);
- effect_textbox_lines_field->setValue(olive::CurrentConfig.effect_textbox_lines);
+ effect_textbox_lines_field->setValue(olive::config.effect_textbox_lines);
appearance_layout->addWidget(effect_textbox_lines_field, row, 1, 1, 2);
row++;
@@ -721,21 +951,21 @@ void PreferencesDialog::setup_ui() {
QGridLayout* memory_usage_layout = new QGridLayout(memory_usage_group);
memory_usage_layout->addWidget(new QLabel(tr("Upcoming Frame Queue:"), playback_tab), 0, 0);
upcoming_queue_spinbox = new QDoubleSpinBox(playback_tab);
- upcoming_queue_spinbox->setValue(olive::CurrentConfig.upcoming_queue_size);
+ upcoming_queue_spinbox->setValue(olive::config.upcoming_queue_size);
memory_usage_layout->addWidget(upcoming_queue_spinbox, 0, 1);
upcoming_queue_type = new QComboBox(playback_tab);
upcoming_queue_type->addItem(tr("frames"));
upcoming_queue_type->addItem(tr("seconds"));
- upcoming_queue_type->setCurrentIndex(olive::CurrentConfig.upcoming_queue_type);
+ upcoming_queue_type->setCurrentIndex(olive::config.upcoming_queue_type);
memory_usage_layout->addWidget(upcoming_queue_type, 0, 2);
memory_usage_layout->addWidget(new QLabel(tr("Previous Frame Queue:"), playback_tab), 1, 0);
previous_queue_spinbox = new QDoubleSpinBox(playback_tab);
- previous_queue_spinbox->setValue(olive::CurrentConfig.previous_queue_size);
+ previous_queue_spinbox->setValue(olive::config.previous_queue_size);
memory_usage_layout->addWidget(previous_queue_spinbox, 1, 1);
previous_queue_type = new QComboBox(playback_tab);
previous_queue_type->addItem(tr("frames"));
previous_queue_type->addItem(tr("seconds"));
- previous_queue_type->setCurrentIndex(olive::CurrentConfig.previous_queue_type);
+ previous_queue_type->setCurrentIndex(olive::config.previous_queue_type);
memory_usage_layout->addWidget(previous_queue_type, 1, 2);
playback_tab_layout->addWidget(memory_usage_group);
@@ -761,7 +991,7 @@ void PreferencesDialog::setup_ui() {
for (int i=0;iaddItem(devs.at(i).deviceName(), devs.at(i).deviceName());
if (!found_preferred_device
- && devs.at(i).deviceName() == olive::CurrentConfig.preferred_audio_output) {
+ && devs.at(i).deviceName() == olive::config.preferred_audio_output) {
audio_output_devices->setCurrentIndex(audio_output_devices->count()-1);
found_preferred_device = true;
}
@@ -784,7 +1014,7 @@ void PreferencesDialog::setup_ui() {
for (int i=0;iaddItem(devs.at(i).deviceName(), devs.at(i).deviceName());
if (!found_preferred_device
- && devs.at(i).deviceName() == olive::CurrentConfig.preferred_audio_input) {
+ && devs.at(i).deviceName() == olive::config.preferred_audio_input) {
audio_input_devices->setCurrentIndex(audio_input_devices->count()-1);
found_preferred_device = true;
}
@@ -801,7 +1031,7 @@ void PreferencesDialog::setup_ui() {
audio_sample_rate = new QComboBox();
combobox_audio_sample_rates(audio_sample_rate);
for (int i=0;icount();i++) {
- if (audio_sample_rate->itemData(i).toInt() == olive::CurrentConfig.audio_rate) {
+ if (audio_sample_rate->itemData(i).toInt() == olive::config.audio_rate) {
audio_sample_rate->setCurrentIndex(i);
break;
}
@@ -817,13 +1047,102 @@ void PreferencesDialog::setup_ui() {
recordingComboBox = new QComboBox(general_tab);
recordingComboBox->addItem(tr("Mono"));
recordingComboBox->addItem(tr("Stereo"));
- recordingComboBox->setCurrentIndex(olive::CurrentConfig.recording_mode - 1);
+ recordingComboBox->setCurrentIndex(olive::config.recording_mode - 1);
audio_tab_layout->addWidget(recordingComboBox, row, 1);
row++;
tabWidget->addTab(audio_tab, tr("Audio"));
+ //
+ // COLOR MANAGEMENT
+ //
+
+ QWidget* color_management_tab = new QWidget();
+
+ QGridLayout* color_management_layout = new QGridLayout(color_management_tab);
+
+ row = 0;
+
+ // COLOR MANAGEMENT -> Enable Color Management
+ enable_color_management = new QCheckBox(tr("Enable Color Management"));
+ enable_color_management->setChecked(olive::config.enable_color_management);
+ color_management_layout->addWidget(enable_color_management, row, 0);
+
+ row++;
+
+ QGroupBox* opencolorio_groupbox = new QGroupBox();
+ QGridLayout* opencolorio_groupbox_layout = new QGridLayout(opencolorio_groupbox);
+
+ // COLOR MANAGEMENT -> OpenColorIO Config File
+ opencolorio_groupbox_layout->addWidget(new QLabel(tr("OpenColorIO Config File:")), 0, 0);
+
+ ocio_config_file = new QLineEdit();
+ ocio_config_file->setText(olive::config.ocio_config_path);
+ connect(ocio_config_file, SIGNAL(textChanged(const QString &)), this, SLOT(update_ocio_config(const QString&)));
+ opencolorio_groupbox_layout->addWidget(ocio_config_file, 0, 1, 1, 4);
+
+ QPushButton* ocio_config_browse_btn = new QPushButton(tr("Browse"));
+ connect(ocio_config_browse_btn, SIGNAL(clicked(bool)), this, SLOT(browse_ocio_config()));
+ opencolorio_groupbox_layout->addWidget(ocio_config_browse_btn, 0, 5);
+
+ // COLOR MANAGEMENT -> Default Input Color Space
+ ocio_default_input = new QComboBox();
+ opencolorio_groupbox_layout->addWidget(new QLabel(tr("Default Input Color Space:")), 1, 0);
+ opencolorio_groupbox_layout->addWidget(ocio_default_input, 1, 1, 1, 5);
+
+ // COLOR MANAGEMENT -> Display
+ ocio_display = new QComboBox();
+ connect(ocio_display, SIGNAL(currentIndexChanged(int)), this, SLOT(update_ocio_view_menu()));
+ opencolorio_groupbox_layout->addWidget(new QLabel(tr("Display:")), 2, 0);
+ opencolorio_groupbox_layout->addWidget(ocio_display, 2, 1);
+
+ // COLOR MANAGEMENT -> View
+ ocio_view = new QComboBox();
+ opencolorio_groupbox_layout->addWidget(new QLabel(tr("View:")), 2, 2);
+ opencolorio_groupbox_layout->addWidget(ocio_view, 2, 3);
+
+ // COLOR MANAGEMENT -> Look
+ ocio_look = new QComboBox();
+ opencolorio_groupbox_layout->addWidget(new QLabel(tr("Look:")), 2, 4);
+ opencolorio_groupbox_layout->addWidget(ocio_look, 2, 5);
+
+ color_management_layout->addWidget(opencolorio_groupbox, row, 0);
+
+ row++;
+
+ // COLOR MANAGEMENT -> Bit Depth
+ QGroupBox* bit_depth_groupbox = new QGroupBox(tr("Bit Depth"));
+ QGridLayout* bit_depth_groupbox_layout = new QGridLayout(bit_depth_groupbox);
+
+ // COLOR MANAGEMENT -> Bit Depth -> Playback
+ playback_bit_depth = new QComboBox();
+ for (int i=0;iaddItem(olive::pixel_formats.at(i).name, i);
+ }
+ playback_bit_depth->setCurrentIndex(olive::config.playback_bit_depth);
+ bit_depth_groupbox_layout->addWidget(new QLabel(tr("Playback (Offline):")), 0, 0);
+ bit_depth_groupbox_layout->addWidget(playback_bit_depth, 0, 1);
+
+ // COLOR MANAGEMENT -> Bit Depth -> Export
+ export_bit_depth = new QComboBox();
+ for (int i=0;iaddItem(olive::pixel_formats.at(i).name, i);
+ }
+ export_bit_depth->setCurrentIndex(olive::config.export_bit_depth);
+ bit_depth_groupbox_layout->addWidget(new QLabel(tr("Export (Online):")), 0, 2);
+ bit_depth_groupbox_layout->addWidget(export_bit_depth, 0, 3);
+
+ color_management_layout->addWidget(bit_depth_groupbox, row, 0);
+
+
+
+ //row++;
+
+ populate_ocio_menus(OCIO::GetCurrentConfig());
+
+ tabWidget->addTab(color_management_tab, tr("Color Management"));
+
// Shortcuts
QWidget* shortcut_tab = new QWidget(this);
diff --git a/dialogs/preferencesdialog.h b/dialogs/preferencesdialog.h
index f360284ea..721a2b505 100644
--- a/dialogs/preferencesdialog.h
+++ b/dialogs/preferencesdialog.h
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
@@ -33,6 +33,8 @@
#include
#include
#include
+#include
+namespace OCIO = OCIO_NAMESPACE::v1;
#include "timeline/sequence.h"
@@ -108,16 +110,23 @@ private slots:
*/
void save_shortcut_file();
- /**
- * @brief Show a file dialog to browse for an external CSS file to load for styling the application.
- */
- void browse_css_file();
-
/**
* @brief Delete all previews (waveform and thumbnail cache)
*/
void delete_all_previews();
+ // Browse for file functionns
+ /**
+ * @brief Show a file dialog to browse for an external CSS file to load for styling the application.
+ */
+ void browse_css_file();
+ void browse_ocio_config();
+
+ // OCIO function
+ void update_ocio_view_menu();
+ void update_ocio_view_menu(OCIO::ConstConfigRcPtr config);
+ void update_ocio_config(const QString&);
+
/**
* @brief Shows a NewSequenceDialog attached to default_sequence
*/
@@ -157,6 +166,13 @@ private:
*/
void setup_kbd_shortcut_worker(QMenu* menu, QTreeWidgetItem* parent);
+ enum PreviewDeleteTypes {
+ DELETE_NONE,
+ DELETE_THUMBNAILS,
+ DELETE_WAVEFORMS,
+ DELETE_BOTH
+ };
+
// used to delete previews
// type can be: 't' for thumbnails, 'w' for waveforms, or 1 for all
/**
@@ -164,9 +180,11 @@ private:
*
* @param type
*
- * The types of previews to
+ * The types of previews to delete.
*/
- void delete_previews(char type);
+ void delete_previews(PreviewDeleteTypes type);
+
+ void populate_ocio_menus(OCIO::ConstConfigRcPtr config);
/**
* @brief UI widget for editing the CSS filename
@@ -183,6 +201,7 @@ private:
*/
QComboBox* recordingComboBox;
+
/**
* @brief UI widget for editing keyboard shortcuts
*/
@@ -243,6 +262,15 @@ private:
*/
QSpinBox* waveform_res_spinbox;
+ QCheckBox* enable_color_management;
+ QLineEdit* ocio_config_file;
+ QComboBox* ocio_default_input;
+ QComboBox* ocio_display;
+ QComboBox* ocio_view;
+ QComboBox* ocio_look;
+ QComboBox* playback_bit_depth;
+ QComboBox* export_bit_depth;
+
/**
* @brief UI widget for selecting the current UI style
*/
@@ -274,6 +302,19 @@ private:
*/
QVector key_shortcut_fields;
+ /**
+ * @brief Tests an OpenColorIO configuration file to determine whether it's valid and throws a messagebox if not
+ *
+ * @param url
+ *
+ * URL to the OpenColorIO configuration file.
+ *
+ * @return
+ *
+ * A OCIO::ConstConfigRcPtr config pointer if the configuration file is valid, nullptr if not.
+ */
+ OCIO::ConstConfigRcPtr TestOCIOConfig(const QString& url);
+
/**
* @brief Add an automated QCheckBox+boolean value pair
*
diff --git a/dialogs/proxydialog.cpp b/dialogs/proxydialog.cpp
index d86044860..acbd77300 100644
--- a/dialogs/proxydialog.cpp
+++ b/dialogs/proxydialog.cpp
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
diff --git a/dialogs/proxydialog.h b/dialogs/proxydialog.h
index 6a036d830..a883b2085 100644
--- a/dialogs/proxydialog.h
+++ b/dialogs/proxydialog.h
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
diff --git a/dialogs/replaceclipmediadialog.cpp b/dialogs/replaceclipmediadialog.cpp
index 8efda92a9..d90452a6e 100644
--- a/dialogs/replaceclipmediadialog.cpp
+++ b/dialogs/replaceclipmediadialog.cpp
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
@@ -95,7 +95,10 @@ void ReplaceClipMediaDialog::accept() {
QMessageBox::Ok
);
} else {
- if (new_item->get_type() == MEDIA_TYPE_SEQUENCE && olive::ActiveSequence == new_item->to_sequence()) {
+
+ SequencePtr top_sequence = Timeline::GetTopSequence();
+
+ if (new_item->get_type() == MEDIA_TYPE_SEQUENCE && top_sequence == new_item->to_sequence()) {
QMessageBox::critical(
this,
tr("Active sequence selected"),
@@ -109,14 +112,15 @@ void ReplaceClipMediaDialog::accept() {
use_same_media_in_points->isChecked()
);
- for (int i=0;iclips.size();i++) {
- ClipPtr c = olive::ActiveSequence->clips.at(i);
- if (c != nullptr && c->media() == media) {
+ QVector all_clips = top_sequence->GetAllClips();
+ for (int i=0;imedia() == media) {
rcmc->clips.append(c);
}
}
- olive::UndoStack.push(rcmc);
+ olive::undo_stack.push(rcmc);
QDialog::accept();
}
diff --git a/dialogs/replaceclipmediadialog.h b/dialogs/replaceclipmediadialog.h
index dd40095be..34fa9b6b1 100644
--- a/dialogs/replaceclipmediadialog.h
+++ b/dialogs/replaceclipmediadialog.h
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
diff --git a/dialogs/speeddialog.cpp b/dialogs/speeddialog.cpp
index 8a87916bc..9b7cad23e 100644
--- a/dialogs/speeddialog.cpp
+++ b/dialogs/speeddialog.cpp
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
@@ -33,7 +33,7 @@
#include "panels/timeline.h"
#include "undo/undo.h"
#include "undo/undostack.h"
-#include "effects/effect.h"
+#include "nodes/node.h"
#include "project/media.h"
SpeedDialog::SpeedDialog(QWidget *parent, QVector clips) : QDialog(parent) {
@@ -61,7 +61,7 @@ SpeedDialog::SpeedDialog(QWidget *parent, QVector clips) : QDialog(parent
grid->addWidget(new QLabel(tr("Duration:"), this), 2, 0);
duration = new LabelSlider(this);
duration->SetDisplayType(LabelSlider::FrameNumber);
- duration->SetFrameRate(olive::ActiveSequence->frame_rate);
+ duration->SetFrameRate(clips_.first()->track()->sequence()->frame_rate);
grid->addWidget(duration, 2, 1);
main_layout->addLayout(grid);
@@ -103,7 +103,7 @@ int SpeedDialog::exec() {
// get default frame rate/percentage
clip_percent = c->speed().value;
- if (c->track() < 0) {
+ if (c->type() == olive::kTypeVideo) {
bool process_video = true;
if (c->media() != nullptr && c->media()->get_type() == MEDIA_TYPE_FOOTAGE) {
FootageStream* ms = c->media_stream();
@@ -131,7 +131,7 @@ int SpeedDialog::exec() {
enable_frame_rate = true;
}
- } else {
+ } else if (c->type() == olive::kTypeAudio) {
maintain_pitch->setEnabled(true);
if (!multiple_audio) {
@@ -192,7 +192,7 @@ void SpeedDialog::percent_update() {
Clip* c = clips_.at(i);
// get frame rate
- if (frame_rate->isEnabled() && c->track() < 0) {
+ if (frame_rate->isEnabled() && c->type() == olive::kTypeVideo) {
double clip_fr = c->media_frame_rate() * percent->value();
if (got_fr) {
if (!qIsNaN(fr_val) && !qFuzzyCompare(fr_val, clip_fr)) {
@@ -236,7 +236,7 @@ void SpeedDialog::duration_update() {
}
// get frame rate
- if (frame_rate->isEnabled() && c->track() < 0) {
+ if (frame_rate->isEnabled() && c->type() == olive::kTypeVideo) {
double clip_fr = c->media_frame_rate() * clip_pc;
if (got_fr) {
if (!qIsNaN(fr_val) && !qFuzzyCompare(fr_val, clip_fr)) {
@@ -276,7 +276,7 @@ void SpeedDialog::frame_rate_update() {
old_pc_val = qSNaN();
}
- if (c->track() < 0) {
+ if (c->type() == olive::kTypeVideo) {
// what would the new speed be based on this frame rate
double new_clip_speed = frame_rate->value() / c->media_frame_rate();
if (!got_pc_val) {
@@ -301,7 +301,7 @@ void SpeedDialog::frame_rate_update() {
for (int i=0;itrack() >= 0) {
+ if (c->type() == olive::kTypeAudio) {
long new_clip_len = (qIsNaN(old_pc_val) || qIsNaN(pc_val)) ?
c->length() : qRound((c->length() * c->speed().value) / pc_val);
@@ -318,15 +318,17 @@ void SpeedDialog::frame_rate_update() {
}
void set_speed(ComboAction* ca, Clip* c, double speed, bool ripple, long& ep, long& lr) {
- panel_timeline->deselect_area(c->timeline_in(), c->timeline_out(), c->track());
+ c->track()->DeselectArea(c->timeline_in(), c->timeline_out());
long proposed_out = c->timeline_out();
double multiplier = (c->speed().value / speed);
proposed_out = qRound(c->timeline_in() + (c->length() * multiplier));
ca->append(new SetSpeedAction(c, speed));
if (!ripple && proposed_out > c->timeline_out()) {
- for (int i=0;isequence->clips.size();i++) {
- ClipPtr compare = c->sequence->clips.at(i);
+ QVector all_clips = c->track()->sequence()->GetAllClips();
+
+ for (int i=0;itrack() == c->track()
&& compare->timeline_in() >= c->timeline_out() && compare->timeline_in() < proposed_out) {
@@ -336,15 +338,16 @@ void set_speed(ComboAction* ca, Clip* c, double speed, bool ripple, long& ep, lo
}
ep = qMin(ep, c->timeline_out());
lr = qMax(lr, proposed_out - c->timeline_out());
- c->move(ca, c->timeline_in(), proposed_out, qRound(c->clip_in() * multiplier), c->track());
+ c->track()->sequence()->MoveClip(c,
+ ca,
+ c->timeline_in(),
+ proposed_out,
+ qRound(c->clip_in() * multiplier),
+ c->track());
c->refactor_frame_rate(ca, multiplier, false);
- Selection sel;
- sel.in = c->timeline_in();
- sel.out = proposed_out;
- sel.track = c->track();
- olive::ActiveSequence->selections.append(sel);
+ c->track()->SelectArea(c->timeline_in(), proposed_out);
}
void SpeedDialog::accept() {
@@ -357,8 +360,8 @@ void SpeedDialog::accept() {
SetClipProperty* reversed_action = new SetClipProperty(kSetClipPropertyReversed);
// undoable action for restoring clip selections
- SetSelectionsCommand* sel_command = new SetSelectionsCommand(olive::ActiveSequence.get());
- sel_command->old_data = olive::ActiveSequence->selections;
+ Sequence* sequence = clips_.first()->track()->sequence();
+ QVector old_selections = sequence->Selections();
// variables used to calculate ripples
long earliest_point = LONG_MAX;
@@ -373,7 +376,7 @@ void SpeedDialog::accept() {
}
// set maintain audio pitch if the user made a selection
- if (c->track() >= 0
+ if (c->type() == olive::kTypeAudio
&& maintain_pitch->checkState() != Qt::PartiallyChecked
&& c->speed().maintain_audio_pitch != maintain_pitch->isChecked()) {
audio_pitch_action->AddSetting(c, maintain_pitch->isChecked());
@@ -382,7 +385,12 @@ void SpeedDialog::accept() {
// set reverse setting if the user made a selection
if (reverse->checkState() != Qt::PartiallyChecked && c->reversed() != reverse->isChecked()) {
long new_clip_in = (c->media_length() - (c->length() + c->clip_in()));
- c->move(ca, c->timeline_in(), c->timeline_out(), new_clip_in, c->track());
+ c->track()->sequence()->MoveClip(c,
+ ca,
+ c->timeline_in(),
+ c->timeline_out(),
+ new_clip_in,
+ c->track());
c->set_clip_in(new_clip_in);
reversed_action->AddSetting(c, reverse->isChecked());
}
@@ -410,7 +418,7 @@ void SpeedDialog::accept() {
if (i > 0 && !qFuzzyCompare(cached_speed, c->speed().value)) {
can_change_all = false;
}
- if (c->track() < 0) {
+ if (c->type() == olive::kTypeVideo) {
if (qIsNaN(cached_fr)) {
cached_fr = c->media_frame_rate();
} else if (!qFuzzyCompare(cached_fr, c->media_frame_rate())) {
@@ -423,7 +431,7 @@ void SpeedDialog::accept() {
// make changes
for (int i=0;itrack() < 0) {
+ if (c->type() == olive::kTypeVideo) {
set_speed(ca, c, frame_rate->value() / c->media_frame_rate(), ripple->isChecked(), earliest_point, longest_ripple);
} else if (can_change_all) {
set_speed(ca, c, frame_rate->value() / cached_fr, ripple->isChecked(), earliest_point, longest_ripple);
@@ -438,16 +446,15 @@ void SpeedDialog::accept() {
}
if (ripple->isChecked()) {
- ripple_clips(ca, clips_.at(0)->sequence, earliest_point, longest_ripple);
+ sequence->Ripple(ca, earliest_point, longest_ripple);
}
- sel_command->new_data = olive::ActiveSequence->selections;
- ca->append(sel_command);
+ ca->append(new SetSelectionsCommand(sequence, old_selections, sequence->Selections()));
ca->append(reversed_action);
ca->append(audio_pitch_action);
- olive::UndoStack.push(ca);
+ olive::undo_stack.push(ca);
update_ui(true);
QDialog::accept();
diff --git a/dialogs/speeddialog.h b/dialogs/speeddialog.h
index 940c50525..5ef9144e6 100644
--- a/dialogs/speeddialog.h
+++ b/dialogs/speeddialog.h
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
diff --git a/dialogs/texteditdialog.cpp b/dialogs/texteditdialog.cpp
index e7a5d9fa0..fc5638f1d 100644
--- a/dialogs/texteditdialog.cpp
+++ b/dialogs/texteditdialog.cpp
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
diff --git a/dialogs/texteditdialog.h b/dialogs/texteditdialog.h
index be812dd85..ff3cd8776 100644
--- a/dialogs/texteditdialog.h
+++ b/dialogs/texteditdialog.h
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
diff --git a/effects/effect.cpp b/effects/effect.cpp
deleted file mode 100644
index 7aca89711..000000000
--- a/effects/effect.cpp
+++ /dev/null
@@ -1,1132 +0,0 @@
-/***
-
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-***/
-
-#include "effect.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "panels/panels.h"
-#include "panels/viewer.h"
-#include "ui/viewerwidget.h"
-#include "ui/collapsiblewidget.h"
-#include "panels/project.h"
-#include "undo/undo.h"
-#include "timeline/sequence.h"
-#include "timeline/clip.h"
-#include "panels/timeline.h"
-#include "panels/effectcontrols.h"
-#include "panels/grapheditor.h"
-#include "global/debug.h"
-#include "global/path.h"
-#include "ui/mainwindow.h"
-#include "global/math.h"
-#include "project/clipboard.h"
-#include "global/config.h"
-#include "transition.h"
-#include "undo/undostack.h"
-
-#include "effects/internal/transformeffect.h"
-#include "effects/internal/texteffect.h"
-#include "effects/internal/timecodeeffect.h"
-#include "effects/internal/solideffect.h"
-#include "effects/internal/audionoiseeffect.h"
-#include "effects/internal/toneeffect.h"
-#include "effects/internal/volumeeffect.h"
-#include "effects/internal/paneffect.h"
-#include "effects/internal/shakeeffect.h"
-#include "effects/internal/cornerpineffect.h"
-#include "effects/internal/vsthost.h"
-#include "effects/internal/fillleftrighteffect.h"
-#include "effects/internal/frei0reffect.h"
-#include "effects/internal/richtexteffect.h"
-
-QVector effects;
-
-EffectPtr Effect::Create(Clip* c, const EffectMeta* em) {
- if (em->internal >= 0 && em->internal < EFFECT_INTERNAL_COUNT) {
- // must be an internal effect
- switch (em->internal) {
- case EFFECT_INTERNAL_TRANSFORM: return std::make_shared(c, em);
- case EFFECT_INTERNAL_TEXT: return std::make_shared(c, em);
- case EFFECT_INTERNAL_TIMECODE: return std::make_shared(c, em);
- case EFFECT_INTERNAL_SOLID: return std::make_shared(c, em);
- case EFFECT_INTERNAL_NOISE: return std::make_shared(c, em);
- case EFFECT_INTERNAL_VOLUME: return std::make_shared(c, em);
- case EFFECT_INTERNAL_PAN: return std::make_shared(c, em);
- case EFFECT_INTERNAL_TONE: return std::make_shared(c, em);
- case EFFECT_INTERNAL_SHAKE: return std::make_shared(c, em);
- case EFFECT_INTERNAL_CORNERPIN: return std::make_shared(c, em);
- case EFFECT_INTERNAL_FILLLEFTRIGHT: return std::make_shared(c, em);
- case EFFECT_INTERNAL_VST: return std::make_shared(c, em);
-#ifndef NOFREI0R
- case EFFECT_INTERNAL_FREI0R: return std::make_shared(c, em);
-#endif
- case EFFECT_INTERNAL_RICHTEXT: return std::make_shared(c, em);
- }
- } else if (!em->filename.isEmpty()) {
- // load effect from file
- return std::make_shared(c, em);
- } else {
- qCritical() << "Invalid effect data";
- QMessageBox::critical(olive::MainWindow,
- QCoreApplication::translate("Effect", "Invalid effect"),
- QCoreApplication::translate("Effect", "No candidate for effect '%1'. This effect may be corrupt. Try reinstalling it or Olive.").arg(em->name));
- }
- return nullptr;
-}
-
-const EffectMeta* Effect::GetInternalMeta(int internal_id, int type) {
- for (int i=0;iname;
-
- if (!em->filename.isEmpty() && em->internal == -1) {
- QFile effect_file(em->filename);
- if (effect_file.open(QFile::ReadOnly)) {
- QXmlStreamReader reader(&effect_file);
-
- while (!reader.atEnd()) {
- if (reader.name() == "row" && reader.isStartElement()) {
- QString row_name;
- const QXmlStreamAttributes& attributes = reader.attributes();
- for (int i=0;ifilename << "- ID cannot be empty.";
- } else {
- EffectField* field = nullptr;
-
- switch (type) {
- case EffectField::EFFECT_FIELD_DOUBLE:
- {
-
- DoubleField* double_field = new DoubleField(row, id);
-
- for (int i=0;iSetDefault(attr.value().toDouble());
- } else if (attr.name() == "min") {
- double_field->SetMinimum(attr.value().toDouble());
- } else if (attr.name() == "max") {
- double_field->SetMaximum(attr.value().toDouble());
- }
- }
-
- field = double_field;
- }
- break;
- case EffectField::EFFECT_FIELD_COLOR:
- {
- QColor color;
-
- field = new ColorField(row, id);
-
- for (int i=0;iSetValueAt(0, color);
- }
- break;
- case EffectField::EFFECT_FIELD_STRING:
- field = new StringField(row, id);
- for (int i=0;iSetValueAt(0, attr.value().toString());
- }
- }
- break;
- case EffectField::EFFECT_FIELD_BOOL:
- field = new BoolField(row, id);
- for (int i=0;iSetValueAt(0, attr.value() == "1");
- }
- }
- break;
- case EffectField::EFFECT_FIELD_COMBO:
- {
- ComboField* combo_field = new ComboField(row, id);
- int combo_default_index = 0;
- for (int i=0;iAddItem(reader.text().toString(), combo_item_count);
- combo_item_count++;
- }
- }
- combo_field->SetValueAt(0, combo_default_index);
- field = combo_field;
- }
- break;
- case EffectField::EFFECT_FIELD_FONT:
- field = new FontField(row, id);
- for (int i=0;iSetValueAt(0, attr.value().toString());
- }
- }
- break;
- case EffectField::EFFECT_FIELD_FILE:
- field = new FileField(row, id);
- for (int i=0;iSetValueAt(0, attr.value().toString());
- }
- }
- break;
- }
- }
- }
- }
- }
- } else if (reader.name() == "shader" && reader.isStartElement()) {
- SetFlags(Flags() | ShaderFlag);
- const QXmlStreamAttributes& attributes = reader.attributes();
- for (int i=0;ifilename;
- enable_superimpose = false;
- }
- break;
- }
- }
- }*/
- reader.readNext();
- }
-
- effect_file.close();
- } else {
- qCritical() << "Failed to open effect file" << em->filename;
- }
- }
- }
-}
-
-Effect::~Effect() {
- if (isOpen) {
- close();
- }
-
- // Clear graph editor if it's using one of these rows
- if (panel_graph_editor != nullptr) {
- for (int i=0;iget_row()) {
- panel_graph_editor->set_row(nullptr);
- break;
- }
- }
- }
-}
-
-void Effect::AddRow(EffectRow *row)
-{
- row->setParent(this);
- rows.append(row);
-}
-
-void Effect::copy_field_keyframes(EffectPtr e) {
- for (int i=0;irows.at(i);
- copy_row->SetKeyframingInternal(row->IsKeyframing());
- for (int j=0;jFieldCount();j++) {
- // Get field from this (the source) effect
- EffectField* field = row->Field(j);
-
- // Get field from the destination effect
- EffectField* copy_field = copy_row->Field(j);
-
- // Copy keyframes between effects
- copy_field->keyframes = field->keyframes;
-
- // Copy persistet data between effects
- copy_field->persistent_data_ = field->persistent_data_;
- }
- }
-}
-
-EffectRow* Effect::row(int i) {
- return rows.at(i);
-}
-
-int Effect::row_count() {
- return rows.size();
-}
-
-EffectGizmo *Effect::add_gizmo(int type) {
- EffectGizmo* gizmo = new EffectGizmo(this, type);
- gizmos.append(gizmo);
- return gizmo;
-}
-
-EffectGizmo *Effect::gizmo(int i) {
- return gizmos.at(i);
-}
-
-int Effect::gizmo_count() {
- return gizmos.size();
-}
-
-void Effect::refresh() {}
-
-void Effect::FieldChanged() {
- update_ui(false);
-}
-
-void Effect::delete_self() {
- olive::UndoStack.push(new EffectDeleteCommand(this));
- update_ui(true);
-}
-
-void Effect::move_up() {
- int index_of_effect = parent_clip->IndexOfEffect(this);
- if (index_of_effect == 0) {
- return;
- }
-
- MoveEffectCommand* command = new MoveEffectCommand();
- command->clip = parent_clip;
- command->from = index_of_effect;
- command->to = command->from - 1;
- olive::UndoStack.push(command);
- panel_effect_controls->Reload();
- panel_sequence_viewer->viewer_widget->frame_update();
-}
-
-void Effect::move_down() {
- int index_of_effect = parent_clip->IndexOfEffect(this);
- if (index_of_effect == parent_clip->effects.size()-1) {
- return;
- }
-
- MoveEffectCommand* command = new MoveEffectCommand();
- command->clip = parent_clip;
- command->from = index_of_effect;
- command->to = command->from + 1;
- olive::UndoStack.push(command);
- panel_effect_controls->Reload();
- panel_sequence_viewer->viewer_widget->frame_update();
-}
-
-void Effect::save_to_file() {
- // save effect settings to file
- QString file = QFileDialog::getSaveFileName(olive::MainWindow,
- tr("Save Effect Settings"),
- QString(),
- tr("Effect XML Settings %1").arg("(*.xml)"));
-
- // if the user picked a file
- if (!file.isEmpty()) {
-
- // ensure file ends with .xml extension
- if (!file.endsWith(".xml", Qt::CaseInsensitive)) {
- file.append(".xml");
- }
-
- QFile file_handle(file);
- if (file_handle.open(QFile::WriteOnly)) {
-
- file_handle.write(save_to_string());
-
- file_handle.close();
- } else {
- QMessageBox::critical(olive::MainWindow,
- tr("Save Settings Failed"),
- tr("Failed to open \"%1\" for writing.").arg(file),
- QMessageBox::Ok);
- }
- }
-}
-
-void Effect::load_from_file() {
- // load effect settings from file
- QString file = QFileDialog::getOpenFileName(olive::MainWindow,
- tr("Load Effect Settings"),
- QString(),
- tr("Effect XML Settings %1").arg("(*.xml)"));
-
- // if the user picked a file
- if (!file.isEmpty()) {
- QFile file_handle(file);
- if (file_handle.open(QFile::ReadOnly)) {
-
- olive::UndoStack.push(new SetEffectData(this, file_handle.readAll()));
-
- file_handle.close();
-
- update_ui(false);
- } else {
- QMessageBox::critical(olive::MainWindow,
- tr("Load Settings Failed"),
- tr("Failed to open \"%1\" for reading.").arg(file),
- QMessageBox::Ok);
- }
- }
-}
-
-bool Effect::AlwaysUpdate()
-{
- return false;
-}
-
-bool Effect::IsEnabled() {
- return enabled_;
-}
-
-bool Effect::IsExpanded()
-{
- return expanded_;
-}
-
-void Effect::SetExpanded(bool e)
-{
- expanded_ = e;
-}
-
-void Effect::SetEnabled(bool b) {
- enabled_ = b;
- emit EnabledChanged(b);
-}
-
-void Effect::load(QXmlStreamReader& stream) {
- int row_count = 0;
-
- QString tag = stream.name().toString();
-
- while (!stream.atEnd() && !(stream.name() == tag && stream.isEndElement())) {
- stream.readNext();
- if (stream.name() == "row" && stream.isStartElement()) {
- if (row_count < rows.size()) {
- EffectRow* row = rows.at(row_count);
-
- while (!stream.atEnd() && !(stream.name() == "row" && stream.isEndElement())) {
- stream.readNext();
-
- // read field
- if (stream.name() == "field" && stream.isStartElement()) {
- int field_number = -1;
-
- // match field using ID
- for (int k=0;kFieldCount();l++) {
- if (row->Field(l)->id() == attr.value()) {
- field_number = l;
- break;
- }
- }
- break;
- }
- }
-
- if (field_number > -1) {
- EffectField* field = row->Field(field_number);
-
- // get current field value
- for (int k=0;kpersistent_data_ = field->ConvertStringToValue(attr.value().toString());
- break;
- }
- }
-
- while (!stream.atEnd() && !(stream.name() == "field" && stream.isEndElement())) {
- stream.readNext();
-
- // read keyframes
- if (stream.name() == "key" && stream.isStartElement()) {
- row->SetKeyframingInternal(true);
-
- EffectKeyframe key;
- for (int k=0;kConvertStringToValue(attr.value().toString());
- } else if (attr.name() == "frame") {
- key.time = attr.value().toLong();
- } else if (attr.name() == "type") {
- key.type = attr.value().toInt();
- } else if (attr.name() == "prehx") {
- key.pre_handle_x = attr.value().toDouble();
- } else if (attr.name() == "prehy") {
- key.pre_handle_y = attr.value().toDouble();
- } else if (attr.name() == "posthx") {
- key.post_handle_x = attr.value().toDouble();
- } else if (attr.name() == "posthy") {
- key.post_handle_y = attr.value().toDouble();
- }
- }
- field->keyframes.append(key);
- }
- }
-
- field->Changed();
-
- }
- }
- }
-
- } else {
- qCritical() << "Too many rows for effect" << id << ". Project might be corrupt. (Got" << row_count << ", expected <" << rows.size()-1 << ")";
- }
- row_count++;
- } else if (stream.isStartElement()) {
- custom_load(stream);
- }
- }
-}
-
-void Effect::custom_load(QXmlStreamReader &) {}
-
-void Effect::save(QXmlStreamWriter& stream) {
- stream.writeAttribute("name", meta->category + "/" + meta->name);
- stream.writeAttribute("enabled", QString::number(IsEnabled()));
-
- for (int i=0;iIsSavable()) {
- stream.writeStartElement("row"); // row
- for (int j=0;jFieldCount();j++) {
- EffectField* field = row->Field(j);
-
- if (!field->id().isEmpty()) {
- stream.writeStartElement("field"); // field
- stream.writeAttribute("id", field->id());
- stream.writeAttribute("value", field->ConvertValueToString(field->persistent_data_));
- for (int k=0;kkeyframes.size();k++) {
- const EffectKeyframe& key = field->keyframes.at(k);
- stream.writeStartElement("key");
- stream.writeAttribute("value", field->ConvertValueToString(key.data));
- stream.writeAttribute("frame", QString::number(key.time));
- stream.writeAttribute("type", QString::number(key.type));
- stream.writeAttribute("prehx", QString::number(key.pre_handle_x));
- stream.writeAttribute("prehy", QString::number(key.pre_handle_y));
- stream.writeAttribute("posthx", QString::number(key.post_handle_x));
- stream.writeAttribute("posthy", QString::number(key.post_handle_y));
- stream.writeEndElement(); // key
- }
- stream.writeEndElement(); // field
- }
- }
- stream.writeEndElement(); // row
- }
- }
-}
-
-void Effect::load_from_string(const QByteArray &s) {
- // clear existing keyframe data
- for (int i=0;iSetKeyframingInternal(false);
- for (int j=0;jFieldCount();j++) {
- EffectField* field = row->Field(j);
- field->keyframes.clear();
- }
- }
-
- // write settings with xml writer
- QXmlStreamReader stream(s);
-
- while (!stream.atEnd()) {
- stream.readNext();
-
- // find the effect opening tag
- if (stream.name() == "effect" && stream.isStartElement()) {
-
- // check the name to see if it matches this effect
- const QXmlStreamAttributes& attributes = stream.attributes();
- for (int i=0;ipath.isEmpty() || (vertPath.isEmpty() && fragPath.isEmpty())) return;
- QList effects_paths = get_effects_paths();
- const QString& test_fn = vertPath.isEmpty() ? fragPath : vertPath;
- for (int i=0;iaddShaderFromSourceFile(QOpenGLShader::Vertex, meta->path + "/" + vertPath)) {
- qInfo() << "Vertex shader added successfully";
- } else {
- glsl_compiled = false;
- qWarning() << "Vertex shader could not be added";
- }
- }
- if (!fragPath.isEmpty()) {
- if (glslProgram->addShaderFromSourceFile(QOpenGLShader::Fragment, meta->path + "/" + fragPath)) {
- qInfo() << "Fragment shader added successfully";
- } else {
- glsl_compiled = false;
- qWarning() << "Fragment shader could not be added";
- }
- }
- if (glsl_compiled) {
- if (glslProgram->link()) {
- qInfo() << "Shader program linked successfully";
- } else {
- qWarning() << "Shader program failed to link";
- }
- }
- isOpen = true;
- }
- } else {
- isOpen = true;
- }
-}
-
-void Effect::close() {
- if (!isOpen) {
- qWarning() << "Tried to close an effect that was already closed";
- }
- delete_texture();
- if (glslProgram != nullptr) {
- delete glslProgram;
- glslProgram = nullptr;
- }
- isOpen = false;
-}
-
-bool Effect::is_glsl_linked() {
- return glslProgram != nullptr && glslProgram->isLinked();
-}
-
-void Effect::startEffect() {
- if (!isOpen) {
- open();
- qWarning() << "Tried to start a closed effect - opening";
- }
- if (olive::CurrentRuntimeConfig.shaders_are_enabled
- && (Flags() & Effect::ShaderFlag)
- && glslProgram->isLinked()) {
- bound = glslProgram->bind();
- }
-}
-
-void Effect::endEffect() {
- if (bound) {
- glslProgram->release();
- }
- bound = false;
-}
-
-int Effect::Flags()
-{
- return flags_;
-}
-
-void Effect::SetFlags(int flags)
-{
- flags_ = flags;
-}
-
-int Effect::getIterations() {
- return iterations;
-}
-
-void Effect::setIterations(int i) {
- iterations = i;
-}
-
-void Effect::process_image(double, uint8_t *, uint8_t *, int){}
-
-EffectPtr Effect::copy(Clip *c) {
- EffectPtr copy = Effect::Create(c, meta);
- copy->SetEnabled(IsEnabled());
- copy_field_keyframes(copy);
- return copy;
-}
-
-void Effect::process_shader(double timecode, GLTextureCoords&, int iteration) {
- glslProgram->setUniformValue("resolution", parent_clip->media_width(), parent_clip->media_height());
- glslProgram->setUniformValue("time", GLfloat(timecode));
- glslProgram->setUniformValue("iteration", iteration);
-
- for (int i=0;iFieldCount();j++) {
- EffectField* field = row->Field(j);
- if (!field->id().isEmpty()) {
- switch (field->type()) {
- case EffectField::EFFECT_FIELD_DOUBLE:
- {
- DoubleField* double_field = static_cast(field);
- glslProgram->setUniformValue(double_field->id().toUtf8().constData(),
- GLfloat(double_field->GetDoubleAt(timecode)));
- }
- break;
- case EffectField::EFFECT_FIELD_COLOR:
- {
- ColorField* color_field = static_cast(field);
- glslProgram->setUniformValue(
- color_field->id().toUtf8().constData(),
- GLfloat(color_field->GetColorAt(timecode).redF()),
- GLfloat(color_field->GetColorAt(timecode).greenF()),
- GLfloat(color_field->GetColorAt(timecode).blueF())
- );
- }
- break;
- case EffectField::EFFECT_FIELD_BOOL:
- glslProgram->setUniformValue(field->id().toUtf8().constData(), field->GetValueAt(timecode).toBool());
- break;
- case EffectField::EFFECT_FIELD_COMBO:
- glslProgram->setUniformValue(field->id().toUtf8().constData(), field->GetValueAt(timecode).toInt());
- break;
-
- // can you even send a string to a uniform value?
- case EffectField::EFFECT_FIELD_STRING:
- case EffectField::EFFECT_FIELD_FONT:
- case EffectField::EFFECT_FIELD_FILE:
- case EffectField::EFFECT_FIELD_UI:
- break;
- }
- }
- }
- }
-}
-
-void Effect::process_coords(double, GLTextureCoords&, int) {}
-
-GLuint Effect::process_superimpose(double timecode) {
- bool dimensions_changed = false;
- bool redrew_image = false;
-
- int width = parent_clip->media_width();
- int height = parent_clip->media_height();
-
- if (width != img.width() || height != img.height()) {
- img = QImage(width, height, QImage::Format_RGBA8888_Premultiplied);
- dimensions_changed = true;
- }
-
- if (valueHasChanged(timecode) || dimensions_changed || AlwaysUpdate()) {
- redraw(timecode);
- redrew_image = true;
- }
-
- if (texture == nullptr || texture->width() != img.width() || texture->height() != img.height()) {
-
- delete_texture();
-
- texture = new QOpenGLTexture(QOpenGLTexture::Target2D);
- texture->setSize(img.width(), img.height());
- texture->setFormat(QOpenGLTexture::RGBA8_UNorm);
- texture->setMipLevels(texture->maximumMipLevels());
- texture->setMinMagFilters(QOpenGLTexture::Linear, QOpenGLTexture::Linear);
- texture->allocateStorage(QOpenGLTexture::RGBA, QOpenGLTexture::UInt8);
-
- redrew_image = true;
-
- }
-
- if (redrew_image) {
- texture->setData(0, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8, img.constBits());
- }
-
- return texture->textureId();
-}
-
-void Effect::process_audio(double, double, quint8*, int, int) {}
-
-void Effect::gizmo_draw(double, GLTextureCoords &) {}
-
-void Effect::gizmo_move(EffectGizmo* gizmo, int x_movement, int y_movement, double timecode, bool done) {
- // Loop through each gizmo to find `gizmo`
- for (int i=0;ix_field1 != nullptr) {
- gizmo_dragging_actions_.append(new KeyframeDataChange(gizmo->x_field1));
- }
- if (gizmo->y_field1 != nullptr) {
- gizmo_dragging_actions_.append(new KeyframeDataChange(gizmo->y_field1));
- }
- if (gizmo->x_field2 != nullptr) {
- gizmo_dragging_actions_.append(new KeyframeDataChange(gizmo->x_field2));
- }
- if (gizmo->y_field2 != nullptr) {
- gizmo_dragging_actions_.append(new KeyframeDataChange(gizmo->y_field2));
- }
- }
-
- // Update the field values
- if (gizmo->x_field1 != nullptr) {
- gizmo->x_field1->SetValueAt(timecode,
- gizmo->x_field1->GetDoubleAt(timecode) + x_movement*gizmo->x_field_multi1);
- }
- if (gizmo->y_field1 != nullptr) {
- gizmo->y_field1->SetValueAt(timecode,
- gizmo->y_field1->GetDoubleAt(timecode) + y_movement*gizmo->y_field_multi1);
- }
- if (gizmo->x_field2 != nullptr) {
- gizmo->x_field2->SetValueAt(timecode,
- gizmo->x_field2->GetDoubleAt(timecode) + x_movement*gizmo->x_field_multi2);
- }
- if (gizmo->y_field2 != nullptr) {
- gizmo->y_field2->SetValueAt(timecode,
- gizmo->y_field2->GetDoubleAt(timecode) + y_movement*gizmo->y_field_multi2);
- }
-
- // If (done && !gizmo_dragging_actions_.isEmpty()), that means the drag just ended and we're going to save
- // the new state of the attach fields' keyframes in KeyframeDataChange objects to make the changes undoable
- // by the user later.
- if (done && !gizmo_dragging_actions_.isEmpty()) {
-
- // Store all the KeyframeDataChange objects into a ComboAction to send to the undo stack (makes them all
- // undoable together rather than having to be undone individually).
- ComboAction* ca = new ComboAction();
-
- for (int j=0;jSetNewKeyframes();
-
- // Add this KeyframeDataChange object to the ComboAction
- ca->append(gizmo_dragging_actions_.at(j));
- }
-
- olive::UndoStack.push(ca);
-
- gizmo_dragging_actions_.clear();
- }
- break;
- }
- }
-}
-
-void Effect::gizmo_world_to_screen() {
- GLfloat view_val[16];
- GLfloat projection_val[16];
- glGetFloatv(GL_MODELVIEW_MATRIX, view_val);
- glGetFloatv(GL_PROJECTION_MATRIX, projection_val);
-
- QMatrix4x4 view_matrix(view_val);
- QMatrix4x4 projection_matrix(projection_val);
-
- for (int i=0;iget_point_count();j++) {
- QVector4D screen_pos = QVector4D(g->world_pos[j].x(), g->world_pos[j].y(), 0, 1.0) * (view_matrix * projection_matrix);
-
- int adjusted_sx1 = qRound(((screen_pos.x()*0.5f)+0.5f)*parent_clip->sequence->width);
- int adjusted_sy1 = qRound((1.0f-((screen_pos.y()*0.5f)+0.5f))*parent_clip->sequence->height);
-
- g->screen_pos[j] = QPoint(adjusted_sx1, adjusted_sy1);
- }
- }
-}
-
-bool Effect::are_gizmos_enabled() {
- return (gizmos.size() > 0);
-}
-
-void Effect::redraw(double) {
- /*
- // run javascript
- QPainter p(&img);
- painter_wrapper.img = &img;
- painter_wrapper.painter = &p;
-
- jsEngine.globalObject().setProperty("painter", wrapper_obj);
- jsEngine.globalObject().setProperty("width", parent_clip->media_width());
- jsEngine.globalObject().setProperty("height", parent_clip->media_height());
-
- for (int i=0;ifieldCount();j++) {
- EffectField* field = row->field(j);
- if (!field->id.isEmpty()) {
- switch (field->type) {
- case EFFECT_FIELD_DOUBLE:
- jsEngine.globalObject().setProperty(field->id, field->get_double_value(timecode));
- break;
- case EFFECT_FIELD_COLOR:
- jsEngine.globalObject().setProperty(field->id, field->get_color_value(timecode).name());
- break;
- case EFFECT_FIELD_STRING:
- jsEngine.globalObject().setProperty(field->id, field->get_string_value(timecode));
- break;
- case EFFECT_FIELD_BOOL:
- jsEngine.globalObject().setProperty(field->id, field->get_bool_value(timecode));
- break;
- case EFFECT_FIELD_COMBO:
- jsEngine.globalObject().setProperty(field->id, field->get_combo_index(timecode));
- break;
- case EFFECT_FIELD_FONT:
- jsEngine.globalObject().setProperty(field->id, field->get_font_name(timecode));
- break;
- }
- }
- }
- }
-
- jsEngine.evaluate(script);
- */
-}
-
-bool Effect::valueHasChanged(double timecode) {
- if (cachedValues.size() == 0) {
-
- for (int i=0;iFieldCount();j++) {
- cachedValues.append(crow->Field(j)->GetValueAt(timecode));
- }
- }
- return true;
-
- } else {
-
- bool changed = false;
- int index = 0;
- for (int i=0;iFieldCount();j++) {
- EffectField* field = crow->Field(j);
- if (cachedValues.at(index) != field->GetValueAt(timecode)) {
- changed = true;
- }
- cachedValues[index] = field->GetValueAt(timecode);
- index++;
- }
- }
- return changed;
-
- }
-}
-
-void Effect::delete_texture() {
- delete texture;
- texture = nullptr;
-}
-
-const EffectMeta* get_meta_from_name(const QString& input) {
- int split_index = input.indexOf('/');
- QString category;
- if (split_index > -1) {
- category = input.left(split_index);
- }
- QString name = input.mid(split_index + 1);
-
- for (int j=0;j(a) + static_cast(b);
- mixed_sample = qMax(qMin(mixed_sample, static_cast(INT16_MAX)), static_cast(INT16_MIN));
- return static_cast(mixed_sample);
-}
diff --git a/effects/effect.h b/effects/effect.h
deleted file mode 100644
index 77c42f51b..000000000
--- a/effects/effect.h
+++ /dev/null
@@ -1,262 +0,0 @@
-/***
-
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-***/
-
-#ifndef EFFECT_H
-#define EFFECT_H
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "ui/collapsiblewidget.h"
-#include "effectrow.h"
-#include "effectgizmo.h"
-
-class Clip;
-
-class Effect;
-using EffectPtr = std::shared_ptr;
-
-struct EffectMeta {
- QString name;
- QString category;
- QString filename;
- QString path;
- QString tooltip;
- int internal;
- int type;
- int subtype;
-};
-extern QVector effects;
-
-double log_volume(double linear);
-
-enum EffectType {
- EFFECT_TYPE_INVALID,
- EFFECT_TYPE_VIDEO,
- EFFECT_TYPE_AUDIO,
- EFFECT_TYPE_EFFECT,
- EFFECT_TYPE_TRANSITION
-};
-
-enum EffectKeyframeType {
- EFFECT_KEYFRAME_LINEAR,
- EFFECT_KEYFRAME_BEZIER,
- EFFECT_KEYFRAME_HOLD
-};
-
-enum EffectInternal {
- EFFECT_INTERNAL_TRANSFORM,
- EFFECT_INTERNAL_TEXT,
- EFFECT_INTERNAL_SOLID,
- EFFECT_INTERNAL_NOISE,
- EFFECT_INTERNAL_VOLUME,
- EFFECT_INTERNAL_PAN,
- EFFECT_INTERNAL_TONE,
- EFFECT_INTERNAL_SHAKE,
- EFFECT_INTERNAL_TIMECODE,
- EFFECT_INTERNAL_MASK,
- EFFECT_INTERNAL_FILLLEFTRIGHT,
- EFFECT_INTERNAL_VST,
- EFFECT_INTERNAL_CORNERPIN,
- EFFECT_INTERNAL_FREI0R,
- EFFECT_INTERNAL_RICHTEXT,
- EFFECT_INTERNAL_COUNT
-};
-
-struct GLTextureCoords {
- int grid_size;
-
- int vertexTopLeftX;
- int vertexTopLeftY;
- int vertexTopLeftZ;
- int vertexTopRightX;
- int vertexTopRightY;
- int vertexTopRightZ;
- int vertexBottomLeftX;
- int vertexBottomLeftY;
- int vertexBottomLeftZ;
- int vertexBottomRightX;
- int vertexBottomRightY;
- int vertexBottomRightZ;
-
- float textureTopLeftX;
- float textureTopLeftY;
- float textureTopLeftQ;
- float textureTopRightX;
- float textureTopRightY;
- float textureTopRightQ;
- float textureBottomRightX;
- float textureBottomRightY;
- float textureBottomRightQ;
- float textureBottomLeftX;
- float textureBottomLeftY;
- float textureBottomLeftQ;
-
- int blendmode;
- float opacity;
-};
-
-const EffectMeta* get_meta_from_name(const QString& input);
-
-qint16 mix_audio_sample(qint16 a, qint16 b);
-
-class Effect : public QObject {
- Q_OBJECT
-public:
- Effect(Clip *c, const EffectMeta* em);
- ~Effect();
-
- Clip* parent_clip;
- const EffectMeta* meta;
- int id;
- QString name;
-
- void AddRow(EffectRow* row);
-
- EffectRow* row(int i);
- int row_count();
-
- EffectGizmo* add_gizmo(int type);
- EffectGizmo* gizmo(int i);
- int gizmo_count();
-
- bool IsEnabled();
- bool IsExpanded();
-
- virtual void refresh();
-
- virtual EffectPtr copy(Clip* c);
- void copy_field_keyframes(EffectPtr e);
-
- virtual void load(QXmlStreamReader& stream);
- virtual void custom_load(QXmlStreamReader& stream);
- virtual void save(QXmlStreamWriter& stream);
-
- void load_from_string(const QByteArray &s);
- QByteArray save_to_string();
-
- // glsl handling
- bool is_open();
- void open();
- void close();
- bool is_glsl_linked();
- virtual void startEffect();
- virtual void endEffect();
-
- enum VideoEffectFlags {
- ShaderFlag = 0x1,
- CoordsFlag = 0x2,
- SuperimposeFlag = 0x4,
- ImageFlag = 0x8
- };
- int Flags();
- void SetFlags(int flags);
-
- int getIterations();
- void setIterations(int i);
-
- const char* ffmpeg_filter;
-
- virtual void process_image(double timecode, uint8_t* input, uint8_t* output, int size);
- virtual void process_shader(double timecode, GLTextureCoords&, int iteration);
- virtual void process_coords(double timecode, GLTextureCoords& coords, int data);
- virtual GLuint process_superimpose(double timecode);
- virtual void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
-
- virtual void gizmo_draw(double timecode, GLTextureCoords& coords);
- void gizmo_move(EffectGizmo* sender, int x_movement, int y_movement, double timecode, bool done);
- void gizmo_world_to_screen();
- bool are_gizmos_enabled();
-
- template
- T randomNumber()
- {
- static std::random_device device;
- static std::mt19937 generator(device());
- static std::uniform_int_distribution<> distribution(std::numeric_limits::min(), std::numeric_limits::max());
- return distribution(generator);
- }
-
- static EffectPtr Create(Clip *c, const EffectMeta *em);
- static const EffectMeta* GetInternalMeta(int internal_id, int type);
-public slots:
- void FieldChanged();
- void SetEnabled(bool b);
- void SetExpanded(bool e);
-signals:
- void EnabledChanged(bool);
-private slots:
- void delete_self();
- void move_up();
- void move_down();
- void save_to_file();
- void load_from_file();
-protected:
- // glsl effect
- QOpenGLShaderProgram* glslProgram;
- QString vertPath;
- QString fragPath;
-
- // superimpose effect
- QImage img;
- QOpenGLTexture* texture;
-
- // enable effect to update constantly
- virtual bool AlwaysUpdate();
-
-private:
- bool isOpen;
- QVector rows;
- QVector gizmos;
- bool bound;
- int iterations;
-
- bool enabled_;
- bool expanded_;
-
- int flags_;
-
- QVector gizmo_dragging_actions_;
-
- // superimpose functions
- virtual void redraw(double timecode);
- bool valueHasChanged(double timecode);
- QVector cachedValues;
- void delete_texture();
- void validate_meta_path();
-};
-
-#endif // EFFECT_H
diff --git a/effects/effectfield.cpp b/effects/effectfield.cpp
index e09723088..5968d7577 100644
--- a/effects/effectfield.cpp
+++ b/effects/effectfield.cpp
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
@@ -24,33 +24,23 @@
#include
#include "rendering/renderfunctions.h"
-
#include "global/config.h"
-
+#include "global/timing.h"
#include "effects/effectrow.h"
-#include "effects/effect.h"
-
+#include "nodes/node.h"
#include "undo/undo.h"
#include "timeline/clip.h"
#include "timeline/sequence.h"
-
#include "global/math.h"
-
#include "global/debug.h"
-EffectField::EffectField(EffectRow* parent, const QString &i, EffectFieldType t) :
+EffectField::EffectField(EffectRow* parent, EffectFieldType t) :
QObject(parent),
type_(t),
- id_(i),
- enabled_(true),
- colspan_(1)
+ enabled_(true)
{
// EffectField MUST be created with a parent.
Q_ASSERT(parent != nullptr);
- Q_ASSERT(!i.isEmpty() || t == EFFECT_FIELD_UI);
-
- // Add this field to the parent row specified
- parent->AddField(this);
// Set a very base default value
SetValueAt(0, 0);
@@ -64,17 +54,6 @@ EffectRow *EffectField::GetParentRow()
return static_cast(parent());
}
-int EffectField::GetColumnSpan()
-{
- return colspan_;
-}
-
-void EffectField::SetColumnSpan(int i)
-{
- Q_ASSERT(i >= 1);
- colspan_ = i;
-}
-
QVariant EffectField::ConvertStringToValue(const QString &s)
{
return s;
@@ -175,7 +154,9 @@ QVariant EffectField::GetValueAt(double timecode)
} else {
QColor before_data = keyframes.at(before_keyframe).data.value();
QColor after_data = keyframes.at(after_keyframe).data.value();
- value = QColor(lerp(before_data.red(), after_data.red(), progress), lerp(before_data.green(), after_data.green(), progress), lerp(before_data.blue(), after_data.blue(), progress));
+ value = QColor(lerp(before_data.red(), after_data.red(), progress),
+ lerp(before_data.green(), after_data.green(), progress),
+ lerp(before_data.blue(), after_data.blue(), progress));
}
persistent_data_ = value;
break;
@@ -234,18 +215,6 @@ void EffectField::SetValueAt(double time, const QVariant &value)
emit Changed();
}
-double EffectField::Now()
-{
- Clip* c = GetParentRow()->GetParentEffect()->parent_clip;
- return playhead_to_clip_seconds(c, c->sequence->playhead);
-}
-
-long EffectField::NowInFrames()
-{
- Clip* c = GetParentRow()->GetParentEffect()->parent_clip;
- return playhead_to_clip_frame(c, c->sequence->playhead);
-}
-
void EffectField::PrepareDataForKeyframing(bool enabled, ComboAction *ca)
{
if (enabled) {
@@ -253,7 +222,7 @@ void EffectField::PrepareDataForKeyframing(bool enabled, ComboAction *ca)
// Create keyframe from perpetual data
EffectKeyframe key;
- key.time = NowInFrames();
+ key.time = GetParentRow()->GetParentEffect()->NowInFrames();
key.data = persistent_data_;
key.type = EFFECT_KEYFRAME_LINEAR;
@@ -266,7 +235,7 @@ void EffectField::PrepareDataForKeyframing(bool enabled, ComboAction *ca)
// Convert keyframes to one "perpetual" keyframe
// Set first keyframe to whatever the data is now
- ca->append(new SetQVariant(&persistent_data_, persistent_data_, GetValueAt(Now())));
+ ca->append(new SetQVariant(&persistent_data_, persistent_data_, GetValueAt(GetParentRow()->GetParentEffect()->Now())));
// Delete all keyframes
for (int i=0;iGetParentEffect()->parent_clip->sequence->frame_rate);
+ return (double(frame) / GetParentRow()->GetParentEffect()->parent_clip->track()->sequence()->frame_rate);
}
long EffectField::SecondsToFrame(double seconds) {
- return qRound(seconds * GetParentRow()->GetParentEffect()->parent_clip->sequence->frame_rate);
+ return qRound(seconds * GetParentRow()->GetParentEffect()->parent_clip->track()->sequence()->frame_rate);
}
void EffectField::GetKeyframeData(double timecode, int &before, int &after, double &progress) {
diff --git a/effects/effectfield.h b/effects/effectfield.h
index 9d5dae487..e72e3d685 100644
--- a/effects/effectfield.h
+++ b/effects/effectfield.h
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
@@ -26,8 +26,8 @@
#include
#include "effects/keyframe.h"
-#include "undo/undo.h"
#include "undo/undostack.h"
+#include "nodes/nodedatatypes.h"
class EffectRow;
class ComboAction;
@@ -56,6 +56,7 @@ class ComboAction;
class EffectField : public QObject {
Q_OBJECT
public:
+
/**
* @brief The EffectFieldType enum
*
@@ -101,18 +102,11 @@ public:
* using the QObject parent/child system to automate memory management. EffectFields are never expected
* to change parent during their lifetime.
*
- * @param i
- *
- * Field ID. Must be non-empty. Must also be unique within this Effect. Used for saving/loading values into project
- * files so that if ordering of fields are changed, or fields are added/removed from Effects later in development,
- * saved values in project files will still link with the correct field. Also used as the uniform variable name
- * in GLSL shaders.
- *
* @param t
*
* The type of data contained within this field. This is expected to be filled by a derived class.
*/
- EffectField(EffectRow* parent, const QString& i, EffectFieldType t);
+ EffectField(EffectRow* parent, EffectFieldType t);
/**
* @brief Get the EffectRow that this field is a member of.
@@ -134,15 +128,6 @@ public:
*/
const EffectFieldType& type();
- /**
- * @brief Get the unique identifier of this field set in the constructor
- *
- * Mostly used for saving/loading or interacting with GLSL-based shader effects (see EffectField() for more details).
- *
- * @return
- */
- const QString& id();
-
/**
* @brief Get the value of this field at a given timecode
*
@@ -193,18 +178,6 @@ public:
*/
void SetValueAt(double time, const QVariant& value);
- /**
- * @brief Get the current clip/media time
- *
- * A convenience function that can be plugged into GetValueAt() to get the value wherever the appropriate Sequence's
- * playhead it.
- *
- * @return
- *
- * Current clip/media time in seconds.
- */
- double Now();
-
/**
* @brief Set up keyframing on this field
*
@@ -228,30 +201,6 @@ public:
*/
void PrepareDataForKeyframing(bool enabled, ComboAction* ca);
- /**
- * @brief Get field's column span
- *
- * Used whenever constructing the effect's UI. EffectFields are visually laid out in a table, and some widgets can
- * be set to take up multiple columns for a better visual flow.
- *
- * @return
- *
- * The current column span.
- */
- int GetColumnSpan();
-
- /**
- * @brief Set field's column span
- *
- * Used whenever constructing the effect's UI. EffectFields are visually laid out in a table, and some widgets can
- * be set to take up multiple columns for a better visual flow.
- *
- * @param i
- *
- * The column span to set on this field.
- */
- void SetColumnSpan(int i);
-
/**
* @brief Convert a value from this field to a string
*
@@ -432,11 +381,6 @@ private:
*/
EffectFieldType type_;
- /**
- * @brief Internal unique identifier for this field set in the constructor. Access with id().
- */
- QString id_;
-
/**
* @brief Used by GetValueAt() to determine whether to use keyframe data or persistent data
* @return
@@ -492,28 +436,11 @@ private:
*/
void GetKeyframeData(double timecode, int& before, int& after, double& d);
- /**
- * @brief Retrieve the current clip as a frame number
- *
- * Same as Now() but retrieves the value as a frame number (in the appropriate Sequence's frame rate) instead of
- * seconds.
- *
- * @return
- *
- * The current clip time in frames
- */
- long NowInFrames();
-
/**
* @brief Internal enabled value
*/
bool enabled_;
- /**
- * @brief Internal column span value
- */
- int colspan_;
-
};
#endif // EFFECTFIELD_H
diff --git a/effects/effectfields.h b/effects/effectfields.h
index 1a6e1777a..dacd3b7d4 100644
--- a/effects/effectfields.h
+++ b/effects/effectfields.h
@@ -1,3 +1,23 @@
+/***
+
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+***/
+
#ifndef EFFECTFIELDS_H
#define EFFECTFIELDS_H
diff --git a/effects/effectgizmo.cpp b/effects/effectgizmo.cpp
index 1c71afdc5..db810016c 100644
--- a/effects/effectgizmo.cpp
+++ b/effects/effectgizmo.cpp
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
@@ -22,9 +22,9 @@
#include "ui/labelslider.h"
#include "effects/fields/doublefield.h"
-#include "effects/effect.h"
+#include "nodes/node.h"
-EffectGizmo::EffectGizmo(Effect *parent, int type) :
+EffectGizmo::EffectGizmo(Node *parent, int type) :
QObject(parent),
x_field1(nullptr),
x_field_multi1(1.0),
diff --git a/effects/effectgizmo.h b/effects/effectgizmo.h
index 30332b21d..aea73fcf2 100644
--- a/effects/effectgizmo.h
+++ b/effects/effectgizmo.h
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
@@ -27,25 +27,26 @@ enum GizmoType {
GIZMO_TYPE_TARGET
};
-#define GIZMO_DOT_SIZE 2.5
-#define GIZMO_TARGET_SIZE 5.0
+#define GIZMO_DOT_SIZE 2.5f
+#define GIZMO_TARGET_SIZE 5.0f
#include
#include
#include
#include
#include
+#include
#include
class DoubleField;
-class Effect;
+class Node;
class EffectGizmo : public QObject {
Q_OBJECT
public:
- EffectGizmo(Effect* parent, int type);
+ EffectGizmo(Node* parent, int type);
- QVector world_pos;
+ QVector world_pos;
QVector screen_pos;
DoubleField* x_field1;
diff --git a/effects/effectloaders.cpp b/effects/effectloaders.cpp
index 83fdc5b64..ae04cce81 100644
--- a/effects/effectloaders.cpp
+++ b/effects/effectloaders.cpp
@@ -1,149 +1,106 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
#include "effectloaders.h"
-#include "effects/effect.h"
+#include
+#include
+#include
+
+#include "nodes/node.h"
#include "effects/transition.h"
#include "global/path.h"
#include "panels/panels.h"
#include "panels/effectcontrols.h"
#include "global/config.h"
-#include
-#include
-#include
-#include
+#include "effects/internal/transformeffect.h"
+#include "effects/internal/texteffect.h"
+#include "effects/internal/timecodeeffect.h"
+#include "effects/internal/solideffect.h"
+#include "effects/internal/audionoiseeffect.h"
+#include "effects/internal/toneeffect.h"
+#include "effects/internal/volumeeffect.h"
+#include "effects/internal/paneffect.h"
+#include "effects/internal/shakeeffect.h"
+#include "effects/internal/cornerpineffect.h"
+#include "effects/internal/vsthost.h"
+#include "effects/internal/fillleftrighteffect.h"
+#include "effects/internal/richtexteffect.h"
-#ifndef NOFREI0R
-#include
-typedef void (*f0rGetPluginInfo)(f0r_plugin_info_t* info);
-#endif
+#include "effects/internal/crossdissolvetransition.h"
+#include "effects/internal/linearfadetransition.h"
+#include "effects/internal/logarithmicfadetransition.h"
+#include "effects/internal/exponentialfadetransition.h"
+
+#include "nodes/nodes/nodemedia.h"
+#include "nodes/nodes/nodeimageoutput.h"
+#include "nodes/nodes/nodeshader.h"
+
+QMutex olive::effects_loaded;
void load_internal_effects() {
- if (!olive::CurrentRuntimeConfig.shaders_are_enabled) {
+ if (!olive::runtime_config.shaders_are_enabled) {
qWarning() << "Shaders are disabled, some effects may be nonfunctional";
}
- EffectMeta em;
+ olive::node_library.resize(kInvalidNode);
+ olive::node_library.fill(nullptr);
- // load internal effects
- em.path = ":/internalshaders";
-
- em.type = EFFECT_TYPE_EFFECT;
- em.subtype = EFFECT_TYPE_AUDIO;
-
- em.name = "Volume";
- em.internal = EFFECT_INTERNAL_VOLUME;
- effects.append(em);
-
- em.name = "Pan";
- em.internal = EFFECT_INTERNAL_PAN;
- effects.append(em);
-
- em.name = "VST Plugin 2.x";
- em.internal = EFFECT_INTERNAL_VST;
- effects.append(em);
-
- em.name = "Tone";
- em.internal = EFFECT_INTERNAL_TONE;
- effects.append(em);
-
- em.name = "Noise";
- em.internal = EFFECT_INTERNAL_NOISE;
- effects.append(em);
-
- em.name = "Fill Left/Right";
- em.internal = EFFECT_INTERNAL_FILLLEFTRIGHT;
- effects.append(em);
-
- em.subtype = EFFECT_TYPE_VIDEO;
-
- em.name = "Transform";
- em.category = "Distort";
- em.internal = EFFECT_INTERNAL_TRANSFORM;
- effects.append(em);
-
- em.name = "Corner Pin";
- em.internal = EFFECT_INTERNAL_CORNERPIN;
- effects.append(em);
-
- /*em.name = "Mask";
- em.internal = EFFECT_INTERNAL_MASK;
- effects.append(em);*/
-
- em.name = "Shake";
- em.internal = EFFECT_INTERNAL_SHAKE;
- effects.append(em);
-
- em.name = "Text";
- em.category = "Render";
- em.internal = EFFECT_INTERNAL_TEXT;
- effects.append(em);
-
- em.name = "Rich Text";
- em.category = "Render";
- em.internal = EFFECT_INTERNAL_RICHTEXT;
- effects.append(em);
-
- em.name = "Timecode";
- em.internal = EFFECT_INTERNAL_TIMECODE;
- effects.append(em);
-
- em.name = "Solid";
- em.internal = EFFECT_INTERNAL_SOLID;
- effects.append(em);
-
- // internal transitions
- em.type = EFFECT_TYPE_TRANSITION;
- em.category = "";
-
- em.name = "Cross Dissolve";
- em.internal = TRANSITION_INTERNAL_CROSSDISSOLVE;
- effects.append(em);
-
- em.subtype = EFFECT_TYPE_AUDIO;
-
- em.name = "Linear Fade";
- em.internal = TRANSITION_INTERNAL_LINEARFADE;
- effects.append(em);
-
- em.name = "Exponential Fade";
- em.internal = TRANSITION_INTERNAL_EXPONENTIALFADE;
- effects.append(em);
-
- em.name = "Logarithmic Fade";
- em.internal = TRANSITION_INTERNAL_LOGARITHMICFADE;
- effects.append(em);
+ olive::node_library[kTransformEffect] = std::make_shared(nullptr);
+ olive::node_library[kTextInput] = std::make_shared(nullptr);
+ olive::node_library[kSolidInput] = std::make_shared(nullptr);
+ olive::node_library[kNoiseInput] = std::make_shared(nullptr);
+ olive::node_library[kVolumeEffect] = std::make_shared(nullptr);
+ olive::node_library[kPanEffect] = std::make_shared(nullptr);
+ olive::node_library[kToneInput] = std::make_shared(nullptr);
+ olive::node_library[kShakeEffect] = std::make_shared(nullptr);
+ olive::node_library[kTimecodeEffect] = std::make_shared(nullptr);
+ olive::node_library[kFillLeftRightEffect] = std::make_shared(nullptr);
+ olive::node_library[kVstEffect] = std::make_shared(nullptr);
+ olive::node_library[kCornerPinEffect] = std::make_shared(nullptr);
+ olive::node_library[kRichTextInput] = std::make_shared(nullptr);
+ olive::node_library[kMediaInput] = std::make_shared(nullptr);
+ olive::node_library[kImageOutput] = std::make_shared(nullptr);
+ olive::node_library[kCrossDissolveTransition] = std::make_shared(nullptr);
+ olive::node_library[kLinearFadeTransition] = std::make_shared(nullptr);
+ olive::node_library[kExponentialFadeTransition] = std::make_shared(nullptr);
+ olive::node_library[kLogarithmicFadeTransition] = std::make_shared(nullptr);
}
void load_shader_effects_worker(const QString& effects_path) {
QDir effects_dir(effects_path);
if (effects_dir.exists()) {
- QList entries = effects_dir.entryList(QStringList("*.xml"), QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
+
+ QList entries = effects_dir.entryList({"*.xml"},
+ QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
+
for (int i=0;i(nullptr,
+ effect_name,
+ effect_id,
+ effect_cat,
+ file_url));
} else {
qCritical() << "Invalid effect found in" << entries.at(i);
}
@@ -201,86 +157,14 @@ void EffectInit::StartLoading() {
init_thread->start();
}
-#ifndef NOFREI0R
-void load_frei0r_effects_worker(const QString& dir, EffectMeta& em, QVector& loaded_names) {
- QDir search_dir(dir);
- if (search_dir.exists()) {
- QList entry_list = search_dir.entryList(QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
- for (int j=0;j(effect.resolve("f0r_get_plugin_info"));
- if (get_info_func != nullptr) {
- f0r_plugin_info_t info;
- get_info_func(&info);
-
- if (!loaded_names.contains(info.name)
- && info.plugin_type == F0R_PLUGIN_TYPE_FILTER
- && info.color_model == F0R_COLOR_MODEL_RGBA8888) {
- em.name = info.name;
- em.path = dir;
- em.filename = entry_list.at(j);
- em.tooltip = QString("%1\n%2\n%3\n%4").arg(em.name, info.author, info.explanation, em.filename);
-
- loaded_names.append(em.name);
-
- effects.append(em);
- }
- }
- effect.unload();
- }
- }
- }
- }
-}
-
-void load_frei0r_effects() {
- QList effect_dirs = get_effects_paths();
-
- // add defined paths for frei0r plugins on unix
-#if defined(Q_OS_MACOS) || defined(Q_OS_LINUX) || defined(__HAIKU__)
- effect_dirs.prepend("/usr/lib/frei0r-1");
- effect_dirs.prepend("/usr/local/lib/frei0r-1");
- effect_dirs.prepend(QDir::homePath() + "/.frei0r-1/lib");
-#endif
-
- QString env_path(qgetenv("FREI0R_PATH"));
- if (!env_path.isEmpty()) effect_dirs.append(env_path);
-
- QVector loaded_names;
-
- // search for paths
- EffectMeta em;
- em.category = "Frei0r";
- em.type = EFFECT_TYPE_EFFECT;
- em.subtype = EFFECT_TYPE_VIDEO;
- em.internal = EFFECT_INTERNAL_FREI0R;
-
- for (int i=0;ieffects_loaded.lock();
+ olive::effects_loaded.lock();
}
void EffectInit::run() {
qInfo() << "Initializing effects...";
load_internal_effects();
load_shader_effects();
-#ifndef NOFREI0R
- load_frei0r_effects();
-#endif
- panel_effect_controls->effects_loaded.unlock();
+ olive::effects_loaded.unlock();
qInfo() << "Finished initializing effects";
}
diff --git a/effects/effectloaders.h b/effects/effectloaders.h
index e4a3da21e..ea7294358 100644
--- a/effects/effectloaders.h
+++ b/effects/effectloaders.h
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
@@ -23,6 +23,11 @@
#include
#include
+#include
+
+namespace olive {
+ extern QMutex effects_loaded;
+}
/**
* @brief The EffectInit class
diff --git a/effects/effectrow.cpp b/effects/effectrow.cpp
index 912d25ad2..274ce3479 100644
--- a/effects/effectrow.cpp
+++ b/effects/effectrow.cpp
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
@@ -32,17 +32,23 @@
#include "panels/effectcontrols.h"
#include "panels/viewer.h"
#include "panels/grapheditor.h"
-#include "effect.h"
+#include "nodes/node.h"
#include "ui/viewerwidget.h"
#include "ui/keyframenavigator.h"
#include "ui/clickablelabel.h"
-EffectRow::EffectRow(Effect *parent, const QString &n, bool savable, bool keyframable) :
+EffectRow::EffectRow(Node *parent,
+ const QString &id,
+ const QString &name,
+ bool savable,
+ bool keyframable) :
QObject(parent),
- name_(n),
+ id_(id),
+ name_(name),
keyframable_(keyframable),
keyframing_(false),
- savable_(savable)
+ savable_(savable),
+ output_type_(olive::nodes::kInvalid)
{
Q_ASSERT(parent != nullptr);
@@ -52,15 +58,67 @@ EffectRow::EffectRow(Effect *parent, const QString &n, bool savable, bool keyfra
void EffectRow::AddField(EffectField *field)
{
field->setParent(this);
+
+ connect(field, SIGNAL(Clicked()), this, SIGNAL(Clicked()));
+ connect(field, SIGNAL(Changed()), this, SIGNAL(Changed()));
+
fields_.append(field);
}
+void EffectRow::AddAcceptedNodeInput(olive::nodes::DataType type)
+{
+ Q_ASSERT(output_type_ == olive::nodes::kInvalid);
+
+ accepted_inputs_.append(type);
+}
+
+void EffectRow::ConnectEdge(EffectRow *output, EffectRow *input)
+{
+ // Make sure one is an output and one is an input
+ Q_ASSERT(output->IsNodeInput() != input->IsNodeInput());
+
+ // Swap them if necessary
+ if (input->IsNodeOutput()) {
+ EffectRow* temp = output;
+ output = input;
+ input = temp;
+ }
+
+ // Inputs can only have one edge, so we disconnect it here if there is one
+ if (!input->node_edges_.isEmpty()) {
+ DisconnectEdge(input->node_edges_.first());
+ }
+
+ NodeEdgePtr edge = std::make_shared(output, input);
+
+ output->node_edges_.append(edge);
+ input->node_edges_.append(edge);
+
+ emit output->EdgesChanged();
+}
+
+void EffectRow::DisconnectEdge(NodeEdgePtr edge)
+{
+ EffectRow* output = edge->output();
+ EffectRow* input = edge->input();
+
+ output->node_edges_.removeAll(edge);
+ input->node_edges_.removeAll(edge);
+
+ emit output->EdgesChanged();
+}
+
+QVector EffectRow::edges()
+{
+ return node_edges_;
+}
+
bool EffectRow::IsKeyframing() {
return keyframing_;
}
void EffectRow::SetKeyframingInternal(bool b) {
- if (GetParentEffect()->meta->type != EFFECT_TYPE_TRANSITION) {
+ if (GetParentEffect()->type() != EFFECT_TYPE_TRANSITION) {
keyframing_ = b;
emit KeyframingSetChanged(keyframing_);
}
@@ -76,6 +134,58 @@ bool EffectRow::IsKeyframable()
return keyframable_;
}
+QVariant EffectRow::GetValueAt(double timecode)
+{
+ Q_ASSERT(FieldCount() == 1);
+
+ return Field(0)->GetValueAt(timecode);
+}
+
+void EffectRow::SetValueAt(double timecode, const QVariant &value)
+{
+ Q_ASSERT(FieldCount() == 1);
+
+ Field(0)->SetValueAt(timecode, value);
+}
+
+void EffectRow::SetEnabled(bool enabled)
+{
+ for (int i=0;iSetEnabled(enabled);
+ }
+}
+
+void EffectRow::SetOutputDataType(olive::nodes::DataType type)
+{
+ Q_ASSERT(accepted_inputs_.isEmpty());
+
+ output_type_ = type;
+}
+
+bool EffectRow::CanAcceptDataType(olive::nodes::DataType type)
+{
+ if (!IsNodeInput()) {
+ return false;
+ }
+
+ return accepted_inputs_.contains(type);
+}
+
+olive::nodes::DataType EffectRow::OutputDataType()
+{
+ return output_type_;
+}
+
+bool EffectRow::IsNodeInput()
+{
+ return !accepted_inputs_.isEmpty();
+}
+
+bool EffectRow::IsNodeOutput()
+{
+ return output_type_ != olive::nodes::kInvalid;
+}
+
void EffectRow::SetKeyframingEnabled(bool enabled) {
if (enabled == keyframing_) {
return;
@@ -93,7 +203,7 @@ void EffectRow::SetKeyframingEnabled(bool enabled) {
Field(i)->PrepareDataForKeyframing(true, ca);
}
- olive::UndoStack.push(ca);
+ olive::undo_stack.push(ca);
update_ui(false);
@@ -116,7 +226,7 @@ void EffectRow::SetKeyframingEnabled(bool enabled) {
// Disable keyframing setting on this row
ca->append(new SetIsKeyframing(this, false));
- olive::UndoStack.push(ca);
+ olive::undo_stack.push(ca);
update_ui(false);
@@ -131,7 +241,7 @@ void EffectRow::SetKeyframingEnabled(bool enabled) {
void EffectRow::GoToPreviousKeyframe() {
long key = LONG_MIN;
Clip* c = GetParentEffect()->parent_clip;
- long sequence_playhead = c->sequence->playhead;
+ long sequence_playhead = c->track()->sequence()->playhead;
// Used to convert clip frame number to sequence frame number
long time_adjustment = c->timeline_in() - c->clip_in();
@@ -158,7 +268,7 @@ void EffectRow::GoToPreviousKeyframe() {
void EffectRow::ToggleKeyframe() {
Clip* c = GetParentEffect()->parent_clip;
- long sequence_playhead = c->sequence->playhead;
+ long sequence_playhead = c->track()->sequence()->playhead;
// Used to convert clip frame number to sequence frame number
long time_adjustment = c->timeline_in() - c->clip_in();
@@ -222,7 +332,7 @@ void EffectRow::ToggleKeyframe() {
}
- olive::UndoStack.push(ca);
+ olive::undo_stack.push(ca);
update_ui(false);
}
@@ -233,7 +343,7 @@ void EffectRow::GoToNextKeyframe() {
EffectField* f = Field(i);
for (int j=0;jkeyframes.size();j++) {
long comp = f->keyframes.at(j).time - c->clip_in() + c->timeline_in();
- if (comp > olive::ActiveSequence->playhead) {
+ if (comp > c->track()->sequence()->playhead) {
key = qMin(comp, key);
}
}
@@ -251,7 +361,7 @@ void EffectRow::SetKeyframeOnAllFields(ComboAction* ca) {
KeyframeDataChange* kdc = new KeyframeDataChange(field);
- field->SetValueAt(field->Now(), field->GetValueAt(field->Now()));
+ field->SetValueAt(GetParentEffect()->Now(), field->GetValueAt(GetParentEffect()->Now()));
kdc->SetNewKeyframes();
ca->append(kdc);
@@ -260,9 +370,9 @@ void EffectRow::SetKeyframeOnAllFields(ComboAction* ca) {
panel_effect_controls->update_keyframes();
}
-Effect *EffectRow::GetParentEffect()
+Node *EffectRow::GetParentEffect()
{
- return static_cast(parent());
+ return static_cast(parent());
}
const QString &EffectRow::name() {
diff --git a/effects/effectrow.h b/effects/effectrow.h
index 723a368ab..5288cd08e 100644
--- a/effects/effectrow.h
+++ b/effects/effectrow.h
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
@@ -24,7 +24,7 @@
#include
#include
-class Effect;
+class Node;
class QGridLayout;
class EffectField;
class QLabel;
@@ -35,6 +35,7 @@ class KeyframeNavigator;
class ClickableLabel;
#include "effectfields.h"
+#include "nodes/nodeedge.h"
/**
* @brief The EffectRow class
@@ -51,6 +52,7 @@ class ClickableLabel;
class EffectRow : public QObject {
Q_OBJECT
public:
+
/**
* @brief EffectRow Constructor
*
@@ -60,7 +62,14 @@ public:
* EffectRow and automatically frees it through the QObject parent/child system. EffectRows are never intended to
* change parents throughout their lifetimes.
*
- * @param n
+ * @param id
+ *
+ * Field ID. Must be non-empty. Must also be unique within this Effect. Used for saving/loading values into project
+ * files so that if ordering of fields are changed, or fields are added/removed from Effects later in development,
+ * saved values in project files will still link with the correct field. Also used as the uniform variable name
+ * in GLSL shaders.
+ *
+ * @param name
*
* Row name. This is not used as an internal identifier, it's just for the user interface, so it can be translated
* with no issue.
@@ -75,19 +84,11 @@ public:
* Whether keyframing can be enabled on this row or not. This is true by default. Some values you may want to prevent
* the user from keyframing (e.g. the filename of a VST plugin), which can be done by setting this to false.
*/
- EffectRow(Effect* parent, const QString& n, bool savable = true, bool keyframable = true);
-
- /**
- * @brief Add a field to this row
- *
- * Ownership of the EffectField is transferred to this row and the row will free its memory. In the Effect's UI, this
- * will add the field to an additional column.
- *
- * @param Field
- *
- * The field to add to this row.
- */
- void AddField(EffectField* Field);
+ EffectRow(Node* parent,
+ const QString& id,
+ const QString& name,
+ bool savable = true,
+ bool keyframable = true);
/**
* @brief Retrieve the EffectField at this index. Must be less than FieldCount().
@@ -126,7 +127,7 @@ public:
*
* @return The parent Effect object that this row is attached to.
*/
- Effect* GetParentEffect();
+ Node* GetParentEffect();
/**
* @brief Return the row's name
@@ -135,6 +136,15 @@ public:
*/
const QString& name();
+ /**
+ * @brief Get the unique identifier of this field set in the constructor
+ *
+ * Mostly used for saving/loading or interacting with GLSL-based shader effects (see EffectField() for more details).
+ *
+ * @return
+ */
+ const QString& id();
+
/**
* @brief Get whether this row is keyframing or not
*
@@ -163,6 +173,150 @@ public:
* @return True if this row can be keyframed. This value is set in the constructor.
*/
bool IsKeyframable();
+
+ /**
+ * @brief Get value at a given timecode
+ *
+ * Functions as a wrapper for EffectField::GetValueAt().
+ *
+ * The default function is to return the result of the first EffectField on this EffectRow which should be sufficient
+ * for most input types. If this EffectRow has more or less than one EffectField, you must override this function in a
+ * derived class to provide the correct field <-> row coordination or else it will trigger an abort.
+ *
+ * @param timecode
+ *
+ * Timecode to get the value at
+ *
+ * @return
+ *
+ * The value of the first EffectField at the given timecode
+ */
+ virtual QVariant GetValueAt(double timecode);
+
+ /**
+ * @brief SetValueAt
+ *
+ * Functions as a wrapper for EffectField::SetValueAt().
+ *
+ * The default function is to call the function of the first EffectField on this EffectRow which should be sufficient
+ * for most input types. If this EffectRow has more or less than one EffectField, you must override this function in a
+ * derived class to provide the correct field <-> row coordination or else it will trigger an abort.
+ *
+ * @param timecode
+ *
+ * Timecode to set the value at
+ *
+ * @param value
+ *
+ * Value to set at this timecode
+ */
+ virtual void SetValueAt(double timecode, const QVariant& value);
+
+ /**
+ * @brief Sets the enabled state on all EffectField objects on this row to enabled
+ */
+ void SetEnabled(bool enabled);
+
+ /**
+ * @brief Check if nodes can be connected to this as an input.
+ *
+ * Connecting is enabled by adding an accepted node input using AddNodeInput().
+ *
+ * @return
+ *
+ * TRUE if nodes can be connected as an input.
+ */
+ bool IsNodeInput();
+
+ /**
+ * @brief Check if nodes can be connected to this as an output
+ *
+ * Connecting is enabled by setting an output data type in SetOutputDataType().
+ *
+ * @return
+ *
+ * TRUE if nodes can be connected as an output
+ */
+ bool IsNodeOutput();
+
+ /**
+ * @brief Set output data type
+ *
+ * Set the type of data this row outputs to type
+ */
+ void SetOutputDataType(olive::nodes::DataType type);
+
+ /**
+ * @brief Check if this row can accept the data type specified in type
+ *
+ * @return
+ *
+ * TRUE if this row can accept this data type. If this row is not an input, this function will always return FALSE.
+ */
+ bool CanAcceptDataType(olive::nodes::DataType type);
+
+ /**
+ * @brief Get this row's output data type
+ *
+ * @return
+ *
+ * If this is not an output, this will always return olive::nodes::kInvalid
+ */
+ olive::nodes::DataType OutputDataType();
+
+ /**
+ * @brief Adds a node data type that can be accepted by this input
+ *
+ * Allows this input to take a node connection from a data type specified by type. An input can take several data
+ * types.
+ *
+ * @param type
+ *
+ * The data type to add
+ */
+ void AddAcceptedNodeInput(olive::nodes::DataType type);
+
+ /**
+ * @brief Connect two node sockets together
+ *
+ * For outputs, the maximum amount of edges is unlimited and this will continually add to a list of edges. For inputs,
+ * there can only be one edge and adding a second will destroy the first.
+ *
+ * @param edge
+ *
+ * The edge to add (output) or replace the current edge (input).
+ */
+ static void ConnectEdge(EffectRow* output, EffectRow* input);
+
+ /**
+ * @brief Disconnect an edge
+ *
+ * Disconnects two nodes and destroys the edge object connecting them together
+ *
+ * @param edge
+ *
+ * Edge to be removed
+ */
+ static void DisconnectEdge(NodeEdgePtr edge);
+
+ /**
+ * @brief Get a list of references to all edges currently connected to this row
+ */
+ QVector edges();
+
+protected:
+ /**
+ * @brief Add a field to this row
+ *
+ * Ownership of the EffectField is transferred to this row and the row will free its memory. In the Effect's UI, this
+ * will add the field to an additional column.
+ *
+ * @param Field
+ *
+ * The field to add to this row.
+ */
+ void AddField(EffectField* Field);
+
public slots:
/**
* @brief Go to previous keyframe
@@ -199,6 +353,7 @@ public slots:
*/
void FocusRow();
signals:
+
/**
* @brief Keyframing setting changed signal
*
@@ -209,6 +364,28 @@ signals:
* True if keyframing was enabled, false if keyframing was disabled.
*/
void KeyframingSetChanged(bool);
+
+ /**
+ * @brief Changed signal
+ *
+ * Wrapper for EffectField::Changed().
+ */
+ void Changed();
+
+ /**
+ * @brief Clicked signal
+ *
+ * Wrapper for EffectField::Clicked().
+ */
+ void Clicked();
+
+ /**
+ * @brief Edges changed signal
+ *
+ * Signal emitted any time an edge is connected or disconnected from this row
+ */
+ void EdgesChanged();
+
private slots:
/**
* @brief Set keyframing enabled state
@@ -222,6 +399,12 @@ private slots:
*/
void SetKeyframingEnabled(bool);
private:
+
+ /**
+ * @brief Internal unique identifier for this field set in the constructor. Access with id().
+ */
+ QString id_;
+
/**
* @brief Internal variable for the row's name
*
@@ -257,6 +440,27 @@ private:
* get freed automatically.
*/
QVector fields_;
+
+ /**
+ * @brief Internal array of accepted node data types.
+ *
+ * Is mutally-exclusive with accepted_outputs_, i.e. you cannot have values added to this and also a value set in
+ * accepted_outputs_.
+ */
+ QVector accepted_inputs_;
+
+ /**
+ * @brief Internal value for what kind of data this row outputs
+ *
+ * Is mutally-exclusive with accepted_inputs_, i.e. you cannot have values added to it and also a value set in
+ * this.
+ */
+ olive::nodes::DataType output_type_;
+
+ /**
+ * @brief Internal array of node edges. Access with AddEdge() and RemoveEdge().
+ */
+ QVector node_edges_;
};
#endif // EFFECTROW_H
diff --git a/effects/fields/boolfield.cpp b/effects/fields/boolfield.cpp
index 7fc7c2a4d..ac3be8ea6 100644
--- a/effects/fields/boolfield.cpp
+++ b/effects/fields/boolfield.cpp
@@ -1,9 +1,32 @@
+/***
+
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+***/
+
#include "boolfield.h"
#include
-BoolField::BoolField(EffectRow *parent, const QString &id) :
- EffectField(parent, id, EFFECT_FIELD_BOOL)
+#include "nodes/node.h"
+#include "undo/undo.h"
+
+BoolField::BoolField(EffectRow *parent) :
+ EffectField(parent, EffectField::EFFECT_FIELD_BOOL)
{}
bool BoolField::GetBoolAt(double timecode)
@@ -69,8 +92,8 @@ void BoolField::UpdateFromWidget(bool b)
{
KeyframeDataChange* kdc = new KeyframeDataChange(this);
- SetValueAt(Now(), b);
+ SetValueAt(GetParentRow()->GetParentEffect()->Now(), b);
kdc->SetNewKeyframes();
- olive::UndoStack.push(kdc);
+ olive::undo_stack.push(kdc);
}
diff --git a/effects/fields/boolfield.h b/effects/fields/boolfield.h
index d84e24c95..1e8e891ae 100644
--- a/effects/fields/boolfield.h
+++ b/effects/fields/boolfield.h
@@ -1,3 +1,23 @@
+/***
+
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+***/
+
#ifndef BOOLFIELD_H
#define BOOLFIELD_H
@@ -15,7 +35,7 @@ public:
/**
* @brief Reimplementation of EffectField::EffectField().
*/
- BoolField(EffectRow* parent, const QString& id);
+ BoolField(EffectRow* parent);
/**
* @brief Get the boolean value at a given timecode
diff --git a/effects/fields/buttonfield.cpp b/effects/fields/buttonfield.cpp
index 23cc860af..2023105f3 100644
--- a/effects/fields/buttonfield.cpp
+++ b/effects/fields/buttonfield.cpp
@@ -1,9 +1,29 @@
+/***
+
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+***/
+
#include "buttonfield.h"
#include
ButtonField::ButtonField(EffectRow *parent, const QString &string) :
- EffectField(parent, nullptr, EFFECT_FIELD_UI),
+ EffectField(parent, EffectField::EFFECT_FIELD_UI),
button_text_(string)
{}
diff --git a/effects/fields/buttonfield.h b/effects/fields/buttonfield.h
index 2f481af30..0cea15459 100644
--- a/effects/fields/buttonfield.h
+++ b/effects/fields/buttonfield.h
@@ -1,3 +1,23 @@
+/***
+
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+***/
+
#ifndef BUTTONFIELD_H
#define BUTTONFIELD_H
diff --git a/effects/fields/colorfield.cpp b/effects/fields/colorfield.cpp
index a70135af4..5702b4582 100644
--- a/effects/fields/colorfield.cpp
+++ b/effects/fields/colorfield.cpp
@@ -1,11 +1,33 @@
+/***
+
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+***/
+
#include "colorfield.h"
#include
#include "ui/colorbutton.h"
+#include "nodes/node.h"
+#include "undo/undo.h"
-ColorField::ColorField(EffectRow* parent, const QString& id) :
- EffectField(parent, id, EFFECT_FIELD_COLOR)
+ColorField::ColorField(EffectRow* parent) :
+ EffectField(parent, EffectField::EFFECT_FIELD_COLOR)
{}
QColor ColorField::GetColorAt(double timecode)
@@ -44,8 +66,8 @@ void ColorField::UpdateFromWidget(const QColor& c)
{
KeyframeDataChange* kdc = new KeyframeDataChange(this);
- SetValueAt(Now(), c);
+ SetValueAt(GetParentRow()->GetParentEffect()->Now(), c);
kdc->SetNewKeyframes();
- olive::UndoStack.push(kdc);
+ olive::undo_stack.push(kdc);
}
diff --git a/effects/fields/colorfield.h b/effects/fields/colorfield.h
index c37427f31..235e831dc 100644
--- a/effects/fields/colorfield.h
+++ b/effects/fields/colorfield.h
@@ -1,3 +1,23 @@
+/***
+
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+***/
+
#ifndef COLORFIELD_H
#define COLORFIELD_H
@@ -15,7 +35,7 @@ public:
/**
* @brief Reimplementation of EffectField::EffectField().
*/
- ColorField(EffectRow* parent, const QString& id);
+ ColorField(EffectRow* parent);
/**
* @brief Get the color value at a given timecode
diff --git a/effects/fields/combofield.cpp b/effects/fields/combofield.cpp
index ad43bb4f5..c9542a000 100644
--- a/effects/fields/combofield.cpp
+++ b/effects/fields/combofield.cpp
@@ -1,11 +1,33 @@
+/***
+
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+***/
+
#include "combofield.h"
#include
+#include "nodes/node.h"
#include "ui/comboboxex.h"
+#include "undo/undo.h"
-ComboField::ComboField(EffectRow* parent, const QString& id) :
- EffectField(parent, id, EFFECT_FIELD_COMBO)
+ComboField::ComboField(EffectRow* parent) :
+ EffectField(parent, EffectField::EFFECT_FIELD_COMBO)
{}
void ComboField::AddItem(const QString &text, const QVariant &data)
@@ -64,8 +86,8 @@ void ComboField::UpdateFromWidget(int index)
{
KeyframeDataChange* kdc = new KeyframeDataChange(this);
- SetValueAt(Now(), items_.at(index).data);
+ SetValueAt(GetParentRow()->GetParentEffect()->Now(), items_.at(index).data);
kdc->SetNewKeyframes();
- olive::UndoStack.push(kdc);
+ olive::undo_stack.push(kdc);
}
diff --git a/effects/fields/combofield.h b/effects/fields/combofield.h
index 64b7cc7fe..2ba63c400 100644
--- a/effects/fields/combofield.h
+++ b/effects/fields/combofield.h
@@ -1,3 +1,23 @@
+/***
+
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+***/
+
#ifndef COMBOFIELD_H
#define COMBOFIELD_H
@@ -28,7 +48,7 @@ public:
/**
* @brief Reimplementation of EffectField::EffectField().
*/
- ComboField(EffectRow* parent, const QString& id);
+ ComboField(EffectRow* parent);
/**
* @brief Add an item to this ComboField
diff --git a/effects/fields/doublefield.cpp b/effects/fields/doublefield.cpp
index ecbadc827..14ef3ec15 100644
--- a/effects/fields/doublefield.cpp
+++ b/effects/fields/doublefield.cpp
@@ -1,9 +1,30 @@
+/***
+
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+***/
+
#include "doublefield.h"
-#include "effects/effectrow.h"
+#include "nodes/node.h"
+#include "undo/undo.h"
-DoubleField::DoubleField(EffectRow* parent, const QString& id) :
- EffectField(parent, id, EFFECT_FIELD_DOUBLE),
+DoubleField::DoubleField(EffectRow* parent) :
+ EffectField(parent, EffectField::EFFECT_FIELD_DOUBLE),
min_(qSNaN()),
max_(qSNaN()),
default_(0),
@@ -118,12 +139,12 @@ void DoubleField::UpdateFromWidget(double d)
kdc_ = new KeyframeDataChange(this);
}
- SetValueAt(Now(), d);
+ SetValueAt(GetParentRow()->GetParentEffect()->Now(), d);
if (!ls->IsDragging() && kdc_ != nullptr) {
kdc_->SetNewKeyframes();
- olive::UndoStack.push(kdc_);
+ olive::undo_stack.push(kdc_);
kdc_ = nullptr;
}
diff --git a/effects/fields/doublefield.h b/effects/fields/doublefield.h
index 90d1351a8..11734244e 100644
--- a/effects/fields/doublefield.h
+++ b/effects/fields/doublefield.h
@@ -1,9 +1,31 @@
+/***
+
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+***/
+
#ifndef DOUBLEFIELD_H
#define DOUBLEFIELD_H
#include "../effectfield.h"
#include "ui/labelslider.h"
+class KeyframeDataChange;
+
/**
* @brief The DoubleField class
*
@@ -17,7 +39,7 @@ public:
/**
* @brief Reimplementation of EffectField::EffectField().
*/
- DoubleField(EffectRow* parent, const QString& id);
+ DoubleField(EffectRow* parent);
/**
* @brief Get double value at timecode
diff --git a/effects/fields/filefield.cpp b/effects/fields/filefield.cpp
index 577a695f2..cc7f7a244 100644
--- a/effects/fields/filefield.cpp
+++ b/effects/fields/filefield.cpp
@@ -1,11 +1,33 @@
+/***
+
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+***/
+
#include "filefield.h"
#include
#include "ui/embeddedfilechooser.h"
+#include "nodes/node.h"
+#include "undo/undo.h"
-FileField::FileField(EffectRow* parent, const QString &id) :
- EffectField(parent, id, EFFECT_FIELD_FILE)
+FileField::FileField(EffectRow* parent) :
+ EffectField(parent, EffectField::EFFECT_FIELD_FILE)
{
// Set default value to an empty string
SetValueAt(0, "");
@@ -39,8 +61,8 @@ void FileField::UpdateFromWidget(const QString &s)
{
KeyframeDataChange* kdc = new KeyframeDataChange(this);
- SetValueAt(Now(), s);
+ SetValueAt(GetParentRow()->GetParentEffect()->Now(), s);
kdc->SetNewKeyframes();
- olive::UndoStack.push(kdc);
+ olive::undo_stack.push(kdc);
}
diff --git a/effects/fields/filefield.h b/effects/fields/filefield.h
index f0717f9c0..3752fd3f7 100644
--- a/effects/fields/filefield.h
+++ b/effects/fields/filefield.h
@@ -1,10 +1,30 @@
+/***
+
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+***/
+
#ifndef FILEFIELD_H
#define FILEFIELD_H
#include "../effectfield.h"
/**
- * @brief The FileField class
+ * @brief The FileInput class
*
* An EffectField derivative that produces filenames in string and uses an EmbeddedFileChooser
* as its visual representation.
@@ -16,7 +36,7 @@ public:
/**
* @brief Reimplementation of EffectField::EffectField().
*/
- FileField(EffectRow* parent, const QString& id);
+ FileField(EffectRow* parent);
/**
* @brief Get the filename at the given timecode
diff --git a/effects/fields/fontfield.cpp b/effects/fields/fontfield.cpp
index 8ee06877a..24e51615a 100644
--- a/effects/fields/fontfield.cpp
+++ b/effects/fields/fontfield.cpp
@@ -1,14 +1,36 @@
+/***
+
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+***/
+
#include "fontfield.h"
#include
#include
#include "ui/comboboxex.h"
+#include "nodes/node.h"
+#include "undo/undo.h"
-// NOTE/TODO: This shares a lot of similarity with ComboField, and could probably be a derived class of it
+// NOTE/TODO: This shares a lot of similarity with ComboInput, and could probably be a derived class of it
-FontField::FontField(EffectRow* parent, const QString &id) :
- EffectField(parent, id, EFFECT_FIELD_FONT)
+FontField::FontField(EffectRow* parent) :
+ EffectField(parent, EffectField::EFFECT_FIELD_FONT)
{
font_list = QFontDatabase().families();
@@ -66,8 +88,8 @@ void FontField::UpdateFromWidget(const QString& s)
{
KeyframeDataChange* kdc = new KeyframeDataChange(this);
- SetValueAt(Now(), s);
+ SetValueAt(GetParentRow()->GetParentEffect()->Now(), s);
kdc->SetNewKeyframes();
- olive::UndoStack.push(kdc);
+ olive::undo_stack.push(kdc);
}
diff --git a/effects/fields/fontfield.h b/effects/fields/fontfield.h
index b34b122d5..6abd7c6c2 100644
--- a/effects/fields/fontfield.h
+++ b/effects/fields/fontfield.h
@@ -1,3 +1,23 @@
+/***
+
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+***/
+
#ifndef FONTFIELD_H
#define FONTFIELD_H
@@ -17,7 +37,7 @@ public:
/**
* @brief Reimplementation of EffectField::EffectField().
*/
- FontField(EffectRow* parent, const QString& id);
+ FontField(EffectRow* parent);
/**
* @brief Get the font family name at the given timecode
diff --git a/effects/fields/labelfield.cpp b/effects/fields/labelfield.cpp
index b3eccfa6d..45306699a 100644
--- a/effects/fields/labelfield.cpp
+++ b/effects/fields/labelfield.cpp
@@ -1,9 +1,29 @@
+/***
+
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+***/
+
#include "labelfield.h"
#include
LabelField::LabelField(EffectRow *parent, const QString &string) :
- EffectField(parent, nullptr, EFFECT_FIELD_UI),
+ EffectField(parent, EffectField::EFFECT_FIELD_UI),
label_text_(string)
{}
diff --git a/effects/fields/labelfield.h b/effects/fields/labelfield.h
index 64aa78ddb..dba2912ff 100644
--- a/effects/fields/labelfield.h
+++ b/effects/fields/labelfield.h
@@ -1,3 +1,23 @@
+/***
+
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+***/
+
#ifndef LABELFIELD_H
#define LABELFIELD_H
diff --git a/effects/fields/stringfield.cpp b/effects/fields/stringfield.cpp
index 7d59d3391..6da53cd93 100644
--- a/effects/fields/stringfield.cpp
+++ b/effects/fields/stringfield.cpp
@@ -1,13 +1,35 @@
+/***
+
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+***/
+
#include "stringfield.h"
#include
#include
+#include "nodes/node.h"
#include "ui/texteditex.h"
#include "global/config.h"
+#include "undo/undo.h"
-StringField::StringField(EffectRow* parent, const QString& id, bool rich_text) :
- EffectField(parent, id, EFFECT_FIELD_STRING),
+StringField::StringField(EffectRow* parent, bool rich_text) :
+ EffectField(parent, EffectField::EFFECT_FIELD_STRING),
rich_text_(rich_text)
{
// Set default value to an empty string
@@ -31,7 +53,7 @@ QWidget *StringField::CreateWidget(QWidget *existing)
text_edit->setUndoRedoEnabled(true);
// the "2" is because the height needs one extra pixel of padding on the top and the bottom
- text_edit->setTextHeight(qCeil(text_edit->fontMetrics().lineSpacing()*olive::CurrentConfig.effect_textbox_lines
+ text_edit->setTextHeight(qCeil(text_edit->fontMetrics().lineSpacing()*olive::config.effect_textbox_lines
+ text_edit->document()->documentMargin()
+ text_edit->document()->documentMargin() + 2));
@@ -72,8 +94,8 @@ void StringField::UpdateFromWidget(const QString &s)
{
KeyframeDataChange* kdc = new KeyframeDataChange(this);
- SetValueAt(Now(), s);
+ SetValueAt(GetParentRow()->GetParentEffect()->Now(), s);
kdc->SetNewKeyframes();
- olive::UndoStack.push(kdc);
+ olive::undo_stack.push(kdc);
}
diff --git a/effects/fields/stringfield.h b/effects/fields/stringfield.h
index d8ee9f360..4124285bb 100644
--- a/effects/fields/stringfield.h
+++ b/effects/fields/stringfield.h
@@ -1,3 +1,23 @@
+/***
+
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+***/
+
#ifndef STRINGFIELD_H
#define STRINGFIELD_H
@@ -19,7 +39,7 @@ public:
* Provides a setting for whether this StringField - and its attached TextEditEx objects - should operate in rich
* text or plain text mode, defaulting to rich text mode.
*/
- StringField(EffectRow* parent, const QString& id, bool rich_text = true);
+ StringField(EffectRow* parent, bool rich_text = true);
/**
* @brief Get the string at the given timecode
diff --git a/effects/internal/audionoiseeffect.cpp b/effects/internal/audionoiseeffect.cpp
index 3f51bcf21..128921978 100644
--- a/effects/internal/audionoiseeffect.cpp
+++ b/effects/internal/audionoiseeffect.cpp
@@ -1,61 +1,94 @@
-/*
- * Olive. Olive is a free non-linear video editor for Windows, macOS, and Linux.
- * Copyright (C) 2018 {{ organization }}
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- *along with this program. If not, see .
- */
+/***
+
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+***/
+
#include "audionoiseeffect.h"
#include
#include
-AudioNoiseEffect::AudioNoiseEffect(Clip* c, const EffectMeta *em) : Effect(c, em) {
- EffectRow* amount_row = new EffectRow(this, tr("Amount"));
- amount_val = new DoubleField(amount_row, "amount");
+AudioNoiseEffect::AudioNoiseEffect(Clip* c) : Node(c) {
+ amount_val = new DoubleInput(this, "amount", tr("Amount"));
amount_val->SetMinimum(0);
amount_val->SetDefault(20);
amount_val->SetMaximum(100);
- EffectRow* mix_row = new EffectRow(this, tr("Mix"));
- mix_val = new BoolField(mix_row, "mix");
+ mix_val = new BoolInput(this, "mix", tr("Mix"));
mix_val->SetValueAt(0, true);
}
-void AudioNoiseEffect::process_audio(double timecode_start, double timecode_end, quint8 *samples, int nb_bytes, int) {
- double interval = (timecode_end - timecode_start)/nb_bytes;
- for (int i=0;i(c);
+}
+
+void AudioNoiseEffect::process_audio(double timecode_start,
+ double timecode_end,
+ float **samples,
+ int nb_samples,
+ int channel_count,
+ int type) {
+
+ Q_UNUSED(type)
+
+ double interval = (timecode_end - timecode_start)/nb_samples;
+ for (int i=0;irandomNumber();
- qint16 right_noise_sample = this->randomNumber();
-
// set noise volume
- double vol = log_volume( amount_val->GetDoubleAt(timecode)*0.01 );
- left_noise_sample *= vol;
- right_noise_sample *= vol;
+ float vol = log_volume( amount_val->GetDoubleAt(timecode)*0.01 );
- // mix with source audio
- if (mix_val->GetBoolAt(timecode)) {
- qint16 left_sample = static_cast (((samples[i+1] & 0xFF) << 8) | (samples[i] & 0xFF));
- qint16 right_sample = static_cast (((samples[i+3] & 0xFF) << 8) | (samples[i+2] & 0xFF));
- left_noise_sample = mix_audio_sample(left_noise_sample, left_sample);
- right_noise_sample = mix_audio_sample(right_noise_sample, right_sample);
+ for (int j=0;jrandomFloat() * vol;
+
+ // mix with source audio
+ if (mix_val->GetBoolAt(timecode)) {
+ samples[j][i] += noise_sample;
+ } else {
+ samples[j][i] = noise_sample;
+ }
}
-
- samples[i+3] = static_cast (right_noise_sample >> 8);
- samples[i+2] = static_cast (right_noise_sample);
- samples[i+1] = static_cast (left_noise_sample >> 8);
- samples[i] = static_cast (left_noise_sample);
}
}
diff --git a/effects/internal/audionoiseeffect.h b/effects/internal/audionoiseeffect.h
index dab29be78..d950080b5 100644
--- a/effects/internal/audionoiseeffect.h
+++ b/effects/internal/audionoiseeffect.h
@@ -1,36 +1,49 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
#ifndef AUDIONOISEEFFECT_H
#define AUDIONOISEEFFECT_H
-#include "effects/effect.h"
+#include "nodes/node.h"
-class AudioNoiseEffect : public Effect {
+class AudioNoiseEffect : public Node {
Q_OBJECT
public:
- AudioNoiseEffect(Clip* c, const EffectMeta* em);
- void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
+ AudioNoiseEffect(Clip* c);
- DoubleField* amount_val;
- BoolField* mix_val;
+ virtual QString name() override;
+ virtual QString id() override;
+ virtual QString description() override;
+ virtual EffectType type() override;
+ virtual olive::TrackType subtype() override;
+ virtual NodePtr Create(Clip *c) override;
+
+ virtual void process_audio(double timecode_start,
+ double timecode_end,
+ float **samples,
+ int nb_samples,
+ int channel_count,
+ int type) override;
+
+ DoubleInput* amount_val;
+ BoolInput* mix_val;
};
#endif // AUDIONOISEEFFECT_H
diff --git a/effects/internal/blending.frag b/effects/internal/blending.frag
deleted file mode 100644
index c8d14d593..000000000
--- a/effects/internal/blending.frag
+++ /dev/null
@@ -1,207 +0,0 @@
-#version 110
-
-const int BLEND_MODE_ADD = 0;
-const int BLEND_MODE_AVERAGE = 1;
-const int BLEND_MODE_COLORBURN = 2;
-const int BLEND_MODE_COLORDODGE = 3;
-const int BLEND_MODE_DARKEN = 4;
-const int BLEND_MODE_DIFFERENCE = 5;
-const int BLEND_MODE_EXCLUSION = 6;
-const int BLEND_MODE_GLOW = 7;
-const int BLEND_MODE_HARDLIGHT = 8;
-const int BLEND_MODE_HARDMIX = 9;
-const int BLEND_MODE_LIGHTEN = 10;
-const int BLEND_MODE_LINEARBURN = 11;
-const int BLEND_MODE_LINEARDODGE = 12;
-const int BLEND_MODE_LINEARLIGHT = 13;
-const int BLEND_MODE_MULTIPLY = 14;
-const int BLEND_MODE_NEGATION = 15;
-const int BLEND_MODE_NORMAL = 16;
-const int BLEND_MODE_OVERLAY = 17;
-const int BLEND_MODE_PHOENIX = 18;
-const int BLEND_MODE_PINLIGHT = 19;
-const int BLEND_MODE_REFLECT = 20;
-const int BLEND_MODE_SCREEN = 21;
-const int BLEND_MODE_SOFTLIGHT = 22;
-const int BLEND_MODE_SUBSTRACT = 23;
-const int BLEND_MODE_SUBTRACT = 24;
-const int BLEND_MODE_VIVIDLIGHT = 25;
-
-uniform sampler2D background;
-uniform sampler2D foreground;
-
-uniform int blendmode;
-uniform float opacity;
-
-varying vec2 vTexCoord;
-
-// adapted from https://github.com/jamieowen/glsl-blend
-// and http://www.deepskycolors.com/archivo/2010/04/21/formulas-for-Photoshop-blending-modes.html
-
-// float blending functions
-float blend_color_burn(float base, float blend) {
- return (blend==0.0)?blend:max((1.0-((1.0-base)/blend)),0.0);
-}
-
-float blend_color_dodge(float base, float blend) {
- return (blend==1.0)?blend:min(base/(1.0-blend),1.0);
-}
-
-float blend_vivid_light(float base, float blend) {
- return (blend<0.5)?blend_color_burn(base,(2.0*blend)):blend_color_dodge(base,(2.0*(blend-0.5)));
-}
-
-vec3 blend_vivid_light(vec3 base, vec3 blend) {
- return vec3(blend_vivid_light(base.r,blend.r),blend_vivid_light(base.g,blend.g),blend_vivid_light(base.b,blend.b));
-}
-
-float blend_hard_mix(float base, float blend) {
- return (blend_vivid_light(base,blend)<0.5)?0.0:1.0;
-}
-
-float blend_lighten(float base, float blend) {
- return max(blend,base);
-}
-
-float blend_overlay(float base, float blend) {
- return base<0.5?(2.0*base*blend):(1.0-2.0*(1.0-base)*(1.0-blend));
-}
-
-vec3 blend_overlay(vec3 base, vec3 blend) {
- return vec3(blend_overlay(base.r,blend.r),blend_overlay(base.g,blend.g),blend_overlay(base.b,blend.b));
-}
-
-float blend_darken(float base, float blend) {
- return min(blend, base);
-}
-
-float blend_linear_burn(float base, float blend) {
- return max(base+blend-1.0,0.0);
-}
-
-vec3 blend_linear_burn(vec3 base, vec3 blend) {
- return max(base+blend-vec3(1.0),vec3(0.0));
-}
-
-float blend_linear_dodge(float base, float blend) {
- return min(base+blend,1.0);
-}
-
-vec3 blend_linear_dodge(vec3 base, vec3 blend) {
- return min(base+blend,vec3(1.0));
-}
-
-float blend_linear_light(float base, float blend) {
- return blend<0.5?blend_linear_burn(base,(2.0*blend)):blend_linear_dodge(base,(2.0*(blend-0.5)));
-}
-
-float blend_pin_light(float base, float blend) {
- return (blend<0.5)?blend_darken(base,(2.0*blend)):blend_lighten(base,(2.0*(blend-0.5)));
-}
-
-float blend_reflect(float base, float blend) {
- return (blend==1.0)?blend:min(base*base/(1.0-blend),1.0);
-}
-
-vec3 blend_reflect(vec3 base, vec3 blend) {
- return vec3(blend_reflect(base.r,blend.r),blend_reflect(base.g,blend.g),blend_reflect(base.b,blend.b));
-}
-
-float blend_screen(float base, float blend) {
- return 1.0-((1.0-base)*(1.0-blend));
-}
-
-float blend_substract(float base, float blend) {
- return max(base+blend-1.0,0.0);
-}
-
-float blend_soft_light(float base, float blend) {
- return (blend<0.5)?(2.0*base*blend+base*base*(1.0-2.0*blend)):(sqrt(base)*(2.0*blend-1.0)+2.0*base*(1.0-blend));
-}
-
-// RGB blending function, alpha is handled below
-vec3 blend(vec3 base, vec3 blend) {
- if (blendmode == BLEND_MODE_AVERAGE) {
- return (base+blend)/2.0;
- } else if (blendmode == BLEND_MODE_COLORBURN) {
- return vec3(blend_color_burn(base.r, blend.r), blend_color_burn(base.g, blend.g), blend_color_burn(base.b, blend.b));
- } else if (blendmode == BLEND_MODE_COLORDODGE) {
- return vec3(blend_color_dodge(base.r, blend.r), blend_color_dodge(base.g, blend.g), blend_color_dodge(base.b, blend.b));
- } else if (blendmode == BLEND_MODE_DARKEN) {
- return vec3(blend_darken(base.r, blend.r), blend_darken(base.g, blend.g), blend_darken(base.b, blend.b));
- } else if (blendmode == BLEND_MODE_DIFFERENCE) {
- return abs(base-blend);
- } else if (blendmode == BLEND_MODE_EXCLUSION) {
- return base+blend-2.0*base*blend;
- } else if (blendmode == BLEND_MODE_GLOW) {
- return blend_reflect(blend, base);
- } else if (blendmode == BLEND_MODE_HARDLIGHT) {
- return blend_overlay(blend,base);
- } else if (blendmode == BLEND_MODE_HARDMIX) {
- return vec3(blend_hard_mix(base.r,blend.r),blend_hard_mix(base.g,blend.g),blend_hard_mix(base.b,blend.b));
- } else if (blendmode == BLEND_MODE_LIGHTEN) {
- return vec3(blend_lighten(base.r,blend.r),blend_lighten(base.g,blend.g),blend_lighten(base.b,blend.b));
- } else if (blendmode == BLEND_MODE_LINEARBURN || blendmode == BLEND_MODE_SUBTRACT) {
- return blend_linear_burn(base, blend);
- } else if (blendmode == BLEND_MODE_LINEARDODGE || blendmode == BLEND_MODE_ADD) {
- return blend_linear_dodge(base, blend);
- } else if (blendmode == BLEND_MODE_LINEARLIGHT) {
- return vec3(blend_linear_light(base.r,blend.r),blend_linear_light(base.g,blend.g),blend_linear_light(base.b,blend.b));
- } else if (blendmode == BLEND_MODE_MULTIPLY) {
- return (base * blend);
- } else if (blendmode == BLEND_MODE_NEGATION) {
- return vec3(1.0)-abs(vec3(1.0)-base-blend);
- } else if (blendmode == BLEND_MODE_OVERLAY) {
- return blend_overlay(base, blend);
- } else if (blendmode == BLEND_MODE_PHOENIX) {
- return min(base,blend)-max(base,blend)+vec3(1.0);
- } else if (blendmode == BLEND_MODE_PINLIGHT) {
- return vec3(blend_pin_light(base.r,blend.r),blend_pin_light(base.g,blend.g),blend_pin_light(base.b,blend.b));
- } else if (blendmode == BLEND_MODE_REFLECT) {
- return blend_reflect(base, blend);
- } else if (blendmode == BLEND_MODE_SCREEN) {
- return vec3(blend_screen(base.r,blend.r),blend_screen(base.g,blend.g),blend_screen(base.b,blend.b));
- } else if (blendmode == BLEND_MODE_SUBSTRACT) {
- return max(base+blend-vec3(1.0),vec3(0.0));
- } else if (blendmode == BLEND_MODE_SOFTLIGHT) {
- return vec3(blend_soft_light(base.r,blend.r),blend_soft_light(base.g,blend.g),blend_soft_light(base.b,blend.b));
- } else if (blendmode == BLEND_MODE_VIVIDLIGHT) {
- return vec3(blend_vivid_light(base.r,blend.r),blend_vivid_light(base.g,blend.g),blend_vivid_light(base.b,blend.b));
- } else {
- return blend;
- }
-}
-
-void main(void) {
- vec4 bg_color = texture2D(background, vTexCoord);
- vec4 fg_color = texture2D(foreground, vTexCoord);
-
- // blend textures together
- vec3 composite = blend(bg_color.rgb, fg_color.rgb);
-
- // add foreground and background alpha's together
- // float alpha_opac = fg_color.a*opacity;
-
- if (blendmode == BLEND_MODE_OVERLAY
- || blendmode == BLEND_MODE_LIGHTEN
- || blendmode == BLEND_MODE_SCREEN
- || blendmode == BLEND_MODE_COLORDODGE
- || blendmode == BLEND_MODE_LINEARDODGE
- || blendmode == BLEND_MODE_ADD
- || blendmode == BLEND_MODE_SOFTLIGHT
- || blendmode == BLEND_MODE_NEGATION
- || blendmode == BLEND_MODE_AVERAGE
- || blendmode == BLEND_MODE_REFLECT
- || blendmode == BLEND_MODE_EXCLUSION
- || blendmode == BLEND_MODE_DIFFERENCE) {
- composite *= fg_color.a;
- }
-
- vec4 full_composite = vec4(composite + bg_color.rgb*(1.0-fg_color.a), bg_color.a + fg_color.a);
- // vec4 full_composite = vec4(mix(bg_color.rgb, composite, alpha_opac), bg_color.a + alpha_opac);
-
- full_composite = mix(bg_color, full_composite, opacity);
-
- // output to color
- gl_FragColor = full_composite;
-}
\ No newline at end of file
diff --git a/effects/internal/cornerpineffect.cpp b/effects/internal/cornerpineffect.cpp
index db802503b..2e5f93281 100644
--- a/effects/internal/cornerpineffect.cpp
+++ b/effects/internal/cornerpineffect.cpp
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
@@ -24,74 +24,93 @@
#include "timeline/clip.h"
#include "global/debug.h"
-CornerPinEffect::CornerPinEffect(Clip* c, const EffectMeta *em) : Effect(c, em) {
- SetFlags(Effect::CoordsFlag | Effect::ShaderFlag);
+CornerPinEffect::CornerPinEffect(Clip* c) : Node(c) {
+ SetFlags(Node::CoordsFlag | Node::ShaderFlag);
- EffectRow* top_left = new EffectRow(this, tr("Top Left"));
- top_left_x = new DoubleField(top_left, "topleftx");
- top_left_y = new DoubleField(top_left, "toplefty");
+ top_left = new Vec2Input(this, "topleft", tr("Top Left"));
- EffectRow* top_right = new EffectRow(this, tr("Top Right"));
- top_right_x = new DoubleField(top_right, "toprightx");
- top_right_y = new DoubleField(top_right, "toprighty");
+ top_right = new Vec2Input(this, "topright", tr("Top Right"));
- EffectRow* bottom_left = new EffectRow(this, tr("Bottom Left"));
- bottom_left_x = new DoubleField(bottom_left, "bottomleftx");
- bottom_left_y = new DoubleField(bottom_left, "bottomlefty");
+ bottom_left = new Vec2Input(this, "bottomleft", tr("Bottom Left"));
- EffectRow* bottom_right = new EffectRow(this, tr("Bottom Right"));
- bottom_right_x = new DoubleField(bottom_right, "bottomrightx");
- bottom_right_y = new DoubleField(bottom_right, "bottomrighty");
+ bottom_right = new Vec2Input(this, "bottomright", tr("Bottom Right"));
- EffectRow* perspective_row = new EffectRow(this, tr("Perspective"));
- perspective = new BoolField(perspective_row, "perspective");
+ perspective = new BoolInput(this, "perspective", tr("Perspective"));
perspective->SetValueAt(0, true);
top_left_gizmo = add_gizmo(GIZMO_TYPE_DOT);
- top_left_gizmo->x_field1 = top_left_x;
- top_left_gizmo->y_field1 = top_left_y;
+ top_left_gizmo->x_field1 = static_cast(top_left->Field(0));
+ top_left_gizmo->y_field1 = static_cast(top_left->Field(1));
top_right_gizmo = add_gizmo(GIZMO_TYPE_DOT);
- top_right_gizmo->x_field1 = top_right_x;
- top_right_gizmo->y_field1 = top_right_y;
+ top_right_gizmo->x_field1 = static_cast(top_right->Field(0));
+ top_right_gizmo->y_field1 = static_cast(top_right->Field(1));
bottom_left_gizmo = add_gizmo(GIZMO_TYPE_DOT);
- bottom_left_gizmo->x_field1 = bottom_left_x;
- bottom_left_gizmo->y_field1 = bottom_left_y;
+ bottom_left_gizmo->x_field1 = static_cast(bottom_left->Field(0));
+ bottom_left_gizmo->y_field1 = static_cast(bottom_left->Field(1));
bottom_right_gizmo = add_gizmo(GIZMO_TYPE_DOT);
- bottom_right_gizmo->x_field1 = bottom_right_x;
- bottom_right_gizmo->y_field1 = bottom_right_y;
+ bottom_right_gizmo->x_field1 = static_cast(bottom_right->Field(0));
+ bottom_right_gizmo->y_field1 = static_cast(bottom_right->Field(1));
- vertPath = "cornerpin.vert";
- fragPath = "cornerpin.frag";
+ shader_vert_path_ = "cornerpin.vert";
+ shader_frag_path_ = "cornerpin.frag";
+}
+
+QString CornerPinEffect::name()
+{
+ return tr("Corner Pin");
+}
+
+QString CornerPinEffect::id()
+{
+ return "org.olivevideoeditor.Olive.cornerpin";
+}
+
+QString CornerPinEffect::category()
+{
+ return tr("Distort");
+}
+
+QString CornerPinEffect::description()
+{
+ return tr("Distort/warp this clip by pinning each of its four corners.");
+}
+
+EffectType CornerPinEffect::type()
+{
+ return EFFECT_TYPE_EFFECT;
+}
+
+olive::TrackType CornerPinEffect::subtype()
+{
+ return olive::kTypeVideo;
+}
+
+NodePtr CornerPinEffect::Create(Clip *c)
+{
+ return std::make_shared(c);
}
void CornerPinEffect::process_coords(double timecode, GLTextureCoords &coords, int) {
- coords.vertexTopLeftX += top_left_x->GetDoubleAt(timecode);
- coords.vertexTopLeftY += top_left_y->GetDoubleAt(timecode);
-
- coords.vertexTopRightX += top_right_x->GetDoubleAt(timecode);
- coords.vertexTopRightY += top_right_y->GetDoubleAt(timecode);
-
- coords.vertexBottomLeftX += bottom_left_x->GetDoubleAt(timecode);
- coords.vertexBottomLeftY += bottom_left_y->GetDoubleAt(timecode);
-
- coords.vertexBottomRightX += bottom_right_x->GetDoubleAt(timecode);
- coords.vertexBottomRightY += bottom_right_y->GetDoubleAt(timecode);
+ coords.vertex_top_left += top_left->GetVector2DAt(timecode);
+ coords.vertex_top_right += top_right->GetVector2DAt(timecode);
+ coords.vertex_bottom_left += bottom_left->GetVector2DAt(timecode);
+ coords.vertex_bottom_right += bottom_right->GetVector2DAt(timecode);
}
void CornerPinEffect::process_shader(double timecode, GLTextureCoords &coords, int) {
- glslProgram->setUniformValue("p0", GLfloat(coords.vertexBottomLeftX), GLfloat(coords.vertexBottomLeftY));
- glslProgram->setUniformValue("p1", GLfloat(coords.vertexBottomRightX), GLfloat(coords.vertexBottomRightY));
- glslProgram->setUniformValue("p2", GLfloat(coords.vertexTopLeftX), GLfloat(coords.vertexTopLeftY));
- glslProgram->setUniformValue("p3", GLfloat(coords.vertexTopRightX), GLfloat(coords.vertexTopRightY));
- glslProgram->setUniformValue("perspective", perspective->GetBoolAt(timecode));
+ shader_program_->setUniformValue("p0", coords.vertex_bottom_left.x(), coords.vertex_bottom_left.y());
+ shader_program_->setUniformValue("p1", coords.vertex_bottom_right.x(), coords.vertex_bottom_right.y());
+ shader_program_->setUniformValue("p2", coords.vertex_top_left.x(), coords.vertex_top_left.y());
+ shader_program_->setUniformValue("p3", coords.vertex_top_right.x(), coords.vertex_top_right.y());
+ shader_program_->setUniformValue("perspective", perspective->GetBoolAt(timecode));
}
void CornerPinEffect::gizmo_draw(double, GLTextureCoords &coords) {
- top_left_gizmo->world_pos[0] = QPoint(coords.vertexTopLeftX, coords.vertexTopLeftY);
- top_right_gizmo->world_pos[0] = QPoint(coords.vertexTopRightX, coords.vertexTopRightY);
- bottom_right_gizmo->world_pos[0] = QPoint(coords.vertexBottomRightX, coords.vertexBottomRightY);
- bottom_left_gizmo->world_pos[0] = QPoint(coords.vertexBottomLeftX, coords.vertexBottomLeftY);
+ top_left_gizmo->world_pos[0] = coords.vertex_top_left;
+ top_right_gizmo->world_pos[0] = coords.vertex_top_right;
+ bottom_right_gizmo->world_pos[0] = coords.vertex_bottom_right;
+ bottom_left_gizmo->world_pos[0] = coords.vertex_bottom_left;
}
diff --git a/effects/internal/cornerpineffect.h b/effects/internal/cornerpineffect.h
index ffee7311b..9226d7c40 100644
--- a/effects/internal/cornerpineffect.h
+++ b/effects/internal/cornerpineffect.h
@@ -1,45 +1,51 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
#ifndef CORNERPINEFFECT_H
#define CORNERPINEFFECT_H
-#include "effects/effect.h"
+#include "nodes/node.h"
-class CornerPinEffect : public Effect {
+class CornerPinEffect : public Node {
Q_OBJECT
public:
- CornerPinEffect(Clip* c, const EffectMeta* em);
+ CornerPinEffect(Clip* c);
+
+ virtual QString name() override;
+ virtual QString id() override;
+ virtual QString category() override;
+ virtual QString description() override;
+ virtual EffectType type() override;
+ virtual olive::TrackType subtype() override;
+ virtual NodePtr Create(Clip *c) override;
+
void process_coords(double timecode, GLTextureCoords& coords, int data);
void process_shader(double timecode, GLTextureCoords& coords, int iterations);
void gizmo_draw(double timecode, GLTextureCoords& coords);
private:
- DoubleField* top_left_x;
- DoubleField* top_left_y;
- DoubleField* top_right_x;
- DoubleField* top_right_y;
- DoubleField* bottom_left_x;
- DoubleField* bottom_left_y;
- DoubleField* bottom_right_x;
- DoubleField* bottom_right_y;
- BoolField* perspective;
+ Vec2Input* top_left;
+ Vec2Input* top_right;
+ Vec2Input* bottom_left;
+ Vec2Input* bottom_right;
+
+ BoolInput* perspective;
EffectGizmo* top_left_gizmo;
EffectGizmo* top_right_gizmo;
diff --git a/effects/internal/crossdissolvetransition.cpp b/effects/internal/crossdissolvetransition.cpp
index a90fbbeff..dc895acea 100644
--- a/effects/internal/crossdissolvetransition.cpp
+++ b/effects/internal/crossdissolvetransition.cpp
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
@@ -22,13 +22,49 @@
#include
-CrossDissolveTransition::CrossDissolveTransition(Clip* c, Clip* s, const EffectMeta* em) : Transition(c, s, em) {
- SetFlags(Effect::CoordsFlag);
+CrossDissolveTransition::CrossDissolveTransition(Clip* c) : Transition(c) {
+ SetFlags(Node::CoordsFlag);
+}
+
+QString CrossDissolveTransition::name()
+{
+ return tr("Cross Dissolve");
+}
+
+QString CrossDissolveTransition::id()
+{
+ return "org.olivevideoeditor.Olive.crossdissolve";
+}
+
+QString CrossDissolveTransition::category()
+{
+ return tr("Dissolves");
+}
+
+QString CrossDissolveTransition::description()
+{
+ return tr("Dissolve clips evenly.");
+}
+
+EffectType CrossDissolveTransition::type()
+{
+ return EFFECT_TYPE_TRANSITION;
+}
+
+olive::TrackType CrossDissolveTransition::subtype()
+{
+ return olive::kTypeVideo;
+}
+
+NodePtr CrossDissolveTransition::Create(Clip *c)
+{
+ return std::make_shared(c);
}
void CrossDissolveTransition::process_coords(double progress, GLTextureCoords& coords, int data) {
- if (!(data == kTransitionClosing && secondary_clip != nullptr)) {
- if (data == kTransitionClosing) progress = 1.0 - progress;
+ if (data == kTransitionClosing) {
+ coords.opacity *= (1.0 - progress);
+ } else {
coords.opacity *= progress;
}
}
diff --git a/effects/internal/crossdissolvetransition.h b/effects/internal/crossdissolvetransition.h
index 42c91492e..153665def 100644
--- a/effects/internal/crossdissolvetransition.h
+++ b/effects/internal/crossdissolvetransition.h
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
@@ -25,8 +25,17 @@
class CrossDissolveTransition : public Transition {
public:
- CrossDissolveTransition(Clip *c, Clip *s, const EffectMeta* em);
- void process_coords(double timecode, GLTextureCoords &, int data);
+ CrossDissolveTransition(Clip *c);
+
+ virtual QString name() override;
+ virtual QString id() override;
+ virtual QString category() override;
+ virtual QString description() override;
+ virtual EffectType type() override;
+ virtual olive::TrackType subtype() override;
+ virtual NodePtr Create(Clip *c) override;
+
+ virtual void process_coords(double timecode, GLTextureCoords &, int data) override;
};
#endif // CROSSDISSOLVETRANSITION_H
diff --git a/effects/internal/cubetransition.h b/effects/internal/cubetransition.h
index fb3bdc512..b1dbe0607 100644
--- a/effects/internal/cubetransition.h
+++ b/effects/internal/cubetransition.h
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
@@ -25,8 +25,8 @@
class CubeTransition : public Transition {
public:
- CubeTransition(Clip* c, Clip* s, const EffectMeta* em);
- void process_coords(double timecode, GLTextureCoords &, int data);
+ CubeTransition(Clip* c, Clip* s);
+ void process_coords(double timecode, GLTextureCoords &, int data);
};
#endif // CUBETRANSITION_H
diff --git a/effects/internal/dropshadoweffect.cpp b/effects/internal/dropshadoweffect.cpp
index c7c0d61b6..934a76b04 100644
--- a/effects/internal/dropshadoweffect.cpp
+++ b/effects/internal/dropshadoweffect.cpp
@@ -1,3 +1,23 @@
+/***
+
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+***/
+
#include "dropshadoweffect.h"
DropShadowEffect::DropShadowEffect() {
diff --git a/effects/internal/dropshadoweffect.h b/effects/internal/dropshadoweffect.h
index 704053c59..5492f09a3 100644
--- a/effects/internal/dropshadoweffect.h
+++ b/effects/internal/dropshadoweffect.h
@@ -1,3 +1,23 @@
+/***
+
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+***/
+
#ifndef DROPSHADOWEFFECT_H
#define DROPSHADOWEFFECT_H
@@ -8,4 +28,4 @@ public:
DropShadowEffect();
};
-#endif // DROPSHADOWEFFECT_H
\ No newline at end of file
+#endif // DROPSHADOWEFFECT_H
diff --git a/effects/internal/exponentialfadetransition.cpp b/effects/internal/exponentialfadetransition.cpp
index ca7c367ca..8c5aae400 100644
--- a/effects/internal/exponentialfadetransition.cpp
+++ b/effects/internal/exponentialfadetransition.cpp
@@ -1,20 +1,20 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
@@ -22,34 +22,62 @@
#include
-ExponentialFadeTransition::ExponentialFadeTransition(Clip* c, Clip* s, const EffectMeta* em) : Transition(c, s, em) {}
-
-void ExponentialFadeTransition::process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int type) {
- double interval = (timecode_end-timecode_start)/nb_bytes;
-
- for (int i=0;i> 8);
- samples[i] = (quint8) samp;
- }
+ExponentialFadeTransition::ExponentialFadeTransition(Clip* c) :
+ Transition(c)
+{
+}
+
+QString ExponentialFadeTransition::name()
+{
+ return tr("Exponential Fade");
+}
+
+QString ExponentialFadeTransition::id()
+{
+ return "org.olivevideoeditor.Olive.exponentialfade";
+}
+
+QString ExponentialFadeTransition::description()
+{
+ return tr("An exponential audio fade that starts slow and ends fast.");
+}
+
+EffectType ExponentialFadeTransition::type()
+{
+ return EFFECT_TYPE_TRANSITION;
+}
+
+olive::TrackType ExponentialFadeTransition::subtype()
+{
+ return olive::kTypeAudio;
+}
+
+NodePtr ExponentialFadeTransition::Create(Clip *c)
+{
+ return std::make_shared(c);
+}
+
+void ExponentialFadeTransition::process_audio(double timecode_start,
+ double timecode_end,
+ float **samples,
+ int nb_samples,
+ int channel_count,
+ int type) {
+ double interval = (timecode_end-timecode_start)/nb_samples;
+
+ for (int i=0;i.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
@@ -25,8 +25,21 @@
class ExponentialFadeTransition : public Transition {
public:
- ExponentialFadeTransition(Clip* c, Clip* s, const EffectMeta* em);
- void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
+ ExponentialFadeTransition(Clip* c);
+
+ virtual QString name() override;
+ virtual QString id() override;
+ virtual QString description() override;
+ virtual EffectType type() override;
+ virtual olive::TrackType subtype() override;
+ virtual NodePtr Create(Clip *c) override;
+
+ virtual void process_audio(double timecode_start,
+ double timecode_end,
+ float **samples,
+ int nb_samples,
+ int channel_count,
+ int type) override;
};
#endif // LINEARFADETRANSITION_H
diff --git a/effects/internal/fillleftrighteffect.cpp b/effects/internal/fillleftrighteffect.cpp
index ff0ebb68d..141583124 100644
--- a/effects/internal/fillleftrighteffect.cpp
+++ b/effects/internal/fillleftrighteffect.cpp
@@ -1,44 +1,84 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
#include "fillleftrighteffect.h"
-#define FILL_TYPE_LEFT 0
-#define FILL_TYPE_RIGHT 1
+enum FillType {
+ FILL_TYPE_LEFT,
+ FILL_TYPE_RIGHT
+};
-FillLeftRightEffect::FillLeftRightEffect(Clip* c, const EffectMeta *em) : Effect(c, em) {
- EffectRow* type_row = new EffectRow(this, tr("Type"));
- fill_type = new ComboField(type_row, "type");
+FillLeftRightEffect::FillLeftRightEffect(Clip* c) : Node(c) {
+ fill_type = new ComboInput(this, "type", tr("Type"));
fill_type->AddItem(tr("Fill Left with Right"), FILL_TYPE_LEFT);
fill_type->AddItem(tr("Fill Right with Left"), FILL_TYPE_RIGHT);
}
-void FillLeftRightEffect::process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int) {
- double interval = (timecode_end-timecode_start)/nb_bytes;
- for (int i=0;iGetValueAt(timecode_start+(interval*i)) == FILL_TYPE_LEFT) {
- samples[i+1] = samples[i+3];
- samples[i] = samples[i+2];
- } else {
- samples[i+3] = samples[i+1];
- samples[i+2] = samples[i];
+QString FillLeftRightEffect::name()
+{
+ return tr("Fill Left/Right");
+}
+
+QString FillLeftRightEffect::id()
+{
+ return "org.olivevideoeditor.Olive.fillleftright";
+}
+
+QString FillLeftRightEffect::description()
+{
+ return tr("Replaces either the left or right channel with the other");
+}
+
+EffectType FillLeftRightEffect::type()
+{
+ return EFFECT_TYPE_EFFECT;
+}
+
+olive::TrackType FillLeftRightEffect::subtype()
+{
+ return olive::kTypeAudio;
+}
+
+NodePtr FillLeftRightEffect::Create(Clip *c)
+{
+ return std::make_shared(c);
+}
+
+void FillLeftRightEffect::process_audio(double timecode_start,
+ double timecode_end,
+ float **samples,
+ int nb_samples,
+ int channel_count,
+ int type) {
+
+ Q_UNUSED(type)
+
+ double interval = (timecode_end-timecode_start)/nb_samples;
+
+ if (channel_count == 2) {
+ for (int i=0;iGetValueAt(timecode_start+(interval*i)) == FILL_TYPE_LEFT) {
+ samples[0][i] = samples[1][i];
+ } else {
+ samples[1][i] = samples[0][i];
+ }
}
}
}
diff --git a/effects/internal/fillleftrighteffect.h b/effects/internal/fillleftrighteffect.h
index 9300bcb72..1acd1de54 100644
--- a/effects/internal/fillleftrighteffect.h
+++ b/effects/internal/fillleftrighteffect.h
@@ -1,35 +1,48 @@
/***
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
***/
#ifndef FILLLEFTRIGHTEFFECT_H
#define FILLLEFTRIGHTEFFECT_H
-#include "effects/effect.h"
+#include "nodes/node.h"
-class FillLeftRightEffect : public Effect {
+class FillLeftRightEffect : public Node {
Q_OBJECT
public:
- FillLeftRightEffect(Clip* c, const EffectMeta* em);
- void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
+ FillLeftRightEffect(Clip* c);
+
+ virtual QString name() override;
+ virtual QString id() override;
+ virtual QString description() override;
+ virtual EffectType type() override;
+ virtual olive::TrackType subtype() override;
+ virtual NodePtr Create(Clip *c) override;
+
+ virtual void process_audio(double timecode_start,
+ double timecode_end,
+ float **samples,
+ int nb_samples,
+ int channel_count,
+ int type) override;
private:
- ComboField* fill_type;
+ ComboInput* fill_type;
};
#endif // FILLLEFTRIGHTEFFECT_H
diff --git a/effects/internal/internalshaders.qrc b/effects/internal/internalshaders.qrc
index 39b1a3aee..ae51e0b27 100644
--- a/effects/internal/internalshaders.qrc
+++ b/effects/internal/internalshaders.qrc
@@ -1,6 +1,5 @@