Plan cube export face targets in app core

This commit is contained in:
2026-06-05 20:00:25 +02:00
parent 27e7c60413
commit af28da4e83
9 changed files with 159 additions and 37 deletions

View File

@@ -2384,7 +2384,7 @@ void print_help()
<< " plan-document-session-prompt --kind close-unsaved|save-before-workflow|new-document-overwrite|file-overwrite|save-error [--name NAME]\n"
<< " plan-export-start [--requires-license] [--demo] [--no-canvas]\n"
<< " plan-export-menu --kind jpeg|png|layers|cube-faces|depth|animation-frames|animation-mp4|timelapse [--demo] [--no-canvas]\n"
<< " plan-export-target --kind file|collection|stem|name --doc-name NAME [--work-dir DIR] [--directory DIR] [--extension EXT] [--suffix SUFFIX]\n"
<< " plan-export-target --kind file|collection|stem|cube-faces|name --doc-name NAME [--work-dir DIR] [--directory DIR] [--extension EXT] [--suffix SUFFIX]\n"
<< " plan-export-message --kind equirectangular|layers|animation-frames|depth|cube-faces|animation-mp4|timelapse --destination photos|pictures|files|work|path|success|suppressed [--detail TEXT]\n"
<< " plan-export-report --kind license-disabled|equirectangular|layers|animation-frames|depth|cube-faces|animation-mp4|timelapse [--message TEXT]\n"
<< " plan-cloud-upload [--no-canvas] [--new-document] [--unsaved]\n"
@@ -9637,7 +9637,8 @@ pp::foundation::Status parse_plan_export_target_args(
return pp::foundation::Status::invalid_argument("document name must not be empty");
}
if ((args.kind == "file" || args.kind == "collection") && args.work_directory.empty()) {
if ((args.kind == "file" || args.kind == "collection" || args.kind == "cube-faces")
&& args.work_directory.empty()) {
return pp::foundation::Status::invalid_argument("work directory must not be empty");
}
@@ -9653,7 +9654,8 @@ pp::foundation::Status parse_plan_export_target_args(
return pp::foundation::Status::invalid_argument("suffix must not be empty");
}
if (args.kind != "file" && args.kind != "collection" && args.kind != "stem" && args.kind != "name") {
if (args.kind != "file" && args.kind != "collection" && args.kind != "stem"
&& args.kind != "cube-faces" && args.kind != "name") {
return pp::foundation::Status::invalid_argument("unknown export target kind");
}
@@ -9716,6 +9718,31 @@ int plan_export_target(int argc, char** argv)
return 0;
}
if (args.kind == "cube-faces") {
const auto target = pp::app::make_document_cube_face_export_target(
args.work_directory,
args.document_name);
if (!target) {
print_error("plan-export-target", target.status().message);
return 2;
}
std::cout << "{\"ok\":true,\"command\":\"plan-export-target\""
<< ",\"kind\":\"cube-faces\",\"target\":{\"faceCount\":" << target.value().face_count
<< ",\"faces\":[";
for (std::size_t face_index = 0; face_index < target.value().face_count; ++face_index) {
if (face_index != 0U) {
std::cout << ",";
}
const auto& face = target.value().faces[face_index];
std::cout << "{\"name\":\"" << json_escape(face.face_name)
<< "\",\"path\":\"" << json_escape(face.path)
<< "\"}";
}
std::cout << "]}}\n";
return 0;
}
const auto target = pp::app::make_document_export_suggested_name(args.document_name, args.suffix);
if (!target) {
print_error("plan-export-target", target.status().message);