From 86c4411b88117c23920fb9fecabae0f8f911abeb Mon Sep 17 00:00:00 2001 From: "victor.anton" Date: Thu, 23 Jan 2020 14:06:48 +0100 Subject: [PATCH] Using CALL_RETURNING_LIST instead of custom function --- PythonAPI/carla/source/libcarla/Geom.cpp | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/PythonAPI/carla/source/libcarla/Geom.cpp b/PythonAPI/carla/source/libcarla/Geom.cpp index a32d18d3d..3c88beef2 100644 --- a/PythonAPI/carla/source/libcarla/Geom.cpp +++ b/PythonAPI/carla/source/libcarla/Geom.cpp @@ -86,25 +86,6 @@ static void TransformList(const carla::geom::Transform &self, boost::python::lis } } -template -static boost::python::list CreatePythonList(const TContainer &container) { - boost::python::list py_list; - for (auto iter = container.begin(); iter != container.end(); ++iter) { - py_list.append(*iter); - } - return py_list; -} - -static boost::python::list BBoxGetLocalVerticesPython(const carla::geom::BoundingBox &self) { - return CreatePythonList(self.GetLocalVertices()); -} - -static boost::python::list BBoxGetWorldVerticesPython( - const carla::geom::BoundingBox &self, - const carla::geom::Transform &bbox_transform) { - return CreatePythonList(self.GetWorldVertices(bbox_transform)); -} - void export_geom() { using namespace boost::python; namespace cg = carla::geom; @@ -201,8 +182,8 @@ void export_geom() { .def_readwrite("location", &cg::BoundingBox::location) .def_readwrite("extent", &cg::BoundingBox::extent) .def("contains", &cg::BoundingBox::Contains, arg("point"), arg("bbox_transform")) - .def("get_local_vertices", &BBoxGetLocalVerticesPython) - .def("get_world_vertices", &BBoxGetWorldVerticesPython, arg("bbox_transform")) + .def("get_local_vertices", CALL_RETURNING_LIST(cg::BoundingBox, GetLocalVertices)) + .def("get_world_vertices", CALL_RETURNING_LIST_1(cg::BoundingBox, GetWorldVertices, const cg::Transform&), arg("bbox_transform")) .def("__eq__", &cg::BoundingBox::operator==) .def("__ne__", &cg::BoundingBox::operator!=) .def(self_ns::str(self_ns::self))