diff --git a/app/node/node.cpp b/app/node/node.cpp index c0678db5a..d52d8893e 100644 --- a/app/node/node.cpp +++ b/app/node/node.cpp @@ -1245,7 +1245,7 @@ bool Node::AreLinked(Node *a, Node *b) return a->links_.contains(b); } -void Node::AddInput(const QString &id, NodeValue::Type type, const QVariant &default_value, Node::InputFlags flags) +void Node::InsertInput(const QString &id, NodeValue::Type type, const QVariant &default_value, Node::InputFlags flags, int index) { if (id.isEmpty()) { qWarning() << "Rejected adding input with an empty ID on node" << this->id(); @@ -1264,8 +1264,8 @@ void Node::AddInput(const QString &id, NodeValue::Type type, const QVariant &def i.flags = flags; i.array_size = 0; - input_ids_.append(id); - input_data_.append(i); + input_ids_.insert(index, id); + input_data_.insert(index, i); if (!standard_immediates_.value(id, nullptr)) { standard_immediates_.insert(id, CreateImmediate(id)); diff --git a/app/node/node.h b/app/node/node.h index 74d1b1fd8..fb9ecf7cf 100644 --- a/app/node/node.h +++ b/app/node/node.h @@ -799,7 +799,23 @@ protected: }; - void AddInput(const QString& id, NodeValue::Type type, const QVariant& default_value, InputFlags flags = InputFlags(kInputFlagNormal)); + void InsertInput(const QString& id, NodeValue::Type type, const QVariant& default_value, InputFlags flags, int index); + + void PrependInput(const QString& id, NodeValue::Type type, const QVariant& default_value, InputFlags flags = InputFlags(kInputFlagNormal)) + { + InsertInput(id, type, default_value, flags, 0); + } + + void PrependInput(const QString& id, NodeValue::Type type, InputFlags flags = InputFlags(kInputFlagNormal)) + { + PrependInput(id, type, QVariant(), flags); + } + + void AddInput(const QString& id, NodeValue::Type type, const QVariant& default_value, InputFlags flags = InputFlags(kInputFlagNormal)) + { + InsertInput(id, type, default_value, flags, input_ids_.size()); + } + void AddInput(const QString& id, NodeValue::Type type, InputFlags flags = InputFlags(kInputFlagNormal)) { AddInput(id, type, QVariant(), flags); diff --git a/app/node/project/footage/footage.cpp b/app/node/project/footage/footage.cpp index bb810e73a..592d288ed 100644 --- a/app/node/project/footage/footage.cpp +++ b/app/node/project/footage/footage.cpp @@ -43,7 +43,7 @@ Footage::Footage(const QString &filename) : ViewerOutput(false), cancelled_(nullptr) { - AddInput(kFilenameInput, NodeValue::kFile, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable)); + PrependInput(kFilenameInput, NodeValue::kFile, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable)); Clear();