Skip to content

Commit

Permalink
use consistent style for documenting python arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
djkeyes committed Oct 4, 2023
1 parent 5c2523a commit ddbab0b
Showing 1 changed file with 70 additions and 67 deletions.
137 changes: 70 additions & 67 deletions cpp/pybind/visualization/o3dvisualizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,17 @@ void pybind_o3dvisualizer(py::module& m) {
"close",
"callback"_a)
.def("show_menu", &O3DVisualizer::ShowMenu,
"show_menu(show): shows or hides the menu in the window, "
"except on macOS since the menubar is not in the window "
"and all applications must have a menubar.")
"Shows or hides the menu in the window, except on macOS since "
"the menubar is not in the window and all applications must "
"have a menubar.",
"show"_a)
// from O3DVisualizer
.def("add_action", &O3DVisualizer::AddAction,
"Adds a button to the custom actions section of the UI "
"and a corresponding menu item in the \"Actions\" menu. "
"add_action(name, callback). The callback will be given "
"one parameter, the O3DVisualizer instance, and does not "
"return any value.")
"Adds a button to the custom actions section of the UI and a "
"corresponding menu item in the \"Actions\" menu. The "
"callback will be given one parameter, the O3DVisualizer "
"instance, and does not return any value.",
"name"_a, "callback"_a)
.def("add_geometry",
py::overload_cast<const std::string&,
std::shared_ptr<geometry::Geometry3D>,
Expand All @@ -176,8 +177,7 @@ void pybind_o3dvisualizer(py::module& m) {
&O3DVisualizer::AddGeometry),
"name"_a, "geometry"_a, "material"_a = nullptr, "group"_a = "",
"time"_a = 0.0, "is_visible"_a = true,
"Adds a geometry: add_geometry(name, geometry, material=None, "
"group='', time=0.0, is_visible=True). 'name' must be unique.")
"Adds a geometry. 'name' must be unique.")
.def("add_geometry",
py::overload_cast<const std::string&,
std::shared_ptr<t::geometry::Geometry>,
Expand All @@ -186,9 +186,7 @@ void pybind_o3dvisualizer(py::module& m) {
&O3DVisualizer::AddGeometry),
"name"_a, "geometry"_a, "material"_a = nullptr, "group"_a = "",
"time"_a = 0.0, "is_visible"_a = true,
"Adds a Tensor-based add_geometry: geometry(name, geometry, "
"material=None, "
"group='', time=0.0, is_visible=True). 'name' must be unique.")
"Adds a Tensor-based geometry. 'name' must be unique.")
.def("add_geometry",
py::overload_cast<
const std::string&,
Expand All @@ -197,10 +195,8 @@ void pybind_o3dvisualizer(py::module& m) {
double, bool>(&O3DVisualizer::AddGeometry),
"name"_a, "model"_a, "material"_a = nullptr, "group"_a = "",
"time"_a = 0.0, "is_visible"_a = true,
"Adds a TriangleMeshModel: add_geometry(name, model, "
"material=None, "
"group='', time=0.0, is_visible=True). 'name' must be unique. "
"'material' is ignored.")
"Adds a TriangleMeshModel. 'name' must be unique. 'material' "
"is ignored.")
.def(
"add_geometry",
[](py::object dv, const py::dict& d) {
Expand Down Expand Up @@ -239,84 +235,89 @@ void pybind_o3dvisualizer(py::module& m) {
"(optional)\n"
"group: a string declaring the group it is a member of "
"(optional)\n"
"time: a time value\n")
"time: a time value\n",
"d"_a)
.def("remove_geometry", &O3DVisualizer::RemoveGeometry,
"remove_geometry(name): removes the geometry with the "
"name.")
"Removes the geometry with the name.", "name"_a)
.def("update_geometry", &O3DVisualizer::UpdateGeometry,
"update_geometry(name, tpoint_cloud, update_flags): updates "
"the attributes of the named geometry specified by "
"Updates the attributes of the named geometry specified by "
"update_flags with tpoint_cloud. Note: Currently this "
"function only works with T Geometry Point Clouds.")
"function only works with T Geometry Point Clouds.",
"name"_a, "tpoint_cloud"_a, "update_flags"_a)
.def("show_geometry", &O3DVisualizer::ShowGeometry,
"Checks or unchecks the named geometry in the list. Note that "
"even if show_geometry(name, True) is called, the object may "
"not actually be visible if its group is unchecked, or if an "
"animation is in progress.")
"animation is in progress.",
"name"_a, "show"_a)
.def("get_geometry", &O3DVisualizer::GetGeometry,
"get_geometry(name): Returns the DrawObject corresponding to "
"the name. This should be treated as read-only. Modify "
"visibility with show_geometry(), and other values by "
"removing the object and re-adding it with the new values")
"Returns the DrawObject corresponding to the name. This "
"should be treated as read-only. Modify visibility with "
"show_geometry(), and other values by removing the object and "
"re-adding it with the new values",
"name"_a)
.def("get_geometry_material", &O3DVisualizer::GetGeometryMaterial,
"get_geometry_material(name): Returns the MaterialRecord "
"corresponding to the name. The returned material is a copy, "
"therefore modifying it directly will not change the "
"visualization.")
"Returns the MaterialRecord corresponding to the name. The "
"returned material is a copy, therefore modifying it directly "
"will not change the visualization.",
"name"_a)
.def("modify_geometry_material",
&O3DVisualizer::ModifyGeometryMaterial,
"modify_geometry_material(name,material): Updates the named "
"geometry to use the new provided material.")
"Updates the named geometry to use the new provided material.",
"name"_a, "material"_a)
.def("add_3d_label", &O3DVisualizer::Add3DLabel,
"add_3d_label([x,y,z], text): displays text anchored at the "
"3D coordinate specified")
"Displays text anchored at the 3D coordinate specified",
"pos"_a, "text"_a)
.def("clear_3d_labels", &O3DVisualizer::Clear3DLabels,
"Clears all 3D text")
.def("setup_camera",
py::overload_cast<float, const Eigen::Vector3f&,
const Eigen::Vector3f&,
const Eigen::Vector3f&>(
&O3DVisualizer::SetupCamera),
"setup_camera(field_of_view, center, eye, up): sets the "
"camera view so that the camera is located at 'eye', pointing "
"towards 'center', and oriented so that the up vector is 'up'")
"Sets the camera view so that the camera is located at 'eye', "
"pointing towards 'center', and oriented so that the up "
"vector is 'up'",
"field_of_view"_a, "center"_a, "eye"_a, "up"_a)
.def("setup_camera",
py::overload_cast<const camera::PinholeCameraIntrinsic&,
const Eigen::Matrix4d&>(
&O3DVisualizer::SetupCamera),
"setup_camera(intrinsic, extrinsic_matrix): sets the camera "
"view")
"Sets the camera view", "intrinsic"_a, "extrinsic_matrix"_a)
.def("setup_camera",
py::overload_cast<const Eigen::Matrix3d&,
const Eigen::Matrix4d&, int, int>(
&O3DVisualizer::SetupCamera),
"setup_camera(intrinsic_matrix, extrinsic_matrix, "
"intrinsic_width_px, intrinsic_height_px): sets the camera "
"view")
"Sets the camera view", "intrinsic_matrix"_a,
"extrinsic_matrix"_a, "intrinsic_width_px"_a,
"intrinsic_height_px"_a)
.def("reset_camera_to_default",
&O3DVisualizer::ResetCameraToDefault,
"Sets camera to default position")
.def("get_selection_sets", &O3DVisualizer::GetSelectionSets,
"Returns the selection sets, as [{'obj_name', "
"[SelectedIndex]}]")
.def("set_on_animation_frame", &O3DVisualizer::SetOnAnimationFrame,
"set_on_animation(callback): Sets a callback that will be "
"called every frame of the animation. The callback will be "
"called as callback(o3dvis, current_time).")
"Sets a callback that will be called every frame of the "
"animation. The callback will be called as callback(o3dvis, "
"current_time).",
"callback"_a)
.def("set_on_animation_tick", &O3DVisualizer::SetOnAnimationTick,
"set_on_animation(callback): Sets a callback that will be "
"called every frame of the animation. The callback will be "
"called as callback(o3dvis, time_since_last_tick, "
"total_elapsed_since_animation_started). Note that this "
"is a low-level callback. If you need to change the current "
"Sets a callback that will be called every frame of the "
"animation. The callback will be called as callback(o3dvis, "
"time_since_last_tick, "
"total_elapsed_since_animation_started). Note that this is a "
"low-level callback. If you need to change the current "
"timestamp being shown you will need to update the "
"o3dvis.current_time property in the callback. The callback "
"must return either O3DVisualizer.TickResult.IGNORE if no "
"redraw is required or O3DVisualizer.TickResult.REDRAW "
"if a redraw is required.")
"redraw is required or O3DVisualizer.TickResult.REDRAW if a "
"redraw is required.",
"callback"_a)
.def("export_current_image", &O3DVisualizer::ExportCurrentImage,
"export_image(path). Exports a PNG image of what is "
"currently displayed to the given path.")
"Exports a PNG image of what is currently displayed to the "
"given path.",
"path"_a)
.def("start_rpc_interface", &O3DVisualizer::StartRPCInterface,
"address"_a, "timeout"_a,
"Starts the RPC interface.\n"
Expand All @@ -325,20 +326,22 @@ void pybind_o3dvisualizer(py::module& m) {
.def("stop_rpc_interface", &O3DVisualizer::StopRPCInterface,
"Stops the RPC interface.")
.def("set_background", &O3DVisualizer::SetBackground,
"set_background(color, image=None): Sets the background color "
"and, optionally, the background image. Passing None for the "
"background image will clear any image already there.")
"Sets the background color and, optionally, the background "
"image. Passing None for the background image will clear any "
"image already there.",
"bg_color"_a, "bg_image"_a)
.def("set_ibl", &O3DVisualizer::SetIBL,
"set_ibl(ibl_name): Sets the IBL and its matching skybox. If "
"ibl_name_ibl.ktx is found in the default resource directory "
"then it is used. Otherwise, ibl_name is assumed to be a path "
"to the ibl KTX file.")
"Sets the IBL and its matching skybox. If ibl_name_ibl.ktx is "
"found in the default resource directory then it is used. "
"Otherwise, ibl_name is assumed to be a path to the ibl KTX "
"file.",
"ibl_name"_a)
.def("set_ibl_intensity", &O3DVisualizer::SetIBLIntensity,
"set_ibl_intensity(intensity): Sets the intensity of the "
"current IBL")
"Sets the intensity of the current IBL", "intensity"_a)
.def("enable_raw_mode", &O3DVisualizer::EnableBasicMode,
"enable_raw_mode(enable): Enables/disables raw mode for "
"simplified lighting environment.")
"Enables/disables raw mode for simplified lighting "
"environment.",
"enable"_a)
.def("show_skybox", &O3DVisualizer::ShowSkybox,
"Show/Hide the skybox", "show"_a)
.def_property(
Expand Down

0 comments on commit ddbab0b

Please sign in to comment.