1 #ifndef OPENMESH_PYTHON_INPUTOUTPUT_HH 2 #define OPENMESH_PYTHON_INPUTOUTPUT_HH 24 BOOST_PYTHON_FUNCTION_OVERLOADS(read_mesh_overloads,
IO::read_mesh, 3, 4)
25 BOOST_PYTHON_FUNCTION_OVERLOADS(write_mesh_overloads, IO::write_mesh, 2, 4)
39 bool (*read_mesh_tri_options )(
TriMesh&,
const std::string&, IO::Options&, bool) = &
IO::read_mesh;
41 bool (*write_mesh_poly)(
const PolyMesh&,
const std::string&, IO::Options, std::streamsize) = &
IO::write_mesh;
42 bool (*write_mesh_tri )(
const TriMesh&,
const std::string&, IO::Options, std::streamsize) = &
IO::write_mesh;
44 def(
"read_mesh", read_mesh_poly);
45 def(
"read_mesh", read_mesh_poly_options, read_mesh_overloads());
46 def(
"read_mesh", read_mesh_tri);
47 def(
"read_mesh", read_mesh_tri_options, read_mesh_overloads());
49 def(
"write_mesh", write_mesh_poly, write_mesh_overloads());
50 def(
"write_mesh", write_mesh_tri, write_mesh_overloads());
56 scope scope_options = class_<IO::Options>(
"Options")
57 .def(init<IO::Options::Flag>())
61 .def(
"check", &IO::Options::check)
62 .def(
"is_binary", &IO::Options::is_binary)
63 .def(
"vertex_has_normal", &IO::Options::vertex_has_normal)
64 .def(
"vertex_has_color", &IO::Options::vertex_has_color)
65 .def(
"vertex_has_texcoord", &IO::Options::vertex_has_texcoord)
66 .def(
"edge_has_color", &IO::Options::edge_has_color)
67 .def(
"face_has_normal", &IO::Options::face_has_normal)
68 .def(
"face_has_color", &IO::Options::face_has_color)
69 .def(
"face_has_texcoord", &IO::Options::face_has_texcoord)
70 .def(
"color_has_alpha", &IO::Options::color_has_alpha)
71 .def(
"color_is_float", &IO::Options::color_is_float)
78 .def_readonly(
"Default", &FLAG_DEFAULT)
79 .def_readonly(
"Binary", &FLAG_BINARY)
80 .def_readonly(
"MSB", &FLAG_MSB)
81 .def_readonly(
"LSB", &FLAG_LSB)
82 .def_readonly(
"Swap", &FLAG_SWAP)
83 .def_readonly(
"VertexNormal", &FLAG_VERTEXNORMAL)
84 .def_readonly(
"VertexColor", &FLAG_VERTEXCOLOR)
85 .def_readonly(
"VertexTexCoord", &FLAG_VERTEXTEXCOORD)
86 .def_readonly(
"EdgeColor", &FLAG_EDGECOLOR)
87 .def_readonly(
"FaceNormal", &FLAG_FACENORMAL)
88 .def_readonly(
"FaceColor", &FLAG_FACECOLOR)
89 .def_readonly(
"FaceTexCoord", &FLAG_FACETEXCOORD)
90 .def_readonly(
"ColorAlpha", &FLAG_COLORALPHA)
91 .def_readonly(
"ColorFloat", &FLAG_COLORFLOAT)
94 enum_<IO::Options::Flag>(
"Flag")
void expose_io()
Expose the input/output functions and options to Python.
Definition: InputOutput.hh:30
void cleanup(void)
Restore state after default constructor.
Definition: Options.hh:147
Flag
Definitions of Options for reading and writing.
Definition: Options.hh:103
void clear(void)
Clear all bits.
Definition: Options.hh:151
bool write_mesh(const Mesh &_mesh, const std::string &_filename, Options _opt=Options::Default, std::streamsize _precision=6)
Write a mesh to the file _filename.
Definition: MeshIO.hh:199
Has (r) / store (w) face colors.
Definition: Options.hh:114
Has (r) / store (w) face normals.
Definition: Options.hh:113
bool is_empty(void) const
Returns true if all bits are zero.
Definition: Options.hh:155
Has (r) / store (w) float values for colors (currently only implemented for PLY and OFF files) ...
Definition: Options.hh:117
Assume big endian byte ordering.
Definition: Options.hh:106
Swap byte order in binary mode.
Definition: Options.hh:108
Has (r) / store (w) vertex normals.
Definition: Options.hh:109
Set options for reader/writer modules.
Definition: Options.hh:95
No options.
Definition: Options.hh:104
Has (r) / store (w) texture coordinates.
Definition: Options.hh:111
Set binary mode for r/w.
Definition: Options.hh:105
Polygonal mesh based on the ArrayKernel.
Definition: PolyMesh_ArrayKernelT.hh:98
Assume little endian byte ordering.
Definition: Options.hh:107
Triangle mesh based on the ArrayKernel.
Definition: TriMesh_ArrayKernelT.hh:98
Has (r) / store (w) alpha values for colors.
Definition: Options.hh:116
Has (r) / store (w) face texture coordinates.
Definition: Options.hh:115
bool read_mesh(Mesh &_mesh, const std::string &_filename)
Read a mesh from file _filename.
Definition: MeshIO.hh:104
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:64
Has (r) / store (w) edge colors.
Definition: Options.hh:112
Has (r) / store (w) vertex colors.
Definition: Options.hh:110