diff --git a/src/py-opentimelineio/opentimelineio-bindings/otio_imath.cpp b/src/py-opentimelineio/opentimelineio-bindings/otio_imath.cpp index 4cd5df28b..07d6bbaff 100644 --- a/src/py-opentimelineio/opentimelineio-bindings/otio_imath.cpp +++ b/src/py-opentimelineio/opentimelineio-bindings/otio_imath.cpp @@ -28,7 +28,7 @@ static void define_imath_2d(py::module m) { // Imath classes are binded with Pybind11 more than once. // Using module_local will avoid conflicts in such cases. py::class_(m, "V2d", py::module_local()) - .def(py::init<>()) + .def(py::init<>([]() { return IMATH_NAMESPACE::V2d(0.0, 0.0); })) .def(py::init()) .def(py::init()) .def_readwrite("x", &IMATH_NAMESPACE::V2d::x) @@ -101,7 +101,7 @@ static void define_imath_2d(py::module m) { }); py::class_(m, "Box2d", py::module_local()) - .def(py::init<>()) + .def(py::init<>([]() { return IMATH_NAMESPACE::Box2d(IMATH_NAMESPACE::V2d(0.0, 0.0)); })) .def(py::init()) .def(py::init()) .def_readwrite("min", &IMATH_NAMESPACE::Box2d::min) diff --git a/tests/test_box2d.py b/tests/test_box2d.py index 93b7cad39..302534e15 100644 --- a/tests/test_box2d.py +++ b/tests/test_box2d.py @@ -9,6 +9,11 @@ class Box2dTests(unittest.TestCase, otio_test_utils.OTIOAssertions): def test_cons(self): + box = otio.schema.Box2d() + + self.assertEqual(box.min, otio.schema.V2d(0.0, 0.0)) + self.assertEqual(box.max, otio.schema.V2d(0.0, 0.0)) + v1 = otio.schema.V2d(1.0, 2.0) v2 = otio.schema.V2d(3.0, 4.0) box = otio.schema.Box2d(v1, v2) diff --git a/tests/test_v2d.py b/tests/test_v2d.py index 8c5680efd..6db7c979e 100644 --- a/tests/test_v2d.py +++ b/tests/test_v2d.py @@ -12,6 +12,11 @@ class V2dTests(unittest.TestCase, otio_test_utils.OTIOAssertions): def test_cons(self): + v = otio.schema.V2d() + + self.assertEqual(v.x, 0.0) + self.assertEqual(v.y, 0.0) + v = otio.schema.V2d(1.0, 2.0) self.assertEqual(v.x, 1.0)