use strings to connect nodes
This makes the node system somewhat more high-level with the intent of making working with them far more flexible and stable. By making the architecture more abstracted, it becomes far less rigid which should allow us to do even more with it and make it much less crash prone.
This commit is contained in:
@@ -22,13 +22,14 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
const QString TrigonometryNode::kMethodIn = QStringLiteral("method_in");
|
||||
const QString TrigonometryNode::kXIn = QStringLiteral("x_in");
|
||||
|
||||
TrigonometryNode::TrigonometryNode()
|
||||
{
|
||||
method_in_ = new NodeInput(this, QStringLiteral("method_in"), NodeValue::kCombo);
|
||||
method_in_->SetConnectable(false);
|
||||
method_in_->SetKeyframable(false);
|
||||
AddInput(kMethodIn, NodeValue::kCombo, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
||||
|
||||
x_in_ = new NodeInput(this, QStringLiteral("x_in"), NodeValue::kFloat, 0.0);
|
||||
AddInput(kXIn, NodeValue::kFloat, 0.0);
|
||||
}
|
||||
|
||||
olive::Node *olive::TrigonometryNode::copy() const
|
||||
@@ -70,18 +71,20 @@ void TrigonometryNode::Retranslate()
|
||||
tr("Hyperbolic Cosine"),
|
||||
tr("Hyperbolic Tangent")};
|
||||
|
||||
method_in_->set_combobox_strings(strings);
|
||||
SetComboBoxStrings(kMethodIn, strings);
|
||||
|
||||
method_in_->set_name(tr("Method"));
|
||||
SetInputName(kMethodIn, tr("Method"));
|
||||
}
|
||||
|
||||
NodeValueTable TrigonometryNode::Value(NodeValueDatabase &value) const
|
||||
NodeValueTable TrigonometryNode::Value(const QString &output, NodeValueDatabase &value) const
|
||||
{
|
||||
float x = value[x_in_].Take(NodeValue::kFloat).toFloat();
|
||||
Q_UNUSED(output)
|
||||
|
||||
float x = value[kXIn].Take(NodeValue::kFloat).toFloat();
|
||||
|
||||
NodeValueTable table = value.Merge();
|
||||
|
||||
switch (static_cast<Operation>(method_in_->GetStandardValue().toInt())) {
|
||||
switch (static_cast<Operation>(GetStandardValue(kMethodIn).toInt())) {
|
||||
case kOpSine:
|
||||
x = qSin(x);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user