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:
+16
-3
@@ -1,5 +1,6 @@
|
||||
#include "xmlutils.h"
|
||||
|
||||
#include "node/block/block.h"
|
||||
#include "node/factory.h"
|
||||
#include "widget/nodeview/nodeviewundo.h"
|
||||
|
||||
@@ -31,10 +32,10 @@ Node* XMLLoadNode(QXmlStreamReader* reader) {
|
||||
return node;
|
||||
}
|
||||
|
||||
void XMLConnectNodes(const QHash<quintptr, NodeOutput*>& output_ptrs, const QList<XMLNodeData::SerializedConnection>& desired_connections, QUndoCommand *command)
|
||||
void XMLConnectNodes(const XMLNodeData &xml_node_data, QUndoCommand *command)
|
||||
{
|
||||
foreach (const XMLNodeData::SerializedConnection& con, desired_connections) {
|
||||
NodeOutput* out = output_ptrs.value(con.output);
|
||||
foreach (const XMLNodeData::SerializedConnection& con, xml_node_data.desired_connections) {
|
||||
NodeOutput* out = xml_node_data.output_ptrs.value(con.output);
|
||||
|
||||
if (out) {
|
||||
if (command) {
|
||||
@@ -61,3 +62,15 @@ bool XMLReadNextStartElement(QXmlStreamReader *reader)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void XMLLinkBlocks(const XMLNodeData &xml_node_data)
|
||||
{
|
||||
foreach (const XMLNodeData::BlockLink& l1, xml_node_data.block_links) {
|
||||
foreach (const XMLNodeData::BlockLink& l2, xml_node_data.block_links) {
|
||||
if (l1.link == l2.block->property("xml_ptr")) {
|
||||
Block::Link(l1.block, l2.block);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user