From 59a27738088e0450b18c6e84f73aec0bebda9929 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 16 Sep 2019 23:59:49 +0200 Subject: [PATCH] python: expose mesh import. --- doc/python/magnum.trade.rst | 24 +++++++++++++ src/python/magnum/test/mesh.glb | Bin 0 -> 832 bytes src/python/magnum/test/test_trade.py | 52 +++++++++++++++++++++++++-- src/python/magnum/trade.cpp | 9 +++++ 4 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 src/python/magnum/test/mesh.glb diff --git a/doc/python/magnum.trade.rst b/doc/python/magnum.trade.rst index 30d3a86..b512cbe 100644 --- a/doc/python/magnum.trade.rst +++ b/doc/python/magnum.trade.rst @@ -95,6 +95,30 @@ .. py:function:: magnum.trade.AbstractImporter.open_file :raise RuntimeError: If file opening fails +.. py:property:: magnum.trade.AbstractImporter.mesh2d_count + :raise RuntimeError: If no file is opened +.. py:property:: magnum.trade.AbstractImporter.mesh3d_count + :raise RuntimeError: If no file is opened + +.. py:function:: magnum.trade.AbstractImporter.mesh2d_for_name + :raise RuntimeError: If no file is opened +.. py:function:: magnum.trade.AbstractImporter.mesh3d_for_name + :raise RuntimeError: If no file is opened + +.. py:function:: magnum.trade.AbstractImporter.mesh2d_name + :raise RuntimeError: If no file is opened + :raise ValueError: If :p:`id` is negative or not less than `mesh2d_count` +.. py:function:: magnum.trade.AbstractImporter.mesh3d_name + :raise RuntimeError: If no file is opened + :raise ValueError: If :p:`id` is negative or not less than `mesh3d_count` + +.. py:function:: magnum.trade.AbstractImporter.mesh2d + :raise RuntimeError: If no file is opened + :raise ValueError: If :p:`id` is negative or not less than `mesh2d_count` +.. py:function:: magnum.trade.AbstractImporter.mesh3d + :raise RuntimeError: If no file is opened + :raise ValueError: If :p:`id` is negative or not less than `mesh3d_count` + .. py:property:: magnum.trade.AbstractImporter.image1d_count :raise RuntimeError: If no file is opened .. py:property:: magnum.trade.AbstractImporter.image2d_count diff --git a/src/python/magnum/test/mesh.glb b/src/python/magnum/test/mesh.glb new file mode 100644 index 0000000000000000000000000000000000000000..3a71a0cc88df4fa32f520cc50ff70019ceca8a2f GIT binary patch literal 832 zcmb7D%}&BV5MK2uyft%P4YWwKi4-K7pwJRPJQxlIwy;sQq}_s~Y2s_(%g6)3%?EN? zkzYN~WRux%_M7>>$+Y*{xH~3<HxhI9?b{SdivGgqF{Hh zo9}u*BWVYY!@MSEV-!H4;|_+dU_v$~LmbsbT204bAaJ%C1(~2wFBZy$8V)yvO@8up zm!JKE-@Gkqdu$xce)s>`=w#h{(@Wx`J&~-;L{Ih;-SO3OoMc7NrL?_Xye(ShDyyws z>@%_bCN;B7RS%)=v{j>(fu;Bj#h39aRB^{|N+uyk@wU$lLf$_ySRN&he*j`+hPd%D fo#qzv`SoI6&Mo5{<`6$MG)*%QHyp, "Two-dimensional mesh count") + .def_property_readonly("mesh3d_count", checkOpened, "Three-dimensional mesh count") + .def("mesh2d_for_name", checkOpened, "Two-dimensional mesh ID for given name") + .def("mesh3d_for_name", checkOpened, "Three-dimensional mesh ID for given name") + .def("mesh2d_name", checkOpenedBounds, "Two-dimensional mesh name", py::arg("id")) + .def("mesh3d_name", checkOpenedBounds, "Three-dimensional mesh name", py::arg("id")) + .def("mesh2d", checkOpenedBoundsResult, "Two-dimensional mesh", py::arg("id")) + .def("mesh3d", checkOpenedBoundsResult, "Three-dimensional mesh", py::arg("id")) + .def_property_readonly("image1d_count", checkOpened, "One-dimensional image count") .def_property_readonly("image2d_count", checkOpened, "Two-dimensional image count") .def_property_readonly("image3d_count", checkOpened, "Three-dimensional image count")