Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
openmesh-python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenMesh
openmesh-python
Commits
17bfe3da
Commit
17bfe3da
authored
7 years ago
by
Alexander Dielen
Browse files
Options
Downloads
Patches
Plain Diff
exposed io functions
parent
437accc1
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
CMakeLists.txt
+1
-1
1 addition, 1 deletion
CMakeLists.txt
src/Bindings.cc
+2
-1
2 additions, 1 deletion
src/Bindings.cc
src/InputOutput.cc
+88
-0
88 additions, 0 deletions
src/InputOutput.cc
src/InputOutput.hh
+3
-108
3 additions, 108 deletions
src/InputOutput.hh
with
94 additions
and
110 deletions
CMakeLists.txt
+
1
−
1
View file @
17bfe3da
...
...
@@ -7,6 +7,6 @@ find_package(OpenMesh)
include_directories
(
${
OPENMESH_INCLUDE_DIRS
}
)
add_subdirectory
(
pybind11
)
pybind11_add_module
(
openmesh src/Bindings.cc src/Miscellaneous.cc
)
pybind11_add_module
(
openmesh src/Bindings.cc
src/InputOutput.cc
src/Miscellaneous.cc
)
target_link_libraries
(
openmesh PRIVATE
${
OPENMESH_LIBRARIES
}
)
This diff is collapsed.
Click to expand it.
src/Bindings.cc
+
2
−
1
View file @
17bfe3da
...
...
@@ -4,6 +4,7 @@
#include
"Mesh.hh"
#include
"Iterator.hh"
#include
"Circulator.hh"
#include
"InputOutput.hh"
#include
<pybind11/pybind11.h>
...
...
@@ -54,7 +55,7 @@ PYBIND11_MODULE(openmesh, m) {
// expose_property_manager<EPropHandleT<object>, EdgeHandle, EdgeIterWrapper>("EPropertyManager");
// expose_property_manager<FPropHandleT<object>, FaceHandle, FaceIterWrapper>("FPropertyManager");
//
expose_io();
expose_io
(
m
);
// expose_decimater<PolyMesh>("PolyMesh");
// expose_decimater<TriMesh>("TriMesh");
...
...
This diff is collapsed.
Click to expand it.
src/InputOutput.cc
0 → 100644
+
88
−
0
View file @
17bfe3da
#include
"InputOutput.hh"
#include
"Bindings.hh"
#include
<pybind11/operators.h>
namespace
OM
=
OpenMesh
;
/**
* Expose the input/output functions and options to Python.
*/
void
expose_io
(
py
::
module
&
m
)
{
//======================================================================
// Options
//======================================================================
py
::
class_
<
OM
::
IO
::
Options
>
class_options
(
m
,
"Options"
);
class_options
.
def
(
py
::
init
<>
())
.
def
(
py
::
init
<
OM
::
IO
::
Options
::
Flag
>
())
.
def
(
"cleanup"
,
&
OM
::
IO
::
Options
::
cleanup
)
.
def
(
"clear"
,
&
OM
::
IO
::
Options
::
clear
)
.
def
(
"is_empty"
,
&
OM
::
IO
::
Options
::
is_empty
)
.
def
(
"check"
,
&
OM
::
IO
::
Options
::
check
)
.
def
(
"is_binary"
,
&
OM
::
IO
::
Options
::
is_binary
)
.
def
(
"vertex_has_normal"
,
&
OM
::
IO
::
Options
::
vertex_has_normal
)
.
def
(
"vertex_has_color"
,
&
OM
::
IO
::
Options
::
vertex_has_color
)
.
def
(
"vertex_has_texcoord"
,
&
OM
::
IO
::
Options
::
vertex_has_texcoord
)
.
def
(
"edge_has_color"
,
&
OM
::
IO
::
Options
::
edge_has_color
)
.
def
(
"face_has_normal"
,
&
OM
::
IO
::
Options
::
face_has_normal
)
.
def
(
"face_has_color"
,
&
OM
::
IO
::
Options
::
face_has_color
)
.
def
(
"face_has_texcoord"
,
&
OM
::
IO
::
Options
::
face_has_texcoord
)
.
def
(
"color_has_alpha"
,
&
OM
::
IO
::
Options
::
color_has_alpha
)
.
def
(
"color_is_float"
,
&
OM
::
IO
::
Options
::
color_is_float
)
.
def
(
py
::
self
==
py
::
self
)
.
def
(
py
::
self
!=
py
::
self
)
.
def
(
py
::
self
-=
OM
::
IO
::
Options
::
Flag
())
.
def
(
py
::
self
+=
OM
::
IO
::
Options
::
Flag
())
;
py
::
enum_
<
OM
::
IO
::
Options
::
Flag
>
(
class_options
,
"Flag"
,
py
::
arithmetic
())
.
value
(
"Default"
,
OM
::
IO
::
Options
::
Default
)
.
value
(
"Binary"
,
OM
::
IO
::
Options
::
Binary
)
.
value
(
"MSB"
,
OM
::
IO
::
Options
::
MSB
)
.
value
(
"LSB"
,
OM
::
IO
::
Options
::
LSB
)
.
value
(
"Swap"
,
OM
::
IO
::
Options
::
Swap
)
.
value
(
"VertexNormal"
,
OM
::
IO
::
Options
::
VertexNormal
)
.
value
(
"VertexColor"
,
OM
::
IO
::
Options
::
VertexColor
)
.
value
(
"VertexTexCoord"
,
OM
::
IO
::
Options
::
VertexTexCoord
)
.
value
(
"EdgeColor"
,
OM
::
IO
::
Options
::
EdgeColor
)
.
value
(
"FaceNormal"
,
OM
::
IO
::
Options
::
FaceNormal
)
.
value
(
"FaceColor"
,
OM
::
IO
::
Options
::
FaceColor
)
.
value
(
"FaceTexCoord"
,
OM
::
IO
::
Options
::
FaceTexCoord
)
.
value
(
"ColorAlpha"
,
OM
::
IO
::
Options
::
ColorAlpha
)
.
value
(
"ColorFloat"
,
OM
::
IO
::
Options
::
ColorFloat
)
.
export_values
()
;
//======================================================================
// Functions
//======================================================================
bool
(
*
read_mesh_poly
)(
PolyMesh
&
,
const
std
::
string
&
)
=
&
OM
::
IO
::
read_mesh
;
bool
(
*
read_mesh_poly_options
)(
PolyMesh
&
,
const
std
::
string
&
,
OM
::
IO
::
Options
&
,
bool
)
=
&
OM
::
IO
::
read_mesh
;
bool
(
*
read_mesh_tri
)(
TriMesh
&
,
const
std
::
string
&
)
=
&
OM
::
IO
::
read_mesh
;
bool
(
*
read_mesh_tri_options
)(
TriMesh
&
,
const
std
::
string
&
,
OM
::
IO
::
Options
&
,
bool
)
=
&
OM
::
IO
::
read_mesh
;
bool
(
*
write_mesh_poly
)(
const
PolyMesh
&
,
const
std
::
string
&
,
OM
::
IO
::
Options
,
std
::
streamsize
)
=
&
OM
::
IO
::
write_mesh
;
bool
(
*
write_mesh_tri
)(
const
TriMesh
&
,
const
std
::
string
&
,
OM
::
IO
::
Options
,
std
::
streamsize
)
=
&
OM
::
IO
::
write_mesh
;
m
.
def
(
"read_mesh"
,
read_mesh_poly
);
m
.
def
(
"read_mesh"
,
read_mesh_poly_options
,
py
::
arg
(
"mesh"
),
py
::
arg
(
"filename"
),
py
::
arg
(
"opt"
),
py
::
arg
(
"clear"
)
=
true
);
m
.
def
(
"read_mesh"
,
read_mesh_tri
);
m
.
def
(
"read_mesh"
,
read_mesh_tri_options
,
py
::
arg
(
"mesh"
),
py
::
arg
(
"filename"
),
py
::
arg
(
"opt"
),
py
::
arg
(
"clear"
)
=
true
);
m
.
def
(
"write_mesh"
,
write_mesh_poly
,
py
::
arg
(
"mesh"
),
py
::
arg
(
"filename"
),
py
::
arg
(
"opt"
)
=
OM
::
IO
::
Options
::
Default
,
py
::
arg
(
"precision"
)
=
6
);
m
.
def
(
"write_mesh"
,
write_mesh_tri
,
py
::
arg
(
"mesh"
),
py
::
arg
(
"filename"
),
py
::
arg
(
"opt"
)
=
OM
::
IO
::
Options
::
Default
,
py
::
arg
(
"precision"
)
=
6
);
}
This diff is collapsed.
Click to expand it.
src/InputOutput.hh
+
3
−
108
View file @
17bfe3da
#ifndef OPENMESH_PYTHON_INPUTOUTPUT_HH
#define OPENMESH_PYTHON_INPUTOUTPUT_HH
#include
"Bindings.hh"
#include
<pybind11/pybind11.h>
namespace
py
=
pybind11
;
namespace
OpenMesh
{
namespace
Python
{
const
IO
::
Options
::
Flag
FLAG_DEFAULT
=
IO
::
Options
::
Default
;
const
IO
::
Options
::
Flag
FLAG_BINARY
=
IO
::
Options
::
Binary
;
const
IO
::
Options
::
Flag
FLAG_MSB
=
IO
::
Options
::
MSB
;
const
IO
::
Options
::
Flag
FLAG_LSB
=
IO
::
Options
::
LSB
;
const
IO
::
Options
::
Flag
FLAG_SWAP
=
IO
::
Options
::
Swap
;
const
IO
::
Options
::
Flag
FLAG_VERTEXNORMAL
=
IO
::
Options
::
VertexNormal
;
const
IO
::
Options
::
Flag
FLAG_VERTEXCOLOR
=
IO
::
Options
::
VertexColor
;
const
IO
::
Options
::
Flag
FLAG_VERTEXTEXCOORD
=
IO
::
Options
::
VertexTexCoord
;
const
IO
::
Options
::
Flag
FLAG_EDGECOLOR
=
IO
::
Options
::
EdgeColor
;
const
IO
::
Options
::
Flag
FLAG_FACENORMAL
=
IO
::
Options
::
FaceNormal
;
const
IO
::
Options
::
Flag
FLAG_FACECOLOR
=
IO
::
Options
::
FaceColor
;
const
IO
::
Options
::
Flag
FLAG_FACETEXCOORD
=
IO
::
Options
::
FaceTexCoord
;
const
IO
::
Options
::
Flag
FLAG_COLORALPHA
=
IO
::
Options
::
ColorAlpha
;
const
IO
::
Options
::
Flag
FLAG_COLORFLOAT
=
IO
::
Options
::
ColorFloat
;
BOOST_PYTHON_FUNCTION_OVERLOADS
(
read_mesh_overloads
,
IO
::
read_mesh
,
3
,
4
)
BOOST_PYTHON_FUNCTION_OVERLOADS
(
write_mesh_overloads
,
IO
::
write_mesh
,
2
,
4
)
/**
* Expose the input/output functions and options to Python.
*/
void
expose_io
()
{
//======================================================================
// Functions
//======================================================================
bool
(
*
read_mesh_poly
)(
PolyMesh
&
,
const
std
::
string
&
)
=
&
IO
::
read_mesh
;
bool
(
*
read_mesh_poly_options
)(
PolyMesh
&
,
const
std
::
string
&
,
IO
::
Options
&
,
bool
)
=
&
IO
::
read_mesh
;
bool
(
*
read_mesh_tri
)(
TriMesh
&
,
const
std
::
string
&
)
=
&
IO
::
read_mesh
;
bool
(
*
read_mesh_tri_options
)(
TriMesh
&
,
const
std
::
string
&
,
IO
::
Options
&
,
bool
)
=
&
IO
::
read_mesh
;
bool
(
*
write_mesh_poly
)(
const
PolyMesh
&
,
const
std
::
string
&
,
IO
::
Options
,
std
::
streamsize
)
=
&
IO
::
write_mesh
;
bool
(
*
write_mesh_tri
)(
const
TriMesh
&
,
const
std
::
string
&
,
IO
::
Options
,
std
::
streamsize
)
=
&
IO
::
write_mesh
;
def
(
"read_mesh"
,
read_mesh_poly
);
def
(
"read_mesh"
,
read_mesh_poly_options
,
read_mesh_overloads
());
def
(
"read_mesh"
,
read_mesh_tri
);
def
(
"read_mesh"
,
read_mesh_tri_options
,
read_mesh_overloads
());
def
(
"write_mesh"
,
write_mesh_poly
,
write_mesh_overloads
());
def
(
"write_mesh"
,
write_mesh_tri
,
write_mesh_overloads
());
//======================================================================
// Options
//======================================================================
scope
scope_options
=
class_
<
IO
::
Options
>
(
"Options"
)
.
def
(
init
<
IO
::
Options
::
Flag
>
())
.
def
(
"cleanup"
,
&
IO
::
Options
::
cleanup
)
.
def
(
"clear"
,
&
IO
::
Options
::
clear
)
.
def
(
"is_empty"
,
&
IO
::
Options
::
is_empty
)
.
def
(
"check"
,
&
IO
::
Options
::
check
)
.
def
(
"is_binary"
,
&
IO
::
Options
::
is_binary
)
.
def
(
"vertex_has_normal"
,
&
IO
::
Options
::
vertex_has_normal
)
.
def
(
"vertex_has_color"
,
&
IO
::
Options
::
vertex_has_color
)
.
def
(
"vertex_has_texcoord"
,
&
IO
::
Options
::
vertex_has_texcoord
)
.
def
(
"edge_has_color"
,
&
IO
::
Options
::
edge_has_color
)
.
def
(
"face_has_normal"
,
&
IO
::
Options
::
face_has_normal
)
.
def
(
"face_has_color"
,
&
IO
::
Options
::
face_has_color
)
.
def
(
"face_has_texcoord"
,
&
IO
::
Options
::
face_has_texcoord
)
.
def
(
"color_has_alpha"
,
&
IO
::
Options
::
color_has_alpha
)
.
def
(
"color_is_float"
,
&
IO
::
Options
::
color_is_float
)
.
def
(
self
==
self
)
.
def
(
self
!=
self
)
.
def
(
self
-=
IO
::
Options
::
Flag
())
.
def
(
self
+=
IO
::
Options
::
Flag
())
.
def_readonly
(
"Default"
,
&
FLAG_DEFAULT
)
.
def_readonly
(
"Binary"
,
&
FLAG_BINARY
)
.
def_readonly
(
"MSB"
,
&
FLAG_MSB
)
.
def_readonly
(
"LSB"
,
&
FLAG_LSB
)
.
def_readonly
(
"Swap"
,
&
FLAG_SWAP
)
.
def_readonly
(
"VertexNormal"
,
&
FLAG_VERTEXNORMAL
)
.
def_readonly
(
"VertexColor"
,
&
FLAG_VERTEXCOLOR
)
.
def_readonly
(
"VertexTexCoord"
,
&
FLAG_VERTEXTEXCOORD
)
.
def_readonly
(
"EdgeColor"
,
&
FLAG_EDGECOLOR
)
.
def_readonly
(
"FaceNormal"
,
&
FLAG_FACENORMAL
)
.
def_readonly
(
"FaceColor"
,
&
FLAG_FACECOLOR
)
.
def_readonly
(
"FaceTexCoord"
,
&
FLAG_FACETEXCOORD
)
.
def_readonly
(
"ColorAlpha"
,
&
FLAG_COLORALPHA
)
.
def_readonly
(
"ColorFloat"
,
&
FLAG_COLORFLOAT
)
;
enum_
<
IO
::
Options
::
Flag
>
(
"Flag"
)
.
value
(
"Default"
,
IO
::
Options
::
Default
)
.
value
(
"Binary"
,
IO
::
Options
::
Binary
)
.
value
(
"MSB"
,
IO
::
Options
::
MSB
)
.
value
(
"LSB"
,
IO
::
Options
::
LSB
)
.
value
(
"Swap"
,
IO
::
Options
::
Swap
)
.
value
(
"VertexNormal"
,
IO
::
Options
::
VertexNormal
)
.
value
(
"VertexColor"
,
IO
::
Options
::
VertexColor
)
.
value
(
"VertexTexCoord"
,
IO
::
Options
::
VertexTexCoord
)
.
value
(
"EdgeColor"
,
IO
::
Options
::
EdgeColor
)
.
value
(
"FaceNormal"
,
IO
::
Options
::
FaceNormal
)
.
value
(
"FaceColor"
,
IO
::
Options
::
FaceColor
)
.
value
(
"FaceTexCoord"
,
IO
::
Options
::
FaceTexCoord
)
.
value
(
"ColorAlpha"
,
IO
::
Options
::
ColorAlpha
)
.
value
(
"ColorFloat"
,
IO
::
Options
::
ColorFloat
)
;
}
}
// namespace OpenMesh
}
// namespace Python
void
expose_io
(
py
::
module
&
m
);
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment