use strings to connect nodes

This makes the node system somewhat more high-level with the intent of making
working with them far more flexible and stable. By making the architecture more
abstracted, it becomes far less rigid which should allow us to do even more
with it and make it much less crash prone.
This commit is contained in:
itsmattkc
2021-02-09 15:48:37 +11:00
parent d1a3e22eaa
commit 81c1922911
138 changed files with 4487 additions and 3913 deletions
+2 -2
View File
@@ -118,7 +118,7 @@ void AddTool::MouseRelease(TimelineViewMouseEvent *event)
command->add_child(new NodeAddCommand(graph,
solid));
command->add_child(new NodeEdgeAddCommand(solid, clip->texture_input(), -1));
command->add_child(new NodeEdgeAddCommand(solid, NodeInput(clip, ClipBlock::kBufferIn)));
break;
}
case olive::Tool::kAddableTitle:
@@ -128,7 +128,7 @@ void AddTool::MouseRelease(TimelineViewMouseEvent *event)
command->add_child(new NodeAddCommand(graph,
text));
command->add_child(new NodeEdgeAddCommand(text, clip->texture_input(), -1));
command->add_child(new NodeEdgeAddCommand(text, NodeInput(clip, ClipBlock::kBufferIn)));
break;
}
case olive::Tool::kAddableBars:
+4 -4
View File
@@ -434,8 +434,8 @@ void ImportTool::DropGhosts(bool insert)
TransformDistortNode* transform = new TransformDistortNode();
command->add_child(new NodeAddCommand(dst_graph, transform));
command->add_child(new NodeEdgeAddCommand(video_input, transform->texture_input(), -1));
command->add_child(new NodeEdgeAddCommand(transform, clip->texture_input(), -1));
command->add_child(new NodeEdgeAddCommand(video_input, NodeInput(transform, TransformDistortNode::kTextureInput)));
command->add_child(new NodeEdgeAddCommand(transform, NodeInput(clip, ClipBlock::kBufferIn)));
break;
}
case Stream::kAudio:
@@ -447,8 +447,8 @@ void ImportTool::DropGhosts(bool insert)
VolumeNode* volume_node = new VolumeNode();
command->add_child(new NodeAddCommand(dst_graph, volume_node));
command->add_child(new NodeEdgeAddCommand(audio_input, volume_node->samples_input(), -1));
command->add_child(new NodeEdgeAddCommand(volume_node, clip->texture_input(), -1));
command->add_child(new NodeEdgeAddCommand(audio_input, NodeInput(volume_node, VolumeNode::kSamplesInput)));
command->add_child(new NodeEdgeAddCommand(volume_node, NodeInput(clip, ClipBlock::kBufferIn)));
break;
}
default:
+6
View File
@@ -37,6 +37,12 @@ public:
class DraggedFootage {
public:
DraggedFootage() :
footage_(nullptr),
streams_(0)
{
}
DraggedFootage(Footage* f, quint64 streams) :
footage_(f),
streams_(streams)
@@ -147,28 +147,25 @@ void TransitionTool::MouseRelease(TimelineViewMouseEvent *event)
// Connect block to transition
command->add_child(new NodeEdgeAddCommand(out_block,
transition->out_block_input(),
-1));
NodeInput(transition, TransitionBlock::kOutBlockInput)));
command->add_child(new NodeEdgeAddCommand(in_block,
transition->in_block_input(),
-1));
NodeInput(transition, TransitionBlock::kInBlockInput)));
} else {
Block* block_to_transition = Node::ValueToPtr<Block>(ghost_->GetData(TimelineViewGhostItem::kAttachedBlock));
NodeInput* transition_input_to_connect;
QString transition_input_to_connect;
if (ghost_->GetMode() == Timeline::kTrimIn) {
transition->set_length_and_media_out(ghost_->GetAdjustedLength());
transition_input_to_connect = transition->in_block_input();
transition_input_to_connect = TransitionBlock::kInBlockInput;
} else {
transition->set_length_and_media_out(ghost_->GetAdjustedLength());
transition_input_to_connect = transition->out_block_input();
transition_input_to_connect = TransitionBlock::kOutBlockInput;
}
// Connect block to transition
command->add_child(new NodeEdgeAddCommand(block_to_transition,
transition_input_to_connect,
-1));
NodeInput(transition, transition_input_to_connect)));
}
Core::instance()->undo_stack()->push(command);