merge of long discussed new pipeline

This commit is contained in:
itsmattkc
2019-05-04 10:48:20 +10:00
382 changed files with 22362 additions and 11653 deletions
+6
View File
@@ -0,0 +1,6 @@
#include "decoder.h"
Decoder::Decoder()
{
}
+11
View File
@@ -0,0 +1,11 @@
#ifndef DECODER_H
#define DECODER_H
class Decoder
{
public:
Decoder();
};
#endif // DECODER_H
+6
View File
@@ -0,0 +1,6 @@
#include "ffmpegdecoder.h"
FFmpegDecoder::FFmpegDecoder()
{
}
+11
View File
@@ -0,0 +1,11 @@
#ifndef FFMPEGDECODER_H
#define FFMPEGDECODER_H
class FFmpegDecoder
{
public:
FFmpegDecoder();
};
#endif // FFMPEGDECODER_H
+12 -12
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
+12 -12
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
+12 -12
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
+12 -12
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
+12 -12
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
+12 -12
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
+19 -19
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -31,7 +31,7 @@
#include "panels/panels.h"
#include "panels/timeline.h"
AutoCutSilenceDialog::AutoCutSilenceDialog(QWidget *parent, QVector<int> clips) :
AutoCutSilenceDialog::AutoCutSilenceDialog(QWidget *parent, QVector<Clip*> clips) :
QDialog(parent),
clips_(clips)
{
@@ -124,16 +124,16 @@ void AutoCutSilenceDialog::cut_silence() {
// Loop over clips provided to this dialog
for (int j=0;j<clips_.size();j++) {
Clip* clip = olive::ActiveSequence->clips.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<long> 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; k<start+chunk_size; k++){
for (long k=start; k<start+chunk_size; k++){
tmp = qMax(tmp, qint8(qRound(double(ms->audio_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;
}
+14 -14
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -31,7 +31,7 @@ class AutoCutSilenceDialog : public QDialog
{
Q_OBJECT
public:
AutoCutSilenceDialog(QWidget* parent, QVector<int> clips);
AutoCutSilenceDialog(QWidget* parent, QVector<Clip*> clips);
public slots:
virtual int exec() override;
private slots:
@@ -39,7 +39,7 @@ private slots:
private:
void cut_silence();
QVector<int> clips_;
QVector<Clip*> clips_;
LabelSlider* attack_threshold;
LabelSlider* release_threshold;
+23 -3
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#include "clippropertiesdialog.h"
#include <QGridLayout>
@@ -72,7 +92,7 @@ ClipPropertiesDialog::ClipPropertiesDialog(QWidget *parent, QVector<Clip *> 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;
+20
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#ifndef CLIPPROPERTIESDIALOG_H
#define CLIPPROPERTIESDIALOG_H
+12 -12
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
+12 -12
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
+12 -12
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
+12 -12
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
+32 -30
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -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;
+15 -13
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -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
+12 -12
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
+12 -12
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
+45 -19
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -30,6 +30,8 @@
#include <QListWidget>
#include <QCheckBox>
#include <QSpinBox>
#include <OpenColorIO/OpenColorIO.h>
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;i<config->getNumColorSpaces();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();
}
+17 -12
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -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
+22 -26
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -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;i<existing_sequence->clips.size();i++) {
ClipPtr c = existing_sequence->clips.at(i);
if (c != nullptr) {
c->refactor_frame_rate(ca, multiplier, true);
}
QVector<Clip*> existing_sequence_clips = existing_sequence->GetAllClips();
for (int i=0;i<existing_sequence_clips.size();i++) {
existing_sequence_clips.at(i)->refactor_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;i<frame_rate_combobox->count();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;i<audio_frequency_combobox->count();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);
}
}
+12 -12
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
+437 -118
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -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;i<config->getNumColorSpaces();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;i<config->getNumDisplays();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;i<config->getNumLooks();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;i<ocio_view_count;i++) {
const char* view = config->getView(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;i<bool_restart_required.size();i++) {
if (bool_restart_required.at(i)
@@ -213,12 +373,12 @@ void PreferencesDialog::accept() {
}
}
// Check if any settings will require a restart of Olive
// Check if any settings will require a restart of Olive (including the bool options determined above)
if (bool_requires_restart
|| olive::CurrentConfig.thumbnail_resolution != thumbnail_res_spinbox->value()
|| olive::CurrentConfig.waveform_resolution != waveform_res_spinbox->value()
|| olive::CurrentConfig.css_path != custom_css_fn->text()
|| olive::CurrentConfig.style != static_cast<olive::styling::Style>(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<olive::styling::Style>(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;i<bool_ui.size();i++) {
*bool_value[i] = bool_ui.at(i)->isChecked();
}
olive::CurrentConfig.style = static_cast<olive::styling::Style>(ui_style->currentData().toInt());
// Set new style
olive::config.style = static_cast<olive::styling::Style>(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;i<devs.size();i++) {
audio_output_devices->addItem(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;i<devs.size();i++) {
audio_input_devices->addItem(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;i<audio_sample_rate->count();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;i<olive::pixel_formats.size();i++) {
playback_bit_depth->addItem(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;i<olive::pixel_formats.size();i++) {
export_bit_depth->addItem(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);
+60 -19
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -33,6 +33,8 @@
#include <QCheckBox>
#include <QDoubleSpinBox>
#include <QSpinBox>
#include <OpenColorIO/OpenColorIO.h>
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<KeySequenceEditor*> 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
*
+12 -12
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
+12 -12
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
+21 -17
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -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;i<olive::ActiveSequence->clips.size();i++) {
ClipPtr c = olive::ActiveSequence->clips.at(i);
if (c != nullptr && c->media() == media) {
QVector<Clip*> all_clips = top_sequence->GetAllClips();
for (int i=0;i<all_clips.size();i++) {
Clip* c = all_clips.at(i);
if (c->media() == media) {
rcmc->clips.append(c);
}
}
olive::UndoStack.push(rcmc);
olive::undo_stack.push(rcmc);
QDialog::accept();
}
+12 -12
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
+46 -39
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -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<Clip*> clips) : QDialog(parent) {
@@ -61,7 +61,7 @@ SpeedDialog::SpeedDialog(QWidget *parent, QVector<Clip*> 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;i<clips_.size();i++) {
Clip* c = clips_.at(i);
if (c->track() >= 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;i<c->sequence->clips.size();i++) {
ClipPtr compare = c->sequence->clips.at(i);
QVector<Clip*> all_clips = c->track()->sequence()->GetAllClips();
for (int i=0;i<all_clips.size();i++) {
Clip* compare = all_clips.at(i);
if (compare != nullptr
&& compare->track() == 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<Selection> 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;i<clips_.size();i++) {
Clip* c = clips_.at(i);
if (c->track() < 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();
+12 -12
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
+12 -12
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
+12 -12
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
-1132
View File
File diff suppressed because it is too large Load Diff
-262
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#ifndef EFFECT_H
#define EFFECT_H
#include <memory>
#include <QObject>
#include <QString>
#include <QVector>
#include <QColor>
#include <QOpenGLFunctions>
#include <QOpenGLShaderProgram>
#include <QOpenGLTexture>
#include <QMutex>
#include <QThread>
#include <QLabel>
#include <QWidget>
#include <QGridLayout>
#include <QPushButton>
#include <QMouseEvent>
#include <QXmlStreamReader>
#include <QXmlStreamWriter>
#include <random>
#include "ui/collapsiblewidget.h"
#include "effectrow.h"
#include "effectgizmo.h"
class Clip;
class Effect;
using EffectPtr = std::shared_ptr<Effect>;
struct EffectMeta {
QString name;
QString category;
QString filename;
QString path;
QString tooltip;
int internal;
int type;
int subtype;
};
extern QVector<EffectMeta> 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 <typename T>
T randomNumber()
{
static std::random_device device;
static std::mt19937 generator(device());
static std::uniform_int_distribution<> distribution(std::numeric_limits<T>::min(), std::numeric_limits<T>::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<EffectRow*> rows;
QVector<EffectGizmo*> gizmos;
bool bound;
int iterations;
bool enabled_;
bool expanded_;
int flags_;
QVector<KeyframeDataChange*> gizmo_dragging_actions_;
// superimpose functions
virtual void redraw(double timecode);
bool valueHasChanged(double timecode);
QVector<QVariant> cachedValues;
void delete_texture();
void validate_meta_path();
};
#endif // EFFECT_H
+23 -59
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -24,33 +24,23 @@
#include <QtMath>
#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<EffectRow*>(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>();
QColor after_data = keyframes.at(after_keyframe).data.value<QColor>();
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;i<keyframes.size();i++) {
@@ -281,11 +250,6 @@ const EffectField::EffectFieldType &EffectField::type()
return type_;
}
const QString &EffectField::id()
{
return id_;
}
double EffectField::GetValidKeyframeHandlePosition(int key, bool post) {
int comp_key = -1;
@@ -333,11 +297,11 @@ double EffectField::GetValidKeyframeHandlePosition(int key, bool post) {
}
double EffectField::FrameToSeconds(long frame) {
return (double(frame) / GetParentRow()->GetParentEffect()->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) {
+15 -88
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -26,8 +26,8 @@
#include <QVector>
#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
+20
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#ifndef EFFECTFIELDS_H
#define EFFECTFIELDS_H
+14 -14
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -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),
+18 -17
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -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 <QObject>
#include <QString>
#include <QRect>
#include <QPoint>
#include <QVector>
#include <QVector3D>
#include <QColor>
class DoubleField;
class Effect;
class Node;
class EffectGizmo : public QObject {
Q_OBJECT
public:
EffectGizmo(Effect* parent, int type);
EffectGizmo(Node* parent, int type);
QVector<QPoint> world_pos;
QVector<QVector3D> world_pos;
QVector<QPoint> screen_pos;
DoubleField* x_field1;
+83 -199
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include "effectloaders.h"
#include "effects/effect.h"
#include <QDir>
#include <QXmlStreamReader>
#include <QDebug>
#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 <QDir>
#include <QXmlStreamReader>
#include <QLibrary>
#include <QDebug>
#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 <frei0r.h>
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<TransformEffect>(nullptr);
olive::node_library[kTextInput] = std::make_shared<TextEffect>(nullptr);
olive::node_library[kSolidInput] = std::make_shared<SolidEffect>(nullptr);
olive::node_library[kNoiseInput] = std::make_shared<AudioNoiseEffect>(nullptr);
olive::node_library[kVolumeEffect] = std::make_shared<VolumeEffect>(nullptr);
olive::node_library[kPanEffect] = std::make_shared<PanEffect>(nullptr);
olive::node_library[kToneInput] = std::make_shared<ToneEffect>(nullptr);
olive::node_library[kShakeEffect] = std::make_shared<ShakeEffect>(nullptr);
olive::node_library[kTimecodeEffect] = std::make_shared<TimecodeEffect>(nullptr);
olive::node_library[kFillLeftRightEffect] = std::make_shared<FillLeftRightEffect>(nullptr);
olive::node_library[kVstEffect] = std::make_shared<VSTHost>(nullptr);
olive::node_library[kCornerPinEffect] = std::make_shared<CornerPinEffect>(nullptr);
olive::node_library[kRichTextInput] = std::make_shared<RichTextEffect>(nullptr);
olive::node_library[kMediaInput] = std::make_shared<NodeMedia>(nullptr);
olive::node_library[kImageOutput] = std::make_shared<NodeImageOutput>(nullptr);
olive::node_library[kCrossDissolveTransition] = std::make_shared<CrossDissolveTransition>(nullptr);
olive::node_library[kLinearFadeTransition] = std::make_shared<LinearFadeTransition>(nullptr);
olive::node_library[kExponentialFadeTransition] = std::make_shared<ExponentialFadeTransition>(nullptr);
olive::node_library[kLogarithmicFadeTransition] = std::make_shared<LogarithmicFadeTransition>(nullptr);
}
void load_shader_effects_worker(const QString& effects_path) {
QDir effects_dir(effects_path);
if (effects_dir.exists()) {
QList<QString> entries = effects_dir.entryList(QStringList("*.xml"), QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
QList<QString> entries = effects_dir.entryList({"*.xml"},
QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
for (int i=0;i<entries.size();i++) {
QString entry_path = effects_dir.filePath(entries.at(i));
if (QFileInfo(entry_path).isDir()) {
load_shader_effects_worker(entry_path);
} else {
QFile file(effects_path + "/" + entries.at(i));
QString file_url = QDir(effects_path).filePath(entries.at(i));
QFile file(file_url);
if (!file.open(QIODevice::ReadOnly)) {
qCritical() << "Could not open" << entries.at(i);
return;
@@ -152,26 +109,25 @@ void load_shader_effects_worker(const QString& effects_path) {
QXmlStreamReader reader(&file);
while (!reader.atEnd()) {
if (reader.name() == "effect") {
QString effect_name = "";
QString effect_cat = "";
QString effect_name;
QString effect_cat;
QString effect_id;
const QXmlStreamAttributes attr = reader.attributes();
for (int j=0;j<attr.size();j++) {
if (attr.at(j).name() == "name") {
effect_name = attr.at(j).value().toString();
} else if (attr.at(j).name() == "category") {
effect_cat = attr.at(j).value().toString();
} else if (attr.at(j).name() == "id") {
effect_id = attr.at(j).value().toString();
}
}
if (!effect_name.isEmpty()) {
EffectMeta em;
em.type = EFFECT_TYPE_EFFECT;
em.subtype = EFFECT_TYPE_VIDEO;
em.name = effect_name;
em.category = effect_cat;
em.filename = file.fileName();
em.path = effects_path;
em.internal = -1;
effects.append(em);
if (!effect_name.isEmpty() && !effect_id.isEmpty()) {
olive::node_library.append(std::make_shared<NodeShader>(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<QString>& loaded_names) {
QDir search_dir(dir);
if (search_dir.exists()) {
QList<QString> entry_list = search_dir.entryList(QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
for (int j=0;j<entry_list.size();j++) {
QString entry_path = search_dir.filePath(entry_list.at(j));
if (QFileInfo(entry_path).isDir()) {
load_frei0r_effects_worker(entry_path, em, loaded_names);
} else {
QString path_without_extension = search_dir.filePath(QFileInfo(entry_list.at(j)).baseName());
QLibrary effect;
effect.setFileName(path_without_extension);
if (effect.load()) {
f0rGetPluginInfo get_info_func = reinterpret_cast<f0rGetPluginInfo>(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<QString> 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<QString> 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;i<effect_dirs.size();i++) {
load_frei0r_effects_worker(effect_dirs.at(i), em, loaded_names);
}
}
#endif
EffectInit::EffectInit() {
panel_effect_controls->effects_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";
}
+17 -12
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -23,6 +23,11 @@
#include <QList>
#include <QThread>
#include <QMutex>
namespace olive {
extern QMutex effects_loaded;
}
/**
* @brief The EffectInit class
+136 -26
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -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<NodeEdge>(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<NodeEdgePtr> 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;i<FieldCount();i++) {
Field(i)->SetEnabled(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;j<f->keyframes.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<Effect*>(parent());
return static_cast<Node*>(parent());
}
const QString &EffectRow::name() {
+232 -28
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -24,7 +24,7 @@
#include <QObject>
#include <QVector>
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<NodeEdgePtr> 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<EffectField*> 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<olive::nodes::DataType> 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<NodeEdgePtr> node_edges_;
};
#endif // EFFECTROW_H
+27 -4
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#include "boolfield.h"
#include <QCheckBox>
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);
}
+21 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#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
+21 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#include "buttonfield.h"
#include <QPushButton>
ButtonField::ButtonField(EffectRow *parent, const QString &string) :
EffectField(parent, nullptr, EFFECT_FIELD_UI),
EffectField(parent, EffectField::EFFECT_FIELD_UI),
button_text_(string)
{}
+20
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#ifndef BUTTONFIELD_H
#define BUTTONFIELD_H
+26 -4
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#include "colorfield.h"
#include <QColor>
#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);
}
+21 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#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
+26 -4
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#include "combofield.h"
#include <QDebug>
#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);
}
+21 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#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
+26 -5
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#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;
}
+23 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#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
+26 -4
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#include "filefield.h"
#include <QDebug>
#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);
}
+22 -2
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#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
+27 -5
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#include "fontfield.h"
#include <QFontDatabase>
#include <QDebug>
#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);
}
+21 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#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
+21 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#include "labelfield.h"
#include <QLabel>
LabelField::LabelField(EffectRow *parent, const QString &string) :
EffectField(parent, nullptr, EFFECT_FIELD_UI),
EffectField(parent, EffectField::EFFECT_FIELD_UI),
label_text_(string)
{}
+20
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#ifndef LABELFIELD_H
#define LABELFIELD_H
+27 -5
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#include "stringfield.h"
#include <QtMath>
#include <QDebug>
#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);
}
+21 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#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
+75 -42
View File
@@ -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 <http://www.gnu.org/licenses/>.
*/
/***
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 <http://www.gnu.org/licenses/>.
***/
#include "audionoiseeffect.h"
#include <QDateTime>
#include <QtMath>
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<nb_bytes;i+=4) {
QString AudioNoiseEffect::name()
{
return tr("Noise");
}
QString AudioNoiseEffect::id()
{
return "org.olivevideoeditor.Olive.noise";
}
QString AudioNoiseEffect::description()
{
return tr("Generate audio noise that can be mixed with this clip.");
}
EffectType AudioNoiseEffect::type()
{
return EFFECT_TYPE_EFFECT;
}
olive::TrackType AudioNoiseEffect::subtype()
{
return olive::kTypeAudio;
}
NodePtr AudioNoiseEffect::Create(Clip *c)
{
return std::make_shared<AudioNoiseEffect>(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;i<nb_samples;i+=4) {
double timecode = timecode_start+(interval*i);
qint16 left_noise_sample = this->randomNumber<qint16>();
qint16 right_noise_sample = this->randomNumber<qint16>();
// 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<qint16> (((samples[i+1] & 0xFF) << 8) | (samples[i] & 0xFF));
qint16 right_sample = static_cast<qint16> (((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;j<channel_count;j++) {
// Generate noise sample
float noise_sample = this->randomFloat<float>() * 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<quint8> (right_noise_sample >> 8);
samples[i+2] = static_cast<quint8> (right_noise_sample);
samples[i+1] = static_cast<quint8> (left_noise_sample >> 8);
samples[i] = static_cast<quint8> (left_noise_sample);
}
}
+31 -18
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#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
-207
View File
@@ -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;
}
+77 -58
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -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<DoubleField*>(top_left->Field(0));
top_left_gizmo->y_field1 = static_cast<DoubleField*>(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<DoubleField*>(top_right->Field(0));
top_right_gizmo->y_field1 = static_cast<DoubleField*>(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<DoubleField*>(bottom_left->Field(0));
bottom_left_gizmo->y_field1 = static_cast<DoubleField*>(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<DoubleField*>(bottom_right->Field(0));
bottom_right_gizmo->y_field1 = static_cast<DoubleField*>(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<CornerPinEffect>(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;
}
+30 -24
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#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;
+52 -16
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -22,13 +22,49 @@
#include <QOpenGLFunctions>
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<CrossDissolveTransition>(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;
}
}
+23 -14
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -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
+14 -14
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -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
+20
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#include "dropshadoweffect.h"
DropShadowEffect::DropShadowEffect() {
+21 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#ifndef DROPSHADOWEFFECT_H
#define DROPSHADOWEFFECT_H
@@ -8,4 +28,4 @@ public:
DropShadowEffect();
};
#endif // DROPSHADOWEFFECT_H
#endif // DROPSHADOWEFFECT_H
+70 -42
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -22,34 +22,62 @@
#include <QtMath>
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<nb_bytes;i+=2) {
qint16 samp = (qint16) (((samples[i+1] & 0xFF) << 8) | (samples[i] & 0xFF));
/*switch (type) {
case TRAN_TYPE_OPEN:
case TRAN_TYPE_OPENWLINK:
samp *= qSqrt(timecode_start + (interval * i));
break;
case TRAN_TYPE_CLOSE:
case TRAN_TYPE_CLOSEWLINK:
samp *= qSqrt(1 - (timecode_start + (interval * i)));
break;
}*/
switch (type) {
case kTransitionOpening:
samp *= qPow(timecode_start + (interval * i), 2);
break;
case kTransitionClosing:
samp *= qPow(1 - (timecode_start + (interval * i)), 2);
break;
}
samples[i+1] = (quint8) (samp >> 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<ExponentialFadeTransition>(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<nb_samples;i++) {
double multi = timecode_start + (interval * i);
for (int j=0;j<channel_count;j++) {
switch (type) {
case kTransitionOpening:
samples[j][i] *= qPow(multi, 2);
break;
case kTransitionClosing:
samples[j][i] *= qPow(1.0 - multi, 2);
break;
}
}
}
}
+27 -14
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -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
+66 -26
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#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;i<nb_bytes;i+=4) {
if (fill_type->GetValueAt(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<FillLeftRightEffect>(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;i<nb_samples;i++) {
if (fill_type->GetValueAt(timecode_start+(interval*i)) == FILL_TYPE_LEFT) {
samples[0][i] = samples[1][i];
} else {
samples[1][i] = samples[0][i];
}
}
}
}
+30 -17
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#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
-1
View File
@@ -1,6 +1,5 @@
<RCC>
<qresource prefix="/internalshaders">
<file>blending.frag</file>
<file>common.vert</file>
<file>cornerpin.frag</file>
<file>cornerpin.vert</file>
+67 -31
View File
@@ -1,43 +1,79 @@
/***
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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include "linearfadetransition.h"
LinearFadeTransition::LinearFadeTransition(Clip* c, Clip* s, const EffectMeta* em) : Transition(c, s, em) {}
LinearFadeTransition::LinearFadeTransition(Clip* c) : Transition(c) {}
void LinearFadeTransition::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<nb_bytes;i+=2) {
qint16 samp = (qint16) (((samples[i+1] & 0xFF) << 8) | (samples[i] & 0xFF));
switch (type) {
case kTransitionOpening:
samp *= timecode_start + (interval * i);
break;
case kTransitionClosing:
samp *= 1 - (timecode_start + (interval * i));
break;
}
samples[i+1] = (quint8) (samp >> 8);
samples[i] = (quint8) samp;
}
QString LinearFadeTransition::name()
{
return tr("Linear Fade");
}
QString LinearFadeTransition::id()
{
return "org.olivevideoeditor.Olive.linearfade";
}
QString LinearFadeTransition::description()
{
return tr("An linear audio fade that fades evenly at a constant rate.");
}
EffectType LinearFadeTransition::type()
{
return EFFECT_TYPE_TRANSITION;
}
olive::TrackType LinearFadeTransition::subtype()
{
return olive::kTypeAudio;
}
NodePtr LinearFadeTransition::Create(Clip *c)
{
return std::make_shared<LinearFadeTransition>(c);
}
void LinearFadeTransition::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<nb_samples;i++) {
float multi = timecode_start + (interval * i);
for (int j=0;j<channel_count;j++) {
switch (type) {
case kTransitionOpening:
samples[j][i] *= multi;
break;
case kTransitionClosing:
samples[j][i] *= 1.0f - multi;
break;
}
}
}
}
+27 -14
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -25,8 +25,21 @@
class LinearFadeTransition : public Transition {
public:
LinearFadeTransition(Clip* c, Clip* s, const EffectMeta* em);
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
LinearFadeTransition(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
+70 -32
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -22,24 +22,62 @@
#include <QtMath>
LogarithmicFadeTransition::LogarithmicFadeTransition(Clip* c, Clip* s, const EffectMeta* em) : Transition(c, s, em) {}
void LogarithmicFadeTransition::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<nb_bytes;i+=2) {
qint16 samp = (qint16) (((samples[i+1] & 0xFF) << 8) | (samples[i] & 0xFF));
switch (type) {
case kTransitionOpening:
samp *= qSqrt(timecode_start + (interval * i));
break;
case kTransitionClosing:
samp *= qSqrt(1 - (timecode_start + (interval * i)));
break;
}
samples[i+1] = (quint8) (samp >> 8);
samples[i] = (quint8) samp;
}
LogarithmicFadeTransition::LogarithmicFadeTransition(Clip* c) :
Transition(c)
{
}
QString LogarithmicFadeTransition::name()
{
return tr("Logarithmic Fade");
}
QString LogarithmicFadeTransition::id()
{
return "org.olivevideoeditor.Olive.logarithmicfade";
}
QString LogarithmicFadeTransition::description()
{
return tr("An logarithmic audio fade that starts fast and ends slow.");
}
EffectType LogarithmicFadeTransition::type()
{
return EFFECT_TYPE_TRANSITION;
}
olive::TrackType LogarithmicFadeTransition::subtype()
{
return olive::kTypeAudio;
}
NodePtr LogarithmicFadeTransition::Create(Clip *c)
{
return std::make_shared<LogarithmicFadeTransition>(c);
}
void LogarithmicFadeTransition::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<nb_samples;i++) {
float multi = timecode_start + (interval * i);
for (int j=0;j<channel_count;j++) {
switch (type) {
case kTransitionOpening:
samples[j][i] *= qSqrt(multi);
break;
case kTransitionClosing:
samples[j][i] *= qSqrt(1.0f - multi);
break;
}
}
}
}
+27 -14
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -25,8 +25,21 @@
class LogarithmicFadeTransition : public Transition {
public:
LogarithmicFadeTransition(Clip* c, Clip* s, const EffectMeta* em);
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
LogarithmicFadeTransition(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 // LOGARITHMICFADETRANSITION_H
+63 -28
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -28,34 +28,69 @@
#include "ui/labelslider.h"
#include "ui/collapsiblewidget.h"
PanEffect::PanEffect(Clip* c, const EffectMeta *em) : Effect(c, em) {
EffectRow* pan_row = new EffectRow(this, tr("Pan"));
pan_val = new DoubleField(pan_row, "pan");
PanEffect::PanEffect(Clip* c) : Node(c) {
pan_val = new DoubleInput(this, "pan", tr("Pan"));
pan_val->SetMinimum(-100);
pan_val->SetDefault(0);
pan_val->SetMaximum(100);
}
void PanEffect::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<nb_bytes;i+=4) {
QString PanEffect::name()
{
return tr("Pan");
}
QString PanEffect::id()
{
return "org.olivevideoeditor.Olive.pan";
}
QString PanEffect::description()
{
return tr("Modifying the panning on a stereo audio clip.");
}
EffectType PanEffect::type()
{
return EFFECT_TYPE_EFFECT;
}
olive::TrackType PanEffect::subtype()
{
return olive::kTypeAudio;
}
NodePtr PanEffect::Create(Clip *c)
{
return std::make_shared<PanEffect>(c);
}
void PanEffect::process_audio(double timecode_start,
double timecode_end,
float **samples,
int nb_samples,
int channel_count,
int type) {
Q_UNUSED(type)
// This has no effect on mono sources
if (channel_count < 2) {
return;
}
double interval = (timecode_end - timecode_start)/nb_samples;
for (int i=0;i<nb_samples;i++) {
double pan_field_val = pan_val->GetDoubleAt(timecode_start+(interval*i));
double pval = log_volume(qAbs(pan_field_val)*0.01);
qint16 left_sample = qint16(((samples[i+1] & 0xFF) << 8) | (samples[i] & 0xFF));
qint16 right_sample = qint16(((samples[i+3] & 0xFF) << 8) | (samples[i+2] & 0xFF));
if (pan_field_val < 0) {
// affect right channel
right_sample *= (1.0-pval);
samples[1][i] *= (1.0-pval);
} else {
// affect left channel
left_sample *= (1.0-pval);
samples[0][i] *= (1.0-pval);
}
samples[i+3] = quint8(right_sample >> 8);
samples[i+2] = quint8(right_sample);
samples[i+1] = quint8(left_sample >> 8);
samples[i] = quint8(left_sample);
}
}
+30 -17
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef PANEFFECT_H
#define PANEFFECT_H
#include "effects/effect.h"
#include "nodes/node.h"
class PanEffect : public Effect {
class PanEffect : public Node {
Q_OBJECT
public:
PanEffect(Clip* c, const EffectMeta* em);
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
PanEffect(Clip* c);
DoubleField* pan_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* pan_val;
};
#endif // PANEFFECT_H
+78 -45
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#include "richtexteffect.h"
#include <QTextDocument>
@@ -14,65 +34,43 @@ enum AutoscrollDirection {
SCROLL_RIGHT,
};
RichTextEffect::RichTextEffect(Clip *c, const EffectMeta *em) :
Effect(c, em)
RichTextEffect::RichTextEffect(Clip *c) :
Node(c)
{
SetFlags(Effect::SuperimposeFlag);
SetFlags(Node::SuperimposeFlag);
EffectRow* text_row = new EffectRow(this, tr("Text"));
text_val = new StringField(text_row, "text");
text_val->SetColumnSpan(2);
text_val = new StringInput(this, "text", tr("Text"));
EffectRow* padding_row = new EffectRow(this, tr("Padding"));
padding_field = new DoubleField(padding_row, "padding");
padding_field->SetColumnSpan(2);
padding_field = new DoubleInput(this, "padding", tr("Padding"));
EffectRow* position_row = new EffectRow(this, tr("Position"));
position_x = new DoubleField(position_row, "posx");
position_y = new DoubleField(position_row, "posy");
position = new Vec2Input(this, "pos", tr("Position"));
EffectRow* vertical_align_row = new EffectRow(this, tr("Vertical Align:"));
vertical_align = new ComboField(vertical_align_row, "valign");
vertical_align = new ComboInput(this, "valign", tr("Vertical Align:"));
vertical_align->AddItem(tr("Top"), Qt::AlignTop);
vertical_align->AddItem(tr("Center"), Qt::AlignCenter);
vertical_align->AddItem(tr("Bottom"), Qt::AlignBottom);
vertical_align->SetValueAt(0, Qt::AlignCenter);
vertical_align->SetColumnSpan(2);
EffectRow* autoscroll_row = new EffectRow(this, tr("Auto-Scroll"));
autoscroll = new ComboField(autoscroll_row, "autoscroll");
autoscroll = new ComboInput(this, "autoscroll", tr("Auto-Scroll"));
autoscroll->AddItem(tr("Off"), SCROLL_OFF);
autoscroll->AddItem(tr("Up"), SCROLL_UP);
autoscroll->AddItem(tr("Down"), SCROLL_DOWN);
autoscroll->AddItem(tr("Left"), SCROLL_LEFT);
autoscroll->AddItem(tr("Right"), SCROLL_RIGHT);
autoscroll->SetColumnSpan(2);
EffectRow* shadow_row = new EffectRow(this, tr("Shadow"));
shadow_bool = new BoolField(shadow_row, "shadow");
shadow_bool->SetColumnSpan(2);
shadow_bool = new BoolInput(this, "shadow", tr("Shadow"));
EffectRow* shadow_color_row = new EffectRow(this, tr("Shadow Color"));
shadow_color = new ColorField(shadow_color_row, "shadowcolor");
shadow_color->SetColumnSpan(2);
shadow_color = new ColorInput(this, "shadowcolor", tr("Shadow Color"));
EffectRow* shadow_angle_row = new EffectRow(this, tr("Shadow Angle"));
shadow_angle = new DoubleField(shadow_angle_row, "shadowangle");
shadow_angle->SetColumnSpan(2);
shadow_angle = new DoubleInput(this, "shadowangle", tr("Shadow Angle"));
EffectRow* shadow_distance_row = new EffectRow(this, tr("Shadow Distance"));
shadow_distance = new DoubleField(shadow_distance_row, "shadowdistance");
shadow_distance->SetColumnSpan(2);
shadow_distance = new DoubleInput(this, "shadowdistance", tr("Shadow Distance"));
shadow_distance->SetMinimum(0);
EffectRow* shadow_softness_row = new EffectRow(this, tr("Shadow Softness"));
shadow_softness = new DoubleField(shadow_softness_row, "shadowsoftness");
shadow_softness->SetColumnSpan(2);
shadow_softness = new DoubleInput(this, "shadowsoftness", tr("Shadow Softness"));
shadow_softness->SetMinimum(0);
EffectRow* shadow_opacity_row = new EffectRow(this, tr("Shadow Opacity"));
shadow_opacity = new DoubleField(shadow_opacity_row, "shadowopacity");
shadow_opacity->SetColumnSpan(2);
shadow_opacity = new DoubleInput(this, "shadowopacity", tr("Shadow Opacity"));
shadow_opacity->SetMinimum(0);
shadow_opacity->SetMaximum(100);
@@ -84,6 +82,41 @@ RichTextEffect::RichTextEffect(Clip *c, const EffectMeta *em) :
"</html>");
}
QString RichTextEffect::name()
{
return tr("Rich Text");
}
QString RichTextEffect::id()
{
return "org.olivevideoeditor.Olive.richtext";
}
QString RichTextEffect::category()
{
return tr("Render");
}
QString RichTextEffect::description()
{
return tr("Render formatted rich text over a clip.");
}
EffectType RichTextEffect::type()
{
return EFFECT_TYPE_EFFECT;
}
olive::TrackType RichTextEffect::subtype()
{
return olive::kTypeVideo;
}
NodePtr RichTextEffect::Create(Clip *c)
{
return std::make_shared<RichTextEffect>(c);
}
void RichTextEffect::redraw(double timecode)
{
QPainter p(&img);
@@ -100,8 +133,8 @@ void RichTextEffect::redraw(double timecode)
td.setHtml(text_val->GetStringAt(timecode));
td.setTextWidth(width);
int translate_x = qRound(position_x->GetDoubleAt(timecode) + padding);
int translate_y = qRound(position_y->GetDoubleAt(timecode) + padding);
QPoint translation = position->GetVector2DAt(timecode).toPoint();
translation += {padding, padding};
int doc_height = qRound(td.size().height());
@@ -118,9 +151,9 @@ void RichTextEffect::redraw(double timecode)
// If we're not auto-scrolling the vertical direction, respect the vertical alignment
if (vertical_align->GetValueAt(timecode).toInt() == Qt::AlignCenter) {
translate_y += height / 2 - doc_height / 2;
translation.setY(translation.y() + height / 2 - doc_height / 2);
} else if (vertical_align->GetValueAt(timecode).toInt() == Qt::AlignBottom) {
translate_y += height - doc_height;
translation.setY(translation.y() + height - doc_height);
}
// Check if we are autoscrolling
@@ -131,7 +164,7 @@ void RichTextEffect::redraw(double timecode)
}
int doc_width = qRound(td.size().width());
translate_x += qRound(-doc_width + (img.width() + doc_width) * scroll_progress);
translation.setX(translation.x() + qRound(-doc_width + (img.width() + doc_width) * scroll_progress));
}
} else if (auto_scroll_dir == SCROLL_UP || auto_scroll_dir == SCROLL_DOWN) {
@@ -142,13 +175,13 @@ void RichTextEffect::redraw(double timecode)
scroll_progress = 1.0 - scroll_progress;
}
translate_y += qRound(-doc_height + (img.height() + doc_height)*scroll_progress);
translation.setY(translation.y() + qRound(-doc_height + (img.height() + doc_height)*scroll_progress));
}
QRect clip_rect = img.rect();
clip_rect.translate(-translate_x, -translate_y);
p.translate(translate_x, translate_y);
clip_rect.translate(-translation);
p.translate(translation);
img.fill(Qt::transparent);
@@ -188,5 +221,5 @@ void RichTextEffect::redraw(double timecode)
bool RichTextEffect::AlwaysUpdate()
{
return autoscroll->GetValueAt(autoscroll->Now()).toInt() != SCROLL_OFF;
return autoscroll->GetValueAt(Now()).toInt() != SCROLL_OFF;
}
+45 -16
View File
@@ -1,29 +1,58 @@
/***
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 <http://www.gnu.org/licenses/>.
***/
#ifndef RICHTEXTEFFECT_H
#define RICHTEXTEFFECT_H
#include "effects/effect.h"
#include "nodes/node.h"
class RichTextEffect : public Effect {
class RichTextEffect : public Node {
Q_OBJECT
public:
RichTextEffect(Clip* c, const EffectMeta *em);
void redraw(double timecode);
RichTextEffect(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 redraw(double timecode) override;
protected:
virtual bool AlwaysUpdate() override;
private:
StringField* text_val;
DoubleField* padding_field;
DoubleField* position_x;
DoubleField* position_y;
ComboField* vertical_align;
ComboField* autoscroll;
StringInput* text_val;
DoubleInput* padding_field;
Vec2Input* position;
ComboInput* vertical_align;
ComboInput* autoscroll;
BoolField* shadow_bool;
DoubleField* shadow_angle;
DoubleField* shadow_distance;
ColorField* shadow_color;
DoubleField* shadow_softness;
DoubleField* shadow_opacity;
BoolInput* shadow_bool;
DoubleInput* shadow_angle;
DoubleInput* shadow_distance;
ColorInput* shadow_color;
DoubleInput* shadow_softness;
DoubleInput* shadow_opacity;
};
#endif // RICHTEXTEFFECT_H
+53 -29
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -32,21 +32,18 @@
#include "panels/timeline.h"
#include "global/debug.h"
ShakeEffect::ShakeEffect(Clip* c, const EffectMeta *em) : Effect(c, em) {
SetFlags(Effect::CoordsFlag);
ShakeEffect::ShakeEffect(Clip* c) : Node(c) {
SetFlags(Node::CoordsFlag);
EffectRow* intensity_row = new EffectRow(this, tr("Intensity"));
intensity_val = new DoubleField(intensity_row, "intensity");
intensity_val = new DoubleInput(this, "intensity", tr("Intensity"));
intensity_val->SetMinimum(0);
intensity_val->SetDefault(25);
EffectRow* rotation_row = new EffectRow(this, tr("Rotation"));
rotation_val = new DoubleField(rotation_row, "rotation");
rotation_val = new DoubleInput(this, "rotation", tr("Rotation"));
rotation_val->SetMinimum(0);
rotation_val->SetDefault(10);
EffectRow* frequency_row = new EffectRow(this, tr("Frequency"));
frequency_val = new DoubleField(frequency_row, "frequency");
frequency_val = new DoubleInput(this, "frequency", tr("Frequency"));
frequency_val->SetMinimum(0);
frequency_val->SetDefault(5);
@@ -78,15 +75,42 @@ void ShakeEffect::process_coords(double timecode, GLTextureCoords& coords, int)
yoff *= multiplier;
rotoff *= rotmult;
coords.vertexTopLeftX += xoff;
coords.vertexTopRightX += xoff;
coords.vertexBottomLeftX += xoff;
coords.vertexBottomRightX += xoff;
coords.matrix.translate(xoff, yoff, 0.0);
coords.vertexTopLeftY += yoff;
coords.vertexTopRightY += yoff;
coords.vertexBottomLeftY += yoff;
coords.vertexBottomRightY += yoff;
coords.matrix.rotate(QQuaternion::fromEulerAngles(0.0f, 0.0f, rotoff));
}
glRotatef(rotoff, 0, 0, 1);
QString ShakeEffect::name()
{
return tr("Shake");
}
QString ShakeEffect::id()
{
return "org.olivevideoeditor.Olive.shake";
}
QString ShakeEffect::category()
{
return tr("Distort");
}
QString ShakeEffect::description()
{
return tr("Simulate a camera shake movement.");
}
EffectType ShakeEffect::type()
{
return EFFECT_TYPE_EFFECT;
}
olive::TrackType ShakeEffect::subtype()
{
return olive::kTypeVideo;
}
NodePtr ShakeEffect::Create(Clip *c)
{
return std::make_shared<ShakeEffect>(c);
}
+27 -19
View File
@@ -1,39 +1,47 @@
/***
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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef SHAKEEFFECT_H
#define SHAKEEFFECT_H
#include "effects/effect.h"
#include "nodes/node.h"
#define RANDOM_VAL_SIZE 30
class ShakeEffect : public Effect {
class ShakeEffect : public Node {
Q_OBJECT
public:
ShakeEffect(Clip* c, const EffectMeta* em);
void process_coords(double timecode, GLTextureCoords& coords, int data);
ShakeEffect(Clip* c);
virtual void process_coords(double timecode, GLTextureCoords& coords, int data) override;
DoubleField* intensity_val;
DoubleField* rotation_val;
DoubleField* frequency_val;
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;
DoubleInput* intensity_val;
DoubleInput* rotation_val;
DoubleInput* frequency_val;
private:
double random_vals[RANDOM_VAL_SIZE];
};
+54 -23
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -34,30 +34,26 @@ const int SMPTE_BARS = 7;
const int SMPTE_STRIP_COUNT = 3;
const int SMPTE_LOWER_BARS = 4;
SolidEffect::SolidEffect(Clip* c, const EffectMeta* em) :
Effect(c, em)
SolidEffect::SolidEffect(Clip* c) :
Node(c)
{
SetFlags(Effect::SuperimposeFlag);
SetFlags(Node::SuperimposeFlag);
// Field for solid type
EffectRow* type_row = new EffectRow(this, tr("Type"));
solid_type = new ComboField(type_row, "type");
solid_type = new ComboInput(this, "type", tr("Type"));
solid_type->AddItem(tr("Solid Color"), SOLID_TYPE_COLOR);
solid_type->AddItem(tr("SMPTE Bars"), SOLID_TYPE_BARS);
solid_type->AddItem(tr("Checkerboard"), SOLID_TYPE_CHECKERBOARD);
EffectRow* opacity_row = new EffectRow(this, tr("Opacity"));
opacity_field = new DoubleField(opacity_row, "opacity");
opacity_field = new DoubleInput(this, "opacity", tr("Opacity"));
opacity_field->SetMinimum(0);
opacity_field->SetDefault(100);
opacity_field->SetMaximum(100);
EffectRow* solid_color_row = new EffectRow(this, tr("Color"));
solid_color_field = new ColorField(solid_color_row, "color");
solid_color_field = new ColorInput(this, "color", tr("Color"));
solid_color_field->SetValueAt(0, QColor(Qt::red));
EffectRow* checkerboard_size = new EffectRow(this, tr("Checkerboard Size"));
checkerboard_size_field = new DoubleField(checkerboard_size, "checker_size");
checkerboard_size_field = new DoubleInput(this, "checker_size", tr("Checkerboard Size"));
checkerboard_size_field->SetMinimum(1);
checkerboard_size_field->SetDefault(10);
@@ -73,6 +69,41 @@ SolidEffect::SolidEffect(Clip* c, const EffectMeta* em) :
fragPath = ":/shaders/solideffect.frag";*/
}
QString SolidEffect::name()
{
return tr("Solid");
}
QString SolidEffect::id()
{
return "org.olivevideoeditor.Olive.solid";
}
QString SolidEffect::category()
{
return tr("Render");
}
QString SolidEffect::description()
{
return tr("Render a solid color over this clip.");
}
EffectType SolidEffect::type()
{
return EFFECT_TYPE_EFFECT;
}
olive::TrackType SolidEffect::subtype()
{
return olive::kTypeVideo;
}
NodePtr SolidEffect::Create(Clip *c)
{
return std::make_shared<SolidEffect>(c);
}
void SolidEffect::redraw(double timecode) {
int w = img.width();
int h = img.height();
+29 -20
View File
@@ -1,31 +1,31 @@
/***
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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef SOLIDEFFECT_H
#define SOLIDEFFECT_H
#include "effects/effect.h"
#include "nodes/node.h"
#include <QImage>
class SolidEffect : public Effect {
class SolidEffect : public Node {
Q_OBJECT
public:
enum SolidType {
@@ -34,17 +34,26 @@ public:
SOLID_TYPE_CHECKERBOARD
};
SolidEffect(Clip* c, const EffectMeta *em);
virtual void redraw(double timecode);
SolidEffect(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 redraw(double timecode) override;
void SetType(SolidType type);
private slots:
void ui_update(const QVariant &d);
private:
ComboField* solid_type;
ColorField* solid_color_field;
DoubleField* opacity_field;
DoubleField* checkerboard_size_field;
ComboInput* solid_type;
ColorInput* solid_color_field;
DoubleInput* opacity_field;
DoubleInput* checkerboard_size_field;
};
#endif // SOLIDEFFECT_H
+71 -70
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -39,94 +39,60 @@
#include "timeline/sequence.h"
#include "ui/comboboxex.h"
#include "ui/colorbutton.h"
#include "ui/fontcombobox.h"
#include "ui/blur.h"
#include "global/config.h"
TextEffect::TextEffect(Clip* c, const EffectMeta* em) :
Effect(c, em)
TextEffect::TextEffect(Clip* c) :
Node(c)
{
SetFlags(Effect::SuperimposeFlag);
SetFlags(Node::SuperimposeFlag);
EffectRow* text_field = new EffectRow(this, tr("Text"));
text_val = new StringField(text_field, "text", false);
text_val->SetColumnSpan(2);
text_val = new StringInput(this, "text", tr("Text"), false);
EffectRow* font_row = new EffectRow(this, tr("Font"));
set_font_combobox = new FontField(font_row, "font");
set_font_combobox->SetColumnSpan(2);
set_font_combobox = new FontInput(this, "font", tr("Font"));
EffectRow* size_row = new EffectRow(this, tr("Size"));
size_val = new DoubleField(size_row, "size");
size_val = new DoubleInput(this, "size", tr("Size"));
size_val->SetMinimum(0);
size_val->SetColumnSpan(2);
EffectRow* color_row = new EffectRow(this, tr("Color"));
set_color_button = new ColorField(color_row, "color");
set_color_button->SetColumnSpan(2);
set_color_button = new ColorInput(this, "color", tr("Color"));
EffectRow* alignment_row = new EffectRow(this, tr("Alignment"));
halign_field = new ComboField(alignment_row, "halign");
halign_field = new ComboInput(this, "halign", tr("Horizontal Alignment"));
halign_field->AddItem(tr("Left"), Qt::AlignLeft);
halign_field->AddItem(tr("Center"), Qt::AlignHCenter);
halign_field->AddItem(tr("Right"), Qt::AlignRight);
halign_field->AddItem(tr("Justify"), Qt::AlignJustify);
valign_field = new ComboField(alignment_row, "valign");
valign_field = new ComboInput(this, "valign", tr("Vertical Alignment"));
valign_field->AddItem(tr("Top"), Qt::AlignTop);
valign_field->AddItem(tr("Center"), Qt::AlignVCenter);
valign_field->AddItem(tr("Bottom"), Qt::AlignBottom);
EffectRow* word_wrap_row = new EffectRow(this, tr("Word Wrap"));
word_wrap_field = new BoolField(word_wrap_row, "wordwrap");
word_wrap_field->SetColumnSpan(2);
word_wrap_field = new BoolInput(this, "wordwrap", tr("Word Wrap"));
EffectRow* padding_row = new EffectRow(this, tr("Padding"));
padding_field = new DoubleField(padding_row, "padding");
padding_field->SetColumnSpan(2);
padding_field = new DoubleInput(this, "padding", tr("Padding"));
EffectRow* position_row = new EffectRow(this, tr("Position"));
position_x = new DoubleField(position_row, "posx");
position_y = new DoubleField(position_row, "posy");
position = new Vec2Input(this, "pos", tr("Position"));
EffectRow* outline_row = new EffectRow(this, tr("Outline"));
outline_bool = new BoolField(outline_row, "outline");
outline_bool->SetColumnSpan(2);
outline_bool = new BoolInput(this, "outline", tr("Outline"));
EffectRow* outline_color_row = new EffectRow(this, tr("Outline Color"));
outline_color = new ColorField(outline_color_row, "outlinecolor");
outline_color->SetColumnSpan(2);
outline_color = new ColorInput(this, "outlinecolor", tr("Outline Color"));
EffectRow* outline_width_row = new EffectRow(this, tr("Outline Width"));
outline_width = new DoubleField(outline_width_row, "outlinewidth");
outline_width->SetColumnSpan(2);
outline_width = new DoubleInput(this, "outlinewidth", tr("Outline Width"));
outline_width->SetMinimum(0);
EffectRow* shadow_row = new EffectRow(this, tr("Shadow"));
shadow_bool = new BoolField(shadow_row, "shadow");
shadow_bool->SetColumnSpan(2);
shadow_bool = new BoolInput(this, "shadow", tr("Shadow"));
EffectRow* shadow_color_row = new EffectRow(this, tr("Shadow Color"));
shadow_color = new ColorField(shadow_color_row, "shadowcolor");
shadow_color->SetColumnSpan(2);
shadow_color = new ColorInput(this, "shadowcolor", tr("Shadow Color"));
EffectRow* shadow_angle_row = new EffectRow(this, tr("Shadow Angle"));
shadow_angle = new DoubleField(shadow_angle_row, "shadowangle");
shadow_angle->SetColumnSpan(2);
shadow_angle = new DoubleInput(this, "shadowangle", tr("Shadow Angle"));
EffectRow* shadow_distance_row = new EffectRow(this, tr("Shadow Distance"));
shadow_distance = new DoubleField(shadow_distance_row, "shadowdistance");
shadow_distance->SetColumnSpan(2);
shadow_distance = new DoubleInput(this, "shadowdistance", tr("Shadow Distance"));
shadow_distance->SetMinimum(0);
EffectRow* shadow_softness_row = new EffectRow(this, tr("Shadow Softness"));
shadow_softness = new DoubleField(shadow_softness_row, "shadowsoftness");
shadow_softness->SetColumnSpan(2);
shadow_softness = new DoubleInput(this, "shadowsoftness", tr("Shadow Softness"));
shadow_softness->SetMinimum(0);
EffectRow* shadow_opacity_row = new EffectRow(this, tr("Shadow Opacity"));
shadow_opacity = new DoubleField(shadow_opacity_row, "shadowopacity");
shadow_opacity->SetColumnSpan(2);
shadow_opacity = new DoubleInput(this, "shadowopacity", tr("Shadow Opacity"));
shadow_opacity->SetMinimum(0);
shadow_opacity->SetMaximum(100);
@@ -151,8 +117,43 @@ TextEffect::TextEffect(Clip* c, const EffectMeta* em) :
connect(shadow_bool, SIGNAL(Toggled(bool)), this, SLOT(shadow_enable(bool)));
connect(outline_bool, SIGNAL(Toggled(bool)), this, SLOT(outline_enable(bool)));
vertPath = "common.vert";
fragPath = "dropshadow.frag";
shader_vert_path_ = "common.vert";
shader_frag_path_ = "dropshadow.frag";
}
QString TextEffect::name()
{
return tr("Text");
}
QString TextEffect::id()
{
return "org.olivevideoeditor.Olive.text";
}
QString TextEffect::category()
{
return tr("Render");
}
QString TextEffect::description()
{
return tr("Generate simple text over this clip");
}
EffectType TextEffect::type()
{
return EFFECT_TYPE_EFFECT;
}
olive::TrackType TextEffect::subtype()
{
return olive::kTypeVideo;
}
NodePtr TextEffect::Create(Clip *c)
{
return std::make_shared<TextEffect>(c);
}
void TextEffect::redraw(double timecode) {
@@ -257,7 +258,7 @@ void TextEffect::redraw(double timecode) {
path.addText(text_x, text_y, font, lines.at(i));
}
path.translate(position_x->GetDoubleAt(timecode) + padding, position_y->GetDoubleAt(timecode) + padding);
path.translate(position->GetVector2DAt(timecode).toPointF() + QPointF(padding, padding));
// draw software shadow
if (shadow_bool->GetBoolAt(timecode)) {
+43 -35
View File
@@ -1,63 +1,71 @@
/***
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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef TEXTEFFECT_H
#define TEXTEFFECT_H
#include "effects/effect.h"
#include "nodes/node.h"
#include <QFont>
#include <QImage>
class TextEffect : public Effect {
class TextEffect : public Node {
Q_OBJECT
public:
TextEffect(Clip* c, const EffectMeta *em);
void redraw(double timecode);
TextEffect(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 redraw(double timecode) override;
private slots:
void outline_enable(bool);
void shadow_enable(bool);
private:
QFont font;
StringField* text_val;
DoubleField* size_val;
ColorField* set_color_button;
FontField* set_font_combobox;
ComboField* halign_field;
ComboField* valign_field;
BoolField* word_wrap_field;
DoubleField* padding_field;
DoubleField* position_x;
DoubleField* position_y;
StringInput* text_val;
DoubleInput* size_val;
ColorInput* set_color_button;
FontInput* set_font_combobox;
ComboInput* halign_field;
ComboInput* valign_field;
BoolInput* word_wrap_field;
DoubleInput* padding_field;
Vec2Input* position;
BoolField* outline_bool;
DoubleField* outline_width;
ColorField* outline_color;
BoolInput* outline_bool;
DoubleInput* outline_width;
ColorInput* outline_color;
BoolField* shadow_bool;
DoubleField* shadow_angle;
DoubleField* shadow_distance;
ColorField* shadow_color;
DoubleField* shadow_softness;
DoubleField* shadow_opacity;
BoolInput* shadow_bool;
DoubleInput* shadow_angle;
DoubleInput* shadow_distance;
ColorInput* shadow_color;
DoubleInput* shadow_softness;
DoubleInput* shadow_opacity;
};
+69 -46
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -37,66 +37,90 @@
#include "ui/collapsiblewidget.h"
#include "timeline/clip.h"
#include "timeline/sequence.h"
#include "panels/viewer.h"
#include "global/timing.h"
#include "ui/comboboxex.h"
#include "ui/colorbutton.h"
#include "ui/fontcombobox.h"
#include "global/config.h"
TimecodeEffect::TimecodeEffect(Clip* c, const EffectMeta* em) :
Effect(c, em)
TimecodeEffect::TimecodeEffect(Clip* c) :
Node(c)
{
SetFlags(Effect::SuperimposeFlag);
SetFlags(Node::SuperimposeFlag);
EffectRow* tc_row = new EffectRow(this, tr("Timecode"));
tc_select = new ComboField(tc_row, "tc_selector");
tc_select = new ComboInput(this, "tc_selector", tr("Timecode"));
tc_select->AddItem(tr("Sequence"), true);
tc_select->AddItem(tr("Media"), false);
tc_select->SetValueAt(0, true);
EffectRow* scale_row = new EffectRow(this, tr("Scale"));
scale_val = new DoubleField(scale_row, "scale");
scale_val->SetColumnSpan(2);
scale_val = new DoubleInput(this, "scale", tr("Scale"));
scale_val->SetMinimum(1);
scale_val->SetDefault(100);
scale_val->SetMaximum(1000);
EffectRow* color_row = new EffectRow(this, tr("Color"));
color_val = new ColorField(color_row, "color");
color_val->SetColumnSpan(2);
color_val = new ColorInput(this, "color", tr("Color"));
color_val->SetValueAt(0, QColor(Qt::white));
EffectRow* color_bg_row = new EffectRow(this, tr("Background Color"));
color_bg_val = new ColorField(color_bg_row, "bgcolor");
color_bg_val->SetColumnSpan(2);
color_bg_val = new ColorInput(this, "bgcolor", tr("Background Color"));
color_bg_val->SetValueAt(0, QColor(Qt::black));
EffectRow* bg_alpha_row = new EffectRow(this, tr("Background Opacity"));
bg_alpha = new DoubleField(bg_alpha_row, "bgalpha");
bg_alpha->SetColumnSpan(2);
bg_alpha = new DoubleInput(this, "bgalpha", tr("Background Opacity"));
bg_alpha->SetMinimum(0);
bg_alpha->SetDefault(50);
bg_alpha->SetMaximum(100);
EffectRow* offset_row = new EffectRow(this, tr("Offset"));
offset_x_val = new DoubleField(offset_row, "offsetx");
offset_y_val = new DoubleField(offset_row, "offsety");
offset_val = new Vec2Input(this, "offset", tr("Offset"));
offset_val->SetDefault(0);
EffectRow* prepent_text_row = new EffectRow(this, tr("Prepend"));
prepend_text = new StringField(prepent_text_row, "prepend", false);
prepend_text->SetColumnSpan(2);
prepend_text = new StringInput(this, "prepend", tr("Prepend"), false);
}
QString TimecodeEffect::name()
{
return tr("Timecode");
}
QString TimecodeEffect::id()
{
return "org.olivevideoeditor.Olive.timecode";
}
QString TimecodeEffect::category()
{
return tr("Render");
}
QString TimecodeEffect::description()
{
return tr("Render the media or sequence timecode on this clip.");
}
EffectType TimecodeEffect::type()
{
return EFFECT_TYPE_EFFECT;
}
olive::TrackType TimecodeEffect::subtype()
{
return olive::kTypeVideo;
}
NodePtr TimecodeEffect::Create(Clip *c)
{
return std::make_shared<TimecodeEffect>(c);
}
void TimecodeEffect::redraw(double timecode) {
Sequence* sequence = parent_clip->track()->sequence();
if (tc_select->GetValueAt(timecode).toBool()) {
display_timecode = prepend_text->GetStringAt(timecode) + frame_to_timecode(olive::ActiveSequence->playhead,
olive::CurrentConfig.timecode_view,
olive::ActiveSequence->frame_rate);
display_timecode = prepend_text->GetStringAt(timecode) + frame_to_timecode(sequence->playhead,
olive::config.timecode_view,
sequence->frame_rate);
} else {
double media_rate = parent_clip->media_frame_rate();
display_timecode = prepend_text->GetStringAt(timecode) + frame_to_timecode(qRound(timecode * media_rate),
olive::CurrentConfig.timecode_view,
olive::config.timecode_view,
media_rate);
}
img.fill(Qt::transparent);
@@ -115,18 +139,17 @@ void TimecodeEffect::redraw(double timecode) {
QPainterPath path;
int text_x, text_y, rect_y, offset_x, offset_y;
int text_x, text_y, rect_y;
int text_height = fm.height();
int text_width = fm.width(display_timecode);
QColor background_color = color_bg_val->GetColorAt(timecode);
int alpha_val = qCeil(bg_alpha->GetDoubleAt(timecode)*2.55);
background_color.setAlpha(alpha_val);
offset_x = int(offset_x_val->GetDoubleAt(timecode));
offset_y = int(offset_y_val->GetDoubleAt(timecode));
QVector2D offset = offset_val->GetVector2DAt(timecode);
text_x = offset_x + (width/2) - (text_width/2);
text_y = offset_y + height - height/10;
text_x = offset.x() + (width/2) - (text_width/2);
text_y = offset.y() + height - height/10;
rect_y = text_y + fm.descent() - text_height;
path.addText(text_x, text_y, font, display_timecode);
+32 -24
View File
@@ -1,44 +1,52 @@
/***
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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef TIMECODEEFFECT_H
#define TIMECODEEFFECT_H
#include "effects/effect.h"
#include "nodes/node.h"
#include <QFont>
#include <QImage>
class TimecodeEffect : public Effect {
class TimecodeEffect : public Node {
Q_OBJECT
public:
TimecodeEffect(Clip* c, const EffectMeta *em);
void redraw(double timecode);
DoubleField* scale_val;
ColorField* color_val;
ColorField* color_bg_val;
DoubleField* bg_alpha;
DoubleField* offset_x_val;
DoubleField* offset_y_val;
StringField* prepend_text;
ComboField* tc_select;
TimecodeEffect(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 redraw(double timecode) override;
DoubleInput* scale_val;
ColorInput* color_val;
ColorInput* color_bg_val;
DoubleInput* bg_alpha;
Vec2Input* offset_val;
StringInput* prepend_text;
ComboInput* tc_select;
protected:
virtual bool AlwaysUpdate() override;
+76 -39
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -27,51 +27,88 @@
#include "timeline/clip.h"
#include "timeline/sequence.h"
ToneEffect::ToneEffect(Clip* c, const EffectMeta *em) : Effect(c, em), sinX(INT_MIN) {
EffectRow* type_row = new EffectRow(this, tr("Type"));
type_val = new ComboField(type_row, "type");
ToneEffect::ToneEffect(Clip* c) : Node(c), sinX(INT_MIN) {
type_val = new ComboInput(this, "type", tr("Type"));
type_val->AddItem(tr("Sine"), TONE_TYPE_SINE);
EffectRow* frequency_row = new EffectRow(this, tr("Frequency"));
freq_val = new DoubleField(frequency_row, "frequency");
freq_val = new DoubleInput(this, "frequency", tr("Frequency"));
freq_val->SetMinimum(20);
freq_val->SetMaximum(20000);
freq_val->SetDefault(1000);
EffectRow* amount_row = new EffectRow(this, tr("Amount"));
amount_val = new DoubleField(amount_row, "amount");
amount_val = new DoubleInput(this, "amount", tr("Amount"));
amount_val->SetMinimum(0);
amount_val->SetMaximum(100);
amount_val->SetDefault(25);
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 ToneEffect::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<nb_bytes;i+=4) {
QString ToneEffect::name()
{
return tr("Tone");
}
QString ToneEffect::id()
{
return "org.olivevideoeditor.Olive.tone";
}
QString ToneEffect::description()
{
return tr("Generate a sine wave tone to mix into this clip's audio.");
}
EffectType ToneEffect::type()
{
return EFFECT_TYPE_EFFECT;
}
olive::TrackType ToneEffect::subtype()
{
return olive::kTypeAudio;
}
NodePtr ToneEffect::Create(Clip *c)
{
return std::make_shared<ToneEffect>(c);
}
void ToneEffect::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;i<nb_samples;i++) {
double timecode = timecode_start+(interval*i);
float tone_sample = qSin((2*M_PI*sinX*freq_val->GetDoubleAt(timecode))
/parent_clip->track()->sequence()->audio_frequency)
*log_volume(amount_val->GetDoubleAt(timecode)*0.01);
qint16 left_tone_sample = qint16(qRound(qSin((2*M_PI*sinX*freq_val->GetDoubleAt(timecode))
/parent_clip->sequence->audio_frequency)
*log_volume(amount_val->GetDoubleAt(timecode)*0.01)*INT16_MAX));
qint16 right_tone_sample = left_tone_sample;
for (int j=0;j<channel_count;j++) {
if (mix_val->GetBoolAt(timecode)) {
// mix with source audio
samples[j][i] += tone_sample;
} else {
// replace source audio
samples[j][i] = tone_sample;
}
// mix with source audio
if (mix_val->GetBoolAt(timecode)) {
qint16 left_sample = qint16(((samples[i+1] & 0xFF) << 8) | (samples[i] & 0xFF));
qint16 right_sample = qint16(((samples[i+3] & 0xFF) << 8) | (samples[i+2] & 0xFF));
left_tone_sample = mix_audio_sample(left_tone_sample, left_sample);
right_tone_sample = mix_audio_sample(right_tone_sample, right_sample);
}
samples[i+3] = quint8(right_tone_sample >> 8);
samples[i+2] = quint8(right_tone_sample);
samples[i+1] = quint8(left_tone_sample >> 8);
samples[i] = quint8(left_tone_sample);
sinX++;
}
}
+34 -20
View File
@@ -1,39 +1,53 @@
/***
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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef TONEEFFECT_H
#define TONEEFFECT_H
#include "effects/effect.h"
#include "nodes/node.h"
class ToneEffect : public Effect {
class ToneEffect : public Node {
Q_OBJECT
public:
ToneEffect(Clip* c, const EffectMeta* em);
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
ToneEffect(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;
ComboField* type_val;
DoubleField* freq_val;
DoubleField* amount_val;
BoolField* mix_val;
private:
ComboInput* type_val;
DoubleInput* freq_val;
DoubleInput* amount_val;
BoolInput* mix_val;
int sinX;
};
+125 -109
View File
@@ -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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -43,122 +43,131 @@
#include "panels/viewer.h"
#include "ui/viewerwidget.h"
TransformEffect::TransformEffect(Clip* c, const EffectMeta* em) : Effect(c, em) {
SetFlags(Effect::CoordsFlag);
TransformEffect::TransformEffect(Clip* c) : Node(c) {
SetFlags(Node::CoordsFlag);
EffectRow* position_row = new EffectRow(this, tr("Position"));
position = new Vec2Input(this, "pos", tr("Position"));
position_x = new DoubleField(position_row, "posx"); // position X
position_y = new DoubleField(position_row, "posy"); // position Y
scale = new Vec2Input(this, "scale", tr("Scale"));
scale->SetMinimum(0);
scale->SetDefault(100);
EffectRow* scale_row = new EffectRow(this, tr("Scale"));
uniform_scale_field = new BoolInput(this, "uniformscale", tr("Uniform Scale"));
connect(uniform_scale_field, SIGNAL(Toggled(bool)), scale, SLOT(SetSingleValueMode(bool)));
uniform_scale_field->SetValueAt(0, true);
// scale X (and Y is uniform scale is selected)
scale_x = new DoubleField(scale_row, "scalex");
scale_x->SetMinimum(0);
rotation = new DoubleInput(this, "rotation", tr("Rotation"));
// scale Y (disabled if uniform scale is selected)
scale_y = new DoubleField(scale_row, "scaley");
scale_y->SetMinimum(0);
EffectRow* uniform_scale_row = new EffectRow(this, tr("Uniform Scale"));
uniform_scale_field = new BoolField(uniform_scale_row, "uniformscale"); // uniform scale option
EffectRow* rotation_row = new EffectRow(this, tr("Rotation"));
rotation = new DoubleField(rotation_row, "rotation");
EffectRow* anchor_point_row = new EffectRow(this, tr("Anchor Point"));
anchor_x_box = new DoubleField(anchor_point_row, "anchorx"); // anchor point X
anchor_y_box = new DoubleField(anchor_point_row, "anchory"); // anchor point Y
EffectRow* opacity_row = new EffectRow(this, tr("Opacity"));
anchor_point = new Vec2Input(this, "anchor", tr("Anchor Point"));
anchor_point->SetDefault(0);
// opacity
opacity = new DoubleField(opacity_row, "opacity");
opacity = new DoubleInput(this, "opacity", tr("Opacity"));
opacity->SetMinimum(0);
opacity->SetMaximum(100);
opacity->SetDefault(100);
EffectRow* blend_mode_row = new EffectRow(this, tr("Blend Mode"));
// blend mode
blend_mode_box = new ComboField(blend_mode_row, "blendmode");
blend_mode_box->SetColumnSpan(2);
blend_mode_box->AddItem(tr("Normal"), "");
// TEMP - Create matrix output
EffectRow* matrix_output = new EffectRow(this, "matrix", "Matrix", false, false);
matrix_output->SetOutputDataType(olive::nodes::kMatrix);
// set up gizmos
top_left_gizmo = add_gizmo(GIZMO_TYPE_DOT);
top_left_gizmo->set_cursor(Qt::SizeFDiagCursor);
top_left_gizmo->x_field1 = scale_x;
top_left_gizmo->x_field1 = static_cast<DoubleField*>(scale->Field(0));
top_center_gizmo = add_gizmo(GIZMO_TYPE_DOT);
top_center_gizmo->set_cursor(Qt::SizeVerCursor);
top_center_gizmo->y_field1 = scale_x;
top_center_gizmo->y_field1 = static_cast<DoubleField*>(scale->Field(0));
top_right_gizmo = add_gizmo(GIZMO_TYPE_DOT);
top_right_gizmo->set_cursor(Qt::SizeBDiagCursor);
top_right_gizmo->x_field1 = scale_x;
top_right_gizmo->x_field1 = static_cast<DoubleField*>(scale->Field(0));
bottom_left_gizmo = add_gizmo(GIZMO_TYPE_DOT);
bottom_left_gizmo->set_cursor(Qt::SizeBDiagCursor);
bottom_left_gizmo->x_field1 = scale_x;
bottom_left_gizmo->x_field1 = static_cast<DoubleField*>(scale->Field(0));
bottom_center_gizmo = add_gizmo(GIZMO_TYPE_DOT);
bottom_center_gizmo->set_cursor(Qt::SizeVerCursor);
bottom_center_gizmo->y_field1 = scale_x;
bottom_center_gizmo->y_field1 = static_cast<DoubleField*>(scale->Field(0));
bottom_right_gizmo = add_gizmo(GIZMO_TYPE_DOT);
bottom_right_gizmo->set_cursor(Qt::SizeFDiagCursor);
bottom_right_gizmo->x_field1 = scale_x;
bottom_right_gizmo->x_field1 = static_cast<DoubleField*>(scale->Field(0));
left_center_gizmo = add_gizmo(GIZMO_TYPE_DOT);
left_center_gizmo->set_cursor(Qt::SizeHorCursor);
left_center_gizmo->x_field1 = scale_x;
left_center_gizmo->x_field1 = static_cast<DoubleField*>(scale->Field(0));
right_center_gizmo = add_gizmo(GIZMO_TYPE_DOT);
right_center_gizmo->set_cursor(Qt::SizeHorCursor);
right_center_gizmo->x_field1 = scale_x;
right_center_gizmo->x_field1 = static_cast<DoubleField*>(scale->Field(0));
anchor_gizmo = add_gizmo(GIZMO_TYPE_TARGET);
anchor_gizmo->set_cursor(Qt::SizeAllCursor);
anchor_gizmo->x_field1 = anchor_x_box;
anchor_gizmo->y_field1 = anchor_y_box;
anchor_gizmo->x_field2 = position_x;
anchor_gizmo->y_field2 = position_y;
anchor_gizmo->x_field1 = static_cast<DoubleField*>(anchor_point->Field(0));
anchor_gizmo->y_field1 = static_cast<DoubleField*>(anchor_point->Field(1));
anchor_gizmo->x_field2 = static_cast<DoubleField*>(position->Field(0));
anchor_gizmo->y_field2 = static_cast<DoubleField*>(position->Field(1));
rotate_gizmo = add_gizmo(GIZMO_TYPE_DOT);
rotate_gizmo->color = Qt::green;
rotate_gizmo->set_cursor(Qt::SizeAllCursor);
rotate_gizmo->x_field1 = rotation;
rotate_gizmo->x_field1 = static_cast<DoubleField*>(rotation->Field(0));
rect_gizmo = add_gizmo(GIZMO_TYPE_POLY);
rect_gizmo->x_field1 = position_x;
rect_gizmo->y_field1 = position_y;
rect_gizmo->x_field1 = static_cast<DoubleField*>(position->Field(0));
rect_gizmo->y_field1 = static_cast<DoubleField*>(position->Field(1));
connect(uniform_scale_field, SIGNAL(Toggled(bool)), this, SLOT(toggle_uniform_scale(bool)));
// set defaults
uniform_scale_field->SetValueAt(0, true);
blend_mode_box->SetValueAt(0, "");
anchor_x_box->SetDefault(0);
anchor_y_box->SetDefault(0);
opacity->SetDefault(100);
scale_x->SetDefault(100);
scale_y->SetDefault(100);
refresh();
}
QString TransformEffect::name()
{
return tr("Transform");
}
QString TransformEffect::id()
{
return "org.olivevideoeditor.Olive.transform";
}
QString TransformEffect::category()
{
return tr("Distort");
}
QString TransformEffect::description()
{
return tr("Transform the position, scale, and rotation of this clip.");
}
EffectType TransformEffect::type()
{
return EFFECT_TYPE_EFFECT;
}
olive::TrackType TransformEffect::subtype()
{
return olive::kTypeVideo;
}
NodePtr TransformEffect::Create(Clip *c)
{
return std::make_shared<TransformEffect>(c);
}
void TransformEffect::refresh() {
if (parent_clip != nullptr && parent_clip->sequence != nullptr) {
if (parent_clip != nullptr && parent_clip->track()->sequence() != nullptr) {
position_x->SetDefault(parent_clip->sequence->width/2);
position_y->SetDefault(parent_clip->sequence->height/2);
position->SetDefault({parent_clip->track()->sequence()->width*0.5,
parent_clip->track()->sequence()->height*0.5});
double x_percent_multipler = 200.0 / parent_clip->sequence->width;
double y_percent_multipler = 200.0 / parent_clip->sequence->height;
double x_percent_multipler = 200.0 / parent_clip->track()->sequence()->width;
double y_percent_multipler = 200.0 / parent_clip->track()->sequence()->height;
top_left_gizmo->x_field_multi1 = -x_percent_multipler;
top_left_gizmo->y_field_multi1 = -y_percent_multipler;
@@ -178,7 +187,10 @@ void TransformEffect::refresh() {
}
void TransformEffect::toggle_uniform_scale(bool enabled) {
scale_y->SetEnabled(!enabled);
scale->SetSingleValueMode(enabled);
DoubleField* scale_x = static_cast<DoubleField*>(scale->Field(0));
DoubleField* scale_y = static_cast<DoubleField*>(scale->Field(1));
top_center_gizmo->y_field1 = enabled ? scale_x : scale_y;
bottom_center_gizmo->y_field1 = enabled ? scale_x : scale_y;
@@ -190,51 +202,55 @@ void TransformEffect::toggle_uniform_scale(bool enabled) {
void TransformEffect::process_coords(double timecode, GLTextureCoords& coords, int) {
// position
glTranslated(position_x->GetDoubleAt(timecode)-(parent_clip->sequence->width/2),
position_y->GetDoubleAt(timecode)-(parent_clip->sequence->height/2),
0);
coords.matrix.translate(position->GetVector2DAt(timecode)
- QVector2D(parent_clip->track()->sequence()->width*0.5f,
parent_clip->track()->sequence()->height*0.5f));
// anchor point
int anchor_x_offset = qRound(anchor_x_box->GetDoubleAt(timecode));
int anchor_y_offset = qRound(anchor_y_box->GetDoubleAt(timecode));
coords.vertexTopLeftX -= anchor_x_offset;
coords.vertexTopRightX -= anchor_x_offset;
coords.vertexBottomLeftX -= anchor_x_offset;
coords.vertexBottomRightX -= anchor_x_offset;
coords.vertexTopLeftY -= anchor_y_offset;
coords.vertexTopRightY -= anchor_y_offset;
coords.vertexBottomLeftY -= anchor_y_offset;
coords.vertexBottomRightY -= anchor_y_offset;
QVector2D anchor_val = anchor_point->GetVector2DAt(timecode);
coords.vertex_top_left -= anchor_val;
coords.vertex_top_right -= anchor_val;
coords.vertex_bottom_left -= anchor_val;
coords.vertex_bottom_right -= anchor_val;
// rotation
glRotated(rotation->GetDoubleAt(timecode), 0, 0, 1);
coords.matrix.rotate(QQuaternion::fromEulerAngles(0, 0, float(rotation->GetDoubleAt(timecode))));
// scale
double sx = scale_x->GetDoubleAt(timecode)*0.01;
double sy = (uniform_scale_field->GetBoolAt(timecode)) ? sx : scale_y->GetDoubleAt(timecode)*0.01;
glScaled(sx, sy, 1);
// blend mode
coords.blendmode = blend_mode_box->GetValueAt(timecode).toInt();
coords.matrix.scale(scale->GetVector2DAt(timecode)*0.01f);
// opacity
coords.opacity *= float(opacity->GetDoubleAt(timecode)*0.01);
}
QVector3D LerpVector3D(const QVector3D& a, const QVector3D& b, float t) {
return QVector3D(
float_lerp(a.x(), b.x(), t),
float_lerp(a.y(), b.y(), t),
float_lerp(a.z(), b.z(), t)
);
}
void TransformEffect::gizmo_draw(double, GLTextureCoords& coords) {
top_left_gizmo->world_pos[0] = QPoint(coords.vertexTopLeftX, coords.vertexTopLeftY);
top_center_gizmo->world_pos[0] = QPoint(lerp(coords.vertexTopLeftX, coords.vertexTopRightX, 0.5), lerp(coords.vertexTopLeftY, coords.vertexTopRightY, 0.5));
top_right_gizmo->world_pos[0] = QPoint(coords.vertexTopRightX, coords.vertexTopRightY);
right_center_gizmo->world_pos[0] = QPoint(lerp(coords.vertexTopRightX, coords.vertexBottomRightX, 0.5), lerp(coords.vertexTopRightY, coords.vertexBottomRightY, 0.5));
bottom_right_gizmo->world_pos[0] = QPoint(coords.vertexBottomRightX, coords.vertexBottomRightY);
bottom_center_gizmo->world_pos[0] = QPoint(lerp(coords.vertexBottomRightX, coords.vertexBottomLeftX, 0.5), lerp(coords.vertexBottomRightY, coords.vertexBottomLeftY, 0.5));
bottom_left_gizmo->world_pos[0] = QPoint(coords.vertexBottomLeftX, coords.vertexBottomLeftY);
left_center_gizmo->world_pos[0] = QPoint(lerp(coords.vertexBottomLeftX, coords.vertexTopLeftX, 0.5), lerp(coords.vertexBottomLeftY, coords.vertexTopLeftY, 0.5));
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;
top_center_gizmo->world_pos[0] = LerpVector3D(coords.vertex_top_left, coords.vertex_top_right, 0.5);
right_center_gizmo->world_pos[0] = LerpVector3D(coords.vertex_top_right, coords.vertex_bottom_right, 0.5);
bottom_center_gizmo->world_pos[0] = LerpVector3D(coords.vertex_bottom_right, coords.vertex_bottom_left, 0.5);
left_center_gizmo->world_pos[0] = LerpVector3D(coords.vertex_bottom_left, coords.vertex_top_left, 0.5);
rotate_gizmo->world_pos[0] = QPoint(lerp(top_center_gizmo->world_pos[0].x(), bottom_center_gizmo->world_pos[0].x(), -0.1), lerp(top_center_gizmo->world_pos[0].y(), bottom_center_gizmo->world_pos[0].y(), -0.1));
rotate_gizmo->world_pos[0] = QVector3D(
float_lerp(top_center_gizmo->world_pos[0].x(), bottom_center_gizmo->world_pos[0].x(), 0.5f),
float_lerp(top_center_gizmo->world_pos[0].y(), bottom_center_gizmo->world_pos[0].y(), -0.1f),
0.0f
);
rect_gizmo->world_pos[0] = QPoint(coords.vertexTopLeftX, coords.vertexTopLeftY);
rect_gizmo->world_pos[1] = QPoint(coords.vertexTopRightX, coords.vertexTopRightY);
rect_gizmo->world_pos[2] = QPoint(coords.vertexBottomRightX, coords.vertexBottomRightY);
rect_gizmo->world_pos[3] = QPoint(coords.vertexBottomLeftX, coords.vertexBottomLeftY);
rect_gizmo->world_pos[0] = coords.vertex_top_left;
rect_gizmo->world_pos[1] = coords.vertex_top_right;
rect_gizmo->world_pos[2] = coords.vertex_bottom_right;
rect_gizmo->world_pos[3] = coords.vertex_bottom_left;
}
+35 -28
View File
@@ -1,49 +1,56 @@
/***
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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef TRANSFORMEFFECT_H
#define TRANSFORMEFFECT_H
#include "effects/effect.h"
#include "nodes/node.h"
class TransformEffect : public Effect {
class TransformEffect : public Node {
Q_OBJECT
public:
TransformEffect(Clip* c, const EffectMeta* em);
void refresh();
void process_coords(double timecode, GLTextureCoords& coords, int data);
TransformEffect(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 refresh() override;
virtual void process_coords(double timecode, GLTextureCoords& coords, int data) override;
virtual void gizmo_draw(double timecode, GLTextureCoords& coords) override;
void gizmo_draw(double timecode, GLTextureCoords& coords);
public slots:
void toggle_uniform_scale(bool enabled);
private:
DoubleField* position_x;
DoubleField* position_y;
DoubleField* scale_x;
DoubleField* scale_y;
BoolField* uniform_scale_field;
DoubleField* rotation;
DoubleField* anchor_x_box;
DoubleField* anchor_y_box;
DoubleField* opacity;
ComboField* blend_mode_box;
Vec2Input* position;
Vec2Input* scale;
BoolInput* uniform_scale_field;
DoubleInput* rotation;
Vec2Input* anchor_point;
DoubleInput* opacity;
EffectGizmo* top_left_gizmo;
EffectGizmo* top_center_gizmo;

Some files were not shown because too many files have changed in this diff Show More