various: use simpler/smarter XML reading functions

Should address any XML parsing issues and allows for simpler, more maintainable
code. Should also address a crash that could occur when pasting nodes that had
inputs that weren't copied.
This commit is contained in:
itsmattkc
2020-03-17 02:38:17 +11:00
parent 72eb3a5d82
commit a1f5c85f49
16 changed files with 326 additions and 285 deletions
+15 -7
View File
@@ -186,17 +186,25 @@ void NodeView::Paste()
QList<NodeParam::SerializedConnection> desired_connections;
QList<NodeInput::FootageConnection> footage_connections;
XMLReadLoop((&reader), QStringLiteral("olive")) {
if (reader.name() == QStringLiteral("node")) {
Node* node = XMLLoadNode(&reader);
while (XMLReadNextStartElement(&reader)) {
if (reader.name() == QStringLiteral("olive")) {
while (XMLReadNextStartElement(&reader)) {
if (reader.name() == QStringLiteral("node")) {
Node* node = XMLLoadNode(&reader);
if (node) {
node->Load(&reader, output_ptrs, desired_connections, footage_connections, nullptr, reader.name().toString());
if (node) {
node->Load(&reader, output_ptrs, desired_connections, footage_connections, nullptr);
graph_->AddNode(node);
graph_->AddNode(node);
pasted_nodes.append(node);
pasted_nodes.append(node);
}
} else {
reader.skipCurrentElement();
}
}
} else {
reader.skipCurrentElement();
}
}