R8: finish app/ pure C ABI migration (P3-P9) and make OTIO required
- app/ no longer includes engine C++ headers nor holds engine C++ types: engine access goes through the oakengine C ABI plus C++ wrappers (oakutil/oaknode.h, oakutil/oakvideo.h) and app-local mirror types (tooltypes, trackreferencehandle, timelinecommonapp, keyframetypes, subtitleapp, serializedlayoutinfoapp, nodevaluehandle, sliderdisplaytypeapp) - engine: new C ABI functions for block/track/clip/transition navigation and predicates, links, caches, waveform/playback, disk folder, sequence_track_list, node_free, footage_is_valid, block_get_track, get_brush; loadotio/saveotio ported to the current engine API - OTIO is now a required dependency: CI and CD build it on every platform, FindOpenTimelineIO fixed for OTIO 0.16/0.19 (the old deps include requirement silently disabled OTIO everywhere), runtime libraries are bundled into packages and copied next to macOS binaries (oak_copy_otio_runtime) - fix ProjectViewModel drag&drop mime read/write size mismatch (segfault) - unify color label naming (k_olive -> "Oak") in the app-side mirror - docs: OTIO required, FFmpeg minimum corrected to 6.0 (en/zh) - gtest suite: 1925 passed, 0 failed
This commit is contained in:
@@ -21,11 +21,11 @@
|
||||
|
||||
#include "widget/timelinewidget/timelinewidget.h"
|
||||
|
||||
#include "node/block/gap/gap.h"
|
||||
#include "oakengine/node.h"
|
||||
#include "oakengine/timeline.h"
|
||||
#include "oakengine/undo.h"
|
||||
#include "timeline/timelineundoripple.h"
|
||||
#include "ripple.h"
|
||||
#include "widget/timelinewidget/trackhandle.h"
|
||||
|
||||
namespace olive
|
||||
{
|
||||
@@ -37,8 +37,8 @@ RippleTool::RippleTool(TimelineWidget *parent)
|
||||
set_gap_trimming_allowed(true);
|
||||
}
|
||||
|
||||
void RippleTool::initiate_drag(Block *clicked_item,
|
||||
Timeline::MovementMode trim_mode,
|
||||
void RippleTool::initiate_drag(OakEngineBlock *clicked_item,
|
||||
TimelineApp::MovementMode trim_mode,
|
||||
Qt::KeyboardModifiers modifiers)
|
||||
{
|
||||
initiate_drag_internal(clicked_item, trim_mode, modifiers, true, true, false);
|
||||
@@ -53,7 +53,7 @@ void RippleTool::initiate_drag(Block *clicked_item,
|
||||
foreach (TimelineViewGhostItem *ghost, parent()->get_ghost_items()) {
|
||||
Rational ghost_ripple_point;
|
||||
|
||||
if (trim_mode == Timeline::k_trim_in) {
|
||||
if (trim_mode == TimelineApp::k_trim_in) {
|
||||
ghost_ripple_point = ghost->get_in();
|
||||
} else {
|
||||
ghost_ripple_point = ghost->get_out();
|
||||
@@ -63,33 +63,52 @@ void RippleTool::initiate_drag(Block *clicked_item,
|
||||
}
|
||||
|
||||
// For each track that does NOT have a ghost, we need to make one for Gaps
|
||||
foreach (Track *track, sequence()->get_tracks()) {
|
||||
if (track->is_locked()) {
|
||||
continue;
|
||||
}
|
||||
// (engine C ABI: per-type count + indexed access; type ordinals match
|
||||
// TrackReference::Type/OAKENGINE_TRACK_TYPE_*)
|
||||
auto *seq_handle = sequence();
|
||||
int track_counts[3] = { 0, 0, 0 };
|
||||
oakengine_sequence_track_count(seq_handle, &track_counts[0],
|
||||
&track_counts[1], &track_counts[2]);
|
||||
for (int track_type = 0; track_type < 3; track_type++) {
|
||||
for (int track_index = 0; track_index < track_counts[track_type];
|
||||
track_index++) {
|
||||
OakEngineTrack *track =
|
||||
oakengine_sequence_track_at(seq_handle, track_type,
|
||||
track_index);
|
||||
if (track_is_locked(track)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Determine if we've already created a ghost on this track
|
||||
bool ghost_on_this_track_exists = false;
|
||||
// Determine if we've already created a ghost on this track
|
||||
bool ghost_on_this_track_exists = false;
|
||||
|
||||
foreach (TimelineViewGhostItem *ghost, parent()->get_ghost_items()) {
|
||||
if (parent()->get_track_from_reference(ghost->get_track()) == track) {
|
||||
ghost_on_this_track_exists = true;
|
||||
break;
|
||||
foreach (TimelineViewGhostItem *ghost, parent()->get_ghost_items()) {
|
||||
if (parent()->get_track_from_reference(ghost->get_track()) ==
|
||||
track) {
|
||||
ghost_on_this_track_exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If there's no ghost on this track, create one
|
||||
if (!ghost_on_this_track_exists) {
|
||||
// Find the block that starts just after or at the ripple point
|
||||
Block *block_after_ripple =
|
||||
track->nearest_block_after_or_at(earliest_ripple);
|
||||
OakEngineBlock *block_after_ripple =
|
||||
oakengine_track_nearest_block_after_or_at(
|
||||
track,
|
||||
core::Timecode::time_to_timestamp(earliest_ripple,
|
||||
parent()->timebase()));
|
||||
|
||||
// Exception for out-transitions, do not create a gap between them
|
||||
if (block_after_ripple) {
|
||||
if (ClipBlock *prev_clip = dynamic_cast<ClipBlock *>(
|
||||
block_after_ripple->previous())) {
|
||||
if (prev_clip->out_transition() == block_after_ripple) {
|
||||
block_after_ripple = block_after_ripple->next();
|
||||
OakEngineBlock *prev_block =
|
||||
oakengine_block_prev(block_after_ripple);
|
||||
if (oakengine_node_is_clip(
|
||||
reinterpret_cast<OakEngineNode *>(prev_block))) {
|
||||
if (oakengine_clip_out_transition(prev_block) ==
|
||||
block_after_ripple) {
|
||||
block_after_ripple =
|
||||
oakengine_block_next(block_after_ripple);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,22 +117,30 @@ void RippleTool::initiate_drag(Block *clicked_item,
|
||||
if (block_after_ripple) {
|
||||
TimelineViewGhostItem *ghost;
|
||||
|
||||
if (dynamic_cast<GapBlock *>(block_after_ripple)) {
|
||||
if (oakengine_block_is_gap(block_after_ripple)) {
|
||||
// If this Block is already a Gap, ghost it now
|
||||
ghost = add_ghost_from_block(block_after_ripple, trim_mode);
|
||||
} else {
|
||||
// Well we need to ripple SOMETHING, it'll either be the previous block if it's a gap
|
||||
// or we'll have to create a new gap ourselves
|
||||
Block *previous = block_after_ripple->previous();
|
||||
OakEngineBlock *previous =
|
||||
oakengine_block_prev(block_after_ripple);
|
||||
|
||||
if (dynamic_cast<GapBlock *>(previous)) {
|
||||
if (oakengine_block_is_gap(previous)) {
|
||||
// Previous is a gap, that'll make a fine substitute
|
||||
ghost = add_ghost_from_block(previous, trim_mode);
|
||||
} else {
|
||||
// Previous is not a gap, we'll have to insert one there ourselves
|
||||
ghost = add_ghost_from_null(block_after_ripple->in(),
|
||||
block_after_ripple->in(),
|
||||
track->to_reference(),
|
||||
int in_num = 0, in_den = 1;
|
||||
oakengine_block_get_in_rational(
|
||||
reinterpret_cast<const OakEngineNode *>(
|
||||
block_after_ripple),
|
||||
&in_num, &in_den);
|
||||
Rational ripple_in(in_num, in_den);
|
||||
ghost = add_ghost_from_null(ripple_in,
|
||||
ripple_in,
|
||||
ghost_block_track_reference(
|
||||
block_after_ripple),
|
||||
trim_mode);
|
||||
ghost->set_data(TimelineViewGhostItem::k_reference_block,
|
||||
QtUtils::ptr_to_value(block_after_ripple));
|
||||
@@ -123,44 +150,45 @@ void RippleTool::initiate_drag(Block *clicked_item,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RippleTool::finish_drag(TimelineViewMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
|
||||
if (parent()->has_ghosts()) {
|
||||
QVector<QVector<oakengine_ripple_info>> info_list(Track::k_count);
|
||||
QVector<QVector<oakengine_ripple_info>> info_list(TrackReference::k_count);
|
||||
|
||||
foreach (TimelineViewGhostItem *ghost, parent()->get_ghost_items()) {
|
||||
if (!ghost->has_been_adjusted()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Track *track = parent()->get_track_from_reference(ghost->get_track());
|
||||
OakEngineTrack *track =
|
||||
parent()->get_track_from_reference(ghost->get_track());
|
||||
|
||||
oakengine_ripple_info info;
|
||||
Block *b = QtUtils::value_to_ptr<Block>(
|
||||
OakEngineBlock *b = QtUtils::value_to_ptr<OakEngineBlock>(
|
||||
ghost->get_data(TimelineViewGhostItem::k_attached_block));
|
||||
|
||||
if (b) {
|
||||
info.block = reinterpret_cast<OakEngineBlock *>(b);
|
||||
info.block = b;
|
||||
info.append_gap = 0;
|
||||
} else {
|
||||
info.block = reinterpret_cast<OakEngineBlock *>(
|
||||
QtUtils::value_to_ptr<Block>(
|
||||
ghost->get_data(TimelineViewGhostItem::k_reference_block)));
|
||||
info.block = QtUtils::value_to_ptr<OakEngineBlock>(
|
||||
ghost->get_data(TimelineViewGhostItem::k_reference_block));
|
||||
info.append_gap = 1;
|
||||
}
|
||||
info.track = reinterpret_cast<OakEngineTrack *>(track);
|
||||
info.track = track;
|
||||
|
||||
info_list[track->type()].append(info);
|
||||
info_list[oakengine_track_type(track)].append(info);
|
||||
}
|
||||
|
||||
void *command = oakengine_undo_command_create_multi();
|
||||
|
||||
Rational movement;
|
||||
|
||||
if (drag_movement_mode() == Timeline::k_trim_out) {
|
||||
if (drag_movement_mode() == TimelineApp::k_trim_out) {
|
||||
movement = parent()->get_ghost_items().first()->get_out_adjustment();
|
||||
} else {
|
||||
movement = parent()->get_ghost_items().first()->get_in_adjustment();
|
||||
@@ -171,7 +199,7 @@ void RippleTool::finish_drag(TimelineViewMouseEvent *event)
|
||||
oakengine_undo_command_multi_add_child(
|
||||
command,
|
||||
oakengine_sequence_ripple_tracks_command(
|
||||
reinterpret_cast<OakEngineSequence *>(sequence()), i,
|
||||
sequence(), i,
|
||||
info_list.at(i).constData(), info_list.at(i).size(),
|
||||
movement.numerator(), movement.denominator(),
|
||||
drag_movement_mode()));
|
||||
@@ -182,7 +210,7 @@ void RippleTool::finish_drag(TimelineViewMouseEvent *event)
|
||||
TimelineWidgetSelections new_sel = parent()->get_selections();
|
||||
TimelineViewGhostItem *reference_ghost =
|
||||
parent()->get_ghost_items().first();
|
||||
if (drag_movement_mode() == Timeline::k_trim_in) {
|
||||
if (drag_movement_mode() == TimelineApp::k_trim_in) {
|
||||
new_sel.trim_out(-reference_ghost->get_in_adjustment());
|
||||
} else {
|
||||
new_sel.trim_out(reference_ghost->get_out_adjustment());
|
||||
|
||||
Reference in New Issue
Block a user