Merge branch 'master' into pr/1875

This commit is contained in:
itsmattkc
2022-05-04 15:04:28 -07:00
140 changed files with 791 additions and 585 deletions
+1 -1
View File
@@ -235,7 +235,7 @@ PaDeviceIndex AudioManager::FindConfigDeviceByName(bool is_output_device)
{
QString entry = is_output_device ? QStringLiteral("AudioOutput") : QStringLiteral("AudioInput");
return FindDeviceByName(Config::Current()[entry].toString(), is_output_device);
return FindDeviceByName(OLIVE_CONFIG_STR(entry).toString(), is_output_device);
}
PaDeviceIndex AudioManager::FindDeviceByName(const QString &s, bool is_output_device)
+1 -1
View File
@@ -426,7 +426,7 @@ void AudioVisualWaveform::DrawWaveform(QPainter *painter, const QRect& rect, con
int start = qMax(rect.x(), -top_left.x());
int end = qMin(rect.right(), -top_left.x() + viewport.width());
bool rectified = Config::Current()[QStringLiteral("RectifiedWaveforms")].toBool();
bool rectified = OLIVE_CONFIG("RectifiedWaveforms").toBool();
for (int i=start;i<end;i++) {
sample_index = next_sample_index;
+50 -22
View File
@@ -72,22 +72,44 @@ FootageDescription OIIODecoder::Probe(const QString &filename, const QAtomicInt*
return desc;
}
VideoParams video_params;
bool stream_enabled = true;
video_params.set_stream_index(0);
video_params.set_width(in->spec().width);
video_params.set_height(in->spec().height);
video_params.set_format(OIIOUtils::GetFormatFromOIIOBasetype(static_cast<OIIO::TypeDesc::BASETYPE>(in->spec().format.basetype)));
video_params.set_channel_count(in->spec().nchannels);
video_params.set_pixel_aspect_ratio(OIIOUtils::GetPixelAspectRatioFromOIIO(in->spec()));
video_params.set_video_type(VideoParams::kVideoTypeStill);
for (int i=0; in->seek_subimage(i, 0); i++) {
VideoParams video_params;
// OIIO automatically premultiplies alpha
// FIXME: We usually disassociate the alpha for the color management later, for 8-bit images this
// likely reduces the fidelity?
video_params.set_premultiplied_alpha(true);
OIIO::ImageSpec spec = in->spec();
desc.AddVideoStream(video_params);
video_params.set_stream_index(i);
video_params.set_width(spec.width);
video_params.set_height(spec.height);
video_params.set_format(OIIOUtils::GetFormatFromOIIOBasetype(static_cast<OIIO::TypeDesc::BASETYPE>(spec.format.basetype)));
video_params.set_channel_count(spec.nchannels);
video_params.set_pixel_aspect_ratio(OIIOUtils::GetPixelAspectRatioFromOIIO(spec));
video_params.set_video_type(VideoParams::kVideoTypeStill);
if (i > 1) {
// This is a multilayer image and this image might have an offset
OIIO::ImageSpec root_spec = in->spec(0);
float norm_x = spec.x + float(spec.width)*0.5f - float(root_spec.width)*0.5f;
float norm_y = spec.y + float(spec.height)*0.5f - float(root_spec.height)*0.5f;
video_params.set_x(norm_x);
video_params.set_y(norm_y);
}
// By default, only enable the first subimage (presumably the combined image). Later we will
// ask the user if they want to enable the layers instead.
video_params.set_enabled(stream_enabled);
stream_enabled = false;
// OIIO automatically premultiplies alpha
// FIXME: We usually disassociate the alpha for the color management later, for 8-bit images this
// likely reduces the fidelity?
video_params.set_premultiplied_alpha(true);
desc.AddVideoStream(video_params);
}
// If we're here, we have a successful image open
in->close();
@@ -98,7 +120,7 @@ FootageDescription OIIODecoder::Probe(const QString &filename, const QAtomicInt*
bool OIIODecoder::OpenInternal()
{
// If we can open the filename provided, assume everything is working
return OpenImageHandler(stream().filename());
return OpenImageHandler(stream().filename(), stream().stream());
}
FramePtr OIIODecoder::RetrieveVideoInternal(const rational &timecode, const RetrieveVideoParams &divider, const QAtomicInt *cancelled)
@@ -108,13 +130,15 @@ FramePtr OIIODecoder::RetrieveVideoInternal(const rational &timecode, const Retr
FramePtr frame = Frame::Create();
frame->set_video_params(VideoParams(buffer_->spec().width,
buffer_->spec().height,
pix_fmt_,
channel_count_,
OIIOUtils::GetPixelAspectRatioFromOIIO(buffer_->spec()),
VideoParams::kInterlaceNone, // FIXME: Does OIIO deinterlace for us?
divider.divider));
VideoParams vp(buffer_->spec().width,
buffer_->spec().height,
pix_fmt_,
channel_count_,
OIIOUtils::GetPixelAspectRatioFromOIIO(buffer_->spec()),
VideoParams::kInterlaceNone, // FIXME: Does OIIO deinterlace for us?
divider.divider);
frame->set_video_params(vp);
frame->allocate();
if (divider.divider == 1) {
@@ -167,7 +191,7 @@ bool OIIODecoder::FileTypeIsSupported(const QString& fn)
return true;
}
bool OIIODecoder::OpenImageHandler(const QString &fn)
bool OIIODecoder::OpenImageHandler(const QString &fn, int subimage)
{
image_ = OIIO::ImageInput::open(fn.toStdString());
@@ -175,6 +199,10 @@ bool OIIODecoder::OpenImageHandler(const QString &fn)
return false;
}
if (!image_->seek_subimage(subimage, 0)) {
return false;
}
// Check if we can work with this pixel format
const OIIO::ImageSpec& spec = image_->spec();
+1 -1
View File
@@ -52,7 +52,7 @@ private:
static bool FileTypeIsSupported(const QString& fn);
bool OpenImageHandler(const QString& fn);
bool OpenImageHandler(const QString& fn, int subimage);
void CloseImageHandle();
+1
View File
@@ -31,6 +31,7 @@
namespace olive {
#define OLIVE_CONFIG(x) Config::Current()[QStringLiteral(x)]
#define OLIVE_CONFIG_STR(x) Config::Current()[x]
class Config {
public:
+51 -8
View File
@@ -533,6 +533,49 @@ void Core::ImportTaskComplete(Task* task)
MultiUndoCommand *command = import_task->GetCommand();
foreach (Footage *f, import_task->GetImportedFootage()) {
// Look for multi-layer images
if (f->GetAudioStreamCount() == 0 && f->GetVideoStreamCount() > 1) {
bool all_stills = true;
for (int i=0; i<f->GetVideoStreamCount(); i++) {
const VideoParams &vs = f->GetVideoParams(i);
if (!(vs.video_type() == VideoParams::kVideoTypeStill && vs.enabled() == (i == 0))) {
all_stills = false;
}
}
if (all_stills) {
QMessageBox d(main_window());
d.setIcon(QMessageBox::Question);
d.setWindowTitle(tr("Multi-Layer Image"));
d.setText(tr("The file '%1' has multiple layers. Would you like these layers to be "
"separated across multiple tracks or merged into a single image?").arg(f->filename()));
auto multi_btn = d.addButton(tr("Multiple Layers"), QMessageBox::YesRole);
auto single_btn = d.addButton(tr("Single Layer"), QMessageBox::NoRole);
auto cancel_btn = d.addButton(QMessageBox::Cancel);
d.exec();
if (d.clickedButton() == multi_btn) {
for (int i=0; i<f->GetVideoStreamCount(); i++) {
VideoParams vs = f->GetVideoParams(i);
vs.set_enabled(!vs.enabled());
f->SetVideoParams(vs, i);
}
} else if (d.clickedButton() == single_btn) {
// Do nothing, footage will already be set up this way
} else if (d.clickedButton() == cancel_btn) {
// Cancel import
delete command;
return;
}
}
}
}
if (import_task->HasInvalidFiles()) {
ProjectImportErrorDialog d(import_task->GetInvalidFiles(), main_window_);
d.exec();
@@ -751,7 +794,7 @@ void Core::StartGUI(bool full_screen)
connect(this, &Core::ProjectClosed, main_window_, &MainWindow::ProjectClose);
// Start autorecovery timer using the config value as its interval
SetAutorecoveryInterval(Config::Current()["AutorecoveryInterval"].toInt());
SetAutorecoveryInterval(OLIVE_CONFIG("AutorecoveryInterval").toInt());
connect(&autorecovery_timer_, &QTimer::timeout, this, &Core::SaveAutorecovery);
autorecovery_timer_.start();
@@ -917,7 +960,7 @@ bool Core::RevertProjectInternal(Project *p, bool by_opening_existing)
void Core::SaveAutorecovery()
{
if (Config::Current()[QStringLiteral("AutorecoveryEnabled")].toBool()) {
if (OLIVE_CONFIG("AutorecoveryEnabled").toBool()) {
foreach (Project* p, open_projects_) {
if (!p->has_autorecovery_been_saved()) {
QDir project_autorecovery_dir(QDir(FileFunctions::GetAutoRecoveryRoot()).filePath(p->GetUuid().toString()));
@@ -943,7 +986,7 @@ void Core::SaveAutorecovery()
realname_file.close();
}
int64_t max_recoveries_per_file = Config::Current()[QStringLiteral("AutorecoveryMaximum")].toLongLong();
int64_t max_recoveries_per_file = OLIVE_CONFIG("AutorecoveryMaximum").toLongLong();
// Since we write an extra file, increment total allowed files by 1
max_recoveries_per_file++;
@@ -1032,12 +1075,12 @@ Folder *Core::GetSelectedFolderInActiveProject() const
Timecode::Display Core::GetTimecodeDisplay() const
{
return static_cast<Timecode::Display>(Config::Current()["TimecodeDisplay"].toInt());
return static_cast<Timecode::Display>(OLIVE_CONFIG("TimecodeDisplay").toInt());
}
void Core::SetTimecodeDisplay(Timecode::Display d)
{
Config::Current()["TimecodeDisplay"] = d;
OLIVE_CONFIG("TimecodeDisplay") = d;
emit TimecodeDisplayChanged(d);
}
@@ -1159,7 +1202,7 @@ void Core::SetStartupLocale()
}
}
QString use_locale = Config::Current()[QStringLiteral("Language")].toString();
QString use_locale = OLIVE_CONFIG("Language").toString();
if (use_locale.isEmpty()) {
// No configured locale, auto-detect the system's locale
@@ -1380,12 +1423,12 @@ QString GetRenderModePreferencePrefix(RenderMode::Mode mode, const QString &pref
QVariant Core::GetPreferenceForRenderMode(RenderMode::Mode mode, const QString &preference)
{
return Config::Current()[GetRenderModePreferencePrefix(mode, preference)];
return OLIVE_CONFIG_STR(GetRenderModePreferencePrefix(mode, preference));
}
void Core::SetPreferenceForRenderMode(RenderMode::Mode mode, const QString &preference, const QVariant &value)
{
Config::Current()[GetRenderModePreferencePrefix(mode, preference)] = value;
OLIVE_CONFIG_STR(GetRenderModePreferencePrefix(mode, preference)) = value;
}
bool Core::LabelNodes(const QVector<Node *> &nodes, MultiUndoCommand *parent)
+1 -1
View File
@@ -132,7 +132,7 @@ AboutDialog::AboutDialog(bool welcome_dialog, QWidget *parent) :
void AboutDialog::accept()
{
if (dont_show_again_checkbox_ && dont_show_again_checkbox_->isChecked()) {
Config::Current()[QStringLiteral("ShowWelcomeDialog")] = false;
OLIVE_CONFIG("ShowWelcomeDialog") = false;
}
QDialog::accept();
+1 -1
View File
@@ -208,7 +208,7 @@ ExportDialog::ExportDialog(ViewerOutput *viewer_node, QWidget *parent) :
video_tab_->height_slider()->SetDefaultValue(vp.height());
video_tab_->SetSelectedFrameRate(vp.frame_rate());
video_tab_->pixel_aspect_combobox()->SetPixelAspectRatio(vp.pixel_aspect_ratio());
video_tab_->pixel_format_field()->SetPixelFormat(static_cast<VideoParams::Format>(Config::Current()[QStringLiteral("OnlinePixelFormat")].toInt()));
video_tab_->pixel_format_field()->SetPixelFormat(static_cast<VideoParams::Format>(OLIVE_CONFIG("OnlinePixelFormat").toInt()));
video_tab_->interlaced_combobox()->SetInterlaceMode(vp.interlacing());
audio_tab_->sample_rate_combobox()->SetSampleRate(ap.sample_rate());
audio_tab_->sample_format_combobox()->SetAttemptToRestoreFormat(false);
@@ -74,7 +74,7 @@ PreferencesAppearanceTab::PreferencesAppearanceTab()
color_layout->addWidget(new QLabel(cat_name), i, 0);
ColorCodingComboBox* ccc = new ColorCodingComboBox();
ccc->SetColor(Config::Current()[QStringLiteral("CatColor%1").arg(i)].toInt());
ccc->SetColor(OLIVE_CONFIG_STR(QStringLiteral("CatColor%1").arg(i)).toInt());
color_layout->addWidget(ccc, i, 1);
color_btns_.append(ccc);
}
@@ -92,7 +92,7 @@ PreferencesAppearanceTab::PreferencesAppearanceTab()
marker_layout->addWidget(new QLabel("Default Marker Color"), 0, 0);
marker_btn_ = new ColorCodingComboBox();
marker_btn_->SetColor(Config::Current()[QStringLiteral("MarkerColor")].toInt());
marker_btn_->SetColor(OLIVE_CONFIG("MarkerColor").toInt());
marker_layout->addWidget(marker_btn_, 0, 1);
appearance_layout->addWidget(marker_group, row, 0, 1, 2);
@@ -109,14 +109,14 @@ void PreferencesAppearanceTab::Accept(MultiUndoCommand *command)
if (style_path != StyleManager::GetStyle()) {
StyleManager::SetStyle(style_path);
Config::Current()[QStringLiteral("Style")] = style_path;
OLIVE_CONFIG("Style") = style_path;
}
for (int i=0; i<color_btns_.size(); i++) {
Config::Current()[QStringLiteral("CatColor%1").arg(i)] = color_btns_.at(i)->GetSelectedColor();
OLIVE_CONFIG_STR(QStringLiteral("CatColor%1").arg(i)) = color_btns_.at(i)->GetSelectedColor();
}
Config::Current()[QStringLiteral("MarkerColor")] = marker_btn_->GetSelectedColor();
OLIVE_CONFIG("MarkerColor") = marker_btn_->GetSelectedColor();
}
}
@@ -108,10 +108,8 @@ void PreferencesBehaviorTab::Accept(MultiUndoCommand *command)
{
Q_UNUSED(command)
QMap<QTreeWidgetItem*, QString>::const_iterator iterator;
for (iterator=config_map_.begin();iterator!=config_map_.end();iterator++) {
Config::Current()[iterator.value()] = (iterator.key()->checkState(0) == Qt::Checked);
for (auto iterator=config_map_.begin();iterator!=config_map_.end();iterator++) {
OLIVE_CONFIG_STR(iterator.value()) = (iterator.key()->checkState(0) == Qt::Checked);
}
}
@@ -119,7 +117,7 @@ QTreeWidgetItem* PreferencesBehaviorTab::AddItem(const QString &text, const QStr
{
QTreeWidgetItem* item = new QTreeWidgetItem({text});
item->setToolTip(0, tooltip);
item->setCheckState(0, Config::Current()[config_key].toBool() ? Qt::Checked : Qt::Unchecked);
item->setCheckState(0, OLIVE_CONFIG_STR(config_key).toBool() ? Qt::Checked : Qt::Unchecked);
config_map_.insert(item, config_key);
@@ -71,7 +71,7 @@ PreferencesDiskTab::PreferencesDiskTab()
cache_ahead_slider_ = new FloatSlider();
cache_ahead_slider_->SetFormat(tr("%1 seconds"));
cache_ahead_slider_->SetMinimum(0);
cache_ahead_slider_->SetValue(Config::Current()["DiskCacheAhead"].value<rational>().toDouble());
cache_ahead_slider_->SetValue(OLIVE_CONFIG("DiskCacheAhead").value<rational>().toDouble());
cache_behavior_layout->addWidget(cache_ahead_slider_, row, 1);
cache_behavior_layout->addWidget(new QLabel(tr("Cache Behind:")), row, 2);
@@ -79,7 +79,7 @@ PreferencesDiskTab::PreferencesDiskTab()
cache_behind_slider_ = new FloatSlider();
cache_behind_slider_->SetMinimum(0);
cache_behind_slider_->SetFormat(tr("%1 seconds"));
cache_behind_slider_->SetValue(Config::Current()["DiskCacheBehind"].value<rational>().toDouble());
cache_behind_slider_->SetValue(OLIVE_CONFIG("DiskCacheBehind").value<rational>().toDouble());
cache_behavior_layout->addWidget(cache_behind_slider_, row, 3);
outer_layout->addStretch();
@@ -115,8 +115,8 @@ void PreferencesDiskTab::Accept(MultiUndoCommand *command)
default_disk_cache_folder_->SetPath(disk_cache_location_->text());
}
Config::Current()["DiskCacheBehind"] = QVariant::fromValue(rational::fromDouble(cache_behind_slider_->GetValue()));
Config::Current()["DiskCacheAhead"] = QVariant::fromValue(rational::fromDouble(cache_ahead_slider_->GetValue()));
OLIVE_CONFIG("DiskCacheBehind") = QVariant::fromValue(rational::fromDouble(cache_behind_slider_->GetValue()));
OLIVE_CONFIG("DiskCacheAhead") = QVariant::fromValue(rational::fromDouble(cache_ahead_slider_->GetValue()));
}
}
@@ -55,7 +55,7 @@ PreferencesGeneralTab::PreferencesGeneralTab()
AddLanguage(l);
}
QString current_language = Config::Current()[QStringLiteral("Language")].toString();
QString current_language = OLIVE_CONFIG("Language").toString();
if (current_language.isEmpty()) {
// No configured language, use system language
current_language = QLocale::system().name();
@@ -86,7 +86,7 @@ PreferencesGeneralTab::PreferencesGeneralTab()
autoscroll_method_->addItem(tr("None"), AutoScroll::kNone);
autoscroll_method_->addItem(tr("Page Scrolling"), AutoScroll::kPage);
autoscroll_method_->addItem(tr("Smooth Scrolling"), AutoScroll::kSmooth);
autoscroll_method_->setCurrentIndex(Config::Current()["Autoscroll"].toInt());
autoscroll_method_->setCurrentIndex(OLIVE_CONFIG("Autoscroll").toInt());
timeline_layout->addWidget(autoscroll_method_, row, 1);
row++;
@@ -94,7 +94,7 @@ PreferencesGeneralTab::PreferencesGeneralTab()
timeline_layout->addWidget(new QLabel(tr("Rectified Waveforms:")), row, 0);
rectified_waveforms_ = new QCheckBox();
rectified_waveforms_->setChecked(Config::Current()["RectifiedWaveforms"].toBool());
rectified_waveforms_->setChecked(OLIVE_CONFIG("RectifiedWaveforms").toBool());
timeline_layout->addWidget(rectified_waveforms_, row, 1);
row++;
@@ -105,7 +105,7 @@ PreferencesGeneralTab::PreferencesGeneralTab()
default_still_length_->SetMinimum(rational(100, 1000));
default_still_length_->SetTimebase(rational(100, 1000));
default_still_length_->SetFormat(tr("%1 seconds"));
default_still_length_->SetValue(Config::Current()["DefaultStillLength"].value<rational>());
default_still_length_->SetValue(OLIVE_CONFIG("DefaultStillLength").value<rational>());
timeline_layout->addWidget(default_still_length_);
}
@@ -119,7 +119,7 @@ PreferencesGeneralTab::PreferencesGeneralTab()
autorecovery_layout->addWidget(new QLabel(tr("Enable Auto-Recovery:")), row, 0);
autorecovery_enabled_ = new QCheckBox();
autorecovery_enabled_->setChecked(Config::Current()[QStringLiteral("AutorecoveryEnabled")].toBool());
autorecovery_enabled_->setChecked(OLIVE_CONFIG("AutorecoveryEnabled").toBool());
autorecovery_layout->addWidget(autorecovery_enabled_, row, 1);
row++;
@@ -130,7 +130,7 @@ PreferencesGeneralTab::PreferencesGeneralTab()
autorecovery_interval_->SetMinimum(1);
autorecovery_interval_->SetMaximum(60);
autorecovery_interval_->SetFormat(QT_TRANSLATE_N_NOOP("olive::SliderBase", "%n minute(s)"), true);
autorecovery_interval_->SetValue(Config::Current()[QStringLiteral("AutorecoveryInterval")].toLongLong());
autorecovery_interval_->SetValue(OLIVE_CONFIG("AutorecoveryInterval").toLongLong());
autorecovery_layout->addWidget(autorecovery_interval_, row, 1);
row++;
@@ -140,7 +140,7 @@ PreferencesGeneralTab::PreferencesGeneralTab()
autorecovery_maximum_ = new IntegerSlider();
autorecovery_maximum_->SetMinimum(1);
autorecovery_maximum_->SetMaximum(1000);
autorecovery_maximum_->SetValue(Config::Current()[QStringLiteral("AutorecoveryMaximum")].toLongLong());
autorecovery_maximum_->SetValue(OLIVE_CONFIG("AutorecoveryMaximum").toLongLong());
autorecovery_layout->addWidget(autorecovery_maximum_, row, 1);
row++;
@@ -157,11 +157,11 @@ void PreferencesGeneralTab::Accept(MultiUndoCommand *command)
{
Q_UNUSED(command)
Config::Current()[QStringLiteral("RectifiedWaveforms")] = rectified_waveforms_->isChecked();
OLIVE_CONFIG("RectifiedWaveforms") = rectified_waveforms_->isChecked();
Config::Current()[QStringLiteral("Autoscroll")] = autoscroll_method_->currentData();
OLIVE_CONFIG("Autoscroll") = autoscroll_method_->currentData();
Config::Current()[QStringLiteral("DefaultStillLength")] = QVariant::fromValue(default_still_length_->GetValue());
OLIVE_CONFIG("DefaultStillLength") = QVariant::fromValue(default_still_length_->GetValue());
QString set_language = language_combobox_->currentData().toString();
if (QLocale::system().name() == set_language) {
@@ -170,14 +170,14 @@ void PreferencesGeneralTab::Accept(MultiUndoCommand *command)
}
// If the language has changed, set it now
if (Config::Current()[QStringLiteral("Language")].toString() != set_language) {
Config::Current()[QStringLiteral("Language")] = set_language;
if (OLIVE_CONFIG("Language").toString() != set_language) {
OLIVE_CONFIG("Language") = set_language;
Core::instance()->SetLanguage(set_language.isEmpty() ? QLocale::system().name() : set_language);
}
Config::Current()[QStringLiteral("AutorecoveryEnabled")] = autorecovery_enabled_->isChecked();
Config::Current()[QStringLiteral("AutorecoveryInterval")] = QVariant::fromValue(autorecovery_interval_->GetValue());
Config::Current()[QStringLiteral("AutorecoveryMaximum")] = QVariant::fromValue(autorecovery_maximum_->GetValue());
OLIVE_CONFIG("AutorecoveryEnabled") = autorecovery_enabled_->isChecked();
OLIVE_CONFIG("AutorecoveryInterval") = QVariant::fromValue(autorecovery_interval_->GetValue());
OLIVE_CONFIG("AutorecoveryMaximum") = QVariant::fromValue(autorecovery_maximum_->GetValue());
Core::instance()->SetAutorecoveryInterval(autorecovery_interval_->GetValue());
}
+8 -8
View File
@@ -148,14 +148,14 @@ void SequenceDialog::SetAsDefaultClicked()
tr("Are you sure you want to set the current parameters as defaults?"),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
// Maybe replace with Preset system
Config::Current()[QStringLiteral("DefaultSequenceWidth")] = parameter_tab_->GetSelectedVideoWidth();
Config::Current()[QStringLiteral("DefaultSequenceHeight")] = parameter_tab_->GetSelectedVideoHeight();
Config::Current()[QStringLiteral("DefaultSequencePixelAspect")] = QVariant::fromValue(parameter_tab_->GetSelectedVideoPixelAspect());
Config::Current()[QStringLiteral("DefaultSequenceFrameRate")] = QVariant::fromValue(parameter_tab_->GetSelectedVideoFrameRate().flipped());
Config::Current()[QStringLiteral("DefaultSequenceInterlacing")] = parameter_tab_->GetSelectedVideoInterlacingMode();
Config::Current()[QStringLiteral("DefaultSequenceAudioFrequency")] = parameter_tab_->GetSelectedAudioSampleRate();
Config::Current()[QStringLiteral("DefaultSequenceAudioLayout")] = QVariant::fromValue(parameter_tab_->GetSelectedAudioChannelLayout());
Config::Current()[QStringLiteral("DefaultSequenceAutoCache")] = QVariant::fromValue(parameter_tab_->GetSelectedPreviewAutoCache());
OLIVE_CONFIG("DefaultSequenceWidth") = parameter_tab_->GetSelectedVideoWidth();
OLIVE_CONFIG("DefaultSequenceHeight") = parameter_tab_->GetSelectedVideoHeight();
OLIVE_CONFIG("DefaultSequencePixelAspect") = QVariant::fromValue(parameter_tab_->GetSelectedVideoPixelAspect());
OLIVE_CONFIG("DefaultSequenceFrameRate") = QVariant::fromValue(parameter_tab_->GetSelectedVideoFrameRate().flipped());
OLIVE_CONFIG("DefaultSequenceInterlacing") = parameter_tab_->GetSelectedVideoInterlacingMode();
OLIVE_CONFIG("DefaultSequenceAudioFrequency") = parameter_tab_->GetSelectedAudioSampleRate();
OLIVE_CONFIG("DefaultSequenceAudioLayout") = QVariant::fromValue(parameter_tab_->GetSelectedAudioChannelLayout());
OLIVE_CONFIG("DefaultSequenceAutoCache") = QVariant::fromValue(parameter_tab_->GetSelectedPreviewAutoCache());
}
}
@@ -100,8 +100,8 @@ QTreeWidgetItem* SequenceDialogPresetTab::CreateFolder(const QString &name)
QTreeWidgetItem *SequenceDialogPresetTab::CreateHDPresetFolder(const QString &name, int width, int height, int divider)
{
const VideoParams::Format default_format = static_cast<VideoParams::Format>(Config::Current()["OfflinePixelFormat"].toInt());
const bool default_autocache = Config::Current()[QStringLiteral("DefaultSequenceAutoCache")].toBool();
const VideoParams::Format default_format = static_cast<VideoParams::Format>(OLIVE_CONFIG("OfflinePixelFormat").toInt());
const bool default_autocache = OLIVE_CONFIG("DefaultSequenceAutoCache").toBool();
QTreeWidgetItem* parent = CreateFolder(name);
AddStandardItem(parent, std::make_shared<SequencePreset>(tr("%1 23.976 FPS").arg(name),
width,
@@ -163,8 +163,8 @@ QTreeWidgetItem *SequenceDialogPresetTab::CreateHDPresetFolder(const QString &na
QTreeWidgetItem *SequenceDialogPresetTab::CreateSDPresetFolder(const QString &name, int width, int height, const rational& frame_rate, const rational &standard_par, const rational &wide_par, int divider)
{
const VideoParams::Format default_format = static_cast<VideoParams::Format>(Config::Current()["OfflinePixelFormat"].toInt());
const bool default_autocache = Config::Current()[QStringLiteral("DefaultSequenceAutoCache")].toBool();
const VideoParams::Format default_format = static_cast<VideoParams::Format>(OLIVE_CONFIG("OfflinePixelFormat").toInt());
const bool default_autocache = OLIVE_CONFIG("DefaultSequenceAutoCache").toBool();
QTreeWidgetItem* parent = CreateFolder(name);
preset_tree_->addTopLevelItem(parent);
AddStandardItem(parent, std::make_shared<SequencePreset>(tr("%1 Standard").arg(name),
-5
View File
@@ -42,11 +42,6 @@ PanNode::PanNode()
SetEffectInput(kSamplesInput);
}
Node *PanNode::copy() const
{
return new PanNode();
}
QString PanNode::Name() const
{
return tr("Pan");
+1 -3
View File
@@ -31,9 +31,7 @@ class PanNode : public Node
public:
PanNode();
NODE_DEFAULT_DESTRUCTOR(PanNode)
virtual Node* copy() const override;
NODE_DEFAULT_FUNCTIONS(PanNode)
virtual QString Name() const override;
virtual QString id() const override;
-5
View File
@@ -41,11 +41,6 @@ VolumeNode::VolumeNode()
SetEffectInput(kSamplesInput);
}
Node *VolumeNode::copy() const
{
return new VolumeNode();
}
QString VolumeNode::Name() const
{
return tr("Volume");
+1 -3
View File
@@ -31,9 +31,7 @@ class VolumeNode : public MathNodeBase
public:
VolumeNode();
NODE_DEFAULT_DESTRUCTOR(VolumeNode)
virtual Node* copy() const override;
NODE_DEFAULT_FUNCTIONS(VolumeNode)
virtual QString Name() const override;
virtual QString id() const override;
-2
View File
@@ -37,8 +37,6 @@ class Block : public Node
public:
Block();
NODE_DEFAULT_DESTRUCTOR(Block)
virtual QVector<CategoryID> Category() const override;
const rational& in() const
-5
View File
@@ -61,11 +61,6 @@ ClipBlock::ClipBlock() :
SetEffectInput(kBufferIn);
}
Node *ClipBlock::copy() const
{
return new ClipBlock();
}
QString ClipBlock::Name() const
{
if (track()) {
+1 -3
View File
@@ -37,9 +37,7 @@ class ClipBlock : public Block
public:
ClipBlock();
NODE_DEFAULT_DESTRUCTOR(ClipBlock)
virtual Node* copy() const override;
NODE_DEFAULT_FUNCTIONS(ClipBlock)
virtual QString Name() const override;
virtual QString id() const override;
-5
View File
@@ -26,11 +26,6 @@ GapBlock::GapBlock()
{
}
Node *GapBlock::copy() const
{
return new GapBlock();
}
QString GapBlock::Name() const
{
return tr("Gap");
+1 -3
View File
@@ -34,9 +34,7 @@ class GapBlock : public Block
public:
GapBlock();
NODE_DEFAULT_DESTRUCTOR(GapBlock)
virtual Node * copy() const override;
NODE_DEFAULT_FUNCTIONS(GapBlock)
virtual QString Name() const override;
virtual QString id() const override;
-5
View File
@@ -31,11 +31,6 @@ SubtitleBlock::SubtitleBlock()
AddInput(kTextIn, NodeValue::kText, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
}
Node *SubtitleBlock::copy() const
{
return new SubtitleBlock();
}
QString SubtitleBlock::Name() const
{
return tr("Subtitle");
+1 -3
View File
@@ -31,9 +31,7 @@ class SubtitleBlock : public ClipBlock
public:
SubtitleBlock();
NODE_DEFAULT_DESTRUCTOR(SubtitleBlock)
virtual Node* copy() const override;
NODE_DEFAULT_FUNCTIONS(SubtitleBlock)
virtual QString Name() const override;
virtual QString id() const override;
@@ -24,12 +24,6 @@ namespace olive {
CrossDissolveTransition::CrossDissolveTransition()
{
}
Node *CrossDissolveTransition::copy() const
{
return new CrossDissolveTransition();
}
QString CrossDissolveTransition::Name() const
@@ -31,9 +31,7 @@ class CrossDissolveTransition : public TransitionBlock
public:
CrossDissolveTransition();
NODE_DEFAULT_DESTRUCTOR(CrossDissolveTransition)
virtual Node* copy() const override;
NODE_DEFAULT_FUNCTIONS(CrossDissolveTransition)
virtual QString Name() const override;
virtual QString id() const override;
@@ -29,11 +29,6 @@ DipToColorTransition::DipToColorTransition()
AddInput(kColorInput, NodeValue::kColor, QVariant::fromValue(Color(0, 0, 0)));
}
Node *DipToColorTransition::copy() const
{
return new DipToColorTransition();
}
QString DipToColorTransition::Name() const
{
return tr("Dip To Color");
@@ -31,9 +31,7 @@ class DipToColorTransition : public TransitionBlock
public:
DipToColorTransition();
NODE_DEFAULT_DESTRUCTOR(DipToColorTransition)
virtual Node* copy() const override;
NODE_DEFAULT_FUNCTIONS(DipToColorTransition)
virtual QString Name() const override;
virtual QString id() const override;
-2
View File
@@ -33,8 +33,6 @@ class TransitionBlock : public Block
public:
TransitionBlock();
NODE_DEFAULT_DESTRUCTOR(TransitionBlock)
virtual void Retranslate() override;
rational in_offset() const;
+2 -5
View File
@@ -38,6 +38,8 @@ class ColorManager : public Node
public:
ColorManager();
NODE_DEFAULT_FUNCTIONS(ColorManager)
virtual QString Name() const override
{
return tr("Color Manager");
@@ -58,11 +60,6 @@ public:
return tr("Color management configuration for project.");
}
virtual Node* copy() const override
{
return new ColorManager();
}
OCIO::ConstConfigRcPtr GetConfig() const;
static OCIO::ConstConfigRcPtr CreateConfigFromFile(const QString& filename);
@@ -35,12 +35,7 @@ class CornerPinDistortNode : public Node
public:
CornerPinDistortNode();
NODE_DEFAULT_DESTRUCTOR(CornerPinDistortNode)
virtual Node* copy() const override
{
return new CornerPinDistortNode();
}
NODE_DEFAULT_FUNCTIONS(CornerPinDistortNode)
virtual QString Name() const override
{
+1 -6
View File
@@ -36,12 +36,7 @@ class CropDistortNode : public Node
public:
CropDistortNode();
NODE_DEFAULT_DESTRUCTOR(CropDistortNode)
virtual Node* copy() const override
{
return new CropDistortNode();
}
NODE_DEFAULT_FUNCTIONS(CropDistortNode)
virtual QString Name() const override
{
@@ -40,11 +40,6 @@ FlipDistortNode::FlipDistortNode()
SetEffectInput(kTextureInput);
}
Node* FlipDistortNode::copy() const
{
return new FlipDistortNode();
}
QString FlipDistortNode::Name() const
{
return tr("Flip");
+1 -3
View File
@@ -31,9 +31,7 @@ class FlipDistortNode : public Node
public:
FlipDistortNode();
NODE_DEFAULT_DESTRUCTOR(FlipDistortNode)
virtual Node* copy() const override;
NODE_DEFAULT_FUNCTIONS(FlipDistortNode)
virtual QString Name() const override;
virtual QString id() const override;
@@ -318,7 +318,7 @@ void TransformDistortNode::GizmoDragMove(double x, double y, const Qt::KeyboardM
}
}
QMatrix4x4 TransformDistortNode::AdjustMatrixByResolutions(const QMatrix4x4 &mat, const QVector2D &sequence_res, const QVector2D &texture_res, AutoScaleType autoscale_type)
QMatrix4x4 TransformDistortNode::AdjustMatrixByResolutions(const QMatrix4x4 &mat, const QVector2D &sequence_res, const QVector2D &texture_res, const QVector2D &offset, AutoScaleType autoscale_type)
{
// First, create an identity matrix
QMatrix4x4 adjusted_matrix;
@@ -326,6 +326,9 @@ QMatrix4x4 TransformDistortNode::AdjustMatrixByResolutions(const QMatrix4x4 &mat
// Scale it to a square based on the sequence's resolution
adjusted_matrix.scale(2.0 / sequence_res.x(), 2.0 / sequence_res.y(), 1.0);
// Apply offset if applicable
adjusted_matrix.translate(offset);
// Adjust by the matrix we generated earlier
adjusted_matrix *= mat;
@@ -378,6 +381,7 @@ void TransformDistortNode::UpdateGizmoPositions(const NodeValueRow &row, const N
// GizmoTraverser just returns the sizes of the textures and no other data
VideoParams tex_params = tex->params();
QVector2D tex_sz(tex_params.square_pixel_width(), tex_params.height());
QVector2D tex_offset = tex_params.offset();
// Retrieve autoscale value
AutoScaleType autoscale = static_cast<AutoScaleType>(row[kAutoscaleInput].data().toInt());
@@ -388,6 +392,7 @@ void TransformDistortNode::UpdateGizmoPositions(const NodeValueRow &row, const N
rectangle_matrix *= AdjustMatrixByResolutions(GenerateMatrix(row, false, false, false, false),
sequence_res,
tex_sz,
tex_offset,
autoscale);
// Create rect and transform it
@@ -407,6 +412,7 @@ void TransformDistortNode::UpdateGizmoPositions(const NodeValueRow &row, const N
anchor_matrix *= AdjustMatrixByResolutions(GenerateMatrix(row, false, true, false, false),
sequence_res,
tex_sz,
tex_offset,
autoscale);
anchor_gizmo_->SetPoint(anchor_matrix.toTransform().map(QPointF(0, 0)) + sequence_half_res_pt);
@@ -422,7 +428,7 @@ void TransformDistortNode::UpdateGizmoPositions(const NodeValueRow &row, const N
// Use offsets to make the appearance of values that start in the top left, even though we
// really anchor around the center
SetInputProperty(kPositionInput, QStringLiteral("offset"), sequence_half_res);
SetInputProperty(kPositionInput, QStringLiteral("offset"), sequence_half_res + tex_offset);
SetInputProperty(kAnchorInput, QStringLiteral("offset"), tex_sz * 0.5);
}
@@ -440,6 +446,7 @@ QMatrix4x4 TransformDistortNode::GenerateAutoScaledMatrix(const QMatrix4x4& gene
return AdjustMatrixByResolutions(generated_matrix,
sequence_res,
texture_res,
texture_params.offset(),
autoscale);
}
@@ -34,12 +34,7 @@ class TransformDistortNode : public MatrixGenerator
public:
TransformDistortNode();
NODE_DEFAULT_DESTRUCTOR(TransformDistortNode)
virtual Node* copy() const override
{
return new TransformDistortNode();
}
NODE_DEFAULT_FUNCTIONS(TransformDistortNode)
virtual QString Name() const override
{
@@ -82,6 +77,7 @@ public:
static QMatrix4x4 AdjustMatrixByResolutions(const QMatrix4x4& mat,
const QVector2D& sequence_res,
const QVector2D& texture_res,
const QVector2D& offset,
AutoScaleType autoscale_type = kAutoScaleNone);
virtual void UpdateGizmoPositions(const NodeValueRow &row, const NodeGlobals &globals) override;
+1 -3
View File
@@ -10,9 +10,7 @@ class OpacityEffect : public Node
public:
OpacityEffect();
NODE_DEFAULT_DESTRUCTOR(OpacityEffect)
NODE_COPY_FUNCTION(OpacityEffect)
NODE_DEFAULT_FUNCTIONS(OpacityEffect)
virtual QString Name() const override
{
-5
View File
@@ -50,11 +50,6 @@ BlurFilterNode::BlurFilterNode()
SetEffectInput(kTextureInput);
}
Node *BlurFilterNode::copy() const
{
return new BlurFilterNode();
}
QString BlurFilterNode::Name() const
{
return tr("Blur");
+1 -3
View File
@@ -31,9 +31,7 @@ class BlurFilterNode : public Node
public:
BlurFilterNode();
NODE_DEFAULT_DESTRUCTOR(BlurFilterNode)
virtual Node* copy() const override;
NODE_DEFAULT_FUNCTIONS(BlurFilterNode)
virtual QString Name() const override;
virtual QString id() const override;
+1 -6
View File
@@ -31,12 +31,7 @@ class MosaicFilterNode : public Node
public:
MosaicFilterNode();
NODE_DEFAULT_DESTRUCTOR(MosaicFilterNode)
virtual Node* copy() const override
{
return new MosaicFilterNode();
}
NODE_DEFAULT_FUNCTIONS(MosaicFilterNode)
virtual QString Name() const override
{
-5
View File
@@ -53,11 +53,6 @@ StrokeFilterNode::StrokeFilterNode()
SetEffectInput(kTextureInput);
}
Node *StrokeFilterNode::copy() const
{
return new StrokeFilterNode();
}
QString StrokeFilterNode::Name() const
{
return tr("Stroke");
+1 -3
View File
@@ -31,9 +31,7 @@ class StrokeFilterNode : public Node
public:
StrokeFilterNode();
NODE_DEFAULT_DESTRUCTOR(StrokeFilterNode)
virtual Node* copy() const override;
NODE_DEFAULT_FUNCTIONS(StrokeFilterNode)
virtual QString Name() const override;
virtual QString id() const override;
-5
View File
@@ -51,11 +51,6 @@ MatrixGenerator::MatrixGenerator()
AddInput(kAnchorInput, NodeValue::kVec2, QVector2D(0.0, 0.0));
}
Node *MatrixGenerator::copy() const
{
return new MatrixGenerator();
}
QString MatrixGenerator::Name() const
{
return tr("Orthographic Matrix");
+1 -3
View File
@@ -34,9 +34,7 @@ class MatrixGenerator : public Node
public:
MatrixGenerator();
NODE_DEFAULT_DESTRUCTOR(MatrixGenerator)
virtual Node* copy() const override;
NODE_DEFAULT_FUNCTIONS(MatrixGenerator)
virtual QString Name() const override;
virtual QString ShortName() const override;
+13 -9
View File
@@ -20,8 +20,11 @@
#include "noise.h"
#include "widget/slider/floatslider.h"
namespace olive {
const QString NoiseGeneratorNode::kBaseIn = QStringLiteral("base_in");
const QString NoiseGeneratorNode::kColorInput = QStringLiteral("color_in");
const QString NoiseGeneratorNode::kStrengthInput = QStringLiteral("strength_in");
@@ -29,14 +32,16 @@ const QString NoiseGeneratorNode::kStrengthInput = QStringLiteral("strength_in")
NoiseGeneratorNode::NoiseGeneratorNode()
{
AddInput(kStrengthInput, NodeValue::kFloat, 20);
AddInput(kBaseIn, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable));
AddInput(kStrengthInput, NodeValue::kFloat, 0.2);
SetInputProperty(kStrengthInput, QStringLiteral("view"), FloatSlider::kPercentage);
SetInputProperty(kStrengthInput, QStringLiteral("min"), 0);
AddInput(kColorInput, NodeValue::kBoolean, false);
}
Node* NoiseGeneratorNode::copy() const
{
return new NoiseGeneratorNode();
SetEffectInput(kBaseIn);
SetFlags(kVideoEffect);
}
QString NoiseGeneratorNode::Name() const
@@ -63,12 +68,13 @@ void NoiseGeneratorNode::Retranslate()
{
super::Retranslate();
SetInputName(kBaseIn, tr("Base"));
SetInputName(kStrengthInput, tr("Strength"));
SetInputName(kColorInput, tr("Color"));
}
ShaderCode NoiseGeneratorNode::GetShaderCode(const QString& shader_id) const {
Q_UNUSED(shader_id)
ShaderCode NoiseGeneratorNode::GetShaderCode(const QString& shader_id) const
{
return ShaderCode(FileFunctions::ReadFileAsString(":/shaders/noise.frag"));
}
@@ -79,8 +85,6 @@ void NoiseGeneratorNode::Value(const NodeValueRow &value, const NodeGlobals &glo
job.InsertValue(value);
job.InsertValue(QStringLiteral("time_in"), NodeValue(NodeValue::kFloat, globals.time().in().toDouble(), this));
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
}
}
+3 -3
View File
@@ -30,9 +30,7 @@ class NoiseGeneratorNode : public Node {
public:
NoiseGeneratorNode();
NODE_DEFAULT_DESTRUCTOR(NoiseGeneratorNode)
virtual Node *copy() const override;
NODE_DEFAULT_FUNCTIONS(NoiseGeneratorNode)
virtual QString Name() const override;
virtual QString id() const override;
@@ -44,8 +42,10 @@ class NoiseGeneratorNode : public Node {
virtual ShaderCode GetShaderCode(const QString &shader_id) const override;
virtual void Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const override;
static const QString kBaseIn;
static const QString kColorInput;
static const QString kStrengthInput;
};
} // namespace olive
+2 -7
View File
@@ -30,7 +30,7 @@ namespace olive {
const QString PolygonGenerator::kPointsInput = QStringLiteral("points_in");
const QString PolygonGenerator::kColorInput = QStringLiteral("color_in");
#define super Node
#define super GeneratorWithMerge
PolygonGenerator::PolygonGenerator()
{
@@ -61,11 +61,6 @@ PolygonGenerator::PolygonGenerator()
poly_gizmo_ = new PathGizmo(this);
}
Node *PolygonGenerator::copy() const
{
return new PolygonGenerator();
}
QString PolygonGenerator::Name() const
{
return tr("Polygon");
@@ -102,7 +97,7 @@ void PolygonGenerator::Value(const NodeValueRow &value, const NodeGlobals &globa
job.SetRequestedFormat(VideoParams::kFormatFloat32);
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
PushMergableJob(value, QVariant::fromValue(job), table);
}
void PolygonGenerator::GenerateFrame(FramePtr frame, const GenerateJob &job) const
+3 -4
View File
@@ -24,6 +24,7 @@
#include <QPainterPath>
#include "common/bezier.h"
#include "node/generator/shape/generatorwithmerge.h"
#include "node/gizmo/line.h"
#include "node/gizmo/path.h"
#include "node/gizmo/point.h"
@@ -32,15 +33,13 @@
namespace olive {
class PolygonGenerator : public Node
class PolygonGenerator : public GeneratorWithMerge
{
Q_OBJECT
public:
PolygonGenerator();
NODE_DEFAULT_DESTRUCTOR(PolygonGenerator)
virtual Node* copy() const override;
NODE_DEFAULT_FUNCTIONS(PolygonGenerator)
virtual QString Name() const override;
virtual QString id() const override;
+2
View File
@@ -16,6 +16,8 @@
set(OLIVE_SOURCES
${OLIVE_SOURCES}
node/generator/shape/generatorwithmerge.cpp
node/generator/shape/generatorwithmerge.h
node/generator/shape/shapenode.cpp
node/generator/shape/shapenode.h
node/generator/shape/shapenodebase.cpp
@@ -0,0 +1,71 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 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 "generatorwithmerge.h"
#include "node/math/merge/merge.h"
namespace olive {
#define super Node
const QString GeneratorWithMerge::kBaseInput = QStringLiteral("base_in");
GeneratorWithMerge::GeneratorWithMerge()
{
AddInput(kBaseInput, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable));
SetEffectInput(kBaseInput);
SetFlags(kVideoEffect);
}
void GeneratorWithMerge::Retranslate()
{
super::Retranslate();
SetInputName(kBaseInput, tr("Base"));
}
ShaderCode GeneratorWithMerge::GetShaderCode(const QString &shader_id) const
{
if (shader_id == QStringLiteral("mrg")) {
return ShaderCode(FileFunctions::ReadFileAsString(":/shaders/alphaover.frag"));
}
return ShaderCode();
}
void GeneratorWithMerge::PushMergableJob(const NodeValueRow &value, const QVariant &job, NodeValueTable *table) const
{
if (!value[kBaseInput].data().isNull()) {
// Push as merge node
ShaderJob merge;
merge.SetShaderID(QStringLiteral("mrg"));
merge.InsertValue(MergeNode::kBaseIn, value[kBaseInput]);
merge.InsertValue(MergeNode::kBlendIn, NodeValue(NodeValue::kTexture, job, this));
table->Push(NodeValue::kTexture, QVariant::fromValue(merge), this);
} else {
// Just push generate job
table->Push(NodeValue::kTexture, job, this);
}
}
}
@@ -0,0 +1,47 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 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 GENERATORWITHMERGE_H
#define GENERATORWITHMERGE_H
#include "node/node.h"
namespace olive {
class GeneratorWithMerge : public Node
{
Q_OBJECT
public:
GeneratorWithMerge();
virtual void Retranslate() override;
virtual ShaderCode GetShaderCode(const QString &shader_id) const override;
static const QString kBaseInput;
protected:
void PushMergableJob(const NodeValueRow &value, const QVariant &job, NodeValueTable *table) const;
};
}
#endif // GENERATORWITHMERGE_H
+1 -14
View File
@@ -79,20 +79,7 @@ void ShapeNode::Value(const NodeValueRow &value, const NodeGlobals &globals, Nod
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
job.SetShaderID(QStringLiteral("shape"));
if (!value[kBaseInput].data().isNull()) {
// Push as merge node
ShaderJob merge;
merge.SetShaderID(QStringLiteral("mrg"));
merge.InsertValue(MergeNode::kBaseIn, value[kBaseInput]);
merge.InsertValue(MergeNode::kBlendIn, NodeValue(NodeValue::kTexture, QVariant::fromValue(job), this));
merge.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
table->Push(NodeValue::kTexture, QVariant::fromValue(merge), this);
} else {
// Just push generate job
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
}
PushMergableJob(value, QVariant::fromValue(job), table);
}
}
+1 -2
View File
@@ -36,8 +36,7 @@ public:
kEllipse
};
NODE_DEFAULT_DESTRUCTOR(ShapeNode)
NODE_COPY_FUNCTION(ShapeNode)
NODE_DEFAULT_FUNCTIONS(ShapeNode)
virtual QString Name() const override;
virtual QString id() const override;
+1 -16
View File
@@ -28,16 +28,14 @@
namespace olive {
#define super Node
#define super GeneratorWithMerge
const QString ShapeNodeBase::kBaseInput = QStringLiteral("base_in");
const QString ShapeNodeBase::kPositionInput = QStringLiteral("pos_in");
const QString ShapeNodeBase::kSizeInput = QStringLiteral("size_in");
const QString ShapeNodeBase::kColorInput = QStringLiteral("color_in");
ShapeNodeBase::ShapeNodeBase(bool create_color_input)
{
AddInput(kBaseInput, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable));
AddInput(kPositionInput, NodeValue::kVec2, QVector2D(0, 0));
AddInput(kSizeInput, NodeValue::kVec2, QVector2D(100, 100));
SetInputProperty(kSizeInput, QStringLiteral("min"), QVector2D(0, 0));
@@ -60,16 +58,12 @@ ShapeNodeBase::ShapeNodeBase(bool create_color_input)
for (int i=0; i<kGizmoScaleCount; i++) {
point_gizmo_[i] = AddDraggableGizmo<PointGizmo>(pos_n_sz, PointGizmo::kAbsolute);
}
SetEffectInput(kBaseInput);
SetFlags(kVideoEffect);
}
void ShapeNodeBase::Retranslate()
{
super::Retranslate();
SetInputName(kBaseInput, tr("Base"));
SetInputName(kPositionInput, tr("Position"));
SetInputName(kSizeInput, tr("Size"));
@@ -108,15 +102,6 @@ void ShapeNodeBase::UpdateGizmoPositions(const NodeValueRow &row, const NodeGlob
poly_gizmo_->SetPolygon(QRectF(left_pt, top_pt, right_pt - left_pt, bottom_pt - top_pt));
}
ShaderCode ShapeNodeBase::GetShaderCode(const QString &shader_id) const
{
if (shader_id == QStringLiteral("mrg")) {
return ShaderCode(FileFunctions::ReadFileAsString(":/shaders/alphaover.frag"));
}
return ShaderCode();
}
void ShapeNodeBase::GizmoDragMove(double x, double y, const Qt::KeyboardModifiers &modifiers)
{
DraggableGizmo *gizmo = static_cast<DraggableGizmo*>(sender());
+2 -7
View File
@@ -21,29 +21,24 @@
#ifndef SHAPENODEBASE_H
#define SHAPENODEBASE_H
#include "generatorwithmerge.h"
#include "node/gizmo/point.h"
#include "node/gizmo/polygon.h"
#include "node/inputdragger.h"
#include "node/math/merge/merge.h"
#include "node/node.h"
namespace olive {
class ShapeNodeBase : public Node
class ShapeNodeBase : public GeneratorWithMerge
{
Q_OBJECT
public:
ShapeNodeBase(bool create_color_input = true);
NODE_DEFAULT_DESTRUCTOR(ShapeNodeBase)
virtual void Retranslate() override;
virtual void UpdateGizmoPositions(const NodeValueRow &row, const NodeGlobals &globals) override;
virtual ShaderCode GetShaderCode(const QString &shader_id) const override;
static const QString kBaseInput;
static const QString kPositionInput;
static const QString kSizeInput;
static const QString kColorInput;
-5
View File
@@ -34,11 +34,6 @@ SolidGenerator::SolidGenerator()
AddInput(kColorInput, NodeValue::kColor, QVariant::fromValue(Color(1.0f, 0.0f, 0.0f, 1.0f)));
}
Node *SolidGenerator::copy() const
{
return new SolidGenerator();
}
QString SolidGenerator::Name() const
{
return tr("Solid");
+1 -3
View File
@@ -31,9 +31,7 @@ class SolidGenerator : public Node
public:
SolidGenerator();
NODE_DEFAULT_DESTRUCTOR(SolidGenerator)
virtual Node* copy() const override;
NODE_DEFAULT_FUNCTIONS(SolidGenerator)
virtual QString Name() const override;
virtual QString id() const override;
+1 -2
View File
@@ -31,8 +31,7 @@ class TextGeneratorV1 : public Node
public:
TextGeneratorV1();
NODE_DEFAULT_DESTRUCTOR(TextGeneratorV1)
NODE_COPY_FUNCTION(TextGeneratorV1)
NODE_DEFAULT_FUNCTIONS(TextGeneratorV1)
virtual QString Name() const override;
virtual QString id() const override;
+1 -2
View File
@@ -31,8 +31,7 @@ class TextGeneratorV2 : public ShapeNodeBase
public:
TextGeneratorV2();
NODE_DEFAULT_DESTRUCTOR(TextGeneratorV2)
NODE_COPY_FUNCTION(TextGeneratorV2)
NODE_DEFAULT_FUNCTIONS(TextGeneratorV2)
virtual QString Name() const override;
virtual QString id() const override;
+1 -14
View File
@@ -89,20 +89,7 @@ void TextGeneratorV3::Value(const NodeValueRow &value, const NodeGlobals &global
job.SetColorspace(project()->color_manager()->GetDefaultInputColorSpace());
if (!job.GetValue(kTextInput).data().toString().isEmpty()) {
if (!value[kBaseInput].data().isNull()) {
// Push as merge node
ShaderJob merge;
merge.SetShaderID(QStringLiteral("mrg"));
merge.InsertValue(MergeNode::kBaseIn, value[kBaseInput]);
merge.InsertValue(MergeNode::kBlendIn, NodeValue(NodeValue::kTexture, QVariant::fromValue(job), this));
merge.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
table->Push(NodeValue::kTexture, QVariant::fromValue(merge), this);
} else {
// Just push generate job
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
}
PushMergableJob(value, QVariant::fromValue(job), table);
} else if (!value[kBaseInput].data().isNull()) {
table->Push(value[kBaseInput]);
}
+1 -2
View File
@@ -32,8 +32,7 @@ class TextGeneratorV3 : public ShapeNodeBase
public:
TextGeneratorV3();
NODE_DEFAULT_DESTRUCTOR(TextGeneratorV3)
NODE_COPY_FUNCTION(TextGeneratorV3)
NODE_DEFAULT_FUNCTIONS(TextGeneratorV3)
virtual QString Name() const override;
virtual QString id() const override;
+1 -2
View File
@@ -31,8 +31,7 @@ class NodeGroup : public Node
public:
NodeGroup();
NODE_DEFAULT_DESTRUCTOR(NodeGroup)
NODE_COPY_FUNCTION(NodeGroup)
NODE_DEFAULT_FUNCTIONS(NodeGroup)
virtual QString Name() const override;
virtual QString id() const override;
-5
View File
@@ -28,11 +28,6 @@ TimeInput::TimeInput()
{
}
Node *TimeInput::copy() const
{
return new TimeInput();
}
QString TimeInput::Name() const
{
return tr("Time");
+2 -4
View File
@@ -27,13 +27,11 @@ namespace olive {
class TimeInput : public Node
{
Q_OBJECT
Q_OBJECT
public:
TimeInput();
NODE_DEFAULT_DESTRUCTOR(TimeInput)
virtual Node* copy() const override;
NODE_DEFAULT_FUNCTIONS(TimeInput)
virtual QString Name() const override;
virtual QString id() const override;
+1 -6
View File
@@ -31,12 +31,7 @@ class ValueNode : public Node
public:
ValueNode();
NODE_DEFAULT_DESTRUCTOR(ValueNode)
virtual Node* copy() const override
{
return new ValueNode();
}
NODE_DEFAULT_FUNCTIONS(ValueNode)
virtual QString Name() const override
{
@@ -49,11 +49,6 @@ ColorDifferenceKeyNode::ColorDifferenceKeyNode()
SetEffectInput(kTextureInput);
}
Node *ColorDifferenceKeyNode::copy() const
{
return new ColorDifferenceKeyNode();
}
QString ColorDifferenceKeyNode::Name() const
{
return tr("Color Difference Key");
@@ -24,7 +24,7 @@ class ColorDifferenceKeyNode : public Node {
public:
ColorDifferenceKeyNode();
virtual Node* copy() const override;
NODE_DEFAULT_FUNCTIONS(ColorDifferenceKeyNode)
virtual QString Name() const override;
virtual QString id() const override;
-5
View File
@@ -40,11 +40,6 @@ DespillNode::DespillNode()
SetEffectInput(kTextureInput);
}
Node* DespillNode::copy() const
{
return new DespillNode();
}
QString DespillNode::Name() const
{
return tr("Despill");
+4 -4
View File
@@ -25,7 +25,7 @@ class DespillNode : public Node {
public:
DespillNode();
virtual Node* copy() const override;
NODE_DEFAULT_FUNCTIONS(DespillNode)
virtual QString Name() const override;
virtual QString id() const override;
@@ -36,13 +36,13 @@ class DespillNode : public Node {
virtual ShaderCode GetShaderCode(const QString& shader_id) const override;
virtual void Value(const NodeValueRow& value, const NodeGlobals& globals, NodeValueTable* table) const override;
static const QString kTextureInput;
static const QString kColorInput;
static const QString kMethodInput;
static const QString kPreserveLuminanceInput;
};
} // namespace olive
-5
View File
@@ -42,11 +42,6 @@ MathNode::MathNode()
SetInputProperty(kParamBIn, QStringLiteral("autotrim"), true);
}
Node *MathNode::copy() const
{
return new MathNode();
}
QString MathNode::Name() const
{
return tr("Math");
+1 -3
View File
@@ -31,9 +31,7 @@ class MathNode : public MathNodeBase
public:
MathNode();
NODE_DEFAULT_DESTRUCTOR(MathNode)
virtual Node* copy() const override;
NODE_DEFAULT_FUNCTIONS(MathNode)
virtual QString Name() const override;
virtual QString id() const override;
+1
View File
@@ -363,6 +363,7 @@ void MathNodeBase::ValueInternal(Operation operation, Pairing pairing, const QSt
QMatrix4x4 adjusted_matrix = TransformDistortNode::AdjustMatrixByResolutions(number_val.data().value<QMatrix4x4>(),
sequence_res,
texture->params().offset(),
texture_res);
if (operation != kOpMultiply || adjusted_matrix.isIdentity()) {
-2
View File
@@ -30,8 +30,6 @@ class MathNodeBase : public Node
public:
MathNodeBase() = default;
NODE_DEFAULT_DESTRUCTOR(MathNodeBase)
enum Operation {
kOpAdd,
kOpSubtract,
-5
View File
@@ -38,11 +38,6 @@ MergeNode::MergeNode()
SetFlags(kDontShowInParamView);
}
Node *MergeNode::copy() const
{
return new MergeNode();
}
QString MergeNode::Name() const
{
return tr("Merge");
+1 -3
View File
@@ -31,9 +31,7 @@ class MergeNode : public Node
public:
MergeNode();
NODE_DEFAULT_DESTRUCTOR(MergeNode)
virtual Node* copy() const override;
NODE_DEFAULT_FUNCTIONS(MergeNode)
virtual QString Name() const override;
virtual QString id() const override;
@@ -34,11 +34,6 @@ TrigonometryNode::TrigonometryNode()
AddInput(kXIn, NodeValue::kFloat, 0.0);
}
olive::Node *olive::TrigonometryNode::copy() const
{
return new TrigonometryNode();
}
QString TrigonometryNode::Name() const
{
return tr("Trigonometry");
+1 -3
View File
@@ -31,9 +31,7 @@ class TrigonometryNode : public Node
public:
TrigonometryNode();
NODE_DEFAULT_DESTRUCTOR(TrigonometryNode)
virtual Node* copy() const override;
NODE_DEFAULT_FUNCTIONS(TrigonometryNode)
virtual QString Name() const override;
virtual QString id() const override;
+3 -3
View File
@@ -148,7 +148,7 @@ Color Node::color() const
if (override_color_ >= 0) {
c = override_color_;
} else {
c = Config::Current()[QStringLiteral("CatColor%1").arg(this->Category().first())].toInt();
c = OLIVE_CONFIG_STR(QStringLiteral("CatColor%1").arg(this->Category().first())).toInt();
}
return ColorCoding::GetColor(c);
@@ -171,7 +171,7 @@ QLinearGradient Node::gradient_color(qreal top, qreal bottom) const
QBrush Node::brush(qreal top, qreal bottom) const
{
if (Config::Current()[QStringLiteral("UseGradients")].toBool()) {
if (OLIVE_CONFIG("UseGradients").toBool()) {
return gradient_color(top, bottom);
} else {
return color().toQColor();
@@ -1103,7 +1103,7 @@ Node *Node::CopyNodeInGraph(Node *node, MultiUndoCommand *command)
{
Node* copy;
if (Config::Current()[QStringLiteral("SplitClipsCopyNodes")].toBool()) {
if (OLIVE_CONFIG("SplitClipsCopyNodes").toBool()) {
copy = Node::CopyNodeAndDependencyGraphMinusItems(node, command);
} else {
copy = node->copy();
+9
View File
@@ -48,6 +48,10 @@
namespace olive {
#define NODE_DEFAULT_FUNCTIONS(x) \
NODE_DEFAULT_DESTRUCTOR(x) \
NODE_COPY_FUNCTION(x)
#define NODE_DEFAULT_DESTRUCTOR(x) \
virtual ~x() override {DisconnectAll();}
@@ -100,6 +104,11 @@ public:
kAudioEffect = 0x4
};
struct ContextPair {
Node *node;
Node *context;
};
Node();
virtual ~Node() override;
-5
View File
@@ -66,11 +66,6 @@ const Track::Type& Track::type() const
return track_type_;
}
Node *Track::copy() const
{
return new Track();
}
QString Track::Name() const
{
if (track_type_ == Track::kVideo) {
+1 -3
View File
@@ -45,13 +45,11 @@ public:
Track();
NODE_DEFAULT_DESTRUCTOR(Track)
NODE_DEFAULT_FUNCTIONS(Track)
const Track::Type& type() const;
void set_type(const Track::Type& track_type);
virtual Node* copy() const override;
virtual QString Name() const override;
virtual QString id() const override;
virtual QVector<CategoryID> Category() const override;
+18 -16
View File
@@ -72,11 +72,6 @@ ViewerOutput::ViewerOutput(bool create_buffer_inputs, bool create_default_stream
timeline_points_ = new TimelinePoints(this);
}
Node *ViewerOutput::copy() const
{
return new ViewerOutput();
}
QString ViewerOutput::Name() const
{
return tr("Viewer");
@@ -188,26 +183,26 @@ AudioParams ViewerOutput::GetFirstEnabledAudioStream() const
void ViewerOutput::set_default_parameters()
{
int width = Config::Current()["DefaultSequenceWidth"].toInt();
int height = Config::Current()["DefaultSequenceHeight"].toInt();
int width = OLIVE_CONFIG("DefaultSequenceWidth").toInt();
int height = OLIVE_CONFIG("DefaultSequenceHeight").toInt();
SetVideoParams(VideoParams(
width,
height,
Config::Current()["DefaultSequenceFrameRate"].value<rational>(),
static_cast<VideoParams::Format>(Config::Current()["OfflinePixelFormat"].toInt()),
OLIVE_CONFIG("DefaultSequenceFrameRate").value<rational>(),
static_cast<VideoParams::Format>(OLIVE_CONFIG("OfflinePixelFormat").toInt()),
VideoParams::kInternalChannelCount,
Config::Current()["DefaultSequencePixelAspect"].value<rational>(),
Config::Current()["DefaultSequenceInterlacing"].value<VideoParams::Interlacing>(),
OLIVE_CONFIG("DefaultSequencePixelAspect").value<rational>(),
OLIVE_CONFIG("DefaultSequenceInterlacing").value<VideoParams::Interlacing>(),
VideoParams::generate_auto_divider(width, height)
));
SetAudioParams(AudioParams(
Config::Current()["DefaultSequenceAudioFrequency"].toInt(),
Config::Current()["DefaultSequenceAudioLayout"].toULongLong(),
OLIVE_CONFIG("DefaultSequenceAudioFrequency").toInt(),
OLIVE_CONFIG("DefaultSequenceAudioLayout").toULongLong(),
AudioParams::kInternalFormat
));
SetVideoAutoCacheEnabled(Config::Current()["DefaultSequenceAutoCache"].toBool());
SetVideoAutoCacheEnabled(OLIVE_CONFIG("DefaultSequenceAutoCache").toBool());
}
void ViewerOutput::ShiftVideoCache(const rational &from, const rational &to)
@@ -475,7 +470,9 @@ void ViewerOutput::set_parameters_from_footage(const QVector<ViewerOutput *> foo
QVector<VideoParams> video_streams = f->GetEnabledVideoStreams();
QVector<AudioParams> audio_streams = f->GetEnabledAudioStreams();
foreach (const VideoParams& s, video_streams) {
for (int i=0; i<video_streams.size(); i++) {
const VideoParams& s = video_streams.at(i);
bool found_video_params = false;
rational using_timebase;
@@ -483,6 +480,11 @@ void ViewerOutput::set_parameters_from_footage(const QVector<ViewerOutput *> foo
// If this is a still image, we'll use it's resolution but won't set
// `found_video_params` in case something with a frame rate comes along which we'll
// prioritize
if (i > 0) {
// Ignore still images past stream 0
continue;
}
using_timebase = GetVideoParams().time_base();
} else {
using_timebase = s.frame_rate_as_time_base();
@@ -492,7 +494,7 @@ void ViewerOutput::set_parameters_from_footage(const QVector<ViewerOutput *> foo
SetVideoParams(VideoParams(s.width(),
s.height(),
using_timebase,
static_cast<VideoParams::Format>(Config::Current()[QStringLiteral("OfflinePixelFormat")].toInt()),
static_cast<VideoParams::Format>(OLIVE_CONFIG("OfflinePixelFormat").toInt()),
VideoParams::kInternalChannelCount,
s.pixel_aspect_ratio(),
s.interlacing(),
+1 -3
View File
@@ -46,9 +46,7 @@ class ViewerOutput : public Node
public:
ViewerOutput(bool create_buffer_inputs = true, bool create_default_streams = true);
NODE_DEFAULT_DESTRUCTOR(ViewerOutput)
virtual Node* copy() const override;
NODE_DEFAULT_FUNCTIONS(ViewerOutput)
virtual QString Name() const override;
virtual QString id() const override;
+1 -6
View File
@@ -37,12 +37,7 @@ class Folder : public Node
public:
Folder();
NODE_DEFAULT_DESTRUCTOR(Folder)
virtual Node* copy() const override
{
return new Folder();
}
NODE_DEFAULT_FUNCTIONS(Folder)
virtual QString Name() const override
{
+1 -6
View File
@@ -55,12 +55,7 @@ public:
*/
Footage(const QString& filename = QString());
NODE_DEFAULT_DESTRUCTOR(Footage)
virtual Node* copy() const override
{
return new Footage();
}
NODE_DEFAULT_FUNCTIONS(Footage)
virtual QString Name() const override
{
@@ -31,7 +31,7 @@ class ProjectSettingsNode : public Node
public:
ProjectSettingsNode();
NODE_DEFAULT_DESTRUCTOR(ProjectSettingsNode)
NODE_DEFAULT_FUNCTIONS(ProjectSettingsNode)
virtual QString Name() const override
{
@@ -53,11 +53,6 @@ public:
return tr("Settings used throughout the project.");
}
virtual Node* copy() const override
{
return new ProjectSettingsNode();
}
enum CacheSetting {
kCacheUseDefaultLocation,
kCacheStoreAlongsideProject,
+1 -6
View File
@@ -36,12 +36,7 @@ class Sequence : public ViewerOutput
public:
Sequence();
NODE_DEFAULT_DESTRUCTOR(Sequence)
virtual Node* copy() const override
{
return new Sequence();
}
NODE_DEFAULT_FUNCTIONS(Sequence)
virtual QString Name() const override
{
@@ -605,7 +605,7 @@ void ProjectSerializer210528::LoadMarkerList(QXmlStreamReader *reader, TimelineM
}
}
new TimelineMarker(Config::Current()[QStringLiteral("MarkerColor")].toInt(), TimeRange(in, out), name, markers);
new TimelineMarker(OLIVE_CONFIG("MarkerColor").toInt(), TimeRange(in, out), name, markers);
}
reader->skipCurrentElement();
@@ -597,7 +597,7 @@ void ProjectSerializer210907::LoadMarkerList(QXmlStreamReader *reader, TimelineM
}
}
new TimelineMarker(Config::Current()[QStringLiteral("MarkerColor")].toInt(), TimeRange(in, out), name, markers);
new TimelineMarker(OLIVE_CONFIG("MarkerColor").toInt(), TimeRange(in, out), name, markers);
}
reader->skipCurrentElement();
@@ -647,7 +647,7 @@ void ProjectSerializer211228::LoadMarkerList(QXmlStreamReader *reader, TimelineM
}
}
new TimelineMarker(Config::Current()[QStringLiteral("MarkerColor")].toInt(), TimeRange(in, out), name, markers);
new TimelineMarker(OLIVE_CONFIG("MarkerColor").toInt(), TimeRange(in, out), name, markers);
}
reader->skipCurrentElement();
+1 -2
View File
@@ -30,8 +30,7 @@ class TimeOffsetNode : public Node
public:
TimeOffsetNode();
NODE_DEFAULT_DESTRUCTOR(TimeOffsetNode)
NODE_COPY_FUNCTION(TimeOffsetNode)
NODE_DEFAULT_FUNCTIONS(TimeOffsetNode)
virtual QString Name() const override
{
-5
View File
@@ -39,11 +39,6 @@ TimeRemapNode::TimeRemapNode()
AddInput(kInputInput, NodeValue::kNone, InputFlags(kInputFlagNotKeyframable));
}
Node *TimeRemapNode::copy() const
{
return new TimeRemapNode();
}
QString TimeRemapNode::Name() const
{
return tr("Time Remap");
+1 -3
View File
@@ -31,9 +31,7 @@ class TimeRemapNode : public Node
public:
TimeRemapNode();
NODE_DEFAULT_DESTRUCTOR(TimeRemapNode)
virtual Node* copy() const override;
NODE_DEFAULT_FUNCTIONS(TimeRemapNode)
virtual QString Name() const override;
virtual QString id() const override;
+15 -2
View File
@@ -307,6 +307,7 @@ void NodeTraverser::ResolveJobs(NodeValue &val, const TimeRange &range)
TexturePtr tex = CreateTexture(tex_params);
PreProcessRow(range, job.GetValues());
ProcessShader(tex, val.source(), range, job);
val.set_data(QVariant::fromValue(tex));
@@ -317,14 +318,26 @@ void NodeTraverser::ResolveJobs(NodeValue &val, const TimeRange &range)
VideoParams tex_params = GetCacheVideoParams();
tex_params.set_channel_count(GetChannelCountFromJob(job));
VideoParams upload_params = tex_params;
if (job.GetRequestedFormat() != VideoParams::kFormatInvalid) {
tex_params.set_format(job.GetRequestedFormat());
upload_params.set_format(job.GetRequestedFormat());
}
TexturePtr tex = CreateTexture(tex_params);
TexturePtr tex = CreateTexture(upload_params);
PreProcessRow(range, job.GetValues());
ProcessFrameGeneration(tex, val.source(), job);
if (!job.GetColorspace().isEmpty()) {
// Convert to reference space
TexturePtr dest = CreateTexture(tex_params);
ConvertToReferenceSpace(dest, tex, job.GetColorspace());
tex = dest;
}
val.set_data(QVariant::fromValue(tex));
} else if (v.canConvert<ColorTransformJob>()) {
+7 -1
View File
@@ -95,6 +95,8 @@ protected:
virtual void ProcessFrameGeneration(TexturePtr destination, const Node *node, const GenerateJob& job){}
virtual void ConvertToReferenceSpace(TexturePtr destination, TexturePtr source, const QString &input_cs){}
virtual TexturePtr CreateTexture(const VideoParams &p)
{
return CreateDummyTexture(p);
@@ -108,7 +110,11 @@ protected:
SampleBufferPtr CreateSampleBuffer(const AudioParams &params, const rational &length)
{
return CreateSampleBuffer(params, params.time_to_samples(length));
if (params.is_valid()) {
return CreateSampleBuffer(params, params.time_to_samples(length));
} else {
return SampleBuffer::Create();
}
}
virtual bool CanCacheFrames()
+2 -1
View File
@@ -28,9 +28,10 @@ NodePanel::NodePanel(QWidget *parent) :
node_widget_ = new NodeWidget();
connect(this, &NodePanel::visibilityChanged, node_widget_->view(), &NodeView::CenterOnItemsBoundingRect);
// Connect node view signals to this panel - MAY REMOVE
connect(node_widget_->view(), &NodeView::NodesSelected, this, &NodePanel::NodesSelected);
connect(node_widget_->view(), &NodeView::NodesDeselected, this, &NodePanel::NodesDeselected);
connect(node_widget_->view(), &NodeView::NodeSelectionChanged, this, &NodePanel::NodeSelectionChanged);
connect(node_widget_->view(), &NodeView::NodeSelectionChangedWithContexts, this, &NodePanel::NodeSelectionChangedWithContexts);
connect(node_widget_->view(), &NodeView::NodeGroupOpened, this, &NodePanel::NodeGroupOpened);
connect(node_widget_->view(), &NodeView::NodeGroupClosed, this, &NodePanel::NodeGroupClosed);
+5 -3
View File
@@ -105,10 +105,9 @@ public:
}
public slots:
void Select(const QVector<Node*>& nodes, bool center_view_on_item)
void Select(const QVector<Node::ContextPair> &p)
{
node_widget_->view()->Select(nodes, center_view_on_item);
this->raise();
node_widget_->view()->Select(p, true);
}
signals:
@@ -116,6 +115,9 @@ signals:
void NodesDeselected(const QVector<Node*>& nodes);
void NodeSelectionChanged(const QVector<Node*>& nodes);
void NodeSelectionChangedWithContexts(const QVector<Node::ContextPair>& nodes);
void NodeGroupOpened(NodeGroup *group);
void NodeGroupClosed();
+1 -1
View File
@@ -49,7 +49,7 @@ PanelWidget *PanelManager::CurrentlyFocused(bool enable_hover) const
{
// If hover focus is enabled, find the currently hovered panel and return it (if no panel is hovered, resort to
// default behavior)
if (enable_hover && Config::Current()[QStringLiteral("HoverFocus")].toBool()) {
if (enable_hover && OLIVE_CONFIG("HoverFocus").toBool()) {
PanelWidget* hovered = CurrentlyHovered();
if (hovered != nullptr) {
+1 -11
View File
@@ -28,24 +28,14 @@ ParamPanel::ParamPanel(QWidget* parent) :
TimeBasedPanel(QStringLiteral("ParamPanel"), parent)
{
NodeParamView* view = new NodeParamView();
connect(view, &NodeParamView::RequestSelectNode, this, &ParamPanel::RequestSelectNode);
connect(view, &NodeParamView::FocusedNodeChanged, this, &ParamPanel::FocusedNodeChanged);
connect(view, &NodeParamView::SelectedNodesChanged, this, &ParamPanel::SelectedNodesChanged);
connect(this, &ParamPanel::visibilityChanged, view, &NodeParamView::UpdateElementY);
SetTimeBasedWidget(view);
Retranslate();
}
void ParamPanel::SelectNodes(const QVector<Node *> &nodes)
{
static_cast<NodeParamView*>(GetTimeBasedWidget())->SelectNodes(nodes);
}
void ParamPanel::DeselectNodes(const QVector<Node *> &nodes)
{
static_cast<NodeParamView*>(GetTimeBasedWidget())->DeselectNodes(nodes);
}
void ParamPanel::DeleteSelected()
{
static_cast<NodeParamView*>(GetTimeBasedWidget())->DeleteSelected();

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