diff --git a/src/InputOutput.cc b/src/InputOutput.cc index 4eca199a9c5ce2337094c054930c65fa5d0732e2..2012297f9919a6d4e913a66ace308fbb02b2e669 100644 --- a/src/InputOutput.cc +++ b/src/InputOutput.cc @@ -24,7 +24,11 @@ void def_read_mesh(py::module& m, const char *_name) { bool _face_color, bool _face_texture_index, bool _color_alpha, - bool _color_float + bool _color_float, + bool _vertex_status, + bool _halfedge_status, + bool _edge_status, + bool _face_status ) { Mesh mesh; @@ -70,6 +74,24 @@ void def_read_mesh(py::module& m, const char *_name) { if (_face_texture_index) { mesh.request_face_texture_index(); } + if (_vertex_status) { + mesh.request_vertex_status(); + } + if (_edge_status) { + mesh.request_vertex_status(); + } + if (_halfedge_status) { + mesh.request_halfedge_status(); + } + if (_edge_status) { + mesh.request_edge_status(); + } + if (_face_status) { + mesh.request_face_status(); + } + if (_face_status || _halfedge_status || _edge_status || _face_status) { + options += OM::IO::Options::Status; + } if (_color_alpha) options += OM::IO::Options::ColorAlpha; if (_color_float) options += OM::IO::Options::ColorFloat; @@ -126,7 +148,11 @@ void def_read_mesh(py::module& m, const char *_name) { py::arg("face_color")=false, py::arg("face_texture_index")=false, py::arg("color_alpha")=false, - py::arg("color_float")=false + py::arg("color_float")=false, + py::arg("vertex_status")=false, + py::arg("halfedge_status")=false, + py::arg("edge_status")=false, + py::arg("face_status")=false ); } @@ -149,6 +175,7 @@ void def_write_mesh(py::module& m) { bool _face_color, bool _color_alpha, bool _color_float, + bool _status, const std::string& _texture_file = "", const std::string& _material_file_extension = ".mat" ) @@ -173,6 +200,8 @@ void def_write_mesh(py::module& m) { options.texture_file = _texture_file; options.material_file_extension = _material_file_extension; + if (_status) options += OM::IO::Options::Status; + const bool ok = OM::IO::write_mesh(_mesh, _filename, options); if (!ok) { @@ -196,6 +225,7 @@ void def_write_mesh(py::module& m) { py::arg("face_color")=false, py::arg("color_alpha")=false, py::arg("color_float")=false, + py::arg("status")=false, py::arg("texture_file")="", py::arg("material_file_extension")=".mat" ); diff --git a/src/Mesh.hh b/src/Mesh.hh index 050c01130af9bfbfe901bf37c4c3d996c82b143d..0a9f6a74bb156c8cb8139acfc1ec1b05b499ffd8 100644 --- a/src/Mesh.hh +++ b/src/Mesh.hh @@ -854,6 +854,23 @@ void expose_mesh(py::module& m, const char *_name) { } }) + .def("set_feature", [](Mesh& _self, OM::EdgeHandle _h, bool val) { + if (!_self.has_edge_status()) _self.request_edge_status(); + return _self.status(_h).set_feature(val); + }) + .def("feature", [](Mesh& _self, OM::EdgeHandle _h) { + if (!_self.has_edge_status()) _self.request_edge_status(); + return _self.status(_h).feature(); + }) + .def("set_feature", [](Mesh& _self, OM::VertexHandle _h, bool val) { + if (!_self.has_vertex_status()) _self.request_vertex_status(); + return _self.status(_h).set_feature(val); + }) + .def("feature", [](Mesh& _self, OM::VertexHandle _h) { + if (!_self.has_vertex_status()) _self.request_vertex_status(); + return _self.status(_h).feature(); + }) + //====================================================================== // BaseKernel //======================================================================