Route export storage hooks through platform services

This commit is contained in:
2026-06-04 16:34:19 +02:00
parent 3c709f07e6
commit 6419645e03
12 changed files with 86 additions and 23 deletions

View File

@@ -204,6 +204,8 @@ public:
void end_render_capture_frame();
[[nodiscard]] bool platform_deletes_recorded_files_on_clear();
void clear_platform_recorded_files(std::string path);
void publish_exported_image(std::string path);
void flush_platform_storage();
[[nodiscard]] bool platform_enables_live_asset_reloading();
void update_platform_frame(float delta_time_seconds);
void report_rendered_frames(int frames);

View File

@@ -31,7 +31,6 @@
#include "oculus_vr.h"
#elif __WEB__
void webgl_pick_file(std::function<void(std::string)> callback);
void webgl_sync();
#endif
namespace {

View File

@@ -277,6 +277,16 @@ void App::clear_platform_recorded_files(std::string path)
active_platform_services().clear_recorded_files(path);
}
void App::publish_exported_image(std::string path)
{
active_platform_services().publish_exported_image(path);
}
void App::flush_platform_storage()
{
active_platform_services().flush_persistent_storage();
}
bool App::platform_enables_live_asset_reloading()
{
return active_platform_services().enables_live_asset_reloading();

View File

@@ -13,9 +13,6 @@
#ifdef __APPLE__
#include <Foundation/Foundation.h>
#import "objc_utils.h"
#elif __WEB__
void webgl_sync();
#endif
namespace {
@@ -2021,9 +2018,7 @@ void Canvas::export_equirectangular_thread(std::string file_path)
data.save_png(file_path);
}
#ifdef __IOS__
save_image_library(file_path);
#endif
App::I->publish_exported_image(file_path);
}
void Canvas::inject_xmp(std::string jpg_path)
@@ -2305,9 +2300,7 @@ void Canvas::export_cube_faces_thread(std::string file_name)
face.save_png(path);
pb->increment();
#ifdef __IOS__
save_image_library(path);
#endif
App::I->publish_exported_image(path);
#ifdef __OBJC__
[files addObject : [NSString stringWithUTF8String:path.c_str()] ];
#endif
@@ -2575,9 +2568,7 @@ bool Canvas::project_save_thread(std::string file_path, bool show_progress)
if (!sw.save(lapse_path))
LOG("cannot save timelase to %s", lapse_path.c_str());
}
#if __WEB__
webgl_sync();
#endif
App::I->flush_platform_storage();
}
if (show_progress)

View File

@@ -9,8 +9,6 @@
#ifdef __APPLE__
#include <Foundation/Foundation.h>
#elif __WEB__
void webgl_sync();
#endif
#include "canvas.h"
@@ -244,9 +242,7 @@ bool NodePanelBrush::save()
}
f.write((char*)sw.m_data.data(), sw.m_data.size());
f.close();
#if __WEB__
webgl_sync();
#endif
App::I->flush_platform_storage();
return true;
}
return false;

View File

@@ -41,6 +41,8 @@ public:
virtual void end_render_capture_frame() = 0;
[[nodiscard]] virtual bool deletes_recorded_files_on_clear() = 0;
virtual void clear_recorded_files(std::string_view recording_path) = 0;
virtual void publish_exported_image(std::string_view path) = 0;
virtual void flush_persistent_storage() = 0;
[[nodiscard]] virtual bool enables_live_asset_reloading() = 0;
virtual void update_platform_frame(float delta_time_seconds) = 0;
virtual void report_rendered_frames(int frames) = 0;

View File

@@ -18,6 +18,9 @@ std::string android_get_clipboard();
bool android_set_clipboard(const std::string& s);
#elif __APPLE__
void delete_all_files_in_path(const std::string& source_path);
#ifdef __IOS__
void save_image_library(const std::string& path);
#endif
#elif __LINUX__
#include <tinyfiledialogs.h>
std::string linux_home_path();
@@ -279,6 +282,22 @@ public:
#endif
}
void publish_exported_image(std::string_view path) override
{
#ifdef __IOS__
save_image_library(std::string(path));
#else
(void)path;
#endif
}
void flush_persistent_storage() override
{
#ifdef __WEB__
webgl_sync();
#endif
}
[[nodiscard]] bool enables_live_asset_reloading() override
{
#if defined(__OSX__)

View File

@@ -369,6 +369,15 @@ public:
(void)recording_path;
}
void publish_exported_image(std::string_view path) override
{
(void)path;
}
void flush_persistent_storage() override
{
}
[[nodiscard]] bool enables_live_asset_reloading() override
{
return true;