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
+16
View File
@@ -198,6 +198,22 @@ rational Block::MediaToSequenceTime(const rational &media_time) const
return (media_time - media_in()) / speed() + in();
}
void Block::LoadInternal(QXmlStreamReader *reader, XMLNodeData &xml_node_data)
{
if (reader->name() == QStringLiteral("link")) {
xml_node_data.block_links.append({this, reader->readElementText().toULongLong()});
} else {
Node::LoadInternal(reader, xml_node_data);
}
}
void Block::SaveInternal(QXmlStreamWriter *writer) const
{
foreach (Block* link, linked_clips_) {
writer->writeTextElement(QStringLiteral("link"), QString::number(reinterpret_cast<quintptr>(link)));
}
}
void Block::LengthInputChanged()
{
emit LengthChanged(length());