Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions doc/user/07-COMMANDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ eg: `cycle_coloring array`.
`roll_camera value`: A specific command to roll the camera on its side, takes an angle in degrees as an argument.
eg: `roll_camera 120`.

`set camera_position x y z`: A specific command to set the position of the camera to the position of x y z.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should be a single set_camera command that suppot both x,y,z and top/bottom

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Meakk this was my recommendation, but lets discuss that on discord

eg: `set_camera_position 1.0 1.0 1.0`.

`elevation_camera value`: A specific command to tilt the camera up or down, takes an angle in degrees as an argument.
eg: `elevation_camera 120`.

Expand Down
19 changes: 19 additions & 0 deletions library/src/interactor_impl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,25 @@ interactor& interactor_impl::initCommands()
},
command_documentation_t{ "roll_camera value", "roll the camera on its side" });

this->addCommand(
"set_camera",
[&](const std::vector<std::string>& args)
{
if (this->Internals->Options.interactor.style == "2d")
{
return;
}
check_args(args, 3, "roll_camera");
this->Internals->Window.getCamera().position(
options::parse<float>(args[0])
options::parse<float>(args[1])
options::parse<float>(args[2])
);
this->Internals->Style->SetTemporaryUp(
this->Internals->Window.getCamera().getViewUp().data());
},
command_documentation_t{ "set_camera x y z", "Sets the position of the camera to the x y z position" });

this->addCommand("jump_to_frame",
[&](const std::vector<std::string>& args)
{
Expand Down
1 change: 1 addition & 0 deletions library/testing/TestSDKInteractorCommand.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ int TestSDKInteractorCommand([[maybe_unused]] int argc, [[maybe_unused]] char* a
f3d::point3_t posBefore = cam.getPosition();
inter.triggerCommand("set_camera front");
inter.triggerCommand("roll_camera 90");
inter.triggerCommand("set_camera_position 1.0 1.0 1.0");
inter.triggerCommand("elevation_camera 90");
inter.triggerCommand("azimuth_camera 90");
test("camera commands no-op in 2d mode", cam.getPosition() == posBefore);
Expand Down
Loading