From 150d36e4dac1c556c3f65755d88ef76112a5ee9c Mon Sep 17 00:00:00 2001 From: Martin Poirier Date: Thu, 12 Jan 2006 01:11:42 +0000 Subject: [PATCH] BPy: Mathutils fix: bug #3737 Vector.resize4D() didn't put 1 in the 4th component (the scale factor), as it did in 2.37. While this is more "correct", it is much less usefull. Also, matrix.resize4x4 puts a 1 there too, so might as well revert and be consistent. --- source/blender/python/api2_2x/doc/Mathutils.py | 1 + source/blender/python/api2_2x/vector.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/source/blender/python/api2_2x/doc/Mathutils.py b/source/blender/python/api2_2x/doc/Mathutils.py index 2d4e0a0c092..b1a8839110e 100644 --- a/source/blender/python/api2_2x/doc/Mathutils.py +++ b/source/blender/python/api2_2x/doc/Mathutils.py @@ -493,6 +493,7 @@ class Vector: def resize4D(): """ Resize the vector to 4d. New axis will be 0.0. + The last component will be 1.0, to make multiplying 3d vectors by 4x4 matrices easier. @return: a copy of itself """ diff --git a/source/blender/python/api2_2x/vector.c b/source/blender/python/api2_2x/vector.c index bb862fe42f7..d9b656be61f 100644 --- a/source/blender/python/api2_2x/vector.c +++ b/source/blender/python/api2_2x/vector.c @@ -160,9 +160,9 @@ PyObject *Vector_Resize4D(VectorObject * self) self->vec = self->data.py_data; //force if(self->size == 2){ self->data.py_data[2] = 0.0f; - self->data.py_data[3] = 0.0f; + self->data.py_data[3] = 1.0f; }else if(self->size == 3){ - self->data.py_data[3] = 0.0f; + self->data.py_data[3] = 1.0f; } self->size = 4; return EXPP_incr_ret((PyObject*)self);