Merge pull request #1562 from ThomasWilshaw/otio_merge_fixes
Fixes for OTIO merges
This commit is contained in:
@@ -133,6 +133,12 @@ void FootageRelinkDialog::BrowseForFootage()
|
||||
QString relative_to_original = original_dir.relativeFilePath(other_footage->filename());
|
||||
QString absolute_to_new = new_dir.filePath(relative_to_original);
|
||||
|
||||
// Second attempt. Try appending the filename to our new filepath
|
||||
if (!QFileInfo::exists(absolute_to_new)) {
|
||||
QFileInfo file_info(other_footage->filename());
|
||||
absolute_to_new = new_dir.filePath(file_info.fileName());
|
||||
}
|
||||
|
||||
// Check if file exists
|
||||
if (QFileInfo::exists(absolute_to_new)) {
|
||||
other_footage->set_filename(absolute_to_new);
|
||||
|
||||
@@ -31,12 +31,19 @@
|
||||
#include <QApplication>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include "core.h"
|
||||
#include "node/audio/volume/volume.h"
|
||||
#include "node/block/clip/clip.h"
|
||||
#include "node/block/gap/gap.h"
|
||||
#include "node/block/transition/crossdissolve/crossdissolvetransition.h"
|
||||
#include "node/distort/transform/transformdistortnode.h"
|
||||
#include "node/generator/matrix/matrix.h"
|
||||
#include "node/math/math/math.h"
|
||||
#include "node/project/folder/folder.h"
|
||||
#include "node/project/footage/footage.h"
|
||||
#include "node/project/sequence/sequence.h"
|
||||
#include "window/mainwindow/mainwindowundo.h"
|
||||
#include "widget/nodeview/nodeviewundo.h"
|
||||
#include "widget/timelinewidget/undo/timelineundogeneral.h"
|
||||
|
||||
namespace olive {
|
||||
@@ -58,7 +65,7 @@ bool LoadOTIOTask::Run()
|
||||
}
|
||||
|
||||
project_ = new Project();
|
||||
project_->set_filename(GetFilename());
|
||||
project_->set_modified(true);
|
||||
|
||||
std::vector<OTIO::Timeline*> timelines;
|
||||
|
||||
@@ -89,6 +96,12 @@ bool LoadOTIOTask::Run()
|
||||
sequence->setParent(project_);
|
||||
FolderAddChild(project_->root(), sequence).redo_now();
|
||||
|
||||
// Create a folder for this sequence's footage
|
||||
Folder* sequence_footage = new Folder();
|
||||
sequence_footage->SetLabel(QString::fromStdString(timeline->name()));
|
||||
sequence_footage->setParent(project_);
|
||||
FolderAddChild(project_->root(), sequence_footage).redo_now();
|
||||
|
||||
// FIXME: As far as I know, OTIO doesn't store video/audio parameters?
|
||||
sequence->set_default_parameters();
|
||||
|
||||
@@ -192,6 +205,20 @@ bool LoadOTIOTask::Run()
|
||||
Node::ConnectEdge(previous_block, NodeInput(transition_block, TransitionBlock::kOutBlockInput));
|
||||
}
|
||||
prev_block_transition = true;
|
||||
|
||||
// Add nodes to the graph and set up contexts
|
||||
block->setParent(sequence->parent());
|
||||
|
||||
// Position transition in its own context
|
||||
sequence->parent()->SetNodePosition(block, block, QPointF(0, 0));
|
||||
}
|
||||
|
||||
if (otio_block->schema_name() == "Gap") {
|
||||
// Add nodes to the graph and set up contexts
|
||||
block->setParent(sequence->parent());
|
||||
|
||||
// Position transition in its own context
|
||||
sequence->parent()->SetNodePosition(block, block, QPointF(0, 0));
|
||||
}
|
||||
|
||||
// Update this after it's used but before any continue statements
|
||||
@@ -214,22 +241,50 @@ bool LoadOTIOTask::Run()
|
||||
probed_item = new Footage(footage_url);
|
||||
imported_footage.insert(footage_url, probed_item);
|
||||
probed_item->setParent(project_);
|
||||
|
||||
|
||||
QFileInfo info(probed_item->filename());
|
||||
probed_item->SetLabel(info.fileName());
|
||||
|
||||
FolderAddChild add(sequence_footage, probed_item, true);
|
||||
add.redo_now();
|
||||
}
|
||||
|
||||
// Add nodes to the graph and set up contexts
|
||||
block->setParent(sequence->parent());
|
||||
|
||||
// Position clip in its own context
|
||||
sequence->parent()->SetNodePosition(block, block, QPointF(0, 0));
|
||||
|
||||
// Position footage in its context
|
||||
sequence->parent()->SetNodePosition(probed_item, block, QPointF(-2, 0));
|
||||
|
||||
|
||||
Track::Reference reference;
|
||||
|
||||
if (track->type() == Track::kVideo) {
|
||||
reference = Track::Reference(Track::kVideo, 0);
|
||||
QString output_id = reference.ToString();
|
||||
|
||||
TransformDistortNode* transform = new TransformDistortNode();
|
||||
transform->setParent(sequence->parent());
|
||||
|
||||
Node::ConnectEdge(NodeOutput(probed_item, output_id),
|
||||
NodeInput(transform, TransformDistortNode::kTextureInput));
|
||||
Node::ConnectEdge(transform, NodeInput(block, ClipBlock::kBufferIn));
|
||||
sequence->parent()->SetNodePosition(transform, block, QPointF(-1, 0));
|
||||
} else {
|
||||
reference = Track::Reference(Track::kAudio, 0);
|
||||
QString output_id = reference.ToString();
|
||||
|
||||
VolumeNode* volume_node = new VolumeNode();
|
||||
volume_node->setParent(sequence->parent());
|
||||
|
||||
Node::ConnectEdge(NodeOutput(probed_item, output_id), NodeInput(volume_node, VolumeNode::kSamplesInput));
|
||||
Node::ConnectEdge(volume_node, NodeInput(block, ClipBlock::kBufferIn));
|
||||
sequence->parent()->SetNodePosition(volume_node, block, QPointF(-1, 0));
|
||||
}
|
||||
|
||||
QString output_id = reference.ToString();
|
||||
|
||||
Node::ConnectEdge(NodeOutput(probed_item, output_id), NodeInput(block, ClipBlock::kBufferIn));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user