nodes: allow inserting inputs at arbitrary indexes
This commit is contained in:
+3
-3
@@ -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));
|
||||
|
||||
+17
-1
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user