implement group-based opacity node

This commit is contained in:
itsmattkc
2022-01-21 10:08:48 -08:00
parent 8ab3331586
commit 3cf90116e2
9 changed files with 140 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
#include "opacityeffect.h"
#include "node/math/math/math.h"
#include "widget/slider/floatslider.h"
namespace olive {
#define super NodeGroup
OpacityEffect::OpacityEffect()
{
MathNode *math = new MathNode();
math->SetOperation(MathNode::kOpMultiply);
SetNodePositionInContext(math, QPointF(0, 0));
tex_in_pass_ = AddInputPassthrough(NodeInput(math, MathNode::kParamAIn));
SetInputDataType(tex_in_pass_, NodeValue::kTexture);
value_in_pass_ = AddInputPassthrough(NodeInput(math, MathNode::kParamBIn));
SetInputProperty(value_in_pass_, QStringLiteral("view"), FloatSlider::kPercentage);
SetInputProperty(value_in_pass_, QStringLiteral("min"), 0.0);
SetInputProperty(value_in_pass_, QStringLiteral("max"), 1.0);
math->SetStandardValue(MathNode::kParamBIn, 1.0);
SetOutputPassthrough(math);
}
void OpacityEffect::Retranslate()
{
super::Retranslate();
SetInputName(tex_in_pass_, tr("Texture"));
SetInputName(value_in_pass_, tr("Opacity"));
}
}