Skip to content
Snippets Groups Projects
Commit 7e82ad6b authored by Jan Möbius's avatar Jan Möbius
Browse files

Merge branch 'feature/status-and-features' into 'master'

Implement reading/writing entity status and expose feature bit

See merge request !4
parents ed217314 a2ad83c3
Branches
Tags
1 merge request!4Implement reading/writing entity status and expose feature bit
Pipeline #20363 passed
......@@ -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"
);
......
......@@ -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
//======================================================================
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment