timeline/project: block serializations to and from xml now include links

Fixes issue where blocks would become unlinked after copy/paste or save/load.
This commit is contained in:
itsmattkc
2020-03-31 02:38:14 +11:00
parent 53955e9632
commit a855dea8de
8 changed files with 73 additions and 9 deletions
+13 -3
View File
@@ -4,13 +4,14 @@
#include <QUndoCommand>
#include <QXmlStreamReader>
#include "project/item/footage/stream.h"
class Block;
class Node;
class NodeParam;
class NodeInput;
class NodeOutput;
#include "project/item/footage/stream.h"
#define XMLAttributeLoop(reader, item) \
QXmlStreamAttributes __attributes = reader->attributes(); \
foreach (const QXmlStreamAttribute& item, __attributes)
@@ -28,14 +29,23 @@ struct XMLNodeData {
quintptr footage;
};
struct BlockLink {
Block* block;
quintptr link;
};
QHash<quintptr, NodeOutput*> output_ptrs;
QList<SerializedConnection> desired_connections;
QHash<quintptr, StreamPtr> footage_ptrs;
QList<FootageConnection> footage_connections;
QList<BlockLink> block_links;
};
void XMLConnectNodes(const QHash<quintptr, NodeOutput *> &output_ptrs, const QList<XMLNodeData::SerializedConnection> &desired_connections, QUndoCommand* command = nullptr);
void XMLConnectNodes(const XMLNodeData& xml_node_data, QUndoCommand* command = nullptr);
bool XMLReadNextStartElement(QXmlStreamReader* reader);
void XMLLinkBlocks(const XMLNodeData& xml_node_data);
#endif // XMLREADLOOP_H