Skip to content

Commit 983e4cf

Browse files
Implement imgui animation progress bar
Draw an interactive progress bar at the bottom of the view during playback. Click or drag it to jump to a point in time. --animation-progress becomes a mode string instead of a flag: none, default (the bar alone), or advanced (adds time range, animation name, current time, keyframe markers and a hover tooltip). Seeking is backed by a new jump_to_time command (time in seconds plus a relative flag), wired through the ImGui actor, renderer and animation manager so the bar tracks playback.
1 parent c210414 commit 983e4cf

27 files changed

Lines changed: 450 additions & 59 deletions

File tree

application/F3DStarter.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1917,7 +1917,7 @@ void F3DStarter::SaveScreenshot(const std::string& filenameTemplate, bool minima
19171917
options.ui.filename = false;
19181918
options.ui.fps = false;
19191919
options.ui.metadata = false;
1920-
options.ui.animation_progress = false;
1920+
options.ui.animation_progress = "none";
19211921
options.ui.axis = false;
19221922
options.render.grid.enable = false;
19231923
noBackground = true;

doc/libf3d/03-OPTIONS.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -559,11 +559,14 @@ CLI: `--loading-progress`.
559559

560560
Set loader progress bar color.
561561

562-
### `ui.animation_progress` (_bool_, default: `false`, **on load**)
562+
### `ui.animation_progress` (_string_, default: `none`, **on load**)
563563

564-
Show a _progress bar_ when playing the animation.
564+
Control the _progress bar_ shown when playing the animation. Can be `none` (hidden),
565+
`default` (only the progress bar, which can be clicked or dragged to jump to a
566+
time) or `advanced` (the progress bar plus time range, animation name and current
567+
time labels, with a marker for each keyframe).
565568

566-
CLI: `--animation-progress`.
569+
CLI: `--animation-progress`. A bare `--animation-progress` implies `default`.
567570

568571
### `ui.animation_progress_color` (_color_, default: `f3d_blue`)
569572

doc/user/05-ANIMATIONS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Press <kbd>W</kbd> to cycle through available animations
2020

2121
<img width="1024" alt="4" src="https://media.githubusercontent.com/media/f3d-app/f3d-website/refs/heads/main/docs/user/animation_3.png" />
2222
Press <kbd>space</kbd> to play/pause current animation.
23-
Note: A blue bar runs along the bottom of screen to indicate the current time interval of the animation sequence if animation-progress was turned on.
23+
Note: A blue bar runs along the bottom of screen to indicate the current time interval of the animation sequence if `--animation-progress` is set to `default` or `advanced`. The `advanced` mode additionally shows the time range, animation name and current time, and marks each keyframe with a vertical line on the bar; both modes let you click or drag the bar to jump to a given time. While hovering the `advanced` bar near a keyframe marker, the tooltip reports that keyframe's time.
2424

2525
<img width="1024" alt="5" src="https://media.githubusercontent.com/media/f3d-app/f3d-website/refs/heads/main/docs/user/animation_4.png" />
2626
"All Animations" will play all animations at the same time if supported by the file format.
@@ -67,7 +67,7 @@ See [Filename templating](03-OPTIONS.md#filename-templating) for more template v
6767
- Press <kbd>Space</kbd> to play/pause animation
6868
- Press <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Space</kbd> to play/pause animation backward
6969

70-
See [COMMANDS](07-COMMANDS.md) for commands like `jump_to_frame`
70+
See [COMMANDS](07-COMMANDS.md) for commands like `jump_to_frame` and `jump_to_time`
7171

7272
## Cycling Animations
7373

doc/user/07-COMMANDS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,16 @@ eg:
8686
- `jump_to_frame -1 false` jump to last frame.
8787
- `jump_to_frame -2 false` jump to second last frame.
8888

89+
`jump_to_time`: A specific command to load an animation at a specific time, takes a number (in seconds) and a boolean as arguments.
90+
When relative is false, a negative time is counted from the end of the animation.
91+
When relative is true, the time is added to the current animation time.
92+
eg:
93+
94+
- `jump_to_time 2.5 false` jump to time 2.5 seconds.
95+
- `jump_to_time -1.5 false` jump to 1.5 seconds before the end.
96+
- `jump_to_time 0.5 true` jump 0.5 seconds forward.
97+
- `jump_to_time -0.5 true` jump 0.5 seconds backward.
98+
8999
`jump_to_keyframe`: A specific command to load an animation at a specific keyframe, takes a number and a boolean as arguments.
90100
When jumping between keyframes, the target keyframe index is adjusted to stay within the total number of available keyframes, avoiding invalid keyframe access.
91101
eg:

examples/libf3d/c/interactive-app/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ int main(int argc, char** argv)
4444
f3d_options_set_as_bool(options, "render.show_edges", 1);
4545
f3d_options_set_as_bool(options, "ui.axis", 1);
4646
f3d_options_set_as_bool(options, "ui.fps", 1);
47-
f3d_options_set_as_bool(options, "ui.animation_progress", 1);
47+
f3d_options_set_as_string(options, "ui.animation_progress", "default");
4848
f3d_options_set_as_bool(options, "ui.filename", 1);
4949

5050
f3d_scene_t* scene = f3d_engine_get_scene(engine);

examples/libf3d/cpp/in-situ/main.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ int main(int argc, char** argv)
9898

9999
opt.ui.axis = true;
100100
opt.ui.fps = true;
101-
opt.ui.animation_progress = true;
101+
opt.ui.animation_progress = "default";
102102
opt.ui.scalar_bar = true;
103103
opt.ui.notifications.enable = true;
104104

examples/libf3d/cpp/interactive-app/main.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ int main(int argc, char** argv)
185185
// UI overlays: axis + some HUD
186186
opt.ui.axis = true;
187187
opt.ui.fps = true;
188-
opt.ui.animation_progress = true;
188+
opt.ui.animation_progress = "default";
189189
opt.ui.filename = true;
190190

191191
// FXAA + tone mapping

examples/libf3d/java/interactive-app/InteractiveApp.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static void main(String[] args) {
3333

3434
options.setAsBool("ui.axis", true);
3535
options.setAsBool("ui.fps", true);
36-
options.setAsBool("ui.animation_progress", true);
36+
options.setAsString("ui.animation_progress", "default");
3737
options.setAsBool("ui.filename", true);
3838

3939
Scene scene = engine.getScene();

examples/libf3d/python/in-situ/in_situ.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def main(argv=None):
197197
"render.effect.tone_mapping": True,
198198
"ui.axis": True,
199199
"ui.fps": True,
200-
"ui.animation_progress": True,
200+
"ui.animation_progress": "default",
201201
"ui.scalar_bar": True,
202202
"ui.notifications.enable": True,
203203
"scene.up_direction": [0.0, 0.0, 1.0],

examples/libf3d/python/interactive-app/interactive_app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def main(argv: list[str] | None = None):
2929
# UI overlays: axis + some HUD
3030
"ui.axis": True,
3131
"ui.fps": True,
32-
"ui.animation_progress": True,
32+
"ui.animation_progress": "default",
3333
"ui.filename": True,
3434
# FXAA + tone mapping
3535
"render.effect.antialiasing.enable": True,

0 commit comments

Comments
 (0)