reduced the output of some nodes

Some nodes don't need to provide all their inputs merged as outputs.
This commit is contained in:
itsmattkc
2019-12-10 00:37:06 +11:00
parent 2fb4047e6f
commit f46b1245c4
7 changed files with 29 additions and 5 deletions
+13
View File
@@ -87,3 +87,16 @@ TimeRange ClipBlock::InputTimeAdjustment(NodeInput *input, const TimeRange &inpu
return Block::InputTimeAdjustment(input, input_time);
}
NodeValueTable ClipBlock::Value(const NodeValueDatabase &value) const
{
// We discard most values here except for the buffer we received
NodeValueTable table;
NodeValue data = value[texture_input()].GetWithMeta(NodeParam::kBuffer);
if (data.type() != NodeParam::kNone) {
table.Push(data);
}
return table;
}
+2
View File
@@ -46,6 +46,8 @@ public:
virtual TimeRange InputTimeAdjustment(NodeInput* input, const TimeRange& input_time) const override;
virtual NodeValueTable Value(const NodeValueDatabase& value) const override;
private:
NodeInput* texture_input_;
+1 -1
View File
@@ -94,7 +94,7 @@ NodeValueTable TransformDistort::Value(const NodeValueDatabase &value) const
mat.translate(-value[anchor_input_].Get(NodeParam::kVec2).value<QVector2D>());
// Push matrix output
NodeValueTable output = value.Merge();
NodeValueTable output;
output.Push(NodeParam::kMatrix, mat);
return output;
}
+1 -3
View File
@@ -103,10 +103,8 @@ void Node::InvalidateCache(const rational &start_range, const rational &end_rang
TimeRange Node::InputTimeAdjustment(NodeInput *input, const TimeRange &input_time) const
{
Q_UNUSED(input)
// Default behavior is no time adjustment at all
Q_UNUSED(input)
return input_time;
}
+11
View File
@@ -67,6 +67,17 @@ QVariant NodeValueTable::Get(const NodeParam::DataType &type, const QString &tag
return QVariant();
}
NodeValue NodeValueTable::GetWithMeta(const NodeParam::DataType &type, const QString &tag) const
{
int value_index = GetInternal(type, tag);
if (value_index >= 0) {
return values_.at(value_index);
}
return NodeValue(NodeParam::kNone, 0);
}
QVariant NodeValueTable::Take(const NodeParam::DataType &type, const QString &tag)
{
int value_index = GetInternal(type, tag);
+1
View File
@@ -27,6 +27,7 @@ public:
NodeValueTable();
QVariant Get(const NodeParam::DataType& type, const QString& tag = QString()) const;
NodeValue GetWithMeta(const NodeParam::DataType& type, const QString& tag = QString()) const;
QVariant Take(const NodeParam::DataType& type, const QString& tag = QString());
void Push(const NodeValue& value);
void Push(const NodeParam::DataType& type, const QVariant& data, const QString& tag = QString());
-1
View File
@@ -33,7 +33,6 @@ public:
static QString CodeAlphaAssociate(const QString& function_name);
private:
};
#endif // OPENGLSHADER_H