From aadc437b2532c47723580be7b1d5c3a62f9d5ce6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 11 May 2021 16:32:28 +0200 Subject: [PATCH] python: added Vector4 from Vector3 and Vector3 from Vector2 constructors. Not sure why I missed those. --- doc/python/pages/changelog.rst | 2 ++ src/python/magnum/math.vector.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/doc/python/pages/changelog.rst b/doc/python/pages/changelog.rst index 5e0de88..e31bb6c 100644 --- a/doc/python/pages/changelog.rst +++ b/doc/python/pages/changelog.rst @@ -35,6 +35,8 @@ Changelog `Changes since 2020.06`_ ======================== +- Exposed missing :ref:`Vector4` constructor from a :ref:`Vector3` and a + W component and :ref:`Vector3` from :ref:`Vector2` and a Z component - Renamed :py:`Matrix3.from()` / :py:`Matrix4.from()` to :ref:`Matrix3.from_()` / :ref:`Matrix4.from_()` because :py:`from` is a Python keyword and it would be silly to have to write :py:`getattr(Matrix4, 'from')` just to use diff --git a/src/python/magnum/math.vector.h b/src/python/magnum/math.vector.h index 14c60a8..a21b4d8 100644 --- a/src/python/magnum/math.vector.h +++ b/src/python/magnum/math.vector.h @@ -380,6 +380,7 @@ template void vector3(py::class_>& c) { c /* Constructors */ .def(py::init(), "Constructor") + .def(py::init, T>(), "Constructor") .def(py::init([](const std::tuple& value) { return Math::Vector3{std::get<0>(value), std::get<1>(value), std::get<2>(value)}; }), "Construct from a tuple") @@ -437,6 +438,7 @@ template void vector4(py::class_>& c) { c /* Constructors */ .def(py::init(), "Constructor") + .def(py::init, T>(), "Constructor") .def(py::init([](const std::tuple& value) { return Math::Vector4{std::get<0>(value), std::get<1>(value), std::get<2>(value), std::get<3>(value)}; }), "Construct from a tuple")