Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions doc/libf3d/06-MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,12 @@ The callback takes an argument of type `f3d::interactor::interactor_state_t` all
## F3D_PLUGINS_PATH

When running F3D, it was possible to specify the path for loading plugins using the environment variable `F3D_PLUGINS_PATH`. This variable has been removed in favor of the CLI option `--plugins-path` which is more secure.

## Animation jump commands

The `jump_to_frame` and `jump_to_keyframe` commands no longer take a second boolean argument and now always perform an absolute jump. To perform a relative jump, use the new `jump_to_frame_relative` and `jump_to_keyframe_relative` commands:

- `jump_to_frame 10 false` -> `jump_to_frame 10`
- `jump_to_frame 1 true` -> `jump_to_frame_relative 1`
- `jump_to_keyframe 4 false` -> `jump_to_keyframe 4`
- `jump_to_keyframe 1 true` -> `jump_to_keyframe_relative 1`
41 changes: 25 additions & 16 deletions doc/user/07-COMMANDS.md
Comment thread
exbluesbreaker marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -75,28 +75,37 @@ Supports `front`, `top`, `right`, `back`, `bottom`, `left`, `isometric` argument

`toggle_animation_backward`: A specific command to start/stop the animation backward. No argument.

`jump_to_frame`: A specific command to load an animation at a specific frame, takes a number and a boolean as arguments.
`jump_to_frame`: A specific command to load an animation at a specific frame, takes a frame index as argument.
eg:

- `jump_to_frame 1 true` jump to next frame.
- `jump_to_frame -1 true` jump to previous frame.
- `jump_to_frame 0 false` jump to frame 0.
- `jump_to_frame 1 false` jump to frame 1.
- `jump_to_frame 10 false` jump to frame 10.
- `jump_to_frame -1 false` jump to last frame.
- `jump_to_frame -2 false` jump to second last frame.
- `jump_to_frame 0` jump to frame 0.
- `jump_to_frame 1` jump to frame 1.
- `jump_to_frame 10` jump to frame 10.
- `jump_to_frame -1` jump to last frame.
- `jump_to_frame -2` jump to second last frame.

`jump_to_keyframe`: A specific command to load an animation at a specific keyframe, takes a number and a boolean as arguments.
`jump_to_frame_relative`: A specific command to move the animation by a number of frames relative to the current frame, takes a frame offset as argument.
eg:

- `jump_to_frame_relative 1` jump to next frame.
- `jump_to_frame_relative -1` jump to previous frame.

`jump_to_keyframe`: A specific command to load an animation at a specific keyframe, takes a keyframe index as argument.
When jumping to a keyframe, the target keyframe index is adjusted to stay within the total number of available keyframes, avoiding invalid keyframe access.
eg:

- `jump_to_keyframe 0` jump to animation start frame.
- `jump_to_keyframe 1` jump to keyframe 1.
- `jump_to_keyframe 10` jump to keyframe 10.

`jump_to_keyframe_relative`: A specific command to move the animation by a number of keyframes relative to the current keyframe, takes a keyframe offset as argument.
When jumping between keyframes, the target keyframe index is adjusted to stay within the total number of available keyframes, avoiding invalid keyframe access.
eg:

- `jump_to_keyframe 1 true` jump to next keyframe.
- `jump_to_keyframe -1 true` jump to previous keyframe.
- `jump_to_keyframe 0 true` jump to closest keyframe.
- `jump_to_keyframe 0 false` jump to animation start frame.
- `jump_to_keyframe 1 false` jump to keyframe 1.
- `jump_to_keyframe 10 false` jump to keyframe 10.
- `jump_to_keyframe 10 true` jump 10 keyframes ahead.
- `jump_to_keyframe_relative 0` jump to closest keyframe.
- `jump_to_keyframe_relative 1` jump to next keyframe.
- `jump_to_keyframe_relative -1` jump to previous keyframe.
- `jump_to_keyframe_relative 10` jump 10 keyframes ahead.

This command is currently supported only by the following readers :

Expand Down
43 changes: 33 additions & 10 deletions library/src/interactor_impl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1112,15 +1112,28 @@ interactor& interactor_impl::initCommands()
},
command_documentation_t{ "roll_camera value", "roll the camera on its side" });

this->addCommand("jump_to_frame",
this->addCommand(
"jump_to_frame",
[&](const std::vector<std::string>& args)
{
check_args(args, 2, "jump_to_frame");
check_args(args, 1, "jump_to_frame");
const int frame = options::parse<int>(args[0]);
const bool relative = options::parse<bool>(args[1]);
this->Internals->AnimationManager->SetDeltaTime(this->Internals->CallbackDeltaTime);
this->Internals->AnimationManager->JumpToFrame(frame, relative);
});
this->Internals->AnimationManager->JumpToFrame(frame, false);
},
command_documentation_t{ "jump_to_frame index", "load animation at a specific frame" });

this->addCommand(
"jump_to_frame_relative",
[&](const std::vector<std::string>& args)
{
check_args(args, 1, "jump_to_frame_relative");
const int frame = options::parse<int>(args[0]);
this->Internals->AnimationManager->SetDeltaTime(this->Internals->CallbackDeltaTime);
this->Internals->AnimationManager->JumpToFrame(frame, true);
},
command_documentation_t{
"jump_to_frame_relative offset", "move animation a number of frames forward or backward" });

this->addCommand(
"elevation_camera",
Expand Down Expand Up @@ -1307,12 +1320,22 @@ interactor& interactor_impl::initCommands()
"jump_to_keyframe",
[&](const std::vector<std::string>& args)
{
check_args(args, 2, "jump_to_keyframe");
int keyframe = options::parse<int>(args[0]);
bool relative = options::parse<bool>(args[1]);
this->Internals->AnimationManager->JumpToKeyFrame(keyframe, relative);
check_args(args, 1, "jump_to_keyframe");
const int keyframe = options::parse<int>(args[0]);
this->Internals->AnimationManager->JumpToKeyFrame(keyframe, false);
},
command_documentation_t{ "jump_to_keyframe index", "jump to a specific animation keyframe" });

this->addCommand(
"jump_to_keyframe_relative",
[&](const std::vector<std::string>& args)
{
check_args(args, 1, "jump_to_keyframe_relative");
const int keyframe = options::parse<int>(args[0]);
this->Internals->AnimationManager->JumpToKeyFrame(keyframe, true);
},
command_documentation_t{ "jump_to_keyframe", "Jump to animation's key frame" });
command_documentation_t{
"jump_to_keyframe_relative offset", "move a number of keyframes forward or backward" });

this->addCommand(
"toggle_animation", [&](const std::vector<std::string>&) { this->toggleAnimation(); },
Expand Down
8 changes: 4 additions & 4 deletions testing/scripts/TestCommandScriptAxesGridAnimation.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
jump_to_frame 25 true
jump_to_frame 25 true
jump_to_frame 25 true
jump_to_frame 25 true
jump_to_frame_relative 25
jump_to_frame_relative 25
jump_to_frame_relative 25
jump_to_frame_relative 25
Original file line number Diff line number Diff line change
@@ -1 +1 @@
jump_to_keyframe 4 false
jump_to_keyframe 4
Original file line number Diff line number Diff line change
@@ -1 +1 @@
jump_to_keyframe 14 false
jump_to_keyframe 14
Original file line number Diff line number Diff line change
@@ -1 +1 @@
jump_to_keyframe 0 true
jump_to_keyframe_relative 0
2 changes: 1 addition & 1 deletion testing/scripts/TestCommandScriptJumpToFirstFrame.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
jump_to_frame 0 false
jump_to_frame 0
2 changes: 1 addition & 1 deletion testing/scripts/TestCommandScriptJumpToFirstKeyFrame.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
jump_to_keyframe 1 false
jump_to_keyframe 1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
jump_to_keyframe 17 false
jump_to_keyframe 17
2 changes: 1 addition & 1 deletion testing/scripts/TestCommandScriptJumpToLastFrame.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
jump_to_frame -1 false
jump_to_frame -1
2 changes: 1 addition & 1 deletion testing/scripts/TestCommandScriptJumpToMiddleFrame.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
jump_to_frame 20 false
jump_to_frame 20
Original file line number Diff line number Diff line change
@@ -1 +1 @@
jump_to_keyframe -17 false
jump_to_keyframe -17
8 changes: 4 additions & 4 deletions testing/scripts/TestCommandScriptJumpToNextFrame.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
jump_to_frame 1 true
jump_to_frame 1 true
jump_to_frame 1 true
jump_to_frame 1 true
jump_to_frame_relative 1
jump_to_frame_relative 1
jump_to_frame_relative 1
jump_to_frame_relative 1
2 changes: 1 addition & 1 deletion testing/scripts/TestCommandScriptJumpToNextKeyFrame.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
jump_to_keyframe 1 true
jump_to_keyframe_relative 1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
jump_to_keyframe 17 false
jump_to_keyframe 17
2 changes: 1 addition & 1 deletion testing/scripts/TestCommandScriptJumpToPreviousFrame.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
jump_to_frame -1 true
jump_to_frame_relative -1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
jump_to_keyframe -1 true
jump_to_keyframe_relative -1
2 changes: 1 addition & 1 deletion testing/scripts/TestCommandScriptJumpToStartKeyFrame.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
jump_to_keyframe 0 false
jump_to_keyframe 0