Add animation playback toggle boundary

This commit is contained in:
2026-06-03 16:47:02 +02:00
parent 5752bc6ae9
commit 603bb0c4e7
7 changed files with 217 additions and 26 deletions

View File

@@ -294,6 +294,7 @@ struct PlanAnimationOperationArgs {
int delta = 1;
int offset = 1;
int onion_size = 1;
bool playback_active = false;
};
struct PlanBrushOperationArgs {
@@ -993,6 +994,8 @@ const char* document_animation_operation_name(pp::app::DocumentAnimationOperatio
return "goto-previous";
case pp::app::DocumentAnimationOperation::playback_step:
return "playback-step";
case pp::app::DocumentAnimationOperation::toggle_playback:
return "toggle-playback";
case pp::app::DocumentAnimationOperation::set_onion_size:
return "set-onion-size";
}
@@ -1553,7 +1556,7 @@ void print_help()
<< " plan-layer-rename --old-name NAME --new-name NAME\n"
<< " plan-layer-menu --command clear|rename|merge [--no-current-layer] [--current-index N] [--animation-duration N] [--current-name NAME] [--lower-name NAME]\n"
<< " plan-layer-operation --kind add|duplicate|select|reorder|remove|opacity|visibility|alpha-lock|blend-mode|highlight [--layer-count N] [--index N] [--from-index N] [--to-index N] [--source-index N] [--name NAME] [--opacity N] [--blend-mode N] [--enabled]\n"
<< " plan-animation-operation --kind add|duplicate|remove|duration|move|select|goto|next|prev|playback|onion [--frame-count N] [--total-duration N] [--current-frame N] [--selected-frame N] [--layer-index N] [--layer-id N] [--current-duration N] [--delta N] [--offset N] [--onion-size N]\n"
<< " plan-animation-operation --kind add|duplicate|remove|duration|move|select|goto|next|prev|playback|toggle-playback|onion [--frame-count N] [--total-duration N] [--current-frame N] [--selected-frame N] [--layer-index N] [--layer-id N] [--current-duration N] [--delta N] [--offset N] [--onion-size N] [--playing]\n"
<< " plan-brush-operation --kind color|tip|pattern|dual|preset|settings [--path FILE] [--thumb FILE] [--r N] [--g N] [--b N] [--a N] [--no-brush]\n"
<< " plan-canvas-tool --kind draw|erase|line|camera|grid|copy|cut|fill|mask-free|mask-line|bucket|pick|touch-lock [--current-mode-draw]\n"
<< " plan-canvas-tool-state [--mode draw|erase|line|camera|grid|copy|cut|fill|mask-free|mask-line|bucket] [--picking] [--touch-lock]\n"
@@ -3857,6 +3860,8 @@ pp::foundation::Status parse_plan_animation_operation_args(
return pp::foundation::Status::invalid_argument("missing value for option");
}
args.kind = argv[++i];
} else if (key == "--playing") {
args.playback_active = true;
} else if (key == "--frame-count" || key == "--total-duration" || key == "--current-frame"
|| key == "--selected-frame" || key == "--current-duration" || key == "--delta"
|| key == "--offset" || key == "--onion-size" || key == "--layer-index"
@@ -3941,6 +3946,9 @@ pp::foundation::Result<pp::app::DocumentAnimationOperationPlan> make_animation_o
if (args.kind == "playback") {
return pp::app::plan_animation_playback_step(args.total_duration, args.current_frame, args.offset);
}
if (args.kind == "toggle-playback" || args.kind == "play-toggle") {
return pp::app::plan_animation_playback_toggle(args.playback_active);
}
if (args.kind == "onion") {
return pp::app::plan_animation_onion_size(args.onion_size);
}
@@ -3977,6 +3985,7 @@ int plan_animation_operation(int argc, char** argv)
<< ",\"delta\":" << args.delta
<< ",\"offset\":" << args.offset
<< ",\"onionSize\":" << args.onion_size
<< ",\"playbackActive\":" << json_bool(args.playback_active)
<< "},\"plan\":{\"operation\":\"" << document_animation_operation_name(value.operation)
<< "\",\"frameCount\":" << value.frame_count
<< ",\"currentFrame\":" << value.current_frame
@@ -3988,11 +3997,15 @@ int plan_animation_operation(int argc, char** argv)
<< ",\"durationDelta\":" << value.duration_delta
<< ",\"moveOffset\":" << value.move_offset
<< ",\"onionSize\":" << value.onion_size
<< ",\"playbackIdleMs\":" << value.playback_idle_ms
<< ",\"requiresSelectedFrame\":" << json_bool(value.requires_selected_frame)
<< ",\"mutatesDocument\":" << json_bool(value.mutates_document)
<< ",\"reloadsAnimationLayers\":" << json_bool(value.reloads_animation_layers)
<< ",\"updatesCanvasAnimation\":" << json_bool(value.updates_canvas_animation)
<< ",\"marksUnsaved\":" << json_bool(value.marks_unsaved)
<< ",\"playbackWasActive\":" << json_bool(value.playback_was_active)
<< ",\"playbackActive\":" << json_bool(value.playback_active)
<< ",\"resetsPlaybackTimer\":" << json_bool(value.resets_playback_timer)
<< "}}\n";
return 0;
}