Add multi-layer PPI save automation
This commit is contained in:
@@ -36,6 +36,7 @@ struct SaveProjectArgs {
|
||||
std::uint32_t width = 0;
|
||||
std::uint32_t height = 0;
|
||||
std::string layer_name = "Ink";
|
||||
std::uint32_t layers = 1;
|
||||
std::uint32_t frames = 1;
|
||||
std::uint32_t frame_duration_ms = 100;
|
||||
bool include_test_face_payload = false;
|
||||
@@ -178,7 +179,7 @@ void print_help()
|
||||
<< " load-project --path FILE\n"
|
||||
<< " parse-layout --path FILE\n"
|
||||
<< " record-render [--width N] [--height N]\n"
|
||||
<< " save-project --path FILE --width N --height N [--layer-name NAME] [--frames N] [--frame-duration-ms N] [--include-test-face-payload]\n"
|
||||
<< " save-project --path FILE --width N --height N [--layer-name NAME] [--layers N] [--frames N] [--frame-duration-ms N] [--include-test-face-payload]\n"
|
||||
<< " simulate-document-edits [--width N] [--height N]\n"
|
||||
<< " simulate-document-history [--width N] [--height N] [--history N]\n"
|
||||
<< " simulate-image-import [--width N] [--height N]\n"
|
||||
@@ -298,7 +299,8 @@ pp::foundation::Status parse_save_project_args(int argc, char** argv, SaveProjec
|
||||
} else {
|
||||
args.layer_name = argv[++i];
|
||||
}
|
||||
} else if (key == "--width" || key == "--height" || key == "--frames" || key == "--frame-duration-ms") {
|
||||
} else if (key == "--width" || key == "--height" || key == "--layers" || key == "--frames"
|
||||
|| key == "--frame-duration-ms") {
|
||||
if (i + 1 >= argc) {
|
||||
return pp::foundation::Status::invalid_argument("missing value for option");
|
||||
}
|
||||
@@ -312,6 +314,8 @@ pp::foundation::Status parse_save_project_args(int argc, char** argv, SaveProjec
|
||||
args.width = value.value();
|
||||
} else if (key == "--height") {
|
||||
args.height = value.value();
|
||||
} else if (key == "--layers") {
|
||||
args.layers = value.value();
|
||||
} else if (key == "--frames") {
|
||||
args.frames = value.value();
|
||||
} else {
|
||||
@@ -336,6 +340,10 @@ pp::foundation::Status parse_save_project_args(int argc, char** argv, SaveProjec
|
||||
return pp::foundation::Status::invalid_argument("layer name must not be empty");
|
||||
}
|
||||
|
||||
if (args.layers == 0) {
|
||||
return pp::foundation::Status::invalid_argument("layer count must be greater than zero");
|
||||
}
|
||||
|
||||
if (args.frames == 0) {
|
||||
return pp::foundation::Status::invalid_argument("frame count must be greater than zero");
|
||||
}
|
||||
@@ -371,6 +379,7 @@ int save_project(int argc, char** argv)
|
||||
.width = args.width,
|
||||
.height = args.height,
|
||||
.layer_name = args.layer_name,
|
||||
.layer_count = args.layers,
|
||||
.frame_count = args.frames,
|
||||
.frame_duration_ms = args.frame_duration_ms,
|
||||
.dirty_faces = args.include_test_face_payload
|
||||
@@ -401,7 +410,7 @@ int save_project(int argc, char** argv)
|
||||
<< ",\"bytes\":" << bytes.size()
|
||||
<< ",\"document\":{\"width\":" << args.width
|
||||
<< ",\"height\":" << args.height
|
||||
<< ",\"layers\":1"
|
||||
<< ",\"layers\":" << args.layers
|
||||
<< ",\"frames\":" << args.frames
|
||||
<< ",\"layerName\":\"" << json_escape(args.layer_name) << "\""
|
||||
<< ",\"frameDurationMs\":" << args.frame_duration_ms
|
||||
|
||||
Reference in New Issue
Block a user