Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7337053

Browse files
committed
Bind constructor for a struct.
1 parent 18bb83f commit 7337053

File tree

2 files changed

+5
-214
lines changed

2 files changed

+5
-214
lines changed

python/bindings.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,13 @@ PYBIND11_MODULE(tinyobjloader, tobj_module)
3535
tobj_module.doc() = "Python bindings for TinyObjLoader.";
3636

3737
// register struct
38+
// py::init<>() for default constructor
3839
py::class_<attrib_t>(tobj_module, "Attrib")
3940
.def(py::init<>());
40-
py::class_<shape_t>(tobj_module, "Shape");
41-
py::class_<material_t>(tobj_module, "Material");
41+
py::class_<shape_t>(tobj_module, "Shape")
42+
.def(py::init<>());
43+
py::class_<material_t>(tobj_module, "Material")
44+
.def(py::init<>());
4245

4346
tobj_module.def("load_obj", &load_obj, "Load wavefront .obj file.");
4447
tobj_module.def("load_mtl", &load_mtl, "Load wavefront material file.");

python/main.cpp

Lines changed: 0 additions & 212 deletions
This file was deleted.

0 commit comments

Comments
 (0)