nodetraverser: always push primary input last if applicable

This commit is contained in:
itsmattkc
2022-05-07 09:39:08 -07:00
parent dabd6d5d3d
commit 21000c3aa7
5 changed files with 27 additions and 7 deletions
+1 -2
View File
@@ -50,8 +50,7 @@ Node::Node() :
folder_(nullptr),
operation_stack_(0),
cache_result_(false),
flags_(kNone),
effect_element_(-1)
flags_(kNone)
{
AddInput(kEnabledInput, NodeValue::kBoolean, true);
}
+7 -4
View File
@@ -552,7 +552,12 @@ public:
NodeInput GetEffectInput()
{
return effect_input_.isEmpty() ? NodeInput() : NodeInput(this, effect_input_, effect_element_);
return effect_input_.isEmpty() ? NodeInput() : NodeInput(this, effect_input_);
}
const QString &GetEffectInputID() const
{
return effect_input_;
}
class ValueHint {
@@ -1047,10 +1052,9 @@ protected:
virtual void childEvent(QChildEvent *event) override;
void SetEffectInput(const QString &input, int element = -1)
void SetEffectInput(const QString &input)
{
effect_input_ = input;
effect_element_ = element;
}
void SetToolTip(const QString& s)
@@ -1369,7 +1373,6 @@ private:
QVector<NodeGizmo*> gizmos_;
QString effect_input_;
int effect_element_;
private slots:
/**
+9 -1
View File
@@ -269,7 +269,15 @@ NodeValueTable NodeTraverser::GenerateTable(const Node *n, const Node::ValueHint
return table;
} else {
return database.Merge();
// If this node has an effect input, ensure that is pushed last
NodeValueTable primary;
if (!n->GetEffectInputID().isEmpty()) {
primary = database.Take(n->GetEffectInputID());
}
NodeValueTable m = database.Merge();
m.Push(primary);
return m;
}
}
+5
View File
@@ -340,6 +340,11 @@ public:
values_.append(value);
}
void Push(const NodeValueTable& value)
{
values_.append(value.values_);
}
void Push(NodeValue::Type type, const QVariant& data, const Node *from, bool array = false, const QString& tag = QString())
{
Push(NodeValue(type, data, from, array, tag));
+5
View File
@@ -41,6 +41,11 @@ public:
tables_.insert(key, value);
}
NodeValueTable Take(const QString &key)
{
return tables_.take(key);
}
NodeValueTable Merge() const;
using Tables = QHash<QString, NodeValueTable>;