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:
authorTon Roosendaal <ton@blender.org>2009-07-09 19:40:04 +0400
committerTon Roosendaal <ton@blender.org>2009-07-09 19:40:04 +0400
commit5e659c0b0895e07351bd2b2425deea342141e515 (patch)
tree7e6bd849591c0eb75fdefe37c061519806edf309 /source/blender/python
parent77c61f545fb3248ae4e06afafa816764222405c4 (diff)
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.
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/BPY_extern.h2
-rw-r--r--source/blender/python/generic/euler.c37
-rw-r--r--source/blender/python/generic/quat.c24
-rw-r--r--source/blender/python/generic/vector.c2
-rw-r--r--source/blender/python/intern/bpy_interface.c4
5 files changed, 43 insertions, 26 deletions
diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h
index d141a585378..c6972793372 100644
--- a/source/blender/python/BPY_extern.h
+++ b/source/blender/python/BPY_extern.h
@@ -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
diff --git a/source/blender/python/generic/euler.c b/source/blender/python/generic/euler.c
index 1e0632f4040..69373b1aa36 100644
--- a/source/blender/python/generic/euler.c
+++ b/source/blender/python/generic/euler.c
@@ -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 */
diff --git a/source/blender/python/generic/quat.c b/source/blender/python/generic/quat.c
index 81d69834469..a353f73c854 100644
--- a/source/blender/python/generic/quat.c
+++ b/source/blender/python/generic/quat.c
@@ -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 */
diff --git a/source/blender/python/generic/vector.c b/source/blender/python/generic/vector.c
index b4c74787e05..cf2396b30d4 100644
--- a/source/blender/python/generic/vector.c
+++ b/source/blender/python/generic/vector.c
@@ -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)
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 76c27dbbc22..42eb9c4c57a 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -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 );