timeline/various: implemented block copy/paste
Implemented the ability to copy/paste blocks/clips in the timeline. This did require some large scale changes and reworking of the copy/paste system introduced a few commits ago, but should be largely functional now.
This commit is contained in:
@@ -44,7 +44,7 @@ QIcon Folder::icon()
|
||||
return icon::Folder;
|
||||
}
|
||||
|
||||
void Folder::Load(QXmlStreamReader *reader, QHash<quintptr, StreamPtr> &footage_ptrs, QList<NodeParam::FootageConnection>& footage_connections, const QAtomicInt *cancelled)
|
||||
void Folder::Load(QXmlStreamReader *reader, XMLNodeData& xml_node_data, const QAtomicInt *cancelled)
|
||||
{
|
||||
XMLAttributeLoop(reader, attr) {
|
||||
if (cancelled && *cancelled) {
|
||||
@@ -75,7 +75,7 @@ void Folder::Load(QXmlStreamReader *reader, QHash<quintptr, StreamPtr> &footage_
|
||||
}
|
||||
|
||||
add_child(child);
|
||||
child->Load(reader, footage_ptrs, footage_connections, cancelled);
|
||||
child->Load(reader, xml_node_data, cancelled);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
|
||||
virtual QIcon icon() override;
|
||||
|
||||
virtual void Load(QXmlStreamReader* reader, QHash<quintptr, StreamPtr> &footage_ptrs, QList<NodeParam::FootageConnection> &footage_connections, const QAtomicInt *cancelled) override;
|
||||
virtual void Load(QXmlStreamReader* reader, XMLNodeData &xml_node_data, const QAtomicInt *cancelled) override;
|
||||
|
||||
virtual void Save(QXmlStreamWriter* writer) const override;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ Footage::~Footage()
|
||||
ClearStreams();
|
||||
}
|
||||
|
||||
void Footage::Load(QXmlStreamReader *reader, QHash<quintptr, StreamPtr>& footage_ptrs, QList<NodeParam::FootageConnection>&, const QAtomicInt* cancelled)
|
||||
void Footage::Load(QXmlStreamReader *reader, XMLNodeData &xml_node_data, const QAtomicInt* cancelled)
|
||||
{
|
||||
QXmlStreamAttributes attributes = reader->attributes();
|
||||
|
||||
@@ -74,7 +74,7 @@ void Footage::Load(QXmlStreamReader *reader, QHash<quintptr, StreamPtr>& footage
|
||||
}
|
||||
|
||||
if (stream_index > -1 && stream_ptr > 0) {
|
||||
footage_ptrs.insert(stream_ptr, stream(stream_index));
|
||||
xml_node_data.footage_ptrs.insert(stream_ptr, stream(stream_index));
|
||||
|
||||
stream(stream_index)->Load(reader);
|
||||
} else {
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
/**
|
||||
* @brief Load function
|
||||
*/
|
||||
virtual void Load(QXmlStreamReader* reader, QHash<quintptr, StreamPtr> &footage_ptrs, QList<NodeParam::FootageConnection> &footage_connections, const QAtomicInt *cancelled) override;
|
||||
virtual void Load(QXmlStreamReader* reader, XMLNodeData &xml_node_data, const QAtomicInt *cancelled) override;
|
||||
|
||||
/**
|
||||
* @brief Save function
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
#include "common/constructors.h"
|
||||
#include "common/threadedobject.h"
|
||||
#include "common/xmlutils.h"
|
||||
#include "node/param.h"
|
||||
#include "project/item/footage/stream.h"
|
||||
|
||||
@@ -65,7 +66,7 @@ public:
|
||||
|
||||
DISABLE_COPY_MOVE(Item)
|
||||
|
||||
virtual void Load(QXmlStreamReader* reader, QHash<quintptr, StreamPtr> &footage_ptrs, QList<NodeParam::FootageConnection> &footage_connections, const QAtomicInt *cancelled) = 0;
|
||||
virtual void Load(QXmlStreamReader* reader, XMLNodeData &xml_node_data, const QAtomicInt *cancelled) = 0;
|
||||
|
||||
virtual void Save(QXmlStreamWriter* writer) const = 0;
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ Sequence::Sequence()
|
||||
AddNode(viewer_output_);
|
||||
}
|
||||
|
||||
void Sequence::Load(QXmlStreamReader *reader, QHash<quintptr, StreamPtr> &, QList<NodeInput::FootageConnection>& footage_connections, const QAtomicInt *cancelled)
|
||||
void Sequence::Load(QXmlStreamReader *reader, XMLNodeData& xml_node_data, const QAtomicInt *cancelled)
|
||||
{
|
||||
XMLAttributeLoop(reader, attr) {
|
||||
if (cancelled && *cancelled) {
|
||||
@@ -56,9 +56,6 @@ void Sequence::Load(QXmlStreamReader *reader, QHash<quintptr, StreamPtr> &, QLis
|
||||
}
|
||||
}
|
||||
|
||||
QHash<quintptr, NodeOutput*> output_ptrs;
|
||||
QList<NodeParam::SerializedConnection> desired_connections;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (cancelled && *cancelled) {
|
||||
return;
|
||||
@@ -110,7 +107,7 @@ void Sequence::Load(QXmlStreamReader *reader, QHash<quintptr, StreamPtr> &, QLis
|
||||
}
|
||||
|
||||
if (node) {
|
||||
node->Load(reader, output_ptrs, desired_connections, footage_connections, cancelled);
|
||||
node->Load(reader, xml_node_data, cancelled);
|
||||
|
||||
AddNode(node);
|
||||
}
|
||||
@@ -120,7 +117,7 @@ void Sequence::Load(QXmlStreamReader *reader, QHash<quintptr, StreamPtr> &, QLis
|
||||
}
|
||||
|
||||
// Make connections
|
||||
XMLConnectNodes(output_ptrs, desired_connections);
|
||||
XMLConnectNodes(xml_node_data.output_ptrs, xml_node_data.desired_connections);
|
||||
|
||||
// Ensure this and all children are in the main thread
|
||||
// (FIXME: Weird place for this? This should probably be in ProjectLoadManager somehow)
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
/**
|
||||
* @brief Load function
|
||||
*/
|
||||
virtual void Load(QXmlStreamReader* reader, QHash<quintptr, StreamPtr> &footage_ptrs, QList<NodeParam::FootageConnection> &footage_connections, const QAtomicInt* cancelled) override;
|
||||
virtual void Load(QXmlStreamReader* reader, XMLNodeData &xml_node_data, const QAtomicInt* cancelled) override;
|
||||
|
||||
/**
|
||||
* @brief Save function
|
||||
|
||||
@@ -35,14 +35,13 @@ Project::Project()
|
||||
|
||||
void Project::Load(QXmlStreamReader *reader, const QAtomicInt* cancelled)
|
||||
{
|
||||
QHash<quintptr, StreamPtr> footage_ptrs;
|
||||
QList<NodeInput::FootageConnection> footage_connections;
|
||||
XMLNodeData xml_node_data;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (reader->name() == QStringLiteral("folder")) {
|
||||
|
||||
// Assume this folder is our root
|
||||
root_.Load(reader, footage_ptrs, footage_connections, cancelled);
|
||||
root_.Load(reader, xml_node_data, cancelled);
|
||||
|
||||
} else if (reader->name() == QStringLiteral("colormanagement")) {
|
||||
|
||||
@@ -62,9 +61,9 @@ void Project::Load(QXmlStreamReader *reader, const QAtomicInt* cancelled)
|
||||
}
|
||||
}
|
||||
|
||||
foreach (const NodeInput::FootageConnection& con, footage_connections) {
|
||||
foreach (const XMLNodeData::FootageConnection& con, xml_node_data.footage_connections) {
|
||||
if (con.footage) {
|
||||
con.input->set_standard_value(QVariant::fromValue(footage_ptrs.value(con.footage)));
|
||||
con.input->set_standard_value(QVariant::fromValue(xml_node_data.footage_ptrs.value(con.footage)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user