allowed parameters to have data without fields

This commit is contained in:
itsmattkc
2019-05-17 18:45:44 +10:00
parent 13a393486b
commit c616bc2b61
7 changed files with 25 additions and 3 deletions
+2
View File
@@ -225,6 +225,8 @@ set(OLIVE_SOURCES
nodes/nodes.h
nodes/oldeffectnode.h
nodes/oldeffectnode.cpp
nodes/nodes/nodeblock.h
nodes/nodes/nodeblock.cpp
nodes/nodes/nodeimageoutput.cpp
nodes/nodes/nodeimageoutput.h
nodes/nodes/nodemedia.cpp
+5
View File
@@ -12,6 +12,11 @@ QString Node::name()
return tr("Node");
}
QString Node::id()
{
return "node";
}
void Node::AddParameter(NodeIO *param)
{
param->setParent(this);
+1
View File
@@ -14,6 +14,7 @@ public:
Node(NodeGraph* parent);
virtual QString name();
virtual QString id();
void AddParameter(NodeIO* row);
int IndexOfParameter(NodeIO* row);
+2 -2
View File
@@ -30,7 +30,7 @@ QString olive::nodes::DataTypeToString(DataType type) {
return "TEXTURE";
case kMatrix:
return "MATRIX";
case kClip:
case kBlock:
return "CLIP";
default:
return QString();
@@ -68,7 +68,7 @@ olive::nodes::DataType olive::nodes::StringToDataType(const QString &s)
} else if (s == "MATRIX") {
return kMatrix;
} else if (s == "CLIP") {
return kClip;
return kBlock;
}
return kInvalid;
}
+1 -1
View File
@@ -61,7 +61,7 @@ enum DataType {
kMatrix,
/** Value is a Clip node */
kClip,
kBlock,
/** Total count of valid node data types. Never use this as an actual data type. */
kDataTypeCount
+9
View File
@@ -138,6 +138,10 @@ bool NodeIO::IsKeyframable()
QVariant NodeIO::GetValueAt(double timecode)
{
if (FieldCount() == 0) {
return data_;
}
Q_ASSERT(FieldCount() == 1);
return Field(0)->GetValueAt(timecode);
@@ -145,6 +149,11 @@ QVariant NodeIO::GetValueAt(double timecode)
void NodeIO::SetValueAt(double timecode, const QVariant &value)
{
if (FieldCount() == 0) {
data_ = value;
return;
}
Q_ASSERT(FieldCount() == 1);
Field(0)->SetValueAt(timecode, value);
+5
View File
@@ -461,6 +461,11 @@ private:
* @brief Internal array of node edges. Access with AddEdge() and RemoveEdge().
*/
QVector<NodeEdgePtr> node_edges_;
/**
* @brief Internal data object for rows without fields
*/
QVariant data_;
};
#endif // EFFECTROW_H