Integrate dialog export and Apple service teams
This commit is contained in:
@@ -330,6 +330,42 @@ pp::foundation::Status export_equirectangular_from_document_snapshot(
|
||||
services);
|
||||
}
|
||||
|
||||
pp::foundation::Status export_depth_from_document_snapshot(
|
||||
App& app,
|
||||
const pp::app::DocumentDepthExportTarget& target,
|
||||
const LegacyDocumentExportSnapshotReports& reports)
|
||||
{
|
||||
auto exported = pp::paint_renderer::export_document_depth_pngs(
|
||||
pp::paint_renderer::DocumentDepthExportRenderPlanRequest {
|
||||
.document = &reports.snapshot.document,
|
||||
.frame_index = reports.snapshot.document.active_frame_index(),
|
||||
});
|
||||
if (!exported) {
|
||||
return exported.status();
|
||||
}
|
||||
|
||||
LOG(
|
||||
"export-depth document export PNG writer: %ux%u imageBytes=%llu depthBytes=%llu mergedFaceDraws=%zu layerDepthDraws=%zu visitedLayers=%zu visibleLayers=%zu facePayloads=%zu",
|
||||
exported.value().output_extent.width,
|
||||
exported.value().output_extent.height,
|
||||
static_cast<unsigned long long>(exported.value().image_encoded_bytes),
|
||||
static_cast<unsigned long long>(exported.value().depth_encoded_bytes),
|
||||
exported.value().merged_face_draw_count,
|
||||
exported.value().layer_depth_draw_count,
|
||||
exported.value().visited_layer_count,
|
||||
exported.value().visible_layer_count,
|
||||
exported.value().face_payload_count);
|
||||
|
||||
LegacyExportWriteServices services(app);
|
||||
return pp::app::execute_document_depth_export_write(
|
||||
target,
|
||||
pp::app::DocumentDepthExportPayload {
|
||||
.image_bytes = std::span<const std::byte>(exported.value().image_png),
|
||||
.depth_bytes = std::span<const std::byte>(exported.value().depth_png),
|
||||
},
|
||||
services);
|
||||
}
|
||||
|
||||
class LegacyDocumentExportServices final : public pp::app::DocumentExportServices {
|
||||
public:
|
||||
explicit LegacyDocumentExportServices(App& app) noexcept
|
||||
@@ -565,15 +601,29 @@ public:
|
||||
|
||||
const auto prepared = prepare_legacy_document_export_snapshot(app_, "export-depth");
|
||||
if (prepared) {
|
||||
const auto report = pp::app::make_document_canvas_save_snapshot_report(prepared.value().snapshot);
|
||||
const auto route = pp::app::plan_document_export_snapshot_route_for_current_platform(
|
||||
pp::app::DocumentExportExecutionKind::depth,
|
||||
report);
|
||||
if (!route.uses_document_snapshot_writer) {
|
||||
LOG(
|
||||
"export-depth document export writer retained legacy export: %.*s",
|
||||
static_cast<int>(route.fallback_reason.size()),
|
||||
route.fallback_reason.data());
|
||||
if (should_use_document_snapshot_writer(
|
||||
"export-depth",
|
||||
pp::app::DocumentExportExecutionKind::depth,
|
||||
prepared.value(),
|
||||
{})) {
|
||||
if (target) {
|
||||
const auto exported = export_depth_from_document_snapshot(app_, target.value(), prepared.value());
|
||||
if (exported.ok()) {
|
||||
show_export_success_dialog(
|
||||
app_,
|
||||
pp::app::plan_document_export_success_dialog(
|
||||
pp::app::DocumentExportSuccessKind::depth,
|
||||
pp::app::document_export_media_platform_destination(),
|
||||
app_.work_path));
|
||||
return;
|
||||
}
|
||||
|
||||
LOG("export-depth document export writer retained legacy export after failure: %s", exported.message);
|
||||
} else {
|
||||
LOG(
|
||||
"export-depth document export writer retained legacy export after target failure: %s",
|
||||
target.status().message);
|
||||
}
|
||||
}
|
||||
#if !__WEB__
|
||||
const auto plan = pp::paint_renderer::plan_document_depth_export_render(
|
||||
|
||||
Reference in New Issue
Block a user