2.5
Monthly cleaning round to make it compile warning free. Mostly it was const stuff (strings, Context), but also a couple useful fixes, like wrong use of temp pointers. Only Mathutils callback struct I left alone... design issue.
This commit is contained in:
@@ -100,7 +100,7 @@ extern "C" {
|
||||
|
||||
/* 2.5 UI Scripts */
|
||||
int BPY_run_python_script( struct bContext *C, const char *filename, struct Text *text, struct ReportList *reports ); // 2.5 working
|
||||
int BPY_run_script_space_draw(struct bContext *C, struct SpaceScript * sc); // 2.5 working
|
||||
int BPY_run_script_space_draw(const struct bContext *C, struct SpaceScript * sc); // 2.5 working
|
||||
void BPY_run_ui_scripts(struct bContext *C, int reload);
|
||||
// int BPY_run_script_space_listener(struct bContext *C, struct SpaceScript * sc, struct ARegion *ar, struct wmNotifier *wmn); // 2.5 working
|
||||
void BPY_update_modules( void ); // XXX - annoying, need this for pointers that get out of date
|
||||
|
||||
@@ -134,18 +134,21 @@ static PyObject *Euler_ToQuat(EulerObject * self)
|
||||
//return a matrix representation of the euler
|
||||
static PyObject *Euler_ToMatrix(EulerObject * self)
|
||||
{
|
||||
float eul[3];
|
||||
float mat[9] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
|
||||
int x;
|
||||
|
||||
if(!BaseMath_ReadCallback(self))
|
||||
return NULL;
|
||||
|
||||
#ifdef USE_MATHUTILS_DEG
|
||||
for(x = 0; x < 3; x++) {
|
||||
eul[x] = self->eul[x] * ((float)Py_PI / 180);
|
||||
{
|
||||
float eul[3];
|
||||
int x;
|
||||
|
||||
for(x = 0; x < 3; x++) {
|
||||
eul[x] = self->eul[x] * ((float)Py_PI / 180);
|
||||
}
|
||||
EulToMat3(eul, (float (*)[3]) mat);
|
||||
}
|
||||
EulToMat3(eul, (float (*)[3]) mat);
|
||||
#else
|
||||
EulToMat3(self->eul, (float (*)[3]) mat);
|
||||
#endif
|
||||
@@ -234,7 +237,6 @@ static PyObject *Euler_Rotate(EulerObject * self, PyObject *args)
|
||||
{
|
||||
float angle = 0.0f;
|
||||
char *axis;
|
||||
int x;
|
||||
|
||||
if(!PyArg_ParseTuple(args, "fs", &angle, &axis)){
|
||||
PyErr_SetString(PyExc_TypeError, "euler.rotate():expected angle (float) and axis (x,y,z)");
|
||||
@@ -249,18 +251,25 @@ static PyObject *Euler_Rotate(EulerObject * self, PyObject *args)
|
||||
return NULL;
|
||||
|
||||
#ifdef USE_MATHUTILS_DEG
|
||||
//covert to radians
|
||||
angle *= ((float)Py_PI / 180);
|
||||
for(x = 0; x < 3; x++) {
|
||||
self->eul[x] *= ((float)Py_PI / 180);
|
||||
{
|
||||
int x;
|
||||
|
||||
//covert to radians
|
||||
angle *= ((float)Py_PI / 180);
|
||||
for(x = 0; x < 3; x++) {
|
||||
self->eul[x] *= ((float)Py_PI / 180);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
euler_rot(self->eul, angle, *axis);
|
||||
|
||||
#ifdef USE_MATHUTILS_DEG
|
||||
//convert back from radians
|
||||
for(x = 0; x < 3; x++) {
|
||||
self->eul[x] *= (180 / (float)Py_PI);
|
||||
{
|
||||
int x;
|
||||
//convert back from radians
|
||||
for(x = 0; x < 3; x++) {
|
||||
self->eul[x] *= (180 / (float)Py_PI);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -602,7 +611,7 @@ PyObject *newEulerObject(float *eul, int type, PyTypeObject *base_type)
|
||||
EulerObject *self;
|
||||
int x;
|
||||
|
||||
if(base_type) self = base_type->tp_alloc(base_type, 0);
|
||||
if(base_type) self = (EulerObject *)base_type->tp_alloc(base_type, 0);
|
||||
else self = PyObject_NEW(EulerObject, &euler_Type);
|
||||
|
||||
/* init callbacks as NULL */
|
||||
|
||||
@@ -167,7 +167,6 @@ static PyObject *Quaternion_ToEuler(QuaternionObject * self, PyObject *args)
|
||||
{
|
||||
float eul[3];
|
||||
EulerObject *eul_compat = NULL;
|
||||
int x;
|
||||
|
||||
if(!PyArg_ParseTuple(args, "|O!:toEuler", &euler_Type, &eul_compat))
|
||||
return NULL;
|
||||
@@ -176,7 +175,7 @@ static PyObject *Quaternion_ToEuler(QuaternionObject * self, PyObject *args)
|
||||
return NULL;
|
||||
|
||||
if(eul_compat) {
|
||||
float mat[3][3], eul_compatf[3];
|
||||
float mat[3][3];
|
||||
|
||||
if(!BaseMath_ReadCallback(eul_compat))
|
||||
return NULL;
|
||||
@@ -184,10 +183,15 @@ static PyObject *Quaternion_ToEuler(QuaternionObject * self, PyObject *args)
|
||||
QuatToMat3(self->quat, mat);
|
||||
|
||||
#ifdef USE_MATHUTILS_DEG
|
||||
for(x = 0; x < 3; x++) {
|
||||
eul_compatf[x] = eul_compat->eul[x] * ((float)Py_PI / 180);
|
||||
{
|
||||
float eul_compatf[3];
|
||||
int x;
|
||||
|
||||
for(x = 0; x < 3; x++) {
|
||||
eul_compatf[x] = eul_compat->eul[x] * ((float)Py_PI / 180);
|
||||
}
|
||||
Mat3ToCompatibleEul(mat, eul, eul_compatf);
|
||||
}
|
||||
Mat3ToCompatibleEul(mat, eul, eul_compatf);
|
||||
#else
|
||||
Mat3ToCompatibleEul(mat, eul, eul_compat->eul);
|
||||
#endif
|
||||
@@ -197,8 +201,12 @@ static PyObject *Quaternion_ToEuler(QuaternionObject * self, PyObject *args)
|
||||
}
|
||||
|
||||
#ifdef USE_MATHUTILS_DEG
|
||||
for(x = 0; x < 3; x++) {
|
||||
eul[x] *= (180 / (float)Py_PI);
|
||||
{
|
||||
int x;
|
||||
|
||||
for(x = 0; x < 3; x++) {
|
||||
eul[x] *= (180 / (float)Py_PI);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return newEulerObject(eul, Py_NEW, NULL);
|
||||
@@ -833,7 +841,7 @@ PyObject *newQuaternionObject(float *quat, int type, PyTypeObject *base_type)
|
||||
{
|
||||
QuaternionObject *self;
|
||||
|
||||
if(base_type) self = base_type->tp_alloc(base_type, 0);
|
||||
if(base_type) self = (QuaternionObject *)base_type->tp_alloc(base_type, 0);
|
||||
else self = PyObject_NEW(QuaternionObject, &quaternion_Type);
|
||||
|
||||
/* init callbacks as NULL */
|
||||
|
||||
@@ -1973,7 +1973,7 @@ PyObject *newVectorObject(float *vec, int size, int type, PyTypeObject *base_typ
|
||||
int i;
|
||||
VectorObject *self;
|
||||
|
||||
if(base_type) self = base_type->tp_alloc(base_type, 0);
|
||||
if(base_type) self = (VectorObject *)base_type->tp_alloc(base_type, 0);
|
||||
else self = PyObject_NEW(VectorObject, &vector_Type);
|
||||
|
||||
if(size > 4 || size < 2)
|
||||
|
||||
@@ -351,9 +351,9 @@ static int bpy_run_script_init(bContext *C, SpaceScript * sc)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int BPY_run_script_space_draw(struct bContext *C, SpaceScript * sc)
|
||||
int BPY_run_script_space_draw(const struct bContext *C, SpaceScript * sc)
|
||||
{
|
||||
if (bpy_run_script_init(C, sc)) {
|
||||
if (bpy_run_script_init( (bContext *)C, sc)) {
|
||||
PyGILState_STATE gilstate = PyGILState_Ensure();
|
||||
PyObject *result = PyObject_CallObject( sc->script->py_draw, NULL );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user