Files
oak-editor/app/common/xmlutils.h
T
itsmattkc a855dea8de timeline/project: block serializations to and from xml now include links
Fixes issue where blocks would become unlinked after copy/paste or save/load.
2020-03-31 02:38:14 +11:00

52 lines
1.1 KiB
C++

#ifndef XMLREADLOOP_H
#define XMLREADLOOP_H
#include <QUndoCommand>
#include <QXmlStreamReader>
#include "project/item/footage/stream.h"
class Block;
class Node;
class NodeParam;
class NodeInput;
class NodeOutput;
#define XMLAttributeLoop(reader, item) \
QXmlStreamAttributes __attributes = reader->attributes(); \
foreach (const QXmlStreamAttribute& item, __attributes)
Node *XMLLoadNode(QXmlStreamReader* reader);
struct XMLNodeData {
struct SerializedConnection {
NodeInput* input;
quintptr output;
};
struct FootageConnection {
NodeInput* input;
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 XMLNodeData& xml_node_data, QUndoCommand* command = nullptr);
bool XMLReadNextStartElement(QXmlStreamReader* reader);
void XMLLinkBlocks(const XMLNodeData& xml_node_data);
#endif // XMLREADLOOP_H