change: change code style to Linux style except indent.
This commit is contained in:
@@ -18,15 +18,18 @@
|
||||
#include "node/color/colormanager/colormanager.h"
|
||||
#include "render/colorprocessor.h"
|
||||
|
||||
namespace olive {
|
||||
namespace olive
|
||||
{
|
||||
|
||||
#define super OCIOBaseNode
|
||||
|
||||
const QString ChromaKeyNode::kColorInput = QStringLiteral("color_key");
|
||||
const QString ChromaKeyNode::kMaskOnlyInput = QStringLiteral("mask_only_in");
|
||||
const QString ChromaKeyNode::kInvertInput = QStringLiteral("invert_in");
|
||||
const QString ChromaKeyNode::kUpperToleranceInput = QStringLiteral("upper_tolerence_in");
|
||||
const QString ChromaKeyNode::kLowerToleranceInput = QStringLiteral("lower_tolerence_in");
|
||||
const QString ChromaKeyNode::kUpperToleranceInput =
|
||||
QStringLiteral("upper_tolerence_in");
|
||||
const QString ChromaKeyNode::kLowerToleranceInput =
|
||||
QStringLiteral("lower_tolerence_in");
|
||||
const QString ChromaKeyNode::kGarbageMatteInput = QStringLiteral("garbage_in");
|
||||
const QString ChromaKeyNode::kCoreMatteInput = QStringLiteral("core_in");
|
||||
const QString ChromaKeyNode::kShadowsInput = QStringLiteral("shadows_in");
|
||||
@@ -34,121 +37,129 @@ const QString ChromaKeyNode::kHighlightsInput = QStringLiteral("highlights_in");
|
||||
|
||||
ChromaKeyNode::ChromaKeyNode()
|
||||
{
|
||||
AddInput(kColorInput, NodeValue::kColor, QVariant::fromValue(Color(0.0f, 1.0f, 0.0f, 1.0f)));
|
||||
AddInput(kColorInput, NodeValue::kColor,
|
||||
QVariant::fromValue(Color(0.0f, 1.0f, 0.0f, 1.0f)));
|
||||
|
||||
AddInput(kLowerToleranceInput, NodeValue::kFloat, 5.0);
|
||||
SetInputProperty(kLowerToleranceInput, QStringLiteral("min"), 0.0);
|
||||
SetInputProperty(kLowerToleranceInput, QStringLiteral("base"), 0.1);
|
||||
AddInput(kLowerToleranceInput, NodeValue::kFloat, 5.0);
|
||||
SetInputProperty(kLowerToleranceInput, QStringLiteral("min"), 0.0);
|
||||
SetInputProperty(kLowerToleranceInput, QStringLiteral("base"), 0.1);
|
||||
|
||||
AddInput(kUpperToleranceInput, NodeValue::kFloat, 25.0);
|
||||
SetInputProperty(kUpperToleranceInput, QStringLiteral("base"), 0.1);
|
||||
AddInput(kUpperToleranceInput, NodeValue::kFloat, 25.0);
|
||||
SetInputProperty(kUpperToleranceInput, QStringLiteral("base"), 0.1);
|
||||
|
||||
// FIXME: Temporarily disabled. This will break if "lower tolerance" is keyframed or connected to
|
||||
// something and there's currently no solution to remedy that. If there is in the future,
|
||||
// we can look into re-enabling this.
|
||||
//SetInputProperty(kUpperToleranceInput, QStringLiteral("min"), GetStandardValue(kLowerToleranceInput).toDouble());
|
||||
// FIXME: Temporarily disabled. This will break if "lower tolerance" is keyframed or connected to
|
||||
// something and there's currently no solution to remedy that. If there is in the future,
|
||||
// we can look into re-enabling this.
|
||||
//SetInputProperty(kUpperToleranceInput, QStringLiteral("min"), GetStandardValue(kLowerToleranceInput).toDouble());
|
||||
|
||||
AddInput(kGarbageMatteInput, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable));
|
||||
AddInput(kGarbageMatteInput, NodeValue::kTexture,
|
||||
InputFlags(kInputFlagNotKeyframable));
|
||||
|
||||
AddInput(kCoreMatteInput, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable));
|
||||
AddInput(kCoreMatteInput, NodeValue::kTexture,
|
||||
InputFlags(kInputFlagNotKeyframable));
|
||||
|
||||
AddInput(kHighlightsInput, NodeValue::kFloat, 100.0f);
|
||||
SetInputProperty(kHighlightsInput, QStringLiteral("min"), 0.0);
|
||||
SetInputProperty(kHighlightsInput, QStringLiteral("base"), 0.1);
|
||||
AddInput(kHighlightsInput, NodeValue::kFloat, 100.0f);
|
||||
SetInputProperty(kHighlightsInput, QStringLiteral("min"), 0.0);
|
||||
SetInputProperty(kHighlightsInput, QStringLiteral("base"), 0.1);
|
||||
|
||||
AddInput(kShadowsInput, NodeValue::kFloat, 100.0f);
|
||||
SetInputProperty(kShadowsInput, QStringLiteral("min"), 0.0);
|
||||
SetInputProperty(kShadowsInput, QStringLiteral("base"), 0.1);
|
||||
AddInput(kShadowsInput, NodeValue::kFloat, 100.0f);
|
||||
SetInputProperty(kShadowsInput, QStringLiteral("min"), 0.0);
|
||||
SetInputProperty(kShadowsInput, QStringLiteral("base"), 0.1);
|
||||
|
||||
AddInput(kInvertInput, NodeValue::kBoolean, false);
|
||||
AddInput(kInvertInput, NodeValue::kBoolean, false);
|
||||
|
||||
AddInput(kMaskOnlyInput, NodeValue::kBoolean, false);
|
||||
AddInput(kMaskOnlyInput, NodeValue::kBoolean, false);
|
||||
}
|
||||
|
||||
QString ChromaKeyNode::Name() const
|
||||
{
|
||||
return tr("Chroma Key");
|
||||
return tr("Chroma Key");
|
||||
}
|
||||
|
||||
QString ChromaKeyNode::id() const
|
||||
{
|
||||
return QStringLiteral("org.olivevideoeditor.Olive.chromakey");
|
||||
return QStringLiteral("org.olivevideoeditor.Olive.chromakey");
|
||||
}
|
||||
|
||||
QVector<Node::CategoryID> ChromaKeyNode::Category() const
|
||||
{
|
||||
return {kCategoryKeying};
|
||||
return { kCategoryKeying };
|
||||
}
|
||||
|
||||
QString ChromaKeyNode::Description() const
|
||||
{
|
||||
return tr("A simple color key based on the distance from the chroma of a selected color.");
|
||||
return tr(
|
||||
"A simple color key based on the distance from the chroma of a selected color.");
|
||||
}
|
||||
|
||||
void ChromaKeyNode::Retranslate()
|
||||
{
|
||||
super::Retranslate();
|
||||
SetInputName(kTextureInput, tr("Input"));
|
||||
SetInputName(kGarbageMatteInput, tr("Garbage Matte"));
|
||||
SetInputName(kCoreMatteInput, tr("Core Matte"));
|
||||
SetInputName(kColorInput, tr("Key Color"));
|
||||
SetInputName(kShadowsInput, tr("Shadows"));
|
||||
SetInputName(kHighlightsInput, tr("Highlights"));
|
||||
SetInputName(kUpperToleranceInput, tr("Upper Tolerance"));
|
||||
SetInputName(kLowerToleranceInput, tr("Lower Tolerance"));
|
||||
SetInputName(kInvertInput, tr("Invert Mask"));
|
||||
SetInputName(kMaskOnlyInput, tr("Show Mask Only"));
|
||||
super::Retranslate();
|
||||
SetInputName(kTextureInput, tr("Input"));
|
||||
SetInputName(kGarbageMatteInput, tr("Garbage Matte"));
|
||||
SetInputName(kCoreMatteInput, tr("Core Matte"));
|
||||
SetInputName(kColorInput, tr("Key Color"));
|
||||
SetInputName(kShadowsInput, tr("Shadows"));
|
||||
SetInputName(kHighlightsInput, tr("Highlights"));
|
||||
SetInputName(kUpperToleranceInput, tr("Upper Tolerance"));
|
||||
SetInputName(kLowerToleranceInput, tr("Lower Tolerance"));
|
||||
SetInputName(kInvertInput, tr("Invert Mask"));
|
||||
SetInputName(kMaskOnlyInput, tr("Show Mask Only"));
|
||||
}
|
||||
|
||||
void ChromaKeyNode::InputValueChangedEvent(const QString &input, int element)
|
||||
{
|
||||
Q_UNUSED(element);
|
||||
if (input == kLowerToleranceInput) {
|
||||
// FIXME: Temporarily disabled. This will break if "lower tolerance" is keyframed or connected to
|
||||
// something and there's currently no solution to remedy that. If there is in the future,
|
||||
// we can look into re-enabling this.
|
||||
//SetInputProperty(kUpperToleranceInput, QStringLiteral("min"), GetStandardValue(kLowerToleranceInput).toDouble());
|
||||
}
|
||||
Q_UNUSED(element);
|
||||
if (input == kLowerToleranceInput) {
|
||||
// FIXME: Temporarily disabled. This will break if "lower tolerance" is keyframed or connected to
|
||||
// something and there's currently no solution to remedy that. If there is in the future,
|
||||
// we can look into re-enabling this.
|
||||
//SetInputProperty(kUpperToleranceInput, QStringLiteral("min"), GetStandardValue(kLowerToleranceInput).toDouble());
|
||||
}
|
||||
|
||||
GenerateProcessor();
|
||||
GenerateProcessor();
|
||||
}
|
||||
|
||||
ShaderCode ChromaKeyNode::GetShaderCode(const ShaderRequest &request) const
|
||||
{
|
||||
return ShaderCode(FileFunctions::ReadFileAsString(QStringLiteral(":/shaders/chromakey.frag")).arg(request.stub));
|
||||
return ShaderCode(FileFunctions::ReadFileAsString(
|
||||
QStringLiteral(":/shaders/chromakey.frag"))
|
||||
.arg(request.stub));
|
||||
}
|
||||
|
||||
void ChromaKeyNode::GenerateProcessor()
|
||||
{
|
||||
if (manager()){
|
||||
try {
|
||||
ColorTransform transform("cie_xyz_d65_interchange");
|
||||
set_processor(ColorProcessor::Create(manager(), manager()->GetReferenceColorSpace(), transform));
|
||||
} catch (const OCIO::Exception &e) {
|
||||
std::cerr << std::endl << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
if (manager()) {
|
||||
try {
|
||||
ColorTransform transform("cie_xyz_d65_interchange");
|
||||
set_processor(ColorProcessor::Create(
|
||||
manager(), manager()->GetReferenceColorSpace(), transform));
|
||||
} catch (const OCIO::Exception &e) {
|
||||
std::cerr << std::endl << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ChromaKeyNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const
|
||||
void ChromaKeyNode::Value(const NodeValueRow &value, const NodeGlobals &globals,
|
||||
NodeValueTable *table) const
|
||||
{
|
||||
if (TexturePtr tex = value[kTextureInput].toTexture()) {
|
||||
if (processor()) {
|
||||
ColorTransformJob job(value);
|
||||
if (TexturePtr tex = value[kTextureInput].toTexture()) {
|
||||
if (processor()) {
|
||||
ColorTransformJob job(value);
|
||||
|
||||
job.SetColorProcessor(processor());
|
||||
job.SetInputTexture(value[kTextureInput]);
|
||||
job.SetNeedsCustomShader(this);
|
||||
job.SetFunctionName(QStringLiteral("SceneLinearToCIEXYZ_d65"));
|
||||
job.SetColorProcessor(processor());
|
||||
job.SetInputTexture(value[kTextureInput]);
|
||||
job.SetNeedsCustomShader(this);
|
||||
job.SetFunctionName(QStringLiteral("SceneLinearToCIEXYZ_d65"));
|
||||
|
||||
table->Push(NodeValue::kTexture, tex->toJob(job), this);
|
||||
}
|
||||
}
|
||||
table->Push(NodeValue::kTexture, tex->toJob(job), this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ChromaKeyNode::ConfigChanged()
|
||||
{
|
||||
GenerateProcessor();
|
||||
GenerateProcessor();
|
||||
}
|
||||
|
||||
} // namespace olive
|
||||
|
||||
@@ -18,44 +18,45 @@
|
||||
|
||||
#include "node/color/ociobase/ociobase.h"
|
||||
|
||||
namespace olive {
|
||||
namespace olive
|
||||
{
|
||||
|
||||
class ChromaKeyNode : public OCIOBaseNode {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ChromaKeyNode();
|
||||
Q_OBJECT
|
||||
public:
|
||||
ChromaKeyNode();
|
||||
|
||||
NODE_DEFAULT_FUNCTIONS(ChromaKeyNode)
|
||||
NODE_DEFAULT_FUNCTIONS(ChromaKeyNode)
|
||||
|
||||
virtual QString Name() const override;
|
||||
virtual QString id() const override;
|
||||
virtual QVector<CategoryID> Category() const override;
|
||||
virtual QString Description() const override;
|
||||
virtual QString Name() const override;
|
||||
virtual QString id() const override;
|
||||
virtual QVector<CategoryID> Category() const override;
|
||||
virtual QString Description() const override;
|
||||
|
||||
virtual void Retranslate() override;
|
||||
virtual void Retranslate() override;
|
||||
|
||||
virtual void InputValueChangedEvent(const QString& input, int element) override;
|
||||
virtual void InputValueChangedEvent(const QString &input,
|
||||
int element) override;
|
||||
|
||||
virtual ShaderCode GetShaderCode(const ShaderRequest &request) const override;
|
||||
virtual void Value(const NodeValueRow& value, const NodeGlobals& globals, NodeValueTable* table) const override;
|
||||
virtual ShaderCode
|
||||
GetShaderCode(const ShaderRequest &request) const override;
|
||||
virtual void Value(const NodeValueRow &value, const NodeGlobals &globals,
|
||||
NodeValueTable *table) const override;
|
||||
|
||||
virtual void ConfigChanged() override;
|
||||
virtual void ConfigChanged() override;
|
||||
|
||||
static const QString kColorInput;
|
||||
static const QString kInvertInput;
|
||||
static const QString kMaskOnlyInput;
|
||||
static const QString kUpperToleranceInput;
|
||||
static const QString kLowerToleranceInput;
|
||||
static const QString kGarbageMatteInput;
|
||||
static const QString kCoreMatteInput;
|
||||
static const QString kShadowsInput;
|
||||
static const QString kHighlightsInput;
|
||||
static const QString kColorInput;
|
||||
static const QString kInvertInput;
|
||||
static const QString kMaskOnlyInput;
|
||||
static const QString kUpperToleranceInput;
|
||||
static const QString kLowerToleranceInput;
|
||||
static const QString kGarbageMatteInput;
|
||||
static const QString kCoreMatteInput;
|
||||
static const QString kShadowsInput;
|
||||
static const QString kHighlightsInput;
|
||||
|
||||
private:
|
||||
void GenerateProcessor();
|
||||
|
||||
|
||||
|
||||
void GenerateProcessor();
|
||||
};
|
||||
|
||||
} // namespace olive
|
||||
|
||||
@@ -15,90 +15,104 @@
|
||||
|
||||
#include "colordifferencekey.h"
|
||||
|
||||
namespace olive {
|
||||
namespace olive
|
||||
{
|
||||
|
||||
const QString ColorDifferenceKeyNode::kTextureInput = QStringLiteral("tex_in");
|
||||
const QString ColorDifferenceKeyNode::kGarbageMatteInput = QStringLiteral("garbage_in");
|
||||
const QString ColorDifferenceKeyNode::kCoreMatteInput = QStringLiteral("core_in");
|
||||
const QString ColorDifferenceKeyNode::kGarbageMatteInput =
|
||||
QStringLiteral("garbage_in");
|
||||
const QString ColorDifferenceKeyNode::kCoreMatteInput =
|
||||
QStringLiteral("core_in");
|
||||
const QString ColorDifferenceKeyNode::kColorInput = QStringLiteral("color_in");
|
||||
const QString ColorDifferenceKeyNode::kShadowsInput = QStringLiteral("shadows_in");
|
||||
const QString ColorDifferenceKeyNode::kHighlightsInput = QStringLiteral("highlights_in");
|
||||
const QString ColorDifferenceKeyNode::kMaskOnlyInput = QStringLiteral("mask_only_in");
|
||||
const QString ColorDifferenceKeyNode::kShadowsInput =
|
||||
QStringLiteral("shadows_in");
|
||||
const QString ColorDifferenceKeyNode::kHighlightsInput =
|
||||
QStringLiteral("highlights_in");
|
||||
const QString ColorDifferenceKeyNode::kMaskOnlyInput =
|
||||
QStringLiteral("mask_only_in");
|
||||
|
||||
#define super Node
|
||||
|
||||
ColorDifferenceKeyNode::ColorDifferenceKeyNode()
|
||||
{
|
||||
AddInput(kTextureInput, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable));
|
||||
AddInput(kTextureInput, NodeValue::kTexture,
|
||||
InputFlags(kInputFlagNotKeyframable));
|
||||
|
||||
AddInput(kGarbageMatteInput, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable));
|
||||
AddInput(kGarbageMatteInput, NodeValue::kTexture,
|
||||
InputFlags(kInputFlagNotKeyframable));
|
||||
|
||||
AddInput(kCoreMatteInput, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable));
|
||||
AddInput(kCoreMatteInput, NodeValue::kTexture,
|
||||
InputFlags(kInputFlagNotKeyframable));
|
||||
|
||||
AddInput(kColorInput, NodeValue::kCombo, 0);
|
||||
AddInput(kColorInput, NodeValue::kCombo, 0);
|
||||
|
||||
AddInput(kHighlightsInput, NodeValue::kFloat, 1.0f);
|
||||
SetInputProperty(kHighlightsInput, QStringLiteral("min"), 0.0);
|
||||
SetInputProperty(kHighlightsInput, QStringLiteral("base"), 0.01);
|
||||
AddInput(kHighlightsInput, NodeValue::kFloat, 1.0f);
|
||||
SetInputProperty(kHighlightsInput, QStringLiteral("min"), 0.0);
|
||||
SetInputProperty(kHighlightsInput, QStringLiteral("base"), 0.01);
|
||||
|
||||
AddInput(kShadowsInput, NodeValue::kFloat, 1.0f);
|
||||
SetInputProperty(kShadowsInput, QStringLiteral("min"), 0.0);
|
||||
SetInputProperty(kShadowsInput, QStringLiteral("base"), 0.01);
|
||||
AddInput(kShadowsInput, NodeValue::kFloat, 1.0f);
|
||||
SetInputProperty(kShadowsInput, QStringLiteral("min"), 0.0);
|
||||
SetInputProperty(kShadowsInput, QStringLiteral("base"), 0.01);
|
||||
|
||||
AddInput(kMaskOnlyInput, NodeValue::kBoolean, false);
|
||||
AddInput(kMaskOnlyInput, NodeValue::kBoolean, false);
|
||||
|
||||
SetFlag(kVideoEffect);
|
||||
SetEffectInput(kTextureInput);
|
||||
SetFlag(kVideoEffect);
|
||||
SetEffectInput(kTextureInput);
|
||||
}
|
||||
|
||||
QString ColorDifferenceKeyNode::Name() const
|
||||
{
|
||||
return tr("Color Difference Key");
|
||||
return tr("Color Difference Key");
|
||||
}
|
||||
|
||||
QString ColorDifferenceKeyNode::id() const
|
||||
{
|
||||
return QStringLiteral("org.olivevideoeditor.Olive.colordifferencekey");
|
||||
return QStringLiteral("org.olivevideoeditor.Olive.colordifferencekey");
|
||||
}
|
||||
|
||||
QVector<Node::CategoryID> ColorDifferenceKeyNode::Category() const
|
||||
{
|
||||
return {kCategoryKeying};
|
||||
return { kCategoryKeying };
|
||||
}
|
||||
|
||||
QString ColorDifferenceKeyNode::Description() const
|
||||
{
|
||||
return tr("A simple color key based on the distance of one color from other colors.");
|
||||
return tr(
|
||||
"A simple color key based on the distance of one color from other colors.");
|
||||
}
|
||||
|
||||
void ColorDifferenceKeyNode::Retranslate()
|
||||
{
|
||||
super::Retranslate();
|
||||
super::Retranslate();
|
||||
|
||||
SetInputName(kTextureInput, tr("Input"));
|
||||
SetInputName(kGarbageMatteInput, tr("Garbage Matte"));
|
||||
SetInputName(kCoreMatteInput, tr("Core Matte"));
|
||||
SetInputName(kColorInput, tr("Key Color"));
|
||||
SetComboBoxStrings(kColorInput, {tr("Green"), tr("Blue")});
|
||||
SetInputName(kShadowsInput, tr("Shadows"));
|
||||
SetInputName(kHighlightsInput, tr("Highlights"));
|
||||
SetInputName(kMaskOnlyInput, tr("Show Mask Only"));
|
||||
SetInputName(kTextureInput, tr("Input"));
|
||||
SetInputName(kGarbageMatteInput, tr("Garbage Matte"));
|
||||
SetInputName(kCoreMatteInput, tr("Core Matte"));
|
||||
SetInputName(kColorInput, tr("Key Color"));
|
||||
SetComboBoxStrings(kColorInput, { tr("Green"), tr("Blue") });
|
||||
SetInputName(kShadowsInput, tr("Shadows"));
|
||||
SetInputName(kHighlightsInput, tr("Highlights"));
|
||||
SetInputName(kMaskOnlyInput, tr("Show Mask Only"));
|
||||
}
|
||||
|
||||
ShaderCode ColorDifferenceKeyNode::GetShaderCode(const ShaderRequest &request) const
|
||||
ShaderCode
|
||||
ColorDifferenceKeyNode::GetShaderCode(const ShaderRequest &request) const
|
||||
{
|
||||
Q_UNUSED(request)
|
||||
return ShaderCode(FileFunctions::ReadFileAsString(":/shaders/colordifferencekey.frag"));
|
||||
Q_UNUSED(request)
|
||||
return ShaderCode(
|
||||
FileFunctions::ReadFileAsString(":/shaders/colordifferencekey.frag"));
|
||||
}
|
||||
|
||||
void ColorDifferenceKeyNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const
|
||||
void ColorDifferenceKeyNode::Value(const NodeValueRow &value,
|
||||
const NodeGlobals &globals,
|
||||
NodeValueTable *table) const
|
||||
{
|
||||
// If there's no texture, no need to run an operation
|
||||
if (TexturePtr tex = value[kTextureInput].toTexture()) {
|
||||
ShaderJob job;
|
||||
job.Insert(value);
|
||||
table->Push(NodeValue::kTexture, tex->toJob(job), this);
|
||||
}
|
||||
// If there's no texture, no need to run an operation
|
||||
if (TexturePtr tex = value[kTextureInput].toTexture()) {
|
||||
ShaderJob job;
|
||||
job.Insert(value);
|
||||
table->Push(NodeValue::kTexture, tex->toJob(job), this);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace olive
|
||||
} // namespace olive
|
||||
|
||||
@@ -18,34 +18,36 @@
|
||||
|
||||
#include "node/node.h"
|
||||
|
||||
namespace olive {
|
||||
namespace olive
|
||||
{
|
||||
|
||||
class ColorDifferenceKeyNode : public Node {
|
||||
public:
|
||||
ColorDifferenceKeyNode();
|
||||
public:
|
||||
ColorDifferenceKeyNode();
|
||||
|
||||
NODE_DEFAULT_FUNCTIONS(ColorDifferenceKeyNode)
|
||||
NODE_DEFAULT_FUNCTIONS(ColorDifferenceKeyNode)
|
||||
|
||||
virtual QString Name() const override;
|
||||
virtual QString id() const override;
|
||||
virtual QVector<CategoryID> Category() const override;
|
||||
virtual QString Description() const override;
|
||||
virtual QString Name() const override;
|
||||
virtual QString id() const override;
|
||||
virtual QVector<CategoryID> Category() const override;
|
||||
virtual QString Description() const override;
|
||||
|
||||
virtual void Retranslate() override;
|
||||
virtual void Retranslate() override;
|
||||
|
||||
virtual ShaderCode GetShaderCode(const ShaderRequest &request) const override;
|
||||
virtual void Value(const NodeValueRow& value, const NodeGlobals& globals, NodeValueTable* table) const override;
|
||||
|
||||
static const QString kTextureInput;
|
||||
static const QString kGarbageMatteInput;
|
||||
static const QString kCoreMatteInput;
|
||||
static const QString kColorInput;
|
||||
static const QString kShadowsInput;
|
||||
static const QString kHighlightsInput;
|
||||
static const QString kMaskOnlyInput;
|
||||
virtual ShaderCode
|
||||
GetShaderCode(const ShaderRequest &request) const override;
|
||||
virtual void Value(const NodeValueRow &value, const NodeGlobals &globals,
|
||||
NodeValueTable *table) const override;
|
||||
|
||||
static const QString kTextureInput;
|
||||
static const QString kGarbageMatteInput;
|
||||
static const QString kCoreMatteInput;
|
||||
static const QString kColorInput;
|
||||
static const QString kShadowsInput;
|
||||
static const QString kHighlightsInput;
|
||||
static const QString kMaskOnlyInput;
|
||||
};
|
||||
|
||||
} // namespace olive
|
||||
} // namespace olive
|
||||
|
||||
#endif // COLORDIFFERENCEKEYNODE_H
|
||||
#endif // COLORDIFFERENCEKEYNODE_H
|
||||
|
||||
@@ -17,84 +17,93 @@
|
||||
|
||||
#include "node/project.h"
|
||||
|
||||
namespace olive {
|
||||
namespace olive
|
||||
{
|
||||
|
||||
const QString DespillNode::kTextureInput = QStringLiteral("tex_in");
|
||||
const QString DespillNode::kColorInput = QStringLiteral("color_in");
|
||||
const QString DespillNode::kMethodInput = QStringLiteral("method_in");
|
||||
const QString DespillNode::kPreserveLuminanceInput = QStringLiteral("preserve_luminance_input");
|
||||
const QString DespillNode::kPreserveLuminanceInput =
|
||||
QStringLiteral("preserve_luminance_input");
|
||||
|
||||
#define super Node
|
||||
|
||||
DespillNode::DespillNode()
|
||||
{
|
||||
AddInput(kTextureInput, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable));
|
||||
AddInput(kTextureInput, NodeValue::kTexture,
|
||||
InputFlags(kInputFlagNotKeyframable));
|
||||
|
||||
AddInput(kColorInput, NodeValue::kCombo, 0);
|
||||
AddInput(kColorInput, NodeValue::kCombo, 0);
|
||||
|
||||
AddInput(kMethodInput, NodeValue::kCombo, 0);
|
||||
AddInput(kMethodInput, NodeValue::kCombo, 0);
|
||||
|
||||
AddInput(kPreserveLuminanceInput, NodeValue::kBoolean, false);
|
||||
AddInput(kPreserveLuminanceInput, NodeValue::kBoolean, false);
|
||||
|
||||
SetFlag(kVideoEffect);
|
||||
SetEffectInput(kTextureInput);
|
||||
SetFlag(kVideoEffect);
|
||||
SetEffectInput(kTextureInput);
|
||||
}
|
||||
|
||||
QString DespillNode::Name() const
|
||||
{
|
||||
return tr("Despill");
|
||||
return tr("Despill");
|
||||
}
|
||||
|
||||
QString DespillNode::id() const
|
||||
{
|
||||
return QStringLiteral("org.olivevideoeditor.Olive.despill");
|
||||
return QStringLiteral("org.olivevideoeditor.Olive.despill");
|
||||
}
|
||||
|
||||
QVector<Node::CategoryID> DespillNode::Category() const
|
||||
{
|
||||
return {kCategoryKeying};
|
||||
return { kCategoryKeying };
|
||||
}
|
||||
|
||||
QString DespillNode::Description() const
|
||||
{
|
||||
return tr("Selection of simple depsill operations");
|
||||
return tr("Selection of simple depsill operations");
|
||||
}
|
||||
|
||||
void DespillNode::Retranslate()
|
||||
{
|
||||
super::Retranslate();
|
||||
super::Retranslate();
|
||||
|
||||
SetInputName(kTextureInput, tr("Input"));
|
||||
SetInputName(kTextureInput, tr("Input"));
|
||||
|
||||
SetInputName(kColorInput, tr("Key Color"));
|
||||
SetComboBoxStrings(kColorInput, {tr("Green"), tr("Blue")});
|
||||
SetInputName(kColorInput, tr("Key Color"));
|
||||
SetComboBoxStrings(kColorInput, { tr("Green"), tr("Blue") });
|
||||
|
||||
SetInputName(kMethodInput, tr("Method"));
|
||||
SetComboBoxStrings(kMethodInput, {tr("Average"), tr("Double Red Average"), tr("Double Average"), tr("Limit")});
|
||||
SetInputName(kMethodInput, tr("Method"));
|
||||
SetComboBoxStrings(kMethodInput, { tr("Average"), tr("Double Red Average"),
|
||||
tr("Double Average"), tr("Limit") });
|
||||
|
||||
SetInputName(kPreserveLuminanceInput, tr("Preserve Luminance"));
|
||||
SetInputName(kPreserveLuminanceInput, tr("Preserve Luminance"));
|
||||
}
|
||||
|
||||
ShaderCode DespillNode::GetShaderCode(const ShaderRequest &request) const {
|
||||
Q_UNUSED(request)
|
||||
return ShaderCode(FileFunctions::ReadFileAsString(":/shaders/despill.frag"));
|
||||
ShaderCode DespillNode::GetShaderCode(const ShaderRequest &request) const
|
||||
{
|
||||
Q_UNUSED(request)
|
||||
return ShaderCode(
|
||||
FileFunctions::ReadFileAsString(":/shaders/despill.frag"));
|
||||
}
|
||||
|
||||
void DespillNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const {
|
||||
ShaderJob job;
|
||||
job.Insert(value);
|
||||
void DespillNode::Value(const NodeValueRow &value, const NodeGlobals &globals,
|
||||
NodeValueTable *table) const
|
||||
{
|
||||
ShaderJob job;
|
||||
job.Insert(value);
|
||||
|
||||
// Set luma coefficients
|
||||
double luma_coeffs[3] = {0.0f, 0.0f, 0.0f};
|
||||
project()->color_manager()->GetDefaultLumaCoefs(luma_coeffs);
|
||||
job.Insert(QStringLiteral("luma_coeffs"),
|
||||
NodeValue(NodeValue::kVec3, QVector3D(luma_coeffs[0], luma_coeffs[1], luma_coeffs[2])));
|
||||
// Set luma coefficients
|
||||
double luma_coeffs[3] = { 0.0f, 0.0f, 0.0f };
|
||||
project()->color_manager()->GetDefaultLumaCoefs(luma_coeffs);
|
||||
job.Insert(
|
||||
QStringLiteral("luma_coeffs"),
|
||||
NodeValue(NodeValue::kVec3,
|
||||
QVector3D(luma_coeffs[0], luma_coeffs[1], luma_coeffs[2])));
|
||||
|
||||
// If there's no texture, no need to run an operation
|
||||
if (TexturePtr tex = job.Get(kTextureInput).toTexture()) {
|
||||
table->Push(NodeValue::kTexture, tex->toJob(job), this);
|
||||
}
|
||||
// If there's no texture, no need to run an operation
|
||||
if (TexturePtr tex = job.Get(kTextureInput).toTexture()) {
|
||||
table->Push(NodeValue::kTexture, tex->toJob(job), this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace olive
|
||||
|
||||
@@ -19,32 +19,33 @@
|
||||
#include "node/node.h"
|
||||
#include "node/color/colormanager/colormanager.h"
|
||||
|
||||
namespace olive {
|
||||
namespace olive
|
||||
{
|
||||
|
||||
class DespillNode : public Node {
|
||||
public:
|
||||
DespillNode();
|
||||
public:
|
||||
DespillNode();
|
||||
|
||||
NODE_DEFAULT_FUNCTIONS(DespillNode)
|
||||
NODE_DEFAULT_FUNCTIONS(DespillNode)
|
||||
|
||||
virtual QString Name() const override;
|
||||
virtual QString id() const override;
|
||||
virtual QVector<CategoryID> Category() const override;
|
||||
virtual QString Description() const override;
|
||||
virtual QString Name() const override;
|
||||
virtual QString id() const override;
|
||||
virtual QVector<CategoryID> Category() const override;
|
||||
virtual QString Description() const override;
|
||||
|
||||
virtual void Retranslate() override;
|
||||
|
||||
virtual ShaderCode GetShaderCode(const ShaderRequest &request) 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;
|
||||
virtual void Retranslate() override;
|
||||
|
||||
virtual ShaderCode
|
||||
GetShaderCode(const ShaderRequest &request) 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
|
||||
} // namespace olive
|
||||
|
||||
#endif // DESPILLNODE_H
|
||||
#endif // DESPILLNODE_H
|
||||
|
||||
Reference in New Issue
Block a user