Commit bb543d03 authored by Jan Möbius's avatar Jan Möbius
Browse files

Updated OpenMesh

parent b98c8dee
Pipeline #20359 passed with stages
in 10 minutes and 19 seconds
OpenMesh @ c36d8a30
Subproject commit dbcb0bf50cff107ffacdaed25aca0f159d934967
Subproject commit c36d8a304c5ab2457eb7969ad440c4b1ea74407b
......@@ -16,3 +16,15 @@ OpenMesh provides functions that read and write meshes from and to files:
om.write_mesh(trimesh, "bunny.ply")
OpenMesh currently supports five file types: .obj, .off, .ply, .stl and .om
For writing .obj files there is also support for textures. You can pass the path of a texture image and
optionally the suffix for the material file, default is ".mat", but some programs, e.g. Blender expect ".mtl" as suffix
.. code:: python
om.write_mesh(
"out.obj",
trimesh,
texture_file="moon.png",
material_file_extension=".mtl" # default is ".mat", blender needs ".mtl"
)
......@@ -148,7 +148,9 @@ void def_write_mesh(py::module& m) {
bool _face_normal,
bool _face_color,
bool _color_alpha,
bool _color_float
bool _color_float,
const std::string& _texture_file = "",
const std::string& _material_file_extension = ".mat"
)
{
OM::IO::Options options;
......@@ -168,6 +170,8 @@ void def_write_mesh(py::module& m) {
if (_color_alpha) options += OM::IO::Options::ColorAlpha;
if (_color_float) options += OM::IO::Options::ColorFloat;
options.texture_file = _texture_file;
options.material_file_extension = _material_file_extension;
const bool ok = OM::IO::write_mesh(_mesh, _filename, options);
......@@ -191,7 +195,9 @@ void def_write_mesh(py::module& m) {
py::arg("face_normal")=false,
py::arg("face_color")=false,
py::arg("color_alpha")=false,
py::arg("color_float")=false
py::arg("color_float")=false,
py::arg("texture_file")="",
py::arg("material_file_extension")=".mat"
);
}
......
......@@ -719,10 +719,21 @@ void expose_mesh(py::module& m, const char *_name) {
_self.status(_h).set_deleted(_val);
})
.def("is_deleted", [](Mesh& _self, OM::HalfedgeHandle _h) {
if (!_self.has_halfedge_status()) return false;
return _self.status(_h).deleted();
})
.def("is_locked", [](Mesh& _self, OM::VertexHandle _h) {
if (!_self.has_vertex_status()) return false;
return _self.status(_h).locked();
})
.def("set_locked", [](Mesh& _self, OM::VertexHandle _h, bool _val) {
if (!_self.has_vertex_status()) _self.request_vertex_status();
_self.status(_h).set_locked(_val);
})
.def("is_deleted", [](Mesh& _self, OM::HalfedgeHandle _h) {
if (!_self.has_halfedge_status()) return false;
return _self.status(_h).deleted();
})
.def("set_deleted", [](Mesh& _self, OM::HalfedgeHandle _h, bool _val) {
if (!_self.has_halfedge_status()) _self.request_halfedge_status();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment