Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Gilbert <ascotan@gmail.com>2005-07-23 17:46:40 +0400
committerJoseph Gilbert <ascotan@gmail.com>2005-07-23 17:46:40 +0400
commit6a9e7ab3f22eb0b153c71f33d0cd912641cd2f0c (patch)
treeb4b65280df6e934648e2dcad0f2dfa39858fa29f /source/blender/python/api2_2x/euler.c
parent32255b65df00897ea9f5ec960eec0040edd946be (diff)
_new point class and update_
- adds a new point class * point/ vector math (p + v = p, p - p = v, etc.) * points can be transformed by matrices/quats * wraps 'place vector' type vectors that have no magnitude - wrapped toXXX() methods work correctly * toXXX() will NOT wrap data (this is due to the fact that wrapped data cannot be converted) * added a 'wrapped' attribute to mathutils classes to determine wether the object is accessing python or blender data - added the ability to negate vectors/points with "-vec" * deprecated vector.negate() - added the ability to shorhand inverse matrices with "~mat" (tilde) - conversion between vector/point with toXXX() methods
Diffstat (limited to 'source/blender/python/api2_2x/euler.c')
-rw-r--r--source/blender/python/api2_2x/euler.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/source/blender/python/api2_2x/euler.c b/source/blender/python/api2_2x/euler.c
index 8ec0bff86a8..a754896db3e 100644
--- a/source/blender/python/api2_2x/euler.c
+++ b/source/blender/python/api2_2x/euler.c
@@ -65,10 +65,7 @@ PyObject *Euler_ToQuat(EulerObject * self)
eul[x] = self->eul[x] * ((float)Py_PI / 180);
}
EulToQuat(eul, quat);
- if(self->data.blend_data)
- return (PyObject *) newQuaternionObject(quat, Py_WRAP);
- else
- return (PyObject *) newQuaternionObject(quat, Py_NEW);
+ return (PyObject *) newQuaternionObject(quat, Py_NEW);
}
//----------------------------Euler.toMatrix()---------------------
//return a matrix representation of the euler
@@ -82,10 +79,7 @@ PyObject *Euler_ToMatrix(EulerObject * self)
eul[x] = self->eul[x] * ((float)Py_PI / 180);
}
EulToMat3(eul, (float (*)[3]) mat);
- if(self->data.blend_data)
- return (PyObject *) newMatrixObject(mat, 3, 3 , Py_WRAP);
- else
- return (PyObject *) newMatrixObject(mat, 3, 3 , Py_NEW);
+ return (PyObject *) newMatrixObject(mat, 3, 3 , Py_NEW);
}
//----------------------------Euler.unique()-----------------------
//sets the x,y,z values to a unique euler rotation
@@ -199,7 +193,12 @@ static PyObject *Euler_getattr(EulerObject * self, char *name)
}else if(STREQ(name, "z")){
return PyFloat_FromDouble(self->eul[2]);
}
-
+ if(STREQ(name, "wrapped")){
+ if(self->wrapped == Py_WRAP)
+ return EXPP_incr_ret((PyObject *)Py_True);
+ else
+ return EXPP_incr_ret((PyObject *)Py_False);
+ }
return Py_FindMethod(Euler_methods, (PyObject *) self, name);
}
//----------------------------setattr()(internal) ------------------
@@ -394,6 +393,7 @@ PyObject *newEulerObject(float *eul, int type)
if(type == Py_WRAP){
self->data.blend_data = eul;
self->eul = self->data.blend_data;
+ self->wrapped = Py_WRAP;
}else if (type == Py_NEW){
self->data.py_data = PyMem_Malloc(3 * sizeof(float));
self->eul = self->data.py_data;
@@ -406,6 +406,7 @@ PyObject *newEulerObject(float *eul, int type)
self->eul[x] = eul[x];
}
}
+ self->wrapped = Py_NEW;
}else{ //bad type
return NULL;
}