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
-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()