added UI for editing video parameters in nodes
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#include "core.h"
|
||||
#include "render/job/footagejob.h"
|
||||
#include "ui/icons/icons.h"
|
||||
#include "widget/videoparamedit/videoparamedit.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
@@ -645,9 +646,43 @@ void Footage::AddStreamAsInput(Stream::Type type, int index, QVariant value)
|
||||
StreamReference ref(type, index);
|
||||
|
||||
// Create input for parameters
|
||||
AddInput(input_id, type == Stream::kVideo ? NodeValue::kVideoParams : NodeValue::kAudioParams,
|
||||
NodeValue::Type value_type;
|
||||
uint64_t param_mask = 0;
|
||||
|
||||
if (type == Stream::kVideo) {
|
||||
VideoParams vp = value.value<VideoParams>();
|
||||
value_type = NodeValue::kVideoParams;
|
||||
|
||||
// Universal parameters for video/image footage
|
||||
param_mask |= VideoParamEdit::kEnabled;
|
||||
param_mask |= VideoParamEdit::kColorspace;
|
||||
param_mask |= VideoParamEdit::kPixelAspect;
|
||||
param_mask |= VideoParamEdit::kInterlacing;
|
||||
|
||||
if (vp.channel_count() == VideoParams::kRGBAChannelCount) {
|
||||
// If this has an alpha channel, add a premultiplied optino
|
||||
param_mask |= VideoParamEdit::kPremultipliedAlpha;
|
||||
}
|
||||
|
||||
if (vp.video_type() != VideoParams::kVideoTypeVideo) {
|
||||
// This is either a still image or an image sequence, add properties for those
|
||||
param_mask |= VideoParamEdit::kIsImageSequence;
|
||||
param_mask |= VideoParamEdit::kStartTime;
|
||||
param_mask |= VideoParamEdit::kEndTime;
|
||||
param_mask |= VideoParamEdit::kFrameRate;
|
||||
} else {
|
||||
// Ensure timebase isn't overwritten by the frame rate field
|
||||
param_mask |= VideoParamEdit::kFrameRateIsNotTimebase;
|
||||
}
|
||||
} else {
|
||||
value_type = NodeValue::kAudioParams;
|
||||
param_mask = 0;
|
||||
}
|
||||
|
||||
AddInput(input_id, value_type,
|
||||
InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
||||
SetStandardValue(input_id, value);
|
||||
SetInputProperty(input_id, QStringLiteral("mask"), QVariant::fromValue(param_mask));
|
||||
inputs_for_stream_properties_.insert(ref, input_id);
|
||||
|
||||
// Create output for stream
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "panel/timeline/timeline.h"
|
||||
#include "panel/sequenceviewer/sequenceviewer.h"
|
||||
#include "ui/icons/icons.h"
|
||||
#include "widget/videoparamedit/videoparamedit.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
@@ -43,6 +44,8 @@ const QString Sequence::kTextureInput = QStringLiteral("tex_in");
|
||||
const QString Sequence::kSamplesInput = QStringLiteral("samples_in");
|
||||
const QString Sequence::kTrackInputFormat = QStringLiteral("track_in_%1");
|
||||
|
||||
const uint64_t Sequence::kVideoParamEditMask = VideoParamEdit::kWidthHeight | VideoParamEdit::kInterlacing | VideoParamEdit::kFrameRate | VideoParamEdit::kPixelAspect;
|
||||
|
||||
#define super Item
|
||||
|
||||
Sequence::Sequence(bool viewer_only_mode) :
|
||||
@@ -52,6 +55,8 @@ Sequence::Sequence(bool viewer_only_mode) :
|
||||
operation_stack_(0)
|
||||
{
|
||||
AddInput(kVideoParamsInput, NodeValue::kVideoParams, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
||||
SetInputProperty(kVideoParamsInput, QStringLiteral("mask"), QVariant::fromValue(kVideoParamEditMask));
|
||||
|
||||
AddInput(kAudioParamsInput, NodeValue::kAudioParams, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
||||
|
||||
AddInput(kTextureInput, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable));
|
||||
|
||||
@@ -161,6 +161,8 @@ public:
|
||||
static const QString kSamplesInput;
|
||||
static const QString kTrackInputFormat;
|
||||
|
||||
static const uint64_t kVideoParamEditMask;
|
||||
|
||||
TimelinePoints* timeline_points()
|
||||
{
|
||||
return &timeline_points_;
|
||||
|
||||
+44
-10
@@ -39,6 +39,12 @@ Project::Project() :
|
||||
// Adds a color manager "node" to this project so that it synchronizes
|
||||
color_manager_ = new ColorManager();
|
||||
color_manager_->setParent(this);
|
||||
AddDefaultNode(color_manager_);
|
||||
|
||||
// Same with project settings
|
||||
settings_ = new ProjectSettingsNode();
|
||||
settings_->setParent(this);
|
||||
AddDefaultNode(settings_);
|
||||
|
||||
// Folder root for project
|
||||
root_ = new Folder();
|
||||
@@ -58,10 +64,6 @@ void Project::Load(QXmlStreamReader *reader, MainWindowLayoutInfo* layout, uint
|
||||
|
||||
root_->Load(reader, xml_node_data, version, cancelled);
|
||||
|
||||
} else if (reader->name() == QStringLiteral("cachepath")) {
|
||||
|
||||
set_cache_path(reader->readElementText());
|
||||
|
||||
} else if (reader->name() == QStringLiteral("layout")) {
|
||||
|
||||
// Since the main window's functions have to occur in the GUI thread (and we're likely
|
||||
@@ -76,6 +78,8 @@ void Project::Load(QXmlStreamReader *reader, MainWindowLayoutInfo* layout, uint
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (reader->name() == QStringLiteral("node")) {
|
||||
bool is_root = false;
|
||||
bool is_cm = false;
|
||||
bool is_settings = false;
|
||||
QString id;
|
||||
|
||||
{
|
||||
@@ -84,6 +88,10 @@ void Project::Load(QXmlStreamReader *reader, MainWindowLayoutInfo* layout, uint
|
||||
id = attr.value().toString();
|
||||
} else if (attr.name() == QStringLiteral("root") && attr.value() == QStringLiteral("1")) {
|
||||
is_root = true;
|
||||
} else if (attr.name() == QStringLiteral("cm") && attr.value() == QStringLiteral("1")) {
|
||||
is_cm = true;
|
||||
} else if (attr.name() == QStringLiteral("settings") && attr.value() == QStringLiteral("1")) {
|
||||
is_settings = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -95,6 +103,10 @@ void Project::Load(QXmlStreamReader *reader, MainWindowLayoutInfo* layout, uint
|
||||
|
||||
if (is_root) {
|
||||
node = root_;
|
||||
} else if (is_cm) {
|
||||
node = color_manager_;
|
||||
} else if (is_settings) {
|
||||
node = settings_;
|
||||
} else {
|
||||
node = NodeFactory::CreateFromID(id);
|
||||
}
|
||||
@@ -128,8 +140,6 @@ void Project::Load(QXmlStreamReader *reader, MainWindowLayoutInfo* layout, uint
|
||||
|
||||
void Project::Save(QXmlStreamWriter *writer) const
|
||||
{
|
||||
writer->writeTextElement(QStringLiteral("cachepath"), cache_path(false));
|
||||
|
||||
writer->writeStartElement(QStringLiteral("nodes"));
|
||||
|
||||
foreach (Node* node, nodes()) {
|
||||
@@ -137,6 +147,10 @@ void Project::Save(QXmlStreamWriter *writer) const
|
||||
|
||||
if (node == root_) {
|
||||
writer->writeAttribute(QStringLiteral("root"), QStringLiteral("1"));
|
||||
} else if (node == color_manager_) {
|
||||
writer->writeAttribute(QStringLiteral("cm"), QStringLiteral("1"));
|
||||
} else if (node == settings_) {
|
||||
writer->writeAttribute(QStringLiteral("settings"), QStringLiteral("1"));
|
||||
}
|
||||
|
||||
writer->writeAttribute(QStringLiteral("id"), node->id());
|
||||
@@ -228,12 +242,32 @@ bool Project::is_new() const
|
||||
return !is_modified_ && filename_.isEmpty();
|
||||
}
|
||||
|
||||
const QString &Project::cache_path(bool default_if_empty) const
|
||||
QString Project::cache_path() const
|
||||
{
|
||||
if (cache_path_.isEmpty() && default_if_empty) {
|
||||
return DiskManager::instance()->GetDefaultCachePath();
|
||||
ProjectSettingsNode::CacheSetting setting = settings_->GetCacheSetting();
|
||||
|
||||
switch (setting) {
|
||||
case ProjectSettingsNode::kCacheUseDefaultLocation:
|
||||
break;
|
||||
case ProjectSettingsNode::kCacheCustomPath:
|
||||
{
|
||||
QString cache_path = settings_->GetCustomCachePath();
|
||||
|
||||
if (cache_path.isEmpty()) {
|
||||
return cache_path;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return cache_path_;
|
||||
case ProjectSettingsNode::kCacheStoreAlongsideProject:
|
||||
{
|
||||
if (!filename_.isEmpty()) {
|
||||
return QFileInfo(filename_).path();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return DiskManager::instance()->GetDefaultCachePath();
|
||||
}
|
||||
|
||||
void Project::ColorManagerValueChanged(const NodeInput &input, const TimeRange &range)
|
||||
|
||||
+4
-12
@@ -24,6 +24,7 @@
|
||||
#include <QObject>
|
||||
#include <memory>
|
||||
|
||||
#include "node/project/projectsettings/projectsettings.h"
|
||||
#include "render/colormanager.h"
|
||||
#include "project/item/folder/folder.h"
|
||||
#include "window/mainwindow/mainwindowlayoutinfo.h"
|
||||
@@ -69,22 +70,13 @@ public:
|
||||
|
||||
bool is_new() const;
|
||||
|
||||
const QString& cache_path(bool default_if_empty = true) const;
|
||||
|
||||
void set_cache_path(const QString& cache_path)
|
||||
{
|
||||
cache_path_ = cache_path;
|
||||
|
||||
emit CachePathChanged(cache_path_);
|
||||
}
|
||||
QString cache_path() const;
|
||||
|
||||
signals:
|
||||
void NameChanged();
|
||||
|
||||
void ModifiedChanged(bool e);
|
||||
|
||||
void CachePathChanged(const QString& s);
|
||||
|
||||
private:
|
||||
Folder* root_;
|
||||
|
||||
@@ -92,12 +84,12 @@ private:
|
||||
|
||||
ColorManager* color_manager_;
|
||||
|
||||
ProjectSettingsNode* settings_;
|
||||
|
||||
bool is_modified_;
|
||||
|
||||
bool autorecovery_saved_;
|
||||
|
||||
QString cache_path_;
|
||||
|
||||
private slots:
|
||||
void ColorManagerValueChanged(const NodeInput& input, const TimeRange& range);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user