diff --git a/src/bindings/bnd_nurbscurve.cpp b/src/bindings/bnd_nurbscurve.cpp index 9c885237..aa3035ab 100644 --- a/src/bindings/bnd_nurbscurve.cpp +++ b/src/bindings/bnd_nurbscurve.cpp @@ -225,7 +225,11 @@ BND_BezierCurve* BND_NurbsCurve::ConvertSpanToBezier(int index) const void initNurbsCurveBindings(rh3dmpymodule& m) { +#if defined(NANOBIND) // temp workaround for buffer protocol + py::class_(m, "NurbsCurveKnotList") +#else py::class_(m, "NurbsCurveKnotList", py::buffer_protocol()) +#endif .def("__len__", &BND_NurbsCurveKnotList::Count) .def("__getitem__", &BND_NurbsCurveKnotList::GetKnot) .def("__setitem__", &BND_NurbsCurveKnotList::SetKnot) @@ -254,7 +258,11 @@ void initNurbsCurveBindings(rh3dmpymodule& m) ; ; +#if defined(NANOBIND) // temp workaround for buffer protocol + py::class_(m, "NurbsCurvePointList") +#else py::class_(m, "NurbsCurvePointList", py::buffer_protocol()) +#endif .def("__len__", &BND_NurbsCurvePointList::Count) .def("__getitem__", &BND_NurbsCurvePointList::GetControlPoint) .def("__setitem__", &BND_NurbsCurvePointList::SetControlPoint) diff --git a/src/bindings/bnd_nurbssurface.cpp b/src/bindings/bnd_nurbssurface.cpp index 7d5696e3..959245c3 100644 --- a/src/bindings/bnd_nurbssurface.cpp +++ b/src/bindings/bnd_nurbssurface.cpp @@ -200,7 +200,11 @@ BND_NurbsSurfacePointList BND_NurbsSurface::Points() void initNurbsSurfaceBindings(rh3dmpymodule& m) { +#if defined(NANOBIND) + py::class_(m, "NurbsSurfaceKnotList") +#else py::class_(m, "NurbsSurfaceKnotList", py::buffer_protocol()) +#endif .def("__len__", &BND_NurbsSurfaceKnotList::Count) .def("__getitem__", &BND_NurbsSurfaceKnotList::GetKnot) .def("__setitem__", &BND_NurbsSurfaceKnotList::SetKnot) @@ -228,7 +232,11 @@ void initNurbsSurfaceBindings(rh3dmpymodule& m) .def("SuperfluousKnot", &BND_NurbsSurfaceKnotList::SuperfluousKnot, py::arg("start")) ; +#if defined(NANOBIND) + py::class_(m, "NurbsSurfacePointList") +#else py::class_(m, "NurbsSurfacePointList", py::buffer_protocol()) +#endif .def("__len__", &BND_NurbsSurfacePointList::Count) .def_property_readonly("CountU", &BND_NurbsSurfacePointList::CountU) .def_property_readonly("CountV", &BND_NurbsSurfacePointList::CountV)