diff options
author | Ken Hughes <khughes@pacific.edu> | 2006-08-21 18:36:11 +0400 |
---|---|---|
committer | Ken Hughes <khughes@pacific.edu> | 2006-08-21 18:36:11 +0400 |
commit | e5be894a29fa1a44cd11da18dbd094e32bb54dfb (patch) | |
tree | aec14b9a3b4d30a264f41c65213da0d5e6b3cc1e /source/blender/python/api2_2x/point.c | |
parent | e3ff8e350778feaa1b5c3feaec7adb56a9d8a630 (diff) |
===Python API===
Bugfix: unary minus on a point object should not modify the original point
data but return a new point.
Diffstat (limited to 'source/blender/python/api2_2x/point.c')
-rw-r--r-- | source/blender/python/api2_2x/point.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/python/api2_2x/point.c b/source/blender/python/api2_2x/point.c index 56e1eae5904..cc6bd3a5342 100644 --- a/source/blender/python/api2_2x/point.c +++ b/source/blender/python/api2_2x/point.c @@ -400,12 +400,14 @@ static PyObject *Point_mul(PyObject * p1, PyObject * p2) static PyObject *Point_neg(PointObject *self) { int x; - for(x = 0; x < self->size; x++){ - self->coord[x] = -self->coord[x]; - } + float coord[3]; - return EXPP_incr_ret((PyObject *)self); + for(x = 0; x < self->size; x++) + coord[x] = -self->coord[x]; + + return newPointObject(coord, self->size, Py_NEW); } + //------------------------coerce(obj, obj)----------------------- //coercion of unknown types to type PointObject for numeric protocols /*Coercion() is called whenever a math operation has 2 operands that |