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:
2026-07-26 22:43:21 +08:00
parent f95590e924
commit 0aa5879f35
256 changed files with 12357 additions and 4044 deletions
+17 -6
View File
@@ -21,6 +21,9 @@
#include "multicamdisplay.h"
#include "oakengine/display.h"
#include "oakengine/node.h"
namespace olive
{
@@ -45,15 +48,20 @@ void MulticamDisplay::on_paint()
p.setBrush(Qt::NoBrush);
int rows, cols;
node_->get_rows_and_columns(&rows, &cols);
oakengine_multicam_get_rows_and_columns(
oakengine_multicam_get_source_count(
reinterpret_cast<OakEngineNode *>(node_)),
&rows, &cols);
int multi = std::max(rows, cols);
int cell_width = width() / multi;
int cell_height = height() / multi;
int col, row;
node_->index_to_row_cols(node_->get_current_source(), rows, cols, &row,
&col);
int current_source = oakengine_multicam_get_current_source(
reinterpret_cast<OakEngineNode *>(node_));
oakengine_multicam_index_to_row_cols(
current_source, rows, cols, &row, &col);
QRect r(cell_width * col, cell_height * row, cell_width, cell_height);
p.drawRect(generate_world_transform().mapRect(r));
@@ -70,10 +78,13 @@ TexturePtr MulticamDisplay::load_custom_texture_from_frame(const QVariant &v)
if (v.canConvert<QVector<TexturePtr>>()) {
QVector<TexturePtr> tex = v.value<QVector<TexturePtr>>();
TexturePtr main = renderer()->create_texture(this->get_viewport_params());
TexturePtr main;
const VideoParams main_params = this->get_viewport_params();
oakengine_display_renderer_create_texture(renderer(), &main_params,
nullptr, 0, &main);
int rows, cols;
MultiCamNode::get_rows_and_columns(tex.size(), &rows, &cols);
oakengine_multicam_get_rows_and_columns(tex.size(), &rows, &cols);
if (shader_.isNull() || rows_ != rows || cols_ != cols) {
if (!shader_.isNull()) {
@@ -91,7 +102,7 @@ TexturePtr MulticamDisplay::load_custom_texture_from_frame(const QVariant &v)
for (int i = 0; i < tex.size(); i++) {
int c, r;
MultiCamNode::index_to_row_cols(i, rows, cols, &r, &c);
oakengine_multicam_index_to_row_cols(i, rows, cols, &r, &c);
job.insert(QStringLiteral("tex_%1_%2")
.arg(QString::number(r), QString::number(c)),
NodeValue(NodeValue::k_texture, tex.at(i)));
+79 -35
View File
@@ -21,9 +21,14 @@
#include "multicamwidget.h"
#include "oakengine/node.h"
#include <QShortcut>
#include "node/nodeundo.h"
#include "oakengine/events.h"
#include "oakengine/viewer.h"
#include "oakengine/timeline.h"
#include "oakengine/undo.h"
#include "timeline/timelineundosplit.h"
#include "widget/timeruler/timeruler.h"
@@ -98,21 +103,41 @@ void MulticamWidget::set_multicam_node(ViewerOutput *viewer, MultiCamNode *n,
void MulticamWidget::ConnectNodeEvent(ViewerOutput *n)
{
connect(n, &ViewerOutput::size_changed, sizer_, &ViewerSizer::set_child_size);
connect(n, &ViewerOutput::pixel_aspect_changed, sizer_,
&ViewerSizer::set_pixel_aspect_ratio);
OakEngineNode *handle = reinterpret_cast<OakEngineNode *>(n);
VideoParams vp = n->get_video_params();
sizer_->set_child_size(vp.width(), vp.height());
sizer_->set_pixel_aspect_ratio(vp.pixel_aspect_ratio());
viewer_sub_ = oakengine_event_subscribe(
handle, OAKENGINE_EVENT_VIEWER_SIZE_CHANGED,
[](const oakengine_event *event, void *userdata) {
auto *w = static_cast<MulticamWidget *>(userdata);
w->sizer_->set_child_size(int(event->a), int(event->b));
},
this);
viewer_sub2_ = oakengine_event_subscribe(
handle, OAKENGINE_EVENT_VIEWER_PIXEL_ASPECT_CHANGED,
[](const oakengine_event *event, void *userdata) {
auto *w = static_cast<MulticamWidget *>(userdata);
w->sizer_->set_pixel_aspect_ratio(
Rational(event->a, event->b));
},
this);
oak_video_params vp;
oakengine_viewer_get_video_params(handle, 0, &vp);
sizer_->set_child_size(vp.width, vp.height);
sizer_->set_pixel_aspect_ratio(
Rational(vp.pixel_aspect_num, vp.pixel_aspect_den));
}
void MulticamWidget::DisconnectNodeEvent(ViewerOutput *n)
{
disconnect(n, &ViewerOutput::size_changed, sizer_,
&ViewerSizer::set_child_size);
disconnect(n, &ViewerOutput::pixel_aspect_changed, sizer_,
&ViewerSizer::set_pixel_aspect_ratio);
if (viewer_sub_ > 0) {
oakengine_event_unsubscribe(viewer_sub_);
viewer_sub_ = 0;
}
if (viewer_sub2_ > 0) {
oakengine_event_unsubscribe(viewer_sub2_);
viewer_sub2_ = 0;
}
}
void MulticamWidget::TimeChangedEvent(const Rational &t)
@@ -134,12 +159,11 @@ void MulticamWidget::Switch(int source, bool split_clip)
return;
}
MultiUndoCommand *command = new MultiUndoCommand();
MultiCamNode *cam = node_;
ClipBlock *clip = clip_;
BlockSplitPreservingLinksCommand *split = nullptr;
const QByteArray undo_name = tr("Switched Multi-Camera Source").toUtf8();
oakengine_undo_group_begin(undo_name.constData());
if (clip_ && split_clip &&
clip_->in() < get_connected_node()->get_playhead() &&
@@ -149,33 +173,50 @@ void MulticamWidget::Switch(int source, bool split_clip)
blocks.append(clip_);
blocks.append(clip_->block_links());
split = new BlockSplitPreservingLinksCommand(
blocks, { get_connected_node()->get_playhead() });
split->redo_now();
command->add_child(split);
int split_tbn = 0, split_tbd = 0;
oakengine_node_frame_time_base(
reinterpret_cast<OakEngineNode *>(get_connected_node()),
&split_tbn, &split_tbd);
void *split = oakengine_block_split_preserving_links_command(
reinterpret_cast<void *const *>(blocks.data()), blocks.size(),
olive::core::Timecode::time_to_timestamp(
get_connected_node()->get_playhead(),
olive::Rational(split_tbn, split_tbd),
olive::core::Timecode::k_round));
oakengine_undo_push(split, undo_name.constData());
clip = reinterpret_cast<ClipBlock *>(
oakengine_block_split_get_split(
split, reinterpret_cast<void *>(clip_), 0));
clip = static_cast<ClipBlock *>(split->get_split(clip_, 0));
cam = clip->find_multicam();
cam = reinterpret_cast<MultiCamNode *>(
oakengine_clip_find_multicam(reinterpret_cast<OakEngineNode *>(clip)));
}
command->add_child(new NodeParamSetStandardValueCommand(
NodeKeyframeTrackReference(NodeInput(cam, cam->k_current_input)),
source));
oak_node_value val;
memset(&val, 0, sizeof(val));
val.type = OAK_NODE_VALUE_INT;
val.num = source;
for (Block *link : clip->block_links()) {
if (ClipBlock *clink = dynamic_cast<ClipBlock *>(link)) {
if (MultiCamNode *mlink = clink->find_multicam()) {
command->add_child(new NodeParamSetStandardValueCommand(
NodeKeyframeTrackReference(
NodeInput(mlink, mlink->k_current_input)),
source));
if (cam) {
oakengine_node_set_input(
reinterpret_cast<OakEngineNode *>(cam),
oakengine_multicam_input_current(), &val);
}
if (clip) {
for (Block *link : clip->block_links()) {
if (ClipBlock *clink = dynamic_cast<ClipBlock *>(link)) {
if (MultiCamNode *mlink = reinterpret_cast<MultiCamNode *>(
oakengine_clip_find_multicam(reinterpret_cast<OakEngineNode *>(clink)))) {
oakengine_node_set_input(
reinterpret_cast<OakEngineNode *>(mlink),
oakengine_multicam_input_current(), &val);
}
}
}
}
Core::instance()->undo_stack()->push(command,
tr("Switched Multi-Camera Source"));
oakengine_undo_group_end();
display_->update();
@@ -198,14 +239,17 @@ void MulticamWidget::display_clicked(const QPoint &p)
}
int rows, cols;
node_->get_rows_and_columns(&rows, &cols);
oakengine_multicam_get_rows_and_columns(
oakengine_multicam_get_source_count(
reinterpret_cast<OakEngineNode *>(node_)),
&rows, &cols);
int multi = std::max(cols, rows);
int c = click.x() / (width / multi);
int r = click.y() / (height / multi);
int source = node_->rows_cols_to_index(r, c, rows, cols);
int source = oakengine_multicam_rows_cols_to_index(r, c, rows, cols);
Switch(source, true);
}
+5
View File
@@ -23,6 +23,8 @@
#define OAK_MULTICAMWIDGET_H
#include "multicamdisplay.h"
#include <cstdint>
#include "node/input/multicam/multicamnode.h"
#include "widget/viewer/viewer.h"
@@ -58,6 +60,9 @@ private:
ViewerSizer *sizer_;
int64_t viewer_sub_ = 0;
int64_t viewer_sub2_ = 0;
MulticamDisplay *display_;
MultiCamNode *node_;