[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30517] branches/bmesh/blender/source/ blender/python/generic: remove old renamed py files
Joseph Eagar
joeedh at gmail.com
Tue Jul 20 01:53:13 CEST 2010
Revision: 30517
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30517
Author: joeedh
Date: 2010-07-20 01:53:13 +0200 (Tue, 20 Jul 2010)
Log Message:
-----------
remove old renamed py files
Removed Paths:
-------------
branches/bmesh/blender/source/blender/python/generic/euler.c
branches/bmesh/blender/source/blender/python/generic/euler.h
branches/bmesh/blender/source/blender/python/generic/matrix.c
branches/bmesh/blender/source/blender/python/generic/matrix.h
branches/bmesh/blender/source/blender/python/generic/quat.c
branches/bmesh/blender/source/blender/python/generic/quat.h
branches/bmesh/blender/source/blender/python/generic/vector.c
branches/bmesh/blender/source/blender/python/generic/vector.h
Deleted: branches/bmesh/blender/source/blender/python/generic/euler.c
===================================================================
--- branches/bmesh/blender/source/blender/python/generic/euler.c 2010-07-19 23:49:38 UTC (rev 30516)
+++ branches/bmesh/blender/source/blender/python/generic/euler.c 2010-07-19 23:53:13 UTC (rev 30517)
@@ -1,667 +0,0 @@
-/*
- * $Id: euler.c 21462 2009-07-09 15:40:04Z ton $
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- *
- * Contributor(s): Joseph Gilbert
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include "Mathutils.h"
-
-#include "BLI_math.h"
-#include "BKE_utildefines.h"
-#include "BLI_blenlib.h"
-
-#include "BLO_sys_types.h"
-
-//----------------------------------Mathutils.Euler() -------------------
-//makes a new euler for you to play with
-static PyObject *Euler_new(PyTypeObject * type, PyObject * args, PyObject * kwargs)
-{
- PyObject *listObject = NULL;
- int size, i;
- float eul[3];
- PyObject *e;
- short order= 0; // TODO, add order option
-
- size = PyTuple_GET_SIZE(args);
- if (size == 1) {
- listObject = PyTuple_GET_ITEM(args, 0);
- if (PySequence_Check(listObject)) {
- size = PySequence_Length(listObject);
- } else { // Single argument was not a sequence
- PyErr_SetString(PyExc_TypeError, "Mathutils.Euler(): 3d numeric sequence expected\n");
- return NULL;
- }
- } else if (size == 0) {
- //returns a new empty 3d euler
- return newEulerObject(NULL, order, Py_NEW, NULL);
- } else {
- listObject = args;
- }
-
- if (size != 3) { // Invalid euler size
- PyErr_SetString(PyExc_AttributeError, "Mathutils.Euler(): 3d numeric sequence expected\n");
- return NULL;
- }
-
- for (i=0; i<size; i++) {
- e = PySequence_GetItem(listObject, i);
- if (e == NULL) { // Failed to read sequence
- Py_DECREF(listObject);
- PyErr_SetString(PyExc_RuntimeError, "Mathutils.Euler(): 3d numeric sequence expected\n");
- return NULL;
- }
-
- eul[i]= (float)PyFloat_AsDouble(e);
- Py_DECREF(e);
-
- if(eul[i]==-1 && PyErr_Occurred()) { // parsed item is not a number
- PyErr_SetString(PyExc_TypeError, "Mathutils.Euler(): 3d numeric sequence expected\n");
- return NULL;
- }
- }
- return newEulerObject(eul, order, Py_NEW, NULL);
-}
-
-short euler_order_from_string(const char *str, const char *error_prefix)
-{
- if((str[0] && str[1] && str[2] && str[3]=='\0')) {
- switch(*((int32_t *)str)) {
- case 'X'|'Y'<<8|'Z'<<16: return 0;
- case 'X'|'Z'<<8|'Y'<<16: return 1;
- case 'Y'|'X'<<8|'Z'<<16: return 2;
- case 'Y'|'Z'<<8|'X'<<16: return 3;
- case 'Z'|'X'<<8|'Y'<<16: return 4;
- case 'Z'|'Y'<<8|'X'<<16: return 5;
- }
- }
-
- PyErr_Format(PyExc_TypeError, "%s: invalid euler order '%s'", error_prefix, str);
- return -1;
-}
-
-//-----------------------------METHODS----------------------------
-//----------------------------Euler.toQuat()----------------------
-//return a quaternion representation of the euler
-
-static char Euler_ToQuat_doc[] =
-".. method:: to_quat()\n"
-"\n"
-" Return a quaternion representation of the euler.\n"
-"\n"
-" :return: Quaternion representation of the euler.\n"
-" :rtype: :class:`Quaternion`\n";
-
-static PyObject *Euler_ToQuat(EulerObject * self)
-{
- float quat[4];
-
- if(!BaseMath_ReadCallback(self))
- return NULL;
-
- if(self->order==0) eul_to_quat(quat, self->eul);
- else eulO_to_quat(quat, self->eul, self->order);
-
- return newQuaternionObject(quat, Py_NEW, NULL);
-}
-//----------------------------Euler.toMatrix()---------------------
-//return a matrix representation of the euler
-static char Euler_ToMatrix_doc[] =
-".. method:: to_matrix()\n"
-"\n"
-" Return a matrix representation of the euler.\n"
-"\n"
-" :return: A 3x3 roation matrix representation of the euler.\n"
-" :rtype: :class:`Matrix`\n";
-
-static PyObject *Euler_ToMatrix(EulerObject * self)
-{
- float mat[9] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
-
- if(!BaseMath_ReadCallback(self))
- return NULL;
-
- if(self->order==0) eul_to_mat3((float (*)[3])mat, self->eul);
- else eulO_to_mat3((float (*)[3])mat, self->eul, self->order);
-
- return newMatrixObject(mat, 3, 3 , Py_NEW, NULL);
-}
-//----------------------------Euler.unique()-----------------------
-//sets the x,y,z values to a unique euler rotation
-// TODO, check if this works with rotation order!!!
-static char Euler_Unique_doc[] =
-".. method:: unique()\n"
-"\n"
-" Calculate a unique rotation for this euler. Avoids gimble lock.\n"
-"\n"
-" :return: an instance of itself\n"
-" :rtype: :class:`Euler`\n";
-
-static PyObject *Euler_Unique(EulerObject * self)
-{
-#define PI_2 (Py_PI * 2.0)
-#define PI_HALF (Py_PI / 2.0)
-#define PI_INV (1.0 / Py_PI)
-
- double heading, pitch, bank;
-
- if(!BaseMath_ReadCallback(self))
- return NULL;
-
- heading = self->eul[0];
- pitch = self->eul[1];
- bank = self->eul[2];
-
- //wrap heading in +180 / -180
- pitch += Py_PI;
- pitch -= floor(pitch * PI_INV) * PI_2;
- pitch -= Py_PI;
-
-
- if(pitch < -PI_HALF) {
- pitch = -Py_PI - pitch;
- heading += Py_PI;
- bank += Py_PI;
- } else if(pitch > PI_HALF) {
- pitch = Py_PI - pitch;
- heading += Py_PI;
- bank += Py_PI;
- }
- //gimbal lock test
- if(fabs(pitch) > PI_HALF - 1e-4) {
- heading += bank;
- bank = 0.0f;
- } else {
- bank += Py_PI;
- bank -= (floor(bank * PI_INV)) * PI_2;
- bank -= Py_PI;
- }
-
- heading += Py_PI;
- heading -= (floor(heading * PI_INV)) * PI_2;
- heading -= Py_PI;
-
- BaseMath_WriteCallback(self);
- Py_INCREF(self);
- return (PyObject *)self;
-}
-//----------------------------Euler.zero()-------------------------
-//sets the euler to 0,0,0
-static char Euler_Zero_doc[] =
-".. method:: zero()\n"
-"\n"
-" Set all values to zero.\n"
-"\n"
-" :return: an instance of itself\n"
-" :rtype: :class:`Euler`\n";
-
-static PyObject *Euler_Zero(EulerObject * self)
-{
- self->eul[0] = 0.0;
- self->eul[1] = 0.0;
- self->eul[2] = 0.0;
-
- BaseMath_WriteCallback(self);
- Py_INCREF(self);
- return (PyObject *)self;
-}
-//----------------------------Euler.rotate()-----------------------
-//rotates a euler a certain amount and returns the result
-//should return a unique euler rotation (i.e. no 720 degree pitches :)
-static PyObject *Euler_Rotate(EulerObject * self, PyObject *args)
-{
- float angle = 0.0f;
- char *axis;
-
- if(!PyArg_ParseTuple(args, "fs", &angle, &axis)){
- PyErr_SetString(PyExc_TypeError, "euler.rotate():expected angle (float) and axis (x,y,z)");
- return NULL;
- }
- if(ELEM3(*axis, 'x', 'y', 'z') && axis[1]=='\0'){
- PyErr_SetString(PyExc_TypeError, "euler.rotate(): expected axis to be 'x', 'y' or 'z'");
- return NULL;
- }
-
- if(!BaseMath_ReadCallback(self))
- return NULL;
-
- if(self->order == 0) rotate_eul(self->eul, *axis, angle);
- else rotate_eulO(self->eul, self->order, *axis, angle);
-
- BaseMath_WriteCallback(self);
- Py_INCREF(self);
- return (PyObject *)self;
-}
-
-static char Euler_MakeCompatible_doc[] =
-".. method:: make_compatible(other)\n"
-"\n"
-" Make this euler compatible with another, so interpolating between them works as intended.\n"
-"\n"
-" :arg other: make compatible with this rotation.\n"
-" :type other: :class:`Euler`\n"
-" :return: an instance of itself.\n"
-" :rtype: :class:`Euler`\n"
-"\n"
-" .. note:: the order of eulers must match or an exception is raised.\n";
-
-static PyObject *Euler_MakeCompatible(EulerObject * self, EulerObject *value)
-{
- if(!EulerObject_Check(value)) {
- PyErr_SetString(PyExc_TypeError, "euler.make_compatible(euler): expected a single euler argument.");
- return NULL;
- }
-
- if(!BaseMath_ReadCallback(self) || !BaseMath_ReadCallback(value))
- return NULL;
-
- if(self->order != value->order) {
- PyErr_SetString(PyExc_ValueError, "euler.make_compatible(euler): rotation orders don't match\n");
- return NULL;
- }
-
- compatible_eul(self->eul, value->eul);
-
- BaseMath_WriteCallback(self);
- Py_INCREF(self);
- return (PyObject *)self;
-}
-
-//----------------------------Euler.rotate()-----------------------
-// return a copy of the euler
-
-static char Euler_copy_doc[] =
-".. function:: copy()\n"
-"\n"
-" Returns a copy of this euler.\n"
-"\n"
-" :return: A copy of the euler.\n"
-" :rtype: :class:`Euler`\n"
-"\n"
-" .. note:: use this to get a copy of a wrapped euler with no reference to the original data.\n";
-
-static PyObject *Euler_copy(EulerObject * self, PyObject *args)
-{
- if(!BaseMath_ReadCallback(self))
- return NULL;
-
- return newEulerObject(self->eul, self->order, Py_NEW, Py_TYPE(self));
-}
-
-//----------------------------print object (internal)--------------
-//print the object to screen
-static PyObject *Euler_repr(EulerObject * self)
-{
- char str[64];
-
- if(!BaseMath_ReadCallback(self))
- return NULL;
-
- sprintf(str, "[%.6f, %.6f, %.6f](euler)", self->eul[0], self->eul[1], self->eul[2]);
- return PyUnicode_FromString(str);
-}
-//------------------------tp_richcmpr
-//returns -1 execption, 0 false, 1 true
-static PyObject* Euler_richcmpr(PyObject *objectA, PyObject *objectB, int comparison_type)
-{
- EulerObject *eulA = NULL, *eulB = NULL;
- int result = 0;
-
- if(EulerObject_Check(objectA)) {
- eulA = (EulerObject*)objectA;
- if(!BaseMath_ReadCallback(eulA))
- return NULL;
- }
- if(EulerObject_Check(objectB)) {
- eulB = (EulerObject*)objectB;
- if(!BaseMath_ReadCallback(eulB))
- return NULL;
- }
-
- if (!eulA || !eulB){
- if (comparison_type == Py_NE){
- Py_RETURN_TRUE;
- }else{
- Py_RETURN_FALSE;
- }
- }
- eulA = (EulerObject*)objectA;
- eulB = (EulerObject*)objectB;
-
- switch (comparison_type){
- case Py_EQ:
- result = EXPP_VectorsAreEqual(eulA->eul, eulB->eul, 3, 1);
- break;
- case Py_NE:
- result = !EXPP_VectorsAreEqual(eulA->eul, eulB->eul, 3, 1);
- break;
- default:
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list