app: migrate all engine access to the C ABI facade (nm U _ZN5olive = 0)
Every app module now reaches liboakengine exclusively through oakengine_* C calls, EngineEventBridge subscriptions and app-side handle headers (cliphandle/keyframehandle/nodevaluehandle/oakvaluehelper). Direct C++ command construction, engine signal connect()s, and engine type usage in MOC-visible signatures are gone: 557 -> 0 undefined olive:: symbols in oak-editor.
This commit is contained in:
@@ -26,10 +26,14 @@
|
||||
#include "node/generator/shape/shapenode.h"
|
||||
#include "node/generator/solid/solid.h"
|
||||
#include "node/generator/text/textv3.h"
|
||||
#include "node/nodeundo.h"
|
||||
#include "oakengine/node.h"
|
||||
#include "oakengine/timeline.h"
|
||||
#include "oakengine/undo.h"
|
||||
#include "timeline/timelineundopointer.h"
|
||||
#include "widget/timelinewidget/cliphandle.h"
|
||||
#include "widget/timelinewidget/timelinewidget.h"
|
||||
|
||||
#include "widget/viewer/vieweroutpututils.h"
|
||||
namespace olive
|
||||
{
|
||||
|
||||
@@ -100,11 +104,11 @@ void AddTool::mouse_release(TimelineViewMouseEvent *event)
|
||||
{
|
||||
if (ghost_) {
|
||||
if (!ghost_->get_adjusted_length().isNull()) {
|
||||
MultiUndoCommand *command = new MultiUndoCommand();
|
||||
void *command = oakengine_undo_command_create_multi();
|
||||
|
||||
if (MultiUndoCommand *subtitle_section_command =
|
||||
if (void *subtitle_section_command =
|
||||
parent()->take_subtitle_section_command()) {
|
||||
command->add_child(subtitle_section_command);
|
||||
oakengine_undo_command_multi_add_child(command, subtitle_section_command);
|
||||
}
|
||||
|
||||
Sequence *s = parent()->sequence();
|
||||
@@ -112,7 +116,7 @@ void AddTool::mouse_release(TimelineViewMouseEvent *event)
|
||||
QRectF r;
|
||||
if (Core::instance()->get_selected_addable_object() ==
|
||||
Tool::k_addable_title) {
|
||||
VideoParams svp = s->get_video_params();
|
||||
VideoParams svp = viewer_output_video_params(s);
|
||||
r = QRectF(0, 0, svp.width(), svp.height());
|
||||
r.adjust(svp.width() / 10, svp.height() / 10, -svp.width() / 10,
|
||||
-svp.height() / 10);
|
||||
@@ -122,8 +126,8 @@ void AddTool::mouse_release(TimelineViewMouseEvent *event)
|
||||
ghost_->get_adjusted_in(),
|
||||
ghost_->get_adjusted_length(), r);
|
||||
|
||||
Core::instance()->undo_stack()->push(
|
||||
command, qApp->translate("AddTool", "Added Clip"));
|
||||
oakengine_undo_push(
|
||||
command, qApp->translate("AddTool", "Added Clip").toUtf8().constData());
|
||||
}
|
||||
|
||||
parent()->clear_ghosts();
|
||||
@@ -132,7 +136,7 @@ void AddTool::mouse_release(TimelineViewMouseEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
Node *AddTool::create_addable_clip(MultiUndoCommand *command, Sequence *sequence,
|
||||
Node *AddTool::create_addable_clip(void *command, Sequence *sequence,
|
||||
const Track::Reference &track,
|
||||
const Rational &in, const Rational &length,
|
||||
const QRectF &rect)
|
||||
@@ -140,20 +144,21 @@ Node *AddTool::create_addable_clip(MultiUndoCommand *command, Sequence *sequence
|
||||
ClipBlock *clip;
|
||||
if (Core::instance()->get_selected_addable_object() ==
|
||||
Tool::k_addable_subtitle) {
|
||||
clip = new SubtitleBlock();
|
||||
clip = reinterpret_cast<SubtitleBlock*>(oakengine_node_factory_create_from_id("org.olivevideoeditor.Olive.subtitle"));
|
||||
} else {
|
||||
clip = new ClipBlock();
|
||||
clip->set_label(olive::Tool::get_addable_object_name(
|
||||
Core::instance()->get_selected_addable_object()));
|
||||
clip = clip_create_empty(olive::Tool::get_addable_object_name(
|
||||
Core::instance()->get_selected_addable_object()).toUtf8().constData());
|
||||
}
|
||||
clip->set_length_and_media_out(length);
|
||||
|
||||
Project *graph = sequence->parent();
|
||||
|
||||
command->add_child(new NodeAddCommand(graph, clip));
|
||||
command->add_child(new NodeSetPositionCommand(clip, clip, QPointF(0, 0)));
|
||||
command->add_child(new TrackPlaceBlockCommand(
|
||||
sequence->track_list(track.type()), track.index(), clip, in));
|
||||
oakengine_undo_command_multi_add_child(command,
|
||||
oakengine_node_add_to_project_command(
|
||||
reinterpret_cast<OakEngineProject *>(graph),
|
||||
reinterpret_cast<OakEngineNode *>(clip)));
|
||||
oakengine_undo_command_multi_add_child(command, oakengine_node_set_position_command(reinterpret_cast<void *>(clip), reinterpret_cast<void *>(clip), 0, 0, 0));
|
||||
oakengine_undo_command_multi_add_child(command, oakengine_track_place_block_command(reinterpret_cast<void *>(sequence->track_list(track.type())), track.index(), reinterpret_cast<void *>(clip), core::Timecode::time_to_timestamp(in, sequence_timebase(sequence))));
|
||||
|
||||
Node *node_to_add = nullptr;
|
||||
|
||||
@@ -162,13 +167,13 @@ Node *AddTool::create_addable_clip(MultiUndoCommand *command, Sequence *sequence
|
||||
// Empty, nothing to be done
|
||||
break;
|
||||
case Tool::k_addable_solid:
|
||||
node_to_add = new SolidGenerator();
|
||||
node_to_add = reinterpret_cast<SolidGenerator*>(oakengine_node_factory_create_from_id("org.olivevideoeditor.Olive.solidgenerator"));
|
||||
break;
|
||||
case Tool::k_addable_shape:
|
||||
node_to_add = new ShapeNode();
|
||||
node_to_add = reinterpret_cast<ShapeNode*>(oakengine_node_factory_create_from_id("org.olivevideoeditor.Olive.shape"));
|
||||
break;
|
||||
case Tool::k_addable_title:
|
||||
node_to_add = new TextGeneratorV3();
|
||||
node_to_add = reinterpret_cast<TextGeneratorV3*>(oakengine_node_factory_create_from_id("org.olivevideoeditor.Olive.text3"));
|
||||
break;
|
||||
case Tool::k_addable_bars:
|
||||
case Tool::k_addable_tone:
|
||||
@@ -186,17 +191,34 @@ Node *AddTool::create_addable_clip(MultiUndoCommand *command, Sequence *sequence
|
||||
|
||||
if (node_to_add) {
|
||||
QPointF extra_node_offset(k_default_distance_from_output, 0);
|
||||
command->add_child(new NodeAddCommand(graph, node_to_add));
|
||||
command->add_child(new NodeEdgeAddCommand(
|
||||
node_to_add, NodeInput(clip, ClipBlock::k_buffer_in)));
|
||||
command->add_child(
|
||||
new NodeSetPositionCommand(node_to_add, clip, extra_node_offset));
|
||||
oakengine_undo_command_multi_add_child(command,
|
||||
oakengine_node_add_to_project_command(
|
||||
reinterpret_cast<OakEngineProject *>(graph),
|
||||
reinterpret_cast<OakEngineNode *>(node_to_add)));
|
||||
oakengine_undo_command_multi_add_child(
|
||||
command,
|
||||
oakengine_node_connect_command(
|
||||
reinterpret_cast<OakEngineNode *>(node_to_add),
|
||||
reinterpret_cast<OakEngineNode *>(clip),
|
||||
oakengine_clip_buffer_input_id(),
|
||||
-1));
|
||||
oakengine_undo_command_multi_add_child(command, oakengine_node_set_position_command(reinterpret_cast<void *>(node_to_add), reinterpret_cast<void *>(clip), extra_node_offset.x(), extra_node_offset.y(), 0));
|
||||
|
||||
if (!rect.isNull()) {
|
||||
if (ShapeNodeBase *shape =
|
||||
dynamic_cast<ShapeNodeBase *>(node_to_add)) {
|
||||
shape->set_rect(rect, sequence->get_video_params(), command);
|
||||
}
|
||||
const VideoParams vp = viewer_output_video_params(sequence);
|
||||
oak_video_params pod = {};
|
||||
pod.width = vp.width();
|
||||
pod.height = vp.height();
|
||||
pod.time_base_num = vp.time_base().numerator();
|
||||
pod.time_base_den = vp.time_base().denominator();
|
||||
pod.format = vp.format();
|
||||
pod.pixel_aspect_num = vp.pixel_aspect_ratio().numerator();
|
||||
pod.pixel_aspect_den = vp.pixel_aspect_ratio().denominator();
|
||||
pod.interlacing = vp.interlacing();
|
||||
pod.divider = vp.divider();
|
||||
oakengine_shape_set_rect_undoable(
|
||||
reinterpret_cast<OakEngineNode *>(node_to_add), rect.x(),
|
||||
rect.y(), rect.width(), rect.height(), &pod, command);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
virtual void mouse_move(TimelineViewMouseEvent *event) override;
|
||||
virtual void mouse_release(TimelineViewMouseEvent *event) override;
|
||||
|
||||
static Node *create_addable_clip(MultiUndoCommand *command,
|
||||
static Node *create_addable_clip(void *command,
|
||||
Sequence *sequence,
|
||||
const Track::Reference &track,
|
||||
const Rational &in, const Rational &length,
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <QMimeData>
|
||||
#include <QToolTip>
|
||||
|
||||
#include "config/config.h"
|
||||
#include "common/configwrapper.h"
|
||||
#include "common/qtutils.h"
|
||||
#include "core.h"
|
||||
#include "dialog/sequence/sequence.h"
|
||||
@@ -35,12 +35,18 @@
|
||||
#include "node/distort/transform/transformdistortnode.h"
|
||||
#include "node/generator/matrix/matrix.h"
|
||||
#include "node/math/math/math.h"
|
||||
#include "node/nodeundo.h"
|
||||
#include "node/project/sequence/sequence.h"
|
||||
#include "oakengine/node.h"
|
||||
#include "oakengine/timeline.h"
|
||||
#include "oakengine/undo.h"
|
||||
#include "oakengine/viewer.h"
|
||||
#include "oakengine/project.h"
|
||||
#include "timeline/timelineundopointer.h"
|
||||
#include "widget/timelinewidget/cliphandle.h"
|
||||
#include "window/mainwindow/mainwindow.h"
|
||||
#include "window/mainwindow/mainwindowundo.h"
|
||||
|
||||
#include "widget/viewer/vieweroutpututils.h"
|
||||
namespace olive
|
||||
{
|
||||
|
||||
@@ -57,10 +63,10 @@ void ImportTool::drag_enter(TimelineViewMouseEvent *event)
|
||||
QStringList mime_formats = event->get_mime_data()->formats();
|
||||
|
||||
// Listen for MIME data from a ProjectViewModel
|
||||
if (mime_formats.contains(Project::k_item_mime_type)) {
|
||||
if (mime_formats.contains(QString::fromUtf8(oakengine_project_item_mime_type()))) {
|
||||
// Data is drag/drop data from a ProjectViewModel
|
||||
QByteArray model_data =
|
||||
event->get_mime_data()->data(Project::k_item_mime_type);
|
||||
event->get_mime_data()->data(QString::fromUtf8(oakengine_project_item_mime_type()));
|
||||
|
||||
// Use QDataStream to deserialize the data
|
||||
QDataStream stream(&model_data, QIODevice::ReadOnly);
|
||||
@@ -189,11 +195,11 @@ void ImportTool::drag_leave(QDragLeaveEvent *event)
|
||||
void ImportTool::drag_drop(TimelineViewMouseEvent *event)
|
||||
{
|
||||
if (!dragged_footage_.isEmpty()) {
|
||||
auto command = new MultiUndoCommand();
|
||||
auto command = oakengine_undo_command_create_multi();
|
||||
drop_ghosts(event->get_modifiers() & Qt::ControlModifier, command);
|
||||
Core::instance()->undo_stack()->push(
|
||||
oakengine_undo_push(
|
||||
command,
|
||||
qApp->translate("ImportTool", "Dropped Footage Into Sequence"));
|
||||
qApp->translate("ImportTool", "Dropped Footage Into Sequence").toUtf8().constData());
|
||||
|
||||
event->accept();
|
||||
} else {
|
||||
@@ -203,7 +209,7 @@ void ImportTool::drag_drop(TimelineViewMouseEvent *event)
|
||||
|
||||
void ImportTool::place_at(const QVector<ViewerOutput *> &footage,
|
||||
const Rational &start, bool insert,
|
||||
MultiUndoCommand *command, int track_offset,
|
||||
void *command, int track_offset,
|
||||
bool jump_to_end)
|
||||
{
|
||||
DraggedFootageData refs;
|
||||
@@ -217,7 +223,7 @@ void ImportTool::place_at(const QVector<ViewerOutput *> &footage,
|
||||
|
||||
void ImportTool::place_at(const DraggedFootageData &footage,
|
||||
const Rational &start, bool insert,
|
||||
MultiUndoCommand *command, int track_offset,
|
||||
void *command, int track_offset,
|
||||
bool jump_to_end)
|
||||
{
|
||||
dragged_footage_ = footage;
|
||||
@@ -238,7 +244,9 @@ void ImportTool::place_at(const DraggedFootageData &footage,
|
||||
drop_ghosts(insert, command);
|
||||
|
||||
if (jump_to_end) {
|
||||
this->sequence()->set_playhead(max);
|
||||
oakengine_viewer_set_playhead(
|
||||
reinterpret_cast<OakEngineNode *>(this->sequence()),
|
||||
max.numerator(), max.denominator());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,14 +311,20 @@ void ImportTool::footage_to_ghosts(Rational ghost_start,
|
||||
ghost->set_data(TimelineViewGhostItem::k_attached_footage,
|
||||
QVariant::fromValue(af));
|
||||
} else if (track_type == Track::k_subtitle) {
|
||||
SubtitleParams sp = footage->get_subtitle_params(ref.index());
|
||||
int sub_count = oakengine_viewer_get_subtitle_count(
|
||||
reinterpret_cast<const OakEngineNode *>(footage),
|
||||
ref.index());
|
||||
|
||||
for (const Subtitle &sub : sp) {
|
||||
for (int si = 0; si < sub_count; si++) {
|
||||
const Subtitle *sub = static_cast<const Subtitle *>(
|
||||
oakengine_viewer_get_subtitle_at(
|
||||
reinterpret_cast<const OakEngineNode *>(footage),
|
||||
ref.index(), si));
|
||||
auto ghost =
|
||||
create_ghost(sub.time() + ghost_start, 0, dest_track);
|
||||
create_ghost(sub->time() + ghost_start, 0, dest_track);
|
||||
|
||||
ghost->set_data(TimelineViewGhostItem::k_attached_footage,
|
||||
QVariant::fromValue(sub));
|
||||
QVariant::fromValue(*sub));
|
||||
}
|
||||
|
||||
parent()->add_tentative_subtitle_track();
|
||||
@@ -327,17 +341,17 @@ void ImportTool::prep_ghosts(const Rational &frame, const int &track_index)
|
||||
if (parent()->get_connected_node()) {
|
||||
footage_to_ghosts(
|
||||
frame, dragged_footage_,
|
||||
parent()->get_connected_node()->get_video_params().time_base(),
|
||||
viewer_output_video_params(parent()->get_connected_node()).time_base(),
|
||||
track_index);
|
||||
}
|
||||
}
|
||||
|
||||
void ImportTool::drop_ghosts(bool insert, MultiUndoCommand *parent_command)
|
||||
void ImportTool::drop_ghosts(bool insert, void *parent_command)
|
||||
{
|
||||
auto command = new MultiUndoCommand();
|
||||
auto command = oakengine_undo_command_create_multi();
|
||||
|
||||
if (MultiUndoCommand *c = parent()->take_subtitle_section_command()) {
|
||||
command->add_child(c);
|
||||
if (void *c = parent()->take_subtitle_section_command()) {
|
||||
oakengine_undo_command_multi_add_child(command, c);
|
||||
}
|
||||
|
||||
Project *dst_graph = nullptr;
|
||||
@@ -402,7 +416,8 @@ void ImportTool::drop_ghosts(bool insert, MultiUndoCommand *parent_command)
|
||||
Core::instance()->create_new_sequence_for_project(
|
||||
active_project);
|
||||
|
||||
new_sequence->set_default_parameters();
|
||||
oakengine_viewer_set_default_parameters(
|
||||
reinterpret_cast<OakEngineNode *>(new_sequence));
|
||||
|
||||
bool sequence_is_valid = true;
|
||||
|
||||
@@ -417,7 +432,14 @@ void ImportTool::drop_ghosts(bool insert, MultiUndoCommand *parent_command)
|
||||
}
|
||||
}
|
||||
|
||||
new_sequence->set_parameters_from_footage(footage_only);
|
||||
QVector<OakEngineNode *> _footage_nodes;
|
||||
for (auto *f : footage_only) {
|
||||
_footage_nodes.append(
|
||||
reinterpret_cast<OakEngineNode *>(f));
|
||||
}
|
||||
oakengine_viewer_set_parameters_from_footage(
|
||||
reinterpret_cast<OakEngineNode *>(new_sequence),
|
||||
_footage_nodes.data(), _footage_nodes.size());
|
||||
|
||||
// If the user selected manual, show them a dialog with parameters
|
||||
if (behavior == k_dws_manual) {
|
||||
@@ -433,22 +455,25 @@ void ImportTool::drop_ghosts(bool insert, MultiUndoCommand *parent_command)
|
||||
if (sequence_is_valid) {
|
||||
dst_graph = Core::instance()->get_active_project();
|
||||
|
||||
command->add_child(
|
||||
new NodeAddCommand(dst_graph, new_sequence));
|
||||
command->add_child(new FolderAddChild(
|
||||
Core::instance()->get_selected_folder_in_active_project(),
|
||||
new_sequence));
|
||||
command->add_child(new NodeSetPositionCommand(
|
||||
new_sequence, new_sequence, QPointF(0, 0)));
|
||||
new_sequence->add_default_nodes(command);
|
||||
oakengine_undo_command_multi_add_child(command,
|
||||
oakengine_node_add_to_project_command(
|
||||
reinterpret_cast<OakEngineProject *>(dst_graph),
|
||||
reinterpret_cast<OakEngineNode *>(new_sequence)));
|
||||
oakengine_folder_add_child(
|
||||
reinterpret_cast<OakEngineNode *>(
|
||||
Core::instance()->get_selected_folder_in_active_project()),
|
||||
reinterpret_cast<OakEngineNode *>(new_sequence));
|
||||
oakengine_undo_command_multi_add_child(command, oakengine_node_set_position_command(reinterpret_cast<void *>(new_sequence), reinterpret_cast<void *>(new_sequence), 0, 0, 0));
|
||||
oakengine_sequence_add_default_nodes(
|
||||
reinterpret_cast<OakEngineSequence *>(new_sequence));
|
||||
|
||||
footage_to_ghosts(0, dragged_footage_,
|
||||
new_sequence->get_video_params().time_base(),
|
||||
viewer_output_video_params(new_sequence).time_base(),
|
||||
0);
|
||||
|
||||
if (MultiUndoCommand *c =
|
||||
if (void *c =
|
||||
parent()->take_subtitle_section_command()) {
|
||||
command->add_child(c);
|
||||
oakengine_undo_command_multi_add_child(command, c);
|
||||
}
|
||||
|
||||
sequence = new_sequence;
|
||||
@@ -484,20 +509,21 @@ void ImportTool::drop_ghosts(bool insert, MultiUndoCommand *parent_command)
|
||||
ghost->get_data(TimelineViewGhostItem::k_attached_footage)
|
||||
.value<TimelineViewGhostItem::AttachedFootage>();
|
||||
|
||||
ClipBlock *clip = new ClipBlock();
|
||||
ClipBlock *clip = clip_create_empty();
|
||||
block = clip;
|
||||
clip->set_media_in(ghost->get_media_in());
|
||||
command->add_child(new NodeAddCommand(dst_graph, clip));
|
||||
clip_set_media_in(clip, ghost->get_media_in());
|
||||
oakengine_undo_command_multi_add_child(command,
|
||||
oakengine_node_add_to_project_command(
|
||||
reinterpret_cast<OakEngineProject *>(dst_graph),
|
||||
reinterpret_cast<OakEngineNode *>(clip)));
|
||||
|
||||
// Position clip in its own context
|
||||
command->add_child(
|
||||
new NodeSetPositionCommand(clip, clip, QPointF(0, 0)));
|
||||
oakengine_undo_command_multi_add_child(command, oakengine_node_set_position_command(reinterpret_cast<void *>(clip), reinterpret_cast<void *>(clip), 0, 0, 0));
|
||||
|
||||
int dep_pos = k_default_distance_from_output;
|
||||
|
||||
// Position footage in its context
|
||||
command->add_child(new NodeSetPositionCommand(
|
||||
footage_stream.footage, clip, QPointF(dep_pos, 0)));
|
||||
oakengine_undo_command_multi_add_child(command, oakengine_node_set_position_command(reinterpret_cast<void *>(footage_stream.footage), reinterpret_cast<void *>(clip), dep_pos, 0, 0));
|
||||
|
||||
dep_pos++;
|
||||
|
||||
@@ -505,42 +531,67 @@ void ImportTool::drop_ghosts(bool insert, MultiUndoCommand *parent_command)
|
||||
Track::Reference::type_from_string(footage_stream.output)) {
|
||||
case Track::k_video: {
|
||||
TransformDistortNode *transform =
|
||||
new TransformDistortNode();
|
||||
command->add_child(
|
||||
new NodeAddCommand(dst_graph, transform));
|
||||
reinterpret_cast<TransformDistortNode*>(oakengine_node_factory_create_from_id("org.olivevideoeditor.Olive.transformdistort"));
|
||||
oakengine_undo_command_multi_add_child(command,
|
||||
oakengine_node_add_to_project_command(
|
||||
reinterpret_cast<OakEngineProject *>(dst_graph),
|
||||
reinterpret_cast<OakEngineNode *>(transform)));
|
||||
|
||||
command->add_child(new NodeSetValueHintCommand(
|
||||
transform, TransformDistortNode::k_texture_input, -1,
|
||||
Node::ValueHint({ NodeValue::k_texture },
|
||||
footage_stream.output)));
|
||||
oakengine_undo_command_multi_add_child(
|
||||
command,
|
||||
oakengine_node_set_value_hint_command(
|
||||
reinterpret_cast<void *>(transform),
|
||||
oakengine_transform_texture_input_id(), -1,
|
||||
OAK_NODE_VALUE_TEXTURE, -1,
|
||||
footage_stream.output.toUtf8().constData()));
|
||||
|
||||
command->add_child(new NodeEdgeAddCommand(
|
||||
footage_stream.footage,
|
||||
NodeInput(transform,
|
||||
TransformDistortNode::k_texture_input)));
|
||||
command->add_child(new NodeEdgeAddCommand(
|
||||
transform, NodeInput(clip, ClipBlock::k_buffer_in)));
|
||||
command->add_child(new NodeSetPositionCommand(
|
||||
transform, clip, QPointF(dep_pos, 0)));
|
||||
oakengine_undo_command_multi_add_child(
|
||||
command,
|
||||
oakengine_node_connect_command(
|
||||
reinterpret_cast<OakEngineNode *>(footage_stream.footage),
|
||||
reinterpret_cast<OakEngineNode *>(transform),
|
||||
QLatin1String(oakengine_transform_texture_input_id()).toUtf8().constData(),
|
||||
-1));
|
||||
oakengine_undo_command_multi_add_child(
|
||||
command,
|
||||
oakengine_node_connect_command(
|
||||
reinterpret_cast<OakEngineNode *>(transform),
|
||||
reinterpret_cast<OakEngineNode *>(clip),
|
||||
oakengine_clip_buffer_input_id(),
|
||||
-1));
|
||||
oakengine_undo_command_multi_add_child(command, oakengine_node_set_position_command(reinterpret_cast<void *>(transform), reinterpret_cast<void *>(clip), dep_pos, 0, 0));
|
||||
break;
|
||||
}
|
||||
case Track::k_audio: {
|
||||
VolumeNode *volume_node = new VolumeNode();
|
||||
command->add_child(
|
||||
new NodeAddCommand(dst_graph, volume_node));
|
||||
VolumeNode *volume_node = reinterpret_cast<VolumeNode*>(oakengine_node_factory_create_from_id("org.olivevideoeditor.Olive.volume"));
|
||||
oakengine_undo_command_multi_add_child(command,
|
||||
oakengine_node_add_to_project_command(
|
||||
reinterpret_cast<OakEngineProject *>(dst_graph),
|
||||
reinterpret_cast<OakEngineNode *>(volume_node)));
|
||||
|
||||
command->add_child(new NodeSetValueHintCommand(
|
||||
volume_node, VolumeNode::k_samples_input, -1,
|
||||
Node::ValueHint({ NodeValue::k_samples },
|
||||
footage_stream.output)));
|
||||
oakengine_undo_command_multi_add_child(
|
||||
command,
|
||||
oakengine_node_set_value_hint_command(
|
||||
reinterpret_cast<void *>(volume_node),
|
||||
oakengine_volume_samples_input_id(), -1,
|
||||
OAK_NODE_VALUE_SAMPLES, -1,
|
||||
footage_stream.output.toUtf8().constData()));
|
||||
|
||||
command->add_child(new NodeEdgeAddCommand(
|
||||
footage_stream.footage,
|
||||
NodeInput(volume_node, VolumeNode::k_samples_input)));
|
||||
command->add_child(new NodeEdgeAddCommand(
|
||||
volume_node, NodeInput(clip, ClipBlock::k_buffer_in)));
|
||||
command->add_child(new NodeSetPositionCommand(
|
||||
volume_node, clip, QPointF(dep_pos, 0)));
|
||||
oakengine_undo_command_multi_add_child(
|
||||
command,
|
||||
oakengine_node_connect_command(
|
||||
reinterpret_cast<OakEngineNode *>(footage_stream.footage),
|
||||
reinterpret_cast<OakEngineNode *>(volume_node),
|
||||
QLatin1String(oakengine_volume_samples_input_id()).toUtf8().constData(),
|
||||
-1));
|
||||
oakengine_undo_command_multi_add_child(
|
||||
command,
|
||||
oakengine_node_connect_command(
|
||||
reinterpret_cast<OakEngineNode *>(volume_node),
|
||||
reinterpret_cast<OakEngineNode *>(clip),
|
||||
oakengine_clip_buffer_input_id(),
|
||||
-1));
|
||||
oakengine_undo_command_multi_add_child(command, oakengine_node_set_position_command(reinterpret_cast<void *>(volume_node), reinterpret_cast<void *>(clip), dep_pos, 0, 0));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -557,7 +608,9 @@ void ImportTool::drop_ghosts(bool insert, MultiUndoCommand *parent_command)
|
||||
.value<TimelineViewGhostItem::AttachedFootage>();
|
||||
|
||||
if (footage_compare.footage == footage_stream.footage) {
|
||||
Block::link(block_items.at(j), clip);
|
||||
oakengine_block_link(
|
||||
reinterpret_cast<void *>(block_items.at(j)),
|
||||
reinterpret_cast<void *>(clip), 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -566,37 +619,40 @@ void ImportTool::drop_ghosts(bool insert, MultiUndoCommand *parent_command)
|
||||
Subtitle src =
|
||||
ghost->get_data(TimelineViewGhostItem::k_attached_footage)
|
||||
.value<Subtitle>();
|
||||
SubtitleBlock *sub = new SubtitleBlock();
|
||||
sub->set_text(src.text());
|
||||
SubtitleBlock *sub = reinterpret_cast<SubtitleBlock *>(
|
||||
oakengine_node_factory_create_from_id(
|
||||
"org.olivevideoeditor.Olive.subtitle"));
|
||||
oakengine_subtitle_set_text(
|
||||
reinterpret_cast<OakEngineNode *>(sub),
|
||||
src.text().toUtf8().constData());
|
||||
block = sub;
|
||||
|
||||
command->add_child(new NodeAddCommand(dst_graph, sub));
|
||||
command->add_child(
|
||||
new NodeSetPositionCommand(sub, sub, QPointF(0, 0)));
|
||||
oakengine_undo_command_multi_add_child(command,
|
||||
oakengine_node_add_to_project_command(
|
||||
reinterpret_cast<OakEngineProject *>(dst_graph),
|
||||
reinterpret_cast<OakEngineNode *>(sub)));
|
||||
oakengine_undo_command_multi_add_child(command, oakengine_node_set_position_command(reinterpret_cast<void *>(sub), reinterpret_cast<void *>(sub), 0, 0, 0));
|
||||
}
|
||||
|
||||
block->set_length_and_media_out(ghost->get_length());
|
||||
|
||||
command->add_child(new TrackPlaceBlockCommand(
|
||||
sequence->track_list(ghost->get_adjusted_track().type()),
|
||||
ghost->get_adjusted_track().index(), block,
|
||||
ghost->get_adjusted_in()));
|
||||
oakengine_undo_command_multi_add_child(command, oakengine_track_place_block_command(reinterpret_cast<void *>(sequence->track_list(ghost->get_adjusted_track().type())), ghost->get_adjusted_track().index(), reinterpret_cast<void *>(block), core::Timecode::time_to_timestamp(ghost->get_adjusted_in(), parent()->timebase())));
|
||||
|
||||
block_items.replace(i, block);
|
||||
}
|
||||
}
|
||||
|
||||
if (open_sequence) {
|
||||
command->add_child(new OpenSequenceCommand(sequence));
|
||||
oakengine_undo_command_multi_add_child(command, make_open_sequence_command(sequence));
|
||||
}
|
||||
|
||||
// Do command now because RequestInvalidatedFromConnected relies on track type, which will be
|
||||
// "none" before this command is done because it won't be connected to any track
|
||||
command->redo_now();
|
||||
parent_command->add_child(command);
|
||||
oakengine_undo_command_redo_now(command);
|
||||
oakengine_undo_command_multi_add_child(parent_command, command);
|
||||
|
||||
while (!imported_clips.empty()) {
|
||||
imported_clips.front()->request_invalidated_from_connected();
|
||||
clip_request_invalidate_connected(imported_clips.front());
|
||||
imported_clips.pop_front();
|
||||
}
|
||||
|
||||
|
||||
@@ -41,10 +41,10 @@ public:
|
||||
QVector<QPair<ViewerOutput *, QVector<Track::Reference>>>;
|
||||
|
||||
void place_at(const QVector<ViewerOutput *> &footage, const Rational &start,
|
||||
bool insert, MultiUndoCommand *command, int track_offset = 0,
|
||||
bool insert, void *command, int track_offset = 0,
|
||||
bool jump_to_end = false);
|
||||
void place_at(const DraggedFootageData &footage, const Rational &start,
|
||||
bool insert, MultiUndoCommand *command, int track_offset = 0,
|
||||
bool insert, void *command, int track_offset = 0,
|
||||
bool jump_to_end = false);
|
||||
|
||||
// The canonical definition lives in the engine layer
|
||||
@@ -61,7 +61,7 @@ private:
|
||||
|
||||
void prep_ghosts(const Rational &frame, const int &track_index);
|
||||
|
||||
void drop_ghosts(bool insert, MultiUndoCommand *parent_command);
|
||||
void drop_ghosts(bool insert, void *parent_command);
|
||||
|
||||
TimelineViewGhostItem *create_ghost(const TimeRange &range,
|
||||
const Rational &media_in,
|
||||
|
||||
@@ -26,11 +26,13 @@
|
||||
|
||||
#include "common/qtutils.h"
|
||||
#include "common/range.h"
|
||||
#include "config/config.h"
|
||||
#include "common/configwrapper.h"
|
||||
#include "core.h"
|
||||
#include "node/block/gap/gap.h"
|
||||
#include "node/block/transition/transition.h"
|
||||
#include "node/nodeundo.h"
|
||||
#include "oakengine/node.h"
|
||||
#include "oakengine/undo.h"
|
||||
#include "oakengine/timeline.h"
|
||||
#include "pointer.h"
|
||||
#include "timeline/timelineundopointer.h"
|
||||
#include "widget/timeruler/timeruler.h"
|
||||
@@ -685,7 +687,7 @@ void PointerTool::finish_drag(TimelineViewMouseEvent *event)
|
||||
return;
|
||||
}
|
||||
|
||||
MultiUndoCommand *command = new MultiUndoCommand();
|
||||
void *command = oakengine_undo_command_create_multi();
|
||||
|
||||
if (!blocks_trimming.isEmpty()) {
|
||||
foreach (const GhostBlockPair &p, blocks_trimming) {
|
||||
@@ -694,18 +696,19 @@ void PointerTool::finish_drag(TimelineViewMouseEvent *event)
|
||||
if (!ghost->get_data(TimelineViewGhostItem::k_trim_should_be_ignored)
|
||||
.toBool()) {
|
||||
// Must be an ordinary trim/roll
|
||||
BlockTrimCommand *c = new BlockTrimCommand(
|
||||
parent()->get_track_from_reference(ghost->get_adjusted_track()),
|
||||
p.block, ghost->get_adjusted_length(), ghost->get_mode());
|
||||
|
||||
if (event->get_modifiers() & Qt::ControlModifier) {
|
||||
}
|
||||
|
||||
c->set_trim_is_a_roll_edit(
|
||||
ghost->get_data(TimelineViewGhostItem::k_trim_is_a_roll_edit)
|
||||
.toBool());
|
||||
|
||||
command->add_child(c);
|
||||
oakengine_undo_command_multi_add_child(
|
||||
command,
|
||||
oakengine_block_trim_command(
|
||||
reinterpret_cast<void *>(
|
||||
parent()->get_track_from_reference(ghost->get_adjusted_track())),
|
||||
reinterpret_cast<void *>(p.block),
|
||||
ghost->get_adjusted_length().numerator(),
|
||||
ghost->get_adjusted_length().denominator(),
|
||||
ghost->get_mode(),
|
||||
ghost->get_data(TimelineViewGhostItem::k_trim_is_a_roll_edit)
|
||||
.toBool()
|
||||
? 1
|
||||
: 0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -719,8 +722,7 @@ void PointerTool::finish_drag(TimelineViewMouseEvent *event)
|
||||
} else {
|
||||
new_sel.trim_out(reference_ghost->get_out_adjustment());
|
||||
}
|
||||
command->add_child(new TimelineWidget::SetSelectionsCommand(
|
||||
parent(), new_sel, parent()->get_selections()));
|
||||
oakengine_undo_command_multi_add_child(command, parent()->create_set_selections_command(new_sel, parent()->get_selections()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -756,20 +758,20 @@ void PointerTool::finish_drag(TimelineViewMouseEvent *event)
|
||||
// Duplicate rather than move
|
||||
// Place the copy instead of the original block
|
||||
Block *new_block =
|
||||
static_cast<Block *>(Node::copy_node_in_graph(block, command));
|
||||
reinterpret_cast<Block *>(oakengine_node_copy_in_graph(
|
||||
reinterpret_cast<OakEngineNode*>(block), command));
|
||||
relinks.insert(block, new_block);
|
||||
block = new_block;
|
||||
|
||||
if (ClipBlock *new_clip = dynamic_cast<ClipBlock *>(block)) {
|
||||
new_clip->add_cache_passthrough_from(
|
||||
static_cast<ClipBlock *>(p.block));
|
||||
oakengine_clip_add_cache_passthrough(
|
||||
reinterpret_cast<OakEngineClip *>(new_clip),
|
||||
reinterpret_cast<OakEngineClip *>(p.block));
|
||||
}
|
||||
}
|
||||
|
||||
const Track::Reference &track_ref = p.ghost->get_adjusted_track();
|
||||
command->add_child(new TrackPlaceBlockCommand(
|
||||
sequence()->track_list(track_ref.type()), track_ref.index(),
|
||||
block, p.ghost->get_adjusted_in()));
|
||||
oakengine_undo_command_multi_add_child(command, oakengine_track_place_block_command(reinterpret_cast<void *>(sequence()->track_list(track_ref.type())), track_ref.index(), reinterpret_cast<void *>(block), core::Timecode::time_to_timestamp(p.ghost->get_adjusted_in(), parent()->timebase())));
|
||||
}
|
||||
|
||||
if (!relinks.empty()) {
|
||||
@@ -780,8 +782,9 @@ void PointerTool::finish_drag(TimelineViewMouseEvent *event)
|
||||
Node *link = *jt;
|
||||
Node *copy_link = relinks.value(link);
|
||||
if (copy_link) {
|
||||
command->add_child(
|
||||
new NodeLinkCommand(it.value(), copy_link, true));
|
||||
oakengine_undo_command_multi_add_child(command, (void *)(oakengine_node_link_command(
|
||||
reinterpret_cast<OakEngineNode*>(it.value()),
|
||||
reinterpret_cast<OakEngineNode*>(copy_link), 1)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -799,10 +802,13 @@ void PointerTool::finish_drag(TimelineViewMouseEvent *event)
|
||||
TransitionBlock *cp_in_transition =
|
||||
static_cast<TransitionBlock *>(
|
||||
relinks.value(og_in_transition));
|
||||
command->add_child(new NodeEdgeAddCommand(
|
||||
cp_clip,
|
||||
NodeInput(cp_in_transition,
|
||||
TransitionBlock::k_in_block_input)));
|
||||
oakengine_undo_command_multi_add_child(
|
||||
command,
|
||||
oakengine_node_connect_command(
|
||||
reinterpret_cast<OakEngineNode *>(cp_clip),
|
||||
reinterpret_cast<OakEngineNode *>(cp_in_transition),
|
||||
QLatin1String(oakengine_transition_in_block_input_id()).toUtf8().constData(),
|
||||
-1));
|
||||
}
|
||||
|
||||
if (og_out_transition &&
|
||||
@@ -810,10 +816,13 @@ void PointerTool::finish_drag(TimelineViewMouseEvent *event)
|
||||
TransitionBlock *cp_out_transition =
|
||||
static_cast<TransitionBlock *>(
|
||||
relinks.value(og_out_transition));
|
||||
command->add_child(new NodeEdgeAddCommand(
|
||||
cp_clip,
|
||||
NodeInput(cp_out_transition,
|
||||
TransitionBlock::k_out_block_input)));
|
||||
oakengine_undo_command_multi_add_child(
|
||||
command,
|
||||
oakengine_node_connect_command(
|
||||
reinterpret_cast<OakEngineNode *>(cp_clip),
|
||||
reinterpret_cast<OakEngineNode *>(cp_out_transition),
|
||||
QLatin1String(oakengine_transition_out_block_input_id()).toUtf8().constData(),
|
||||
-1));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -824,8 +833,7 @@ void PointerTool::finish_drag(TimelineViewMouseEvent *event)
|
||||
new_sel.shift_time(blocks_moving.first().ghost->get_in_adjustment());
|
||||
new_sel.shift_tracks(drag_track_type_,
|
||||
blocks_moving.first().ghost->get_track_adjustment());
|
||||
command->add_child(new TimelineWidget::SetSelectionsCommand(
|
||||
parent(), new_sel, parent()->get_selections()));
|
||||
oakengine_undo_command_multi_add_child(command, parent()->create_set_selections_command(new_sel, parent()->get_selections()));
|
||||
}
|
||||
|
||||
if (!blocks_sliding.isEmpty()) {
|
||||
@@ -875,22 +883,31 @@ void PointerTool::finish_drag(TimelineViewMouseEvent *event)
|
||||
if (!movement.isNull()) {
|
||||
for (auto i = slide_info.constBegin(); i != slide_info.constEnd();
|
||||
i++) {
|
||||
command->add_child(new TrackSlideCommand(
|
||||
parent()->get_track_from_reference(i.key()), i.value(),
|
||||
in_adjacents.value(i.key()), out_adjacents.value(i.key()),
|
||||
movement));
|
||||
const QList<Block *> &moving_blocks = i.value();
|
||||
QVector<void *> slide_blocks;
|
||||
slide_blocks.reserve(moving_blocks.size());
|
||||
for (Block *b : moving_blocks) {
|
||||
slide_blocks.append(reinterpret_cast<void *>(b));
|
||||
}
|
||||
oakengine_undo_command_multi_add_child(
|
||||
command,
|
||||
oakengine_track_slide_command(
|
||||
reinterpret_cast<void *>(parent()->get_track_from_reference(i.key())),
|
||||
slide_blocks.constData(), slide_blocks.size(),
|
||||
reinterpret_cast<void *>(in_adjacents.value(i.key())),
|
||||
reinterpret_cast<void *>(out_adjacents.value(i.key())),
|
||||
movement.numerator(), movement.denominator()));
|
||||
}
|
||||
|
||||
// Adjust selections
|
||||
TimelineWidgetSelections new_sel = parent()->get_selections();
|
||||
new_sel.shift_time(movement);
|
||||
command->add_child(new TimelineWidget::SetSelectionsCommand(
|
||||
parent(), new_sel, parent()->get_selections()));
|
||||
oakengine_undo_command_multi_add_child(command, parent()->create_set_selections_command(new_sel, parent()->get_selections()));
|
||||
}
|
||||
}
|
||||
|
||||
Core::instance()->undo_stack()->push(
|
||||
command, qApp->translate("PointerTool", "Moved Clips"));
|
||||
oakengine_undo_push(
|
||||
command, qApp->translate("PointerTool", "Moved Clips").toUtf8().constData());
|
||||
}
|
||||
|
||||
Timeline::MovementMode PointerTool::is_cursor_in_trim_handle(Block *block,
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#include "widget/timelinewidget/timelinewidget.h"
|
||||
|
||||
#include "node/block/gap/gap.h"
|
||||
#include "oakengine/timeline.h"
|
||||
#include "oakengine/undo.h"
|
||||
#include "timeline/timelineundoripple.h"
|
||||
#include "ripple.h"
|
||||
|
||||
@@ -127,8 +129,7 @@ void RippleTool::finish_drag(TimelineViewMouseEvent *event)
|
||||
Q_UNUSED(event)
|
||||
|
||||
if (parent()->has_ghosts()) {
|
||||
QVector<QHash<Track *, TrackListRippleToolCommand::RippleInfo>>
|
||||
info_list(Track::k_count);
|
||||
QVector<QVector<oakengine_ripple_info>> info_list(Track::k_count);
|
||||
|
||||
foreach (TimelineViewGhostItem *ghost, parent()->get_ghost_items()) {
|
||||
if (!ghost->has_been_adjusted()) {
|
||||
@@ -137,23 +138,25 @@ void RippleTool::finish_drag(TimelineViewMouseEvent *event)
|
||||
|
||||
Track *track = parent()->get_track_from_reference(ghost->get_track());
|
||||
|
||||
TrackListRippleToolCommand::RippleInfo info;
|
||||
oakengine_ripple_info info;
|
||||
Block *b = QtUtils::value_to_ptr<Block>(
|
||||
ghost->get_data(TimelineViewGhostItem::k_attached_block));
|
||||
|
||||
if (b) {
|
||||
info.block = b;
|
||||
info.append_gap = false;
|
||||
info.block = reinterpret_cast<OakEngineBlock *>(b);
|
||||
info.append_gap = 0;
|
||||
} else {
|
||||
info.block = QtUtils::value_to_ptr<Block>(
|
||||
ghost->get_data(TimelineViewGhostItem::k_reference_block));
|
||||
info.append_gap = true;
|
||||
info.block = reinterpret_cast<OakEngineBlock *>(
|
||||
QtUtils::value_to_ptr<Block>(
|
||||
ghost->get_data(TimelineViewGhostItem::k_reference_block)));
|
||||
info.append_gap = 1;
|
||||
}
|
||||
info.track = reinterpret_cast<OakEngineTrack *>(track);
|
||||
|
||||
info_list[track->type()].insert(track, info);
|
||||
info_list[track->type()].append(info);
|
||||
}
|
||||
|
||||
MultiUndoCommand *command = new MultiUndoCommand();
|
||||
void *command = oakengine_undo_command_create_multi();
|
||||
|
||||
Rational movement;
|
||||
|
||||
@@ -165,13 +168,17 @@ void RippleTool::finish_drag(TimelineViewMouseEvent *event)
|
||||
|
||||
for (int i = 0; i < info_list.size(); i++) {
|
||||
if (!info_list.at(i).isEmpty()) {
|
||||
command->add_child(new TrackListRippleToolCommand(
|
||||
sequence()->track_list(static_cast<Track::Type>(i)),
|
||||
info_list.at(i), movement, drag_movement_mode()));
|
||||
oakengine_undo_command_multi_add_child(
|
||||
command,
|
||||
oakengine_sequence_ripple_tracks_command(
|
||||
reinterpret_cast<OakEngineSequence *>(sequence()), i,
|
||||
info_list.at(i).constData(), info_list.at(i).size(),
|
||||
movement.numerator(), movement.denominator(),
|
||||
drag_movement_mode()));
|
||||
}
|
||||
}
|
||||
|
||||
if (command->child_count() > 0) {
|
||||
if (oakengine_undo_command_multi_child_count(command) > 0) {
|
||||
TimelineWidgetSelections new_sel = parent()->get_selections();
|
||||
TimelineViewGhostItem *reference_ghost =
|
||||
parent()->get_ghost_items().first();
|
||||
@@ -180,13 +187,12 @@ void RippleTool::finish_drag(TimelineViewMouseEvent *event)
|
||||
} else {
|
||||
new_sel.trim_out(reference_ghost->get_out_adjustment());
|
||||
}
|
||||
command->add_child(new TimelineWidget::SetSelectionsCommand(
|
||||
parent(), new_sel, parent()->get_selections(), false));
|
||||
oakengine_undo_command_multi_add_child(command, parent()->create_set_selections_command(new_sel, parent()->get_selections(), false));
|
||||
|
||||
Core::instance()->undo_stack()->push(
|
||||
command, qApp->translate("RippleTool", "Rippled Clips"));
|
||||
oakengine_undo_push(
|
||||
command, qApp->translate("RippleTool", "Rippled Clips").toUtf8().constData());
|
||||
} else {
|
||||
delete command;
|
||||
oakengine_undo_command_free(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "widget/timelinewidget/timelinewidget.h"
|
||||
|
||||
#include "node/block/gap/gap.h"
|
||||
#include "node/nodeundo.h"
|
||||
#include "rolling.h"
|
||||
|
||||
namespace olive
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "widget/timelinewidget/timelinewidget.h"
|
||||
|
||||
#include "node/block/gap/gap.h"
|
||||
#include "node/nodeundo.h"
|
||||
#include "slide.h"
|
||||
|
||||
namespace olive
|
||||
|
||||
@@ -23,10 +23,12 @@
|
||||
|
||||
#include <QToolTip>
|
||||
|
||||
#include "config/config.h"
|
||||
#include "common/configwrapper.h"
|
||||
#include "timeline/timelineundogeneral.h"
|
||||
#include "widget/timelinewidget/timelinewidget.h"
|
||||
|
||||
#include "oakengine/timeline.h"
|
||||
#include "oakengine/undo.h"
|
||||
namespace olive
|
||||
{
|
||||
|
||||
@@ -70,7 +72,7 @@ void SlipTool::finish_drag(TimelineViewMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
|
||||
MultiUndoCommand *command = new MultiUndoCommand();
|
||||
void *command = oakengine_undo_command_create_multi();
|
||||
|
||||
// Find earliest point to ripple around
|
||||
foreach (TimelineViewGhostItem *ghost, parent()->get_ghost_items()) {
|
||||
@@ -79,14 +81,13 @@ void SlipTool::finish_drag(TimelineViewMouseEvent *event)
|
||||
|
||||
ClipBlock *cb = dynamic_cast<ClipBlock *>(b);
|
||||
if (cb) {
|
||||
command->add_child(
|
||||
new BlockSetMediaInCommand(cb, ghost->get_adjusted_media_in()));
|
||||
oakengine_undo_command_multi_add_child(command, oakengine_block_set_media_in_command(reinterpret_cast<void *>(cb), ghost->get_adjusted_media_in().numerator(), ghost->get_adjusted_media_in().denominator()));
|
||||
}
|
||||
}
|
||||
|
||||
Core::instance()->undo_stack()->push(
|
||||
oakengine_undo_push(
|
||||
command, qApp->translate("SlipTool", "Slipped %1 Clip(s)")
|
||||
.arg(parent()->get_ghost_items().size()));
|
||||
.arg(parent()->get_ghost_items().size()).toUtf8().constData());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ void TimelineTool::get_ghost_data(Rational *earliest_point,
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineTool::insert_gaps_at_ghost_destination(olive::MultiUndoCommand *command)
|
||||
void TimelineTool::insert_gaps_at_ghost_destination(void *command)
|
||||
{
|
||||
Rational earliest_point, latest_point;
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ protected:
|
||||
|
||||
void get_ghost_data(Rational *earliest_point, Rational *latest_point);
|
||||
|
||||
void insert_gaps_at_ghost_destination(MultiUndoCommand *command);
|
||||
void insert_gaps_at_ghost_destination(void *command);
|
||||
|
||||
std::vector<Rational> snap_points_;
|
||||
|
||||
|
||||
@@ -23,8 +23,9 @@
|
||||
|
||||
#include "node/block/transition/crossdissolve/crossdissolvetransition.h"
|
||||
#include "node/block/transition/transition.h"
|
||||
#include "node/factory.h"
|
||||
#include "node/nodeundo.h"
|
||||
#include "oakengine/node.h"
|
||||
#include "oakengine/undo.h"
|
||||
#include "oakengine/timeline.h"
|
||||
#include "timeline/timelineundopointer.h"
|
||||
#include "transition.h"
|
||||
|
||||
@@ -104,29 +105,28 @@ void TransitionTool::mouse_release(TimelineViewMouseEvent *event)
|
||||
|
||||
if (Core::instance()->get_selected_transition().isEmpty()) {
|
||||
// Fallback if the user hasn't selected one yet
|
||||
transition = new CrossDissolveTransition();
|
||||
transition = reinterpret_cast<CrossDissolveTransition*>(oakengine_node_factory_create_from_id("org.olivevideoeditor.Olive.crossdissolve"));
|
||||
} else {
|
||||
transition =
|
||||
static_cast<TransitionBlock *>(NodeFactory::create_from_id(
|
||||
Core::instance()->get_selected_transition()));
|
||||
reinterpret_cast<TransitionBlock *>(oakengine_node_factory_create_from_id(
|
||||
Core::instance()->get_selected_transition().toUtf8().constData()));
|
||||
}
|
||||
|
||||
// Set transition length
|
||||
Rational len = ghost_->get_adjusted_length();
|
||||
transition->set_length_and_media_out(len);
|
||||
|
||||
MultiUndoCommand *command = new MultiUndoCommand();
|
||||
void *command = oakengine_undo_command_create_multi();
|
||||
|
||||
// Place transition in place
|
||||
command->add_child(new NodeAddCommand(
|
||||
parent()->get_connected_node()->parent(), transition));
|
||||
oakengine_undo_command_multi_add_child(command,
|
||||
oakengine_node_add_to_project_command(
|
||||
reinterpret_cast<OakEngineProject *>(parent()->get_connected_node()->parent()),
|
||||
reinterpret_cast<OakEngineNode *>(transition)));
|
||||
|
||||
command->add_child(new NodeSetPositionCommand(
|
||||
transition, transition, QPointF(0, 0)));
|
||||
oakengine_undo_command_multi_add_child(command, oakengine_node_set_position_command(reinterpret_cast<void *>(transition), reinterpret_cast<void *>(transition), 0, 0, 0));
|
||||
|
||||
command->add_child(new TrackPlaceBlockCommand(
|
||||
sequence()->track_list(track.type()), track.index(), transition,
|
||||
ghost_->get_adjusted_in()));
|
||||
oakengine_undo_command_multi_add_child(command, oakengine_track_place_block_command(reinterpret_cast<void *>(sequence()->track_list(track.type())), track.index(), reinterpret_cast<void *>(transition), core::Timecode::time_to_timestamp(ghost_->get_adjusted_in(), parent()->timebase())));
|
||||
|
||||
if (dual_transition_) {
|
||||
// Block mouse is hovering over
|
||||
@@ -146,18 +146,24 @@ void TransitionTool::mouse_release(TimelineViewMouseEvent *event)
|
||||
friend_block;
|
||||
|
||||
// Connect block to transition
|
||||
command->add_child(new NodeEdgeAddCommand(
|
||||
out_block,
|
||||
NodeInput(transition, TransitionBlock::k_out_block_input)));
|
||||
oakengine_undo_command_multi_add_child(
|
||||
command,
|
||||
oakengine_node_connect_command(
|
||||
reinterpret_cast<OakEngineNode *>(out_block),
|
||||
reinterpret_cast<OakEngineNode *>(transition),
|
||||
QLatin1String(oakengine_transition_out_block_input_id()).toUtf8().constData(),
|
||||
-1));
|
||||
|
||||
command->add_child(new NodeEdgeAddCommand(
|
||||
in_block,
|
||||
NodeInput(transition, TransitionBlock::k_in_block_input)));
|
||||
oakengine_undo_command_multi_add_child(
|
||||
command,
|
||||
oakengine_node_connect_command(
|
||||
reinterpret_cast<OakEngineNode *>(in_block),
|
||||
reinterpret_cast<OakEngineNode *>(transition),
|
||||
QLatin1String(oakengine_transition_in_block_input_id()).toUtf8().constData(),
|
||||
-1));
|
||||
|
||||
command->add_child(new NodeSetPositionCommand(
|
||||
out_block, transition, QPointF(-1, -0.5)));
|
||||
command->add_child(new NodeSetPositionCommand(
|
||||
in_block, transition, QPointF(-1, 0.5)));
|
||||
oakengine_undo_command_multi_add_child(command, oakengine_node_set_position_command(reinterpret_cast<void *>(out_block), reinterpret_cast<void *>(transition), -1, -0.5, 0));
|
||||
oakengine_undo_command_multi_add_child(command, oakengine_node_set_position_command(reinterpret_cast<void *>(in_block), reinterpret_cast<void *>(transition), -1, 0.5, 0));
|
||||
} else {
|
||||
Block *block_to_transition = QtUtils::value_to_ptr<Block>(
|
||||
ghost_->get_data(TimelineViewGhostItem::k_attached_block));
|
||||
@@ -165,24 +171,27 @@ void TransitionTool::mouse_release(TimelineViewMouseEvent *event)
|
||||
|
||||
if (ghost_->get_mode() == Timeline::k_trim_in) {
|
||||
transition_input_to_connect =
|
||||
TransitionBlock::k_in_block_input;
|
||||
QLatin1String(oakengine_transition_in_block_input_id());
|
||||
} else {
|
||||
transition_input_to_connect =
|
||||
TransitionBlock::k_out_block_input;
|
||||
QLatin1String(oakengine_transition_out_block_input_id());
|
||||
}
|
||||
|
||||
// Connect block to transition
|
||||
command->add_child(new NodeEdgeAddCommand(
|
||||
block_to_transition,
|
||||
NodeInput(transition, transition_input_to_connect)));
|
||||
oakengine_undo_command_multi_add_child(
|
||||
command,
|
||||
oakengine_node_connect_command(
|
||||
reinterpret_cast<OakEngineNode *>(block_to_transition),
|
||||
reinterpret_cast<OakEngineNode *>(transition),
|
||||
transition_input_to_connect.toUtf8().constData(),
|
||||
-1));
|
||||
|
||||
command->add_child(new NodeSetPositionCommand(
|
||||
block_to_transition, transition, QPointF(-1, 0)));
|
||||
oakengine_undo_command_multi_add_child(command, oakengine_node_set_position_command(reinterpret_cast<void *>(block_to_transition), reinterpret_cast<void *>(transition), -1, 0, 0));
|
||||
}
|
||||
|
||||
Core::instance()->undo_stack()->push(
|
||||
oakengine_undo_push(
|
||||
command,
|
||||
qApp->translate("TransitionTool", "Created Transition"));
|
||||
qApp->translate("TransitionTool", "Created Transition").toUtf8().constData());
|
||||
|
||||
parent()->set_view_transition_overlay(nullptr, nullptr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user