[Bf-blender-cvs] [79ba5e5] master: Revert "mathutils: let Vector.normalize() return the original length."

Campbell Barton noreply at git.blender.org
Thu Jan 29 16:14:58 CET 2015


Commit: 79ba5e52dd6f7405e34a8773275af975ad1c06d9
Author: Campbell Barton
Date:   Fri Jan 30 02:12:02 2015 +1100
Branches: master
https://developer.blender.org/rB79ba5e52dd6f7405e34a8773275af975ad1c06d9

Revert "mathutils: let Vector.normalize() return the original length."

Please discuss changes to core mathutils functions first.

Changes like this should be considered and applied to all areas of the API (or not at all).
Missed quaternion, matrix normalize for eg.

===================================================================

M	source/blender/python/mathutils/mathutils_Vector.c

===================================================================

diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c
index 640a335..167fb5b 100644
--- a/source/blender/python/mathutils/mathutils_Vector.c
+++ b/source/blender/python/mathutils/mathutils_Vector.c
@@ -349,9 +349,6 @@ PyDoc_STRVAR(Vector_normalize_doc,
 "\n"
 "   Normalize the vector, making the length of the vector always 1.0.\n"
 "\n"
-"   :return: the original length of the vector, before normalization\n"
-"   :rtype: float\n"
-"\n"
 "   .. warning:: Normalizing a vector where all values are zero has no effect.\n"
 "\n"
 "   .. note:: Normalize works for vectors of all sizes,\n"
@@ -359,15 +356,14 @@ PyDoc_STRVAR(Vector_normalize_doc,
 );
 static PyObject *Vector_normalize(VectorObject *self)
 {
-	float length;
 	int size = (self->size == 4 ? 3 : self->size);
 	if (BaseMath_ReadCallback(self) == -1)
 		return NULL;
 
-	length = normalize_vn(self->vec, size);
+	normalize_vn(self->vec, size);
 
 	(void)BaseMath_WriteCallback(self);
-	return PyFloat_FromDouble(length);
+	Py_RETURN_NONE;
 }
 PyDoc_STRVAR(Vector_normalized_doc,
 ".. method:: normalized()\n"




More information about the Bf-blender-cvs mailing list