diff --git a/cpp/pybind/camera/camera.cpp b/cpp/pybind/camera/camera.cpp index 54d865e4d27..442ca803add 100644 --- a/cpp/pybind/camera/camera.cpp +++ b/cpp/pybind/camera/camera.cpp @@ -93,12 +93,12 @@ void pybind_camera_definitions(py::module &m) { "0, cx], [0, fy, " "cy], [0, 0, 1]]``") .def("__repr__", [](const PinholeCameraIntrinsic &c) { - return std::string("PinholeCameraIntrinsic with width = ") + - std::to_string(c.width_) + - std::string(" and height = ") + - std::to_string(c.height_) + - std::string( - ".\nAccess intrinsics with intrinsic_matrix."); + return fmt::format( + "PinholeCameraIntrinsic(" + "width={}, " + "height={}, " + ")", + c.width_, c.height_); }); docstring::ClassMethodDocInject(m_camera, "PinholeCameraIntrinsic", "__init__"); diff --git a/cpp/pybind/core/dtype.cpp b/cpp/pybind/core/dtype.cpp index 870b2f10033..f6e87aa11e9 100644 --- a/cpp/pybind/core/dtype.cpp +++ b/cpp/pybind/core/dtype.cpp @@ -18,6 +18,13 @@ namespace core { void pybind_core_dtype_declarations(py::module &m) { py::class_> dtype(m, "Dtype", "Open3D data types."); + py::enum_(dtype, "DtypeCode") + .value("Undefined", Dtype::DtypeCode::Undefined) + .value("Bool", Dtype::DtypeCode::Bool) + .value("Int", Dtype::DtypeCode::Int) + .value("UInt", Dtype::DtypeCode::UInt) + .value("Float", Dtype::DtypeCode::Float) + .value("Object", Dtype::DtypeCode::Object); } void pybind_core_dtype_definitions(py::module &m) { // open3d.core.Dtype class diff --git a/cpp/pybind/core/tensor.cpp b/cpp/pybind/core/tensor.cpp index fb2929fc54d..28e20081f06 100644 --- a/cpp/pybind/core/tensor.cpp +++ b/cpp/pybind/core/tensor.cpp @@ -254,6 +254,7 @@ void pybind_core_tensor_declarations(py::module& m) { py::class_ tensor( m, "Tensor", "A Tensor is a view of a data Blob with shape, stride, data_ptr."); + m.attr("capsule") = py::module_::import("typing").attr("Any"); } void pybind_core_tensor_definitions(py::module& m) { auto tensor = static_cast>(m.attr("Tensor")); diff --git a/cpp/pybind/docstring.cpp b/cpp/pybind/docstring.cpp index 6db1ff883fe..fce26d58688 100644 --- a/cpp/pybind/docstring.cpp +++ b/cpp/pybind/docstring.cpp @@ -201,14 +201,24 @@ std::string FunctionDoc::ToGoogleDocString() const { for (size_t i = 0; i < overload.argument_docs_.size(); ++i) { const ArgumentDoc& argument_doc = overload.argument_docs_[i]; rc << argument_doc.name_; + if (argument_doc.type_ != "") { + rc << ": " << argument_doc.type_; + } if (argument_doc.default_ != "") { - rc << "=" << argument_doc.default_; + rc << " = " << argument_doc.default_; } if (i != overload.argument_docs_.size() - 1) { rc << ", "; } } - rc << ")" << std::endl; + rc << ")"; + + // Return type + if (overload.return_doc_.type_ != "") { + rc << " -> " << overload.return_doc_.type_; + } + + rc << std::endl; // Summary line, strictly speaking this shall be at the very front. // However from a compiled Python module we need the function signature @@ -347,6 +357,12 @@ std::vector FunctionDoc::GetArgumentTokens( str.replace(parenthesis_pos + 1, 0, ", "); } + // Ignore everything after last argument (right before ") ->") + // Otherwise false argument matches might be found in docstrings + std::size_t arrow_pos = str.rfind(") -> "); + if (arrow_pos == std::string::npos) return {}; + str.resize(arrow_pos); + // Get start positions std::regex pattern("(, [A-Za-z_][A-Za-z\\d_]*:)"); std::smatch res; @@ -366,12 +382,7 @@ std::vector FunctionDoc::GetArgumentTokens( for (size_t i = 0; i + 1 < argument_start_positions.size(); ++i) { argument_end_positions.push_back(argument_start_positions[i + 1] - 2); } - std::size_t arrow_pos = str.rfind(") -> "); - if (arrow_pos == std::string::npos) { - return {}; - } else { - argument_end_positions.push_back(arrow_pos); - } + argument_end_positions.push_back(arrow_pos); std::vector argument_tokens; for (size_t i = 0; i < argument_start_positions.size(); ++i) { diff --git a/cpp/pybind/geometry/geometry.cpp b/cpp/pybind/geometry/geometry.cpp index 98bf6c1e9e7..ce1c21fb7c5 100644 --- a/cpp/pybind/geometry/geometry.cpp +++ b/cpp/pybind/geometry/geometry.cpp @@ -45,6 +45,9 @@ void pybind_geometry_classes_declarations(py::module &m) { std::shared_ptr, Geometry> geometry2d(m, "Geometry2D", "The base geometry class for 2D geometries."); + + m.attr("m") = py::module_::import("typing").attr("TypeVar")("m"); + m.attr("n") = py::module_::import("typing").attr("TypeVar")("n"); } void pybind_geometry_classes_definitions(py::module &m) { // open3d.geometry functions diff --git a/cpp/pybind/geometry/kdtreeflann.cpp b/cpp/pybind/geometry/kdtreeflann.cpp index 7b2d590ca9c..23e55e11861 100644 --- a/cpp/pybind/geometry/kdtreeflann.cpp +++ b/cpp/pybind/geometry/kdtreeflann.cpp @@ -58,10 +58,10 @@ void pybind_kdtreeflann_definitions(py::module &m) { kdtreesearchparam_knn.def(py::init(), "knn"_a = 30) .def("__repr__", [](const KDTreeSearchParamKNN ¶m) { - return std::string( - "KDTreeSearchParamKNN with knn " - "= ") + - std::to_string(param.knn_); + return fmt::format( + "KDTreeSearchParamKNN(" + "knn={})", + param.knn_); }) .def_readwrite("knn", &KDTreeSearchParamKNN::knn_, "Number of the neighbors that will be searched."); @@ -73,10 +73,10 @@ void pybind_kdtreeflann_definitions(py::module &m) { kdtreesearchparam_radius.def(py::init(), "radius"_a) .def("__repr__", [](const KDTreeSearchParamRadius ¶m) { - return std::string( - "KDTreeSearchParamRadius with " - "radius = ") + - std::to_string(param.radius_); + return fmt::format( + "KDTreeSearchParamRadius(" + "radius={})", + param.radius_); }) .def_readwrite("radius", &KDTreeSearchParamRadius::radius_, "Search radius."); @@ -89,11 +89,11 @@ void pybind_kdtreeflann_definitions(py::module &m) { .def(py::init(), "radius"_a, "max_nn"_a) .def("__repr__", [](const KDTreeSearchParamHybrid ¶m) { - return std::string( - "KDTreeSearchParamHybrid with " - "radius = ") + - std::to_string(param.radius_) + - " and max_nn = " + std::to_string(param.max_nn_); + return fmt::format( + "KDTreeSearchParamHybrid(" + "radius={}, " + "max_nn={})", + param.radius_, param.max_nn_); }) .def_readwrite("radius", &KDTreeSearchParamHybrid::radius_, "Search radius.") diff --git a/cpp/pybind/geometry/trianglemesh.cpp b/cpp/pybind/geometry/trianglemesh.cpp index 4c046d5871b..452736626d2 100644 --- a/cpp/pybind/geometry/trianglemesh.cpp +++ b/cpp/pybind/geometry/trianglemesh.cpp @@ -110,7 +110,8 @@ void pybind_trianglemesh_definitions(py::module &m) { ":math:`v_o = v_i x strength (v_i * |N| - \\sum_{n \\in N} " "v_n)`", "number_of_iterations"_a = 1, "strength"_a = 1, - "filter_scope"_a = MeshBase::FilterScope::All) + py::arg_v("filter_scope", MeshBase::FilterScope::All, + "FilterScope.All")) .def("filter_smooth_simple", &TriangleMesh::FilterSmoothSimple, "Function to smooth triangle mesh with simple neighbour " "average. :math:`v_o = \\frac{v_i + \\sum_{n \\in N} " @@ -118,7 +119,8 @@ void pybind_trianglemesh_definitions(py::module &m) { ":math:`v_o` the output value, and :math:`N` is the set of " "adjacent neighbours.", "number_of_iterations"_a = 1, - "filter_scope"_a = MeshBase::FilterScope::All) + py::arg_v("filter_scope", MeshBase::FilterScope::All, + "FilterScope.All")) .def("filter_smooth_laplacian", &TriangleMesh::FilterSmoothLaplacian, "Function to smooth triangle mesh using Laplacian. :math:`v_o " @@ -129,7 +131,8 @@ void pybind_trianglemesh_definitions(py::module &m) { "inverse distance (closer neighbours have higher weight), and " "lambda_filter is the smoothing parameter.", "number_of_iterations"_a = 1, "lambda_filter"_a = 0.5, - "filter_scope"_a = MeshBase::FilterScope::All) + py::arg_v("filter_scope", MeshBase::FilterScope::All, + "FilterScope.All")) .def("filter_smooth_taubin", &TriangleMesh::FilterSmoothTaubin, "Function to smooth triangle mesh using method of Taubin, " "\"Curve and Surface Smoothing Without Shrinkage\", 1995. " @@ -139,7 +142,9 @@ void pybind_trianglemesh_definitions(py::module &m) { "parameter mu as smoothing parameter. This method avoids " "shrinkage of the triangle mesh.", "number_of_iterations"_a = 1, "lambda_filter"_a = 0.5, - "mu"_a = -0.53, "filter_scope"_a = MeshBase::FilterScope::All) + "mu"_a = -0.53, + py::arg_v("filter_scope", MeshBase::FilterScope::All, + "FilterScope.All")) .def("has_vertices", &TriangleMesh::HasVertices, "Returns ``True`` if the mesh contains vertices.") .def("has_triangles", &TriangleMesh::HasTriangles, @@ -250,7 +255,9 @@ void pybind_trianglemesh_definitions(py::module &m) { &TriangleMesh::SimplifyVertexClustering, "Function to simplify mesh using vertex clustering.", "voxel_size"_a, - "contraction"_a = MeshBase::SimplificationContraction::Average) + py::arg_v("contraction", + MeshBase::SimplificationContraction::Average, + "SimplificationContraction.Average")) .def("simplify_quadric_decimation", &TriangleMesh::SimplifyQuadricDecimation, "Function to simplify mesh using Quadric Error Metric " @@ -298,7 +305,9 @@ void pybind_trianglemesh_definitions(py::module &m) { "'As-Rigid-As-Possible Surface Modeling', 2007", "constraint_vertex_indices"_a, "constraint_vertex_positions"_a, "max_iter"_a, - "energy"_a = MeshBase::DeformAsRigidAsPossibleEnergy::Spokes, + py::arg_v("energy", + MeshBase::DeformAsRigidAsPossibleEnergy::Spokes, + "DeformAsRigidAsPossibleEnergy.Spokes"), "smoothed_alpha"_a = 0.01) .def_static( "create_from_point_cloud_alpha_shape", diff --git a/cpp/pybind/pipelines/odometry/odometry.cpp b/cpp/pybind/pipelines/odometry/odometry.cpp index 44a09ff0a3a..08456a5255b 100644 --- a/cpp/pybind/pipelines/odometry/odometry.cpp +++ b/cpp/pybind/pipelines/odometry/odometry.cpp @@ -128,17 +128,15 @@ void pybind_odometry_definitions(py::module &m) { c.iteration_number_per_pyramid_level_[i]) + ", "; str_iteration_number_per_pyramid_level_ += "] "; - return std::string("OdometryOption class.") + - /*std::string("\nodo_init = ") + - std::to_string(c.odo_init_) +*/ - std::string("\niteration_number_per_pyramid_level = ") + - str_iteration_number_per_pyramid_level_ + - std::string("\ndepth_diff_max = ") + - std::to_string(c.depth_diff_max_) + - std::string("\ndepth_min = ") + - std::to_string(c.depth_min_) + - std::string("\ndepth_max = ") + - std::to_string(c.depth_max_); + return fmt::format( + "OdometryOption(\n" + "iteration_number_per_pyramid_level={},\n" + "depth_diff_max={},\n" + "depth_min={},\n" + "depth_max={},\n" + ")", + str_iteration_number_per_pyramid_level_, + c.depth_diff_max_, c.depth_min_, c.depth_max_); }); // open3d.odometry.RGBDOdometryJacobian diff --git a/cpp/pybind/pipelines/registration/feature.cpp b/cpp/pybind/pipelines/registration/feature.cpp index 4baef5b560c..5ab1ce3cd2c 100644 --- a/cpp/pybind/pipelines/registration/feature.cpp +++ b/cpp/pybind/pipelines/registration/feature.cpp @@ -19,6 +19,10 @@ void pybind_feature_declarations(py::module &m_registration) { py::class_> feature( m_registration, "Feature", "Class to store featrues for registration."); + m_registration.attr("m") = + py::module_::import("typing").attr("TypeVar")("m"); + m_registration.attr("n") = + py::module_::import("typing").attr("TypeVar")("n"); } void pybind_feature_definitions(py::module &m_registration) { // open3d.registration.Feature diff --git a/cpp/pybind/pipelines/registration/registration.cpp b/cpp/pybind/pipelines/registration/registration.cpp index d5b9af18c28..0cc560df72f 100644 --- a/cpp/pybind/pipelines/registration/registration.cpp +++ b/cpp/pybind/pipelines/registration/registration.cpp @@ -188,9 +188,10 @@ void pybind_registration_definitions(py::module &m) { "Maximum iteration before iteration stops.") .def("__repr__", [](const ICPConvergenceCriteria &c) { return fmt::format( - "ICPConvergenceCriteria class " - "with relative_fitness={:e}, relative_rmse={:e}, " - "and max_iteration={:d}", + "ICPConvergenceCriteria(" + "relative_fitness={:e}, " + "relative_rmse={:e}, " + "max_iteration={:d})", c.relative_fitness_, c.relative_rmse_, c.max_iteration_); }); @@ -214,9 +215,9 @@ void pybind_registration_definitions(py::module &m) { "termination. Use 1.0 to avoid early termination.") .def("__repr__", [](const RANSACConvergenceCriteria &c) { return fmt::format( - "RANSACConvergenceCriteria " - "class with max_iteration={:d}, " - "and confidence={:e}", + "RANSACConvergenceCriteria(" + "max_iteration={:d}, " + "confidence={:e})", c.max_iteration_, c.confidence_); }); @@ -264,11 +265,10 @@ void pybind_registration_definitions(py::module &m) { "with_scaling"_a = false) .def("__repr__", [](const TransformationEstimationPointToPoint &te) { - return std::string( - "TransformationEstimationPointToPoint ") + - (te.with_scaling_ - ? std::string("with scaling.") - : std::string("without scaling.")); + return fmt::format( + "TransformationEstimationPointToPoint(" + "with_scaling={})", + te.with_scaling_ ? "True" : "False"); }) .def_readwrite( "with_scaling", @@ -336,10 +336,12 @@ Sets :math:`c = 1` if ``with_scaling`` is ``False``. "kernel"_a) .def("__repr__", [](const TransformationEstimationForColoredICP &te) { - return std::string( - "TransformationEstimationForColoredICP ") + - ("with lambda_geometric=" + - std::to_string(te.lambda_geometric_)); + // This is missing kernel, but getting kernel name on C++ + // is hard + return fmt::format( + "TransformationEstimationForColoredICP(" + "lambda_geometric={})", + te.lambda_geometric_); }) .def_readwrite( "lambda_geometric", @@ -380,10 +382,10 @@ Sets :math:`c = 1` if ``with_scaling`` is ``False``. "kernel"_a) .def("__repr__", [](const TransformationEstimationForGeneralizedICP &te) { - return std::string( - "TransformationEstimationForGeneralizedICP" - " ") + - ("with epsilon=" + std::to_string(te.epsilon_)); + return fmt::format( + "TransformationEstimationForGeneralizedICP(" + "epsilon={})", + te.epsilon_); }) .def_readwrite("epsilon", &TransformationEstimationForGeneralizedICP::epsilon_, @@ -555,19 +557,20 @@ must hold true for all edges.)"); "tests on initial set of correspondences.") .def("__repr__", [](const FastGlobalRegistrationOption &c) { return fmt::format( - "" - "FastGlobalRegistrationOption class " - "with \ndivision_factor={}" - "\nuse_absolute_scale={}" - "\ndecrease_mu={}" - "\nmaximum_correspondence_distance={}" - "\niteration_number={}" - "\ntuple_scale={}" - "\nmaximum_tuple_count={}", - "\ntuple_test={}", c.division_factor_, - c.use_absolute_scale_, c.decrease_mu_, - c.maximum_correspondence_distance_, c.iteration_number_, - c.tuple_scale_, c.maximum_tuple_count_, c.tuple_test_); + "FastGlobalRegistrationOption(" + "\ndivision_factor={}," + "\nuse_absolute_scale={}," + "\ndecrease_mu={}," + "\nmaximum_correspondence_distance={}," + "\niteration_number={}," + "\ntuple_scale={}," + "\nmaximum_tuple_count={}," + "\ntuple_test={}," + "\n)", + c.division_factor_, c.use_absolute_scale_, + c.decrease_mu_, c.maximum_correspondence_distance_, + c.iteration_number_, c.tuple_scale_, + c.maximum_tuple_count_, c.tuple_test_); }); // open3d.registration.RegistrationResult diff --git a/cpp/pybind/t/geometry/image.cpp b/cpp/pybind/t/geometry/image.cpp index 46ae6e8807a..1d63432f1c6 100644 --- a/cpp/pybind/t/geometry/image.cpp +++ b/cpp/pybind/t/geometry/image.cpp @@ -181,7 +181,8 @@ void pybind_image_definitions(py::module &m) { "Upsample if sampling rate > 1. Aspect ratio is always " "kept.", "sampling_rate"_a = 0.5, - "interp_type"_a = Image::InterpType::Nearest) + py::arg_v("interp_type", Image::InterpType::Nearest, + "open3d.t.geometry.InterpType.Nearest")) .def("pyrdown", &Image::PyrDown, "Return a new downsampled image with pyramid downsampling " "formed by a chained Gaussian filter (kernel_size = 5, sigma" diff --git a/cpp/pybind/t/geometry/lineset.cpp b/cpp/pybind/t/geometry/lineset.cpp index 44fce56fd28..6d209646abd 100644 --- a/cpp/pybind/t/geometry/lineset.cpp +++ b/cpp/pybind/t/geometry/lineset.cpp @@ -306,7 +306,10 @@ transformation as :math:`P = R(P) + t`)"); line_set.def_static( "create_camera_visualization", &LineSet::CreateCameraVisualization, "view_width_px"_a, "view_height_px"_a, "intrinsic"_a, "extrinsic"_a, - "scale"_a = 1.f, "color"_a = core::Tensor({}, core::Float32), + "scale"_a = 1.f, + py::arg_v( + "color", core::Tensor({}, core::Float32), + "open3d.core.Tensor([], dtype=open3d.core.Dtype.Float32)"), R"(Factory function to create a LineSet from intrinsic and extrinsic matrices. Camera reference frame is shown with XYZ axes in RGB. diff --git a/cpp/pybind/t/geometry/pointcloud.cpp b/cpp/pybind/t/geometry/pointcloud.cpp index 444852c7802..e5bac211b90 100644 --- a/cpp/pybind/t/geometry/pointcloud.cpp +++ b/cpp/pybind/t/geometry/pointcloud.cpp @@ -436,14 +436,18 @@ point clouds can be found in Piazza, Valentini, Varetti, "Mesh Reconstruction fr // processing pointcloud.def("project_to_depth_image", &PointCloud::ProjectToDepthImage, "width"_a, "height"_a, "intrinsics"_a, - "extrinsics"_a = core::Tensor::Eye(4, core::Float32, - core::Device("CPU:0")), + py::arg_v("extrinsics", + core::Tensor::Eye(4, core::Float32, + core::Device("CPU:0")), + "open3d.core.Tensor.eye(4)"), "depth_scale"_a = 1000.0, "depth_max"_a = 3.0, "Project a point cloud to a depth image."); pointcloud.def("project_to_rgbd_image", &PointCloud::ProjectToRGBDImage, "width"_a, "height"_a, "intrinsics"_a, - "extrinsics"_a = core::Tensor::Eye(4, core::Float32, - core::Device("CPU:0")), + py::arg_v("extrinsics", + core::Tensor::Eye(4, core::Float32, + core::Device("CPU:0")), + "open3d.core.Tensor.eye(4)"), "depth_scale"_a = 1000.0, "depth_max"_a = 3.0, "Project a colored point cloud to a RGBD image."); pointcloud.def( diff --git a/cpp/pybind/t/pipelines/odometry/odometry.cpp b/cpp/pybind/t/pipelines/odometry/odometry.cpp index 3626de2c4c2..35886b5e554 100644 --- a/cpp/pybind/t/pipelines/odometry/odometry.cpp +++ b/cpp/pybind/t/pipelines/odometry/odometry.cpp @@ -124,8 +124,10 @@ void pybind_odometry_definitions(py::module &m) { "than ``relative_fitness``, the iteration stops.") .def("__repr__", [](const OdometryConvergenceCriteria &c) { return fmt::format( - "OdometryConvergenceCriteria[max_iteration={:d}, " - "relative_rmse={:e}, relative_fitness={:e}].", + "OdometryConvergenceCriteria(" + "max_iteration={:d}, " + "relative_rmse={:e}, " + "relative_fitness={:e})", c.max_iteration_, c.relative_rmse_, c.relative_fitness_); }); @@ -136,8 +138,11 @@ void pybind_odometry_definitions(py::module &m) { py::detail::bind_copy_functions(odometry_result); odometry_result .def(py::init(), - "transformation"_a = core::Tensor::Eye(4, core::Float64, - core::Device("CPU:0")), + py::arg_v("transformation", + core::Tensor::Eye(4, core::Float64, + core::Device("CPU:0")), + "open3d.core.Tensor.eye(4, " + "dtype=open3d.core.Dtype.Float64)"), "inlier_rmse"_a = 0.0, "fitness"_a = 0.0) .def_readwrite("transformation", &OdometryResult::transformation_, "``4 x 4`` float64 tensor on CPU: The estimated " diff --git a/cpp/pybind/t/pipelines/registration/robust_kernel.cpp b/cpp/pybind/t/pipelines/registration/robust_kernel.cpp index e6cd74e7526..34d5a219b54 100644 --- a/cpp/pybind/t/pipelines/registration/robust_kernel.cpp +++ b/cpp/pybind/t/pipelines/registration/robust_kernel.cpp @@ -115,7 +115,9 @@ void pybind_robust_kernel_definitions(py::module& m) { return new RobustKernel(type, scaling_parameter, shape_parameter); }), - "type"_a = RobustKernelMethod::L2Loss, + py::arg_v("type", RobustKernelMethod::L2Loss, + "open3d.t.pipelines.registration.RobustKernelMethod." + "L2Loss"), "scaling_parameter"_a = 1.0, "shape_parameter"_a = 1.0) .def_readwrite("type", &RobustKernel::type_, "Loss type.") .def_readwrite("scaling_parameter", diff --git a/cpp/pybind/t/pipelines/slac/slac.cpp b/cpp/pybind/t/pipelines/slac/slac.cpp index c32475ca007..06eec75b3a5 100644 --- a/cpp/pybind/t/pipelines/slac/slac.cpp +++ b/cpp/pybind/t/pipelines/slac/slac.cpp @@ -94,10 +94,11 @@ void pybind_slac_definitions(py::module &m) { "folder.") .def("__repr__", [](const SLACOptimizerParams ¶ms) { return fmt::format( - "SLACOptimizerParams[max_iterations={:d}, " + "SLACOptimizerParams(max_iterations={:d}, " "voxel_size={:e}, distance_threshold={:e}, " "fitness_threshold={:e}, regularizer_weight={:e}, " - "device={}, slac_folder={}].", + "device=open3d.core.Device(\"{}\"), " + "slac_folder=\"{}\")", params.max_iterations_, params.voxel_size_, params.distance_threshold_, params.fitness_threshold_, params.regularizer_weight_, params.device_.ToString(), @@ -117,9 +118,9 @@ void pybind_slac_definitions(py::module &m) { "will be skipped for visualization.") .def("__repr__", [](const SLACDebugOption &debug_option) { return fmt::format( - "SLACDebugOption[debug={}, " - "debug_start_node_idx={:d}].", - debug_option.debug_, + "SLACDebugOption(debug={}, " + "debug_start_node_idx={:d})", + debug_option.debug_ ? "True" : "False", debug_option.debug_start_node_idx_); }); auto control_grid = diff --git a/cpp/pybind/t/pipelines/slam/slam.cpp b/cpp/pybind/t/pipelines/slam/slam.cpp index c43daf0fc81..f9a88f3c01b 100644 --- a/cpp/pybind/t/pipelines/slam/slam.cpp +++ b/cpp/pybind/t/pipelines/slam/slam.cpp @@ -94,7 +94,8 @@ void pybind_slam_definitions(py::module &m) { "Track input frame against raycasted frame from model.", "input_frame"_a, "model_frame"_a, "depth_scale"_a = 1000.0, "depth_max"_a = 3.0, "depth_diff"_a = 0.07, - "method"_a = odometry::Method::PointToPlane, + py::arg_v("method", odometry::Method::PointToPlane, + "Method.PointToPlane"), "criteria"_a = (std::vector){ 6, 3, 1}); docstring::ClassMethodDocInject(m_slam, "Model", "track_frame_to_model", diff --git a/cpp/pybind/visualization/gui/gui.cpp b/cpp/pybind/visualization/gui/gui.cpp index a7c22c1e74b..5bd67a951ad 100644 --- a/cpp/pybind/visualization/gui/gui.cpp +++ b/cpp/pybind/visualization/gui/gui.cpp @@ -537,7 +537,8 @@ void pybind_gui_definitions(py::module &m) { fd.attr("MONOSPACE") = FontDescription::MONOSPACE; fd.def(py::init(), "typeface"_a = FontDescription::SANS_SERIF, - "style"_a = FontStyle::NORMAL, "point_size"_a = 0, + py::arg_v("style", FontStyle::NORMAL, "open3d.gui.FontStyle.NORMAL"), + "point_size"_a = 0, "Creates a FontDescription. 'typeface' is a path to a " "TrueType (.ttf), TrueType Collection (.ttc), or " "OpenType (.otf) file, or it is the name of the font, " @@ -1809,7 +1810,19 @@ void pybind_gui_definitions(py::module &m) { .def_readwrite("right", &Margins::right) .def_readwrite("bottom", &Margins::bottom) .def("get_horiz", &Margins::GetHoriz) - .def("get_vert", &Margins::GetVert); + .def("get_vert", &Margins::GetVert) + .def("__repr__", [](const Margins &m) -> std::string { + if (m.left == 0 && m.top == 0 && m.right == 0 && m.bottom == 0) + return "Margins()"; + else if (m.left == m.top && m.top == m.right && + m.right == m.bottom) + return fmt::format("Margins({})", m.left); + else if (m.left == m.right && m.top == m.bottom) + return fmt::format("Margins({}, {})", m.left, m.top); + else + return fmt::format("Margins({}, {}, {}, {})", m.left, m.top, + m.right, m.bottom); + }); // ---- Layout1D ---- auto layout1d = diff --git a/cpp/pybind/visualization/rendering/rendering.cpp b/cpp/pybind/visualization/rendering/rendering.cpp index 24d93fc6163..513a0f09934 100644 --- a/cpp/pybind/visualization/rendering/rendering.cpp +++ b/cpp/pybind/visualization/rendering/rendering.cpp @@ -111,6 +111,8 @@ class PyOffscreenRenderer { void pybind_rendering_declarations(py::module &m) { py::module m_rendering = m.def_submodule("rendering"); + py::class_ texture_handle(m_rendering, "TextureHandle", + "Handle to a texture"); py::class_ renderer( m_rendering, "Renderer", "Renderer class that manages 3D resources. Get from gui.Window."); @@ -514,7 +516,9 @@ void pybind_rendering_definitions(py::module &m) { "Typical values are 2, 4 or 8. The maximum possible value " "depends on the underlying GPU and OpenGL driver.") .def("set_shadowing", &View::SetShadowing, "enabled"_a, - "type"_a = View::ShadowType::kPCF, + py::arg_v( + "type", View::ShadowType::kPCF, + "open3d.visualization.rendering.View.ShadowType.PCF"), "True to enable, false to enable all shadow mapping when " "rendering this View. When enabling shadow mapping you may " "also specify one of two shadow mapping algorithms: PCF "