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
|
||||
|
||||
Reference in New Issue
Block a user