Route collection export targets through platform policy
This commit is contained in:
@@ -53,6 +53,57 @@ namespace {
|
||||
return false;
|
||||
}
|
||||
|
||||
void start_document_export_collection(
|
||||
App& app,
|
||||
pp::app::DocumentExportCollectionKind kind,
|
||||
const char* message_title,
|
||||
const char* collection_log_message,
|
||||
const char* stem_log_message)
|
||||
{
|
||||
const auto plan = pp::app::plan_document_export_collection_target(
|
||||
kind,
|
||||
app.uses_work_directory_document_export_collections());
|
||||
|
||||
if (plan.destination == pp::app::DocumentExportCollectionDestination::work_directory_collection) {
|
||||
const auto target = pp::app::make_document_export_collection_target(
|
||||
app.work_path,
|
||||
app.doc_name,
|
||||
plan.suffix);
|
||||
if (!target) {
|
||||
app.message_box(message_title, target.status().message);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto status = pp::panopainter::execute_legacy_document_export_collection(
|
||||
app,
|
||||
plan.kind,
|
||||
target.value());
|
||||
if (!status.ok())
|
||||
LOG("%s: %s", collection_log_message, status.message);
|
||||
return;
|
||||
}
|
||||
|
||||
app.pick_dir([
|
||||
&app,
|
||||
kind = plan.kind,
|
||||
title = std::string(message_title),
|
||||
log_message = std::string(stem_log_message)
|
||||
](std::string path) {
|
||||
const auto target = pp::app::make_document_export_stem_target(path, app.doc_name);
|
||||
if (!target) {
|
||||
app.message_box(title, target.status().message);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto status = pp::panopainter::execute_legacy_document_export_stem(
|
||||
app,
|
||||
kind,
|
||||
target.value());
|
||||
if (!status.ok())
|
||||
LOG("%s: %s", log_message.c_str(), status.message);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
std::shared_ptr<NodeProgressBar> App::show_progress(const std::string& title, int total /*= 0*/)
|
||||
@@ -361,35 +412,12 @@ void App::dialog_export_layers()
|
||||
if (!can_start_document_export(*this, true))
|
||||
return;
|
||||
|
||||
#if defined(__IOS__)
|
||||
const auto target = pp::app::make_document_export_collection_target(work_path, doc_name, "_layers");
|
||||
if (!target) {
|
||||
message_box("Export Layers", target.status().message);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto status = pp::panopainter::execute_legacy_document_export_collection(
|
||||
start_document_export_collection(
|
||||
*this,
|
||||
pp::app::DocumentExportCollectionKind::layers,
|
||||
target.value());
|
||||
if (!status.ok())
|
||||
LOG("Document layer collection export failed: %s", status.message);
|
||||
#else
|
||||
pick_dir([this](std::string path) {
|
||||
const auto target = pp::app::make_document_export_stem_target(path, doc_name);
|
||||
if (!target) {
|
||||
message_box("Export Layers", target.status().message);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto status = pp::panopainter::execute_legacy_document_export_stem(
|
||||
*this,
|
||||
pp::app::DocumentExportCollectionKind::layers,
|
||||
target.value());
|
||||
if (!status.ok())
|
||||
LOG("Document layer stem export failed: %s", status.message);
|
||||
});
|
||||
#endif
|
||||
"Export Layers",
|
||||
"Document layer collection export failed",
|
||||
"Document layer stem export failed");
|
||||
}
|
||||
|
||||
void App::dialog_export_anim_frames()
|
||||
@@ -397,35 +425,12 @@ void App::dialog_export_anim_frames()
|
||||
if (!can_start_document_export(*this, true))
|
||||
return;
|
||||
|
||||
#if defined(__IOS__)
|
||||
const auto target = pp::app::make_document_export_collection_target(work_path, doc_name, "_frames");
|
||||
if (!target) {
|
||||
message_box("Export Layers", target.status().message);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto status = pp::panopainter::execute_legacy_document_export_collection(
|
||||
start_document_export_collection(
|
||||
*this,
|
||||
pp::app::DocumentExportCollectionKind::animation_frames,
|
||||
target.value());
|
||||
if (!status.ok())
|
||||
LOG("Document animation frame collection export failed: %s", status.message);
|
||||
#else
|
||||
pick_dir([this](std::string path) {
|
||||
const auto target = pp::app::make_document_export_stem_target(path, doc_name);
|
||||
if (!target) {
|
||||
message_box("Export Layers", target.status().message);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto status = pp::panopainter::execute_legacy_document_export_stem(
|
||||
*this,
|
||||
pp::app::DocumentExportCollectionKind::animation_frames,
|
||||
target.value());
|
||||
if (!status.ok())
|
||||
LOG("Document animation frame stem export failed: %s", status.message);
|
||||
});
|
||||
#endif
|
||||
"Export Layers",
|
||||
"Document animation frame collection export failed",
|
||||
"Document animation frame stem export failed");
|
||||
}
|
||||
|
||||
void App::dialog_export_depth()
|
||||
|
||||
Reference in New Issue
Block a user