math: use operation by default for name
This commit is contained in:
@@ -44,6 +44,14 @@ MathNode::MathNode()
|
||||
|
||||
QString MathNode::Name() const
|
||||
{
|
||||
// Default to naming after the operation
|
||||
if (parent()) {
|
||||
QString op_name = GetOperationName(GetOperation());
|
||||
if (!op_name.isEmpty()) {
|
||||
return op_name;
|
||||
}
|
||||
}
|
||||
|
||||
return tr("Math");
|
||||
}
|
||||
|
||||
@@ -70,12 +78,12 @@ void MathNode::Retranslate()
|
||||
SetInputName(kParamAIn, tr("Value"));
|
||||
SetInputName(kParamBIn, tr("Value"));
|
||||
|
||||
QStringList operations = {tr("Add"),
|
||||
tr("Subtract"),
|
||||
tr("Multiply"),
|
||||
tr("Divide"),
|
||||
QStringList operations = {GetOperationName(kOpAdd),
|
||||
GetOperationName(kOpSubtract),
|
||||
GetOperationName(kOpMultiply),
|
||||
GetOperationName(kOpDivide),
|
||||
QString(),
|
||||
tr("Power")};
|
||||
GetOperationName(kOpPower)};
|
||||
|
||||
SetComboBoxStrings(kMethodIn, operations);
|
||||
}
|
||||
|
||||
@@ -167,6 +167,19 @@ void MathNodeBase::PushVector(NodeValueTable *output, olive::NodeValue::Type typ
|
||||
}
|
||||
}
|
||||
|
||||
QString MathNodeBase::GetOperationName(Operation o)
|
||||
{
|
||||
switch (o) {
|
||||
case kOpAdd: return tr("Add");
|
||||
case kOpSubtract: return tr("Subtract");
|
||||
case kOpMultiply: return tr("Multiply");
|
||||
case kOpDivide: return tr("Divide");
|
||||
case kOpPower: return tr("Power");
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
void MathNodeBase::PerformAllOnFloatBuffer(Operation operation, float *a, float b, int start, int end)
|
||||
{
|
||||
for (int j=start;j<end;j++) {
|
||||
|
||||
@@ -38,6 +38,8 @@ public:
|
||||
kOpPower
|
||||
};
|
||||
|
||||
static QString GetOperationName(Operation o);
|
||||
|
||||
protected:
|
||||
enum Pairing {
|
||||
kPairNone = -1,
|
||||
|
||||
Reference in New Issue
Block a user