Used GET_INT_FROM_POINTER to get rid of many warnings that only occurred with 64bit os's
Also use Py_ssize_t which we might need to define for older python's
This commit is contained in:
parent
45dee507aa
commit
be0b8ccfaa
@ -178,7 +178,7 @@ static PyObject *BonesDict_repr(BPy_BonesDict *self)
|
||||
{
|
||||
char str[2048];
|
||||
PyObject *key, *value;
|
||||
int pos = 0;
|
||||
Py_ssize_t pos = 0;
|
||||
char *p = str;
|
||||
char *keys, *vals;
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_library.h"
|
||||
#include "BKE_utildefines.h"
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_arithb.h" /* for M_PI */
|
||||
#include "BSE_editipo.h"
|
||||
@ -682,7 +683,7 @@ static PyObject *getFloatAttr( BPy_Camera *self, void *type )
|
||||
float param;
|
||||
struct Camera *cam= self->camera;
|
||||
|
||||
switch( (int)type ) {
|
||||
switch( GET_INT_FROM_POINTER(type) ) {
|
||||
case EXPP_CAM_ATTR_LENS:
|
||||
param = cam->lens;
|
||||
break;
|
||||
@ -735,7 +736,7 @@ static int setFloatAttrClamp( BPy_Camera *self, PyObject *value, void *type )
|
||||
float min, max;
|
||||
int ret;
|
||||
|
||||
switch( (int)type ) {
|
||||
switch( GET_INT_FROM_POINTER(type) ) {
|
||||
case EXPP_CAM_ATTR_LENS:
|
||||
min = 1.0;
|
||||
max = 250.0;
|
||||
@ -795,7 +796,7 @@ static int setFloatAttrClamp( BPy_Camera *self, PyObject *value, void *type )
|
||||
ret = EXPP_setFloatClamped( value, param, min, max );
|
||||
|
||||
if (ret==0) {
|
||||
if ((int)type == EXPP_CAM_ATTR_ANGLE) {
|
||||
if (GET_INT_FROM_POINTER(type) == EXPP_CAM_ATTR_ANGLE) {
|
||||
cam->lens = 16.0f / tan(M_PI*cam->lens/360.0f);
|
||||
}
|
||||
}
|
||||
@ -809,7 +810,7 @@ static int setFloatAttrClamp( BPy_Camera *self, PyObject *value, void *type )
|
||||
|
||||
static PyObject *getFlagAttr( BPy_Camera *self, void *type )
|
||||
{
|
||||
if (self->camera->flag & (int)type)
|
||||
if (self->camera->flag & GET_INT_FROM_POINTER(type))
|
||||
Py_RETURN_TRUE;
|
||||
else
|
||||
Py_RETURN_FALSE;
|
||||
@ -827,9 +828,9 @@ static int setFlagAttr( BPy_Camera *self, PyObject *value, void *type )
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
if (param)
|
||||
self->camera->flag |= (int)type;
|
||||
self->camera->flag |= GET_INT_FROM_POINTER(type);
|
||||
else
|
||||
self->camera->flag &= ~(int)type;
|
||||
self->camera->flag &= ~GET_INT_FROM_POINTER(type);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,8 @@
|
||||
#include "gen_utils.h"
|
||||
#include "BezTriple.h"
|
||||
|
||||
#include "BKE_utildefines.h"
|
||||
|
||||
/* Only for ME_SMOOTH */
|
||||
#include "DNA_meshdata_types.h"
|
||||
|
||||
@ -430,14 +432,14 @@ static PyObject *CurNurb_getPoints( BPy_CurNurb * self )
|
||||
static PyObject *CurNurb_getFlagBits( BPy_CurNurb * self, void *type )
|
||||
{
|
||||
return EXPP_getBitfield( (void *)&self->nurb->flag,
|
||||
(int)type, 'h' );
|
||||
GET_INT_FROM_POINTER(type), 'h' );
|
||||
}
|
||||
|
||||
static int CurNurb_setFlagBits( BPy_CurNurb * self, PyObject *value,
|
||||
void *type )
|
||||
{
|
||||
return EXPP_setBitfield( value, (void *)&self->nurb->flag,
|
||||
(int)type, 'h' );
|
||||
GET_INT_FROM_POINTER(type), 'h' );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -516,7 +516,7 @@ PyObject *BPy_IDGroup_HasKey(BPy_IDProperty *self, PyObject *value)
|
||||
PyObject *BPy_IDGroup_Update(BPy_IDProperty *self, PyObject *vars)
|
||||
{
|
||||
PyObject *pyob, *pkey, *pval;
|
||||
int i=0;
|
||||
Py_ssize_t i=0;
|
||||
|
||||
if (PySequence_Size(vars) != 1)
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
|
@ -1191,7 +1191,7 @@ static PyObject *Image_hasData(BPy_Image *self, void *closure)
|
||||
|
||||
static PyObject *Image_getFlag(BPy_Image *self, void *flag)
|
||||
{
|
||||
if (self->image->flag & (int)flag)
|
||||
if (self->image->flag & GET_INT_FROM_POINTER(flag))
|
||||
Py_RETURN_TRUE;
|
||||
else
|
||||
Py_RETURN_FALSE;
|
||||
@ -1200,7 +1200,7 @@ static PyObject *Image_getFlag(BPy_Image *self, void *flag)
|
||||
|
||||
static PyObject *Image_getFlagTpage(BPy_Image *self, void *flag)
|
||||
{
|
||||
if (self->image->tpageflag & (int)flag)
|
||||
if (self->image->tpageflag & GET_INT_FROM_POINTER(flag))
|
||||
Py_RETURN_TRUE;
|
||||
else
|
||||
Py_RETURN_FALSE;
|
||||
@ -1235,9 +1235,9 @@ static int Image_setFlag(BPy_Image *self, PyObject *value, void *flag)
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
if ( param )
|
||||
self->image->flag |= (int)flag;
|
||||
self->image->flag |= GET_INT_FROM_POINTER(flag);
|
||||
else
|
||||
self->image->flag &= ~(int)flag;
|
||||
self->image->flag &= ~GET_INT_FROM_POINTER(flag);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1249,9 +1249,9 @@ static int Image_setFlagTpage(BPy_Image *self, PyObject *value, void *flag)
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
if ( param )
|
||||
self->image->tpageflag |= (int)flag;
|
||||
self->image->tpageflag |= GET_INT_FROM_POINTER(flag);
|
||||
else
|
||||
self->image->tpageflag &= ~(int)flag;
|
||||
self->image->tpageflag &= ~GET_INT_FROM_POINTER(flag);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1263,7 +1263,7 @@ static PyObject *getIntAttr( BPy_Image *self, void *type )
|
||||
int param;
|
||||
struct Image *image = self->image;
|
||||
|
||||
switch( (int)type ) {
|
||||
switch( GET_INT_FROM_POINTER(type) ) {
|
||||
case EXPP_IMAGE_ATTR_XREP:
|
||||
param = image->xrep;
|
||||
break;
|
||||
@ -1304,7 +1304,7 @@ static int setIntAttrClamp( BPy_Image *self, PyObject *value, void *type )
|
||||
struct Image *image = self->image;
|
||||
int min, max, size;
|
||||
|
||||
switch( (int)type ) {
|
||||
switch( GET_INT_FROM_POINTER(type) ) {
|
||||
case EXPP_IMAGE_ATTR_XREP:
|
||||
min = EXPP_IMAGE_REP_MIN;
|
||||
max = EXPP_IMAGE_REP_MAX;
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_depsgraph.h"
|
||||
#include "BKE_ipo.h"
|
||||
#include "BKE_utildefines.h"
|
||||
#include "BIF_space.h"
|
||||
#include "BSE_editipo.h"
|
||||
#include "MEM_guardedalloc.h"
|
||||
@ -1017,7 +1018,7 @@ static int IpoCurve_newsetExtend( C_IpoCurve * self, PyObject * value )
|
||||
|
||||
static PyObject *IpoCurve_getFlag( C_IpoCurve * self, void *type )
|
||||
{
|
||||
if (self->ipocurve->flag & (int)type)
|
||||
if (self->ipocurve->flag & GET_INT_FROM_POINTER(type))
|
||||
Py_RETURN_TRUE;
|
||||
else
|
||||
Py_RETURN_FALSE;
|
||||
@ -1031,9 +1032,9 @@ static int IpoCurve_setFlag( C_IpoCurve * self, PyObject *value, void *type )
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
if (param)
|
||||
self->ipocurve->flag |= (int)type;
|
||||
self->ipocurve->flag |= GET_INT_FROM_POINTER(type);
|
||||
else
|
||||
self->ipocurve->flag &= ~(int)type;
|
||||
self->ipocurve->flag &= ~GET_INT_FROM_POINTER(type);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "constant.h"
|
||||
#include "gen_utils.h"
|
||||
#include "gen_library.h"
|
||||
#include "BKE_utildefines.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Python BPy_Lamp defaults: */
|
||||
@ -1175,7 +1176,7 @@ static int Lamp_setFalloffType( BPy_Lamp * self, PyObject * value )
|
||||
|
||||
static PyObject *Lamp_getComponent( BPy_Lamp * self, void * closure )
|
||||
{
|
||||
switch ( (int)closure ) {
|
||||
switch ( GET_INT_FROM_POINTER(closure) ) {
|
||||
case EXPP_LAMP_COMP_R:
|
||||
return PyFloat_FromDouble( self->lamp->r );
|
||||
case EXPP_LAMP_COMP_G:
|
||||
@ -1200,7 +1201,7 @@ static int Lamp_setComponent( BPy_Lamp * self, PyObject * value,
|
||||
color = (float)PyFloat_AsDouble( value );
|
||||
color = EXPP_ClampFloat( color, EXPP_LAMP_COL_MIN, EXPP_LAMP_COL_MAX );
|
||||
|
||||
switch ( (int)closure ) {
|
||||
switch ( GET_INT_FROM_POINTER(closure) ) {
|
||||
case EXPP_LAMP_COMP_R:
|
||||
self->lamp->r = color;
|
||||
return 0;
|
||||
|
@ -676,7 +676,7 @@ static PyObject *Lattice_getLatSize(BPy_Lattice * self)
|
||||
static PyObject *Lattice_getAxisType(BPy_Lattice * self, void * type)
|
||||
{
|
||||
char interp_type = 0;
|
||||
switch ( (int)type ) {
|
||||
switch ( GET_INT_FROM_POINTER(type) ) {
|
||||
case 0:
|
||||
interp_type = self->lattice->typeu;
|
||||
break;
|
||||
|
@ -941,7 +941,7 @@ PyTypeObject LibraryData_Type = {
|
||||
|
||||
static PyObject *LibraryData_CreatePyObject( BPy_Library *self, void *mode )
|
||||
{
|
||||
return CreatePyObject_LibData( (int)mode, OTHER, NULL, NULL,
|
||||
return CreatePyObject_LibData( GET_INT_FROM_POINTER(mode), OTHER, NULL, NULL,
|
||||
self->filename );
|
||||
}
|
||||
|
||||
|
@ -1601,7 +1601,7 @@ static PyObject* Material_getSssScale( BPy_Material * self )
|
||||
|
||||
static PyObject* Material_getSssRadius( BPy_Material * self, void * type )
|
||||
{
|
||||
return PyFloat_FromDouble( ( double ) (self->material->sss_radius[(int)type]) );
|
||||
return PyFloat_FromDouble( ( double ) (self->material->sss_radius[GET_INT_FROM_POINTER(type)]) );
|
||||
}
|
||||
|
||||
static PyObject* Material_getSssIOR( BPy_Material * self )
|
||||
@ -1813,7 +1813,7 @@ static int Material_setColorComponent( BPy_Material * self, PyObject * value,
|
||||
param = (float)PyFloat_AsDouble( value );
|
||||
param = EXPP_ClampFloat( param, EXPP_MAT_COL_MIN, EXPP_MAT_COL_MAX );
|
||||
|
||||
switch ( (int)closure ) {
|
||||
switch ( GET_INT_FROM_POINTER(closure) ) {
|
||||
case EXPP_MAT_COMP_R:
|
||||
self->material->r = param;
|
||||
return 0;
|
||||
@ -2174,7 +2174,7 @@ static int Material_setSssScale( BPy_Material * self, PyObject * value )
|
||||
|
||||
static int Material_setSssRadius( BPy_Material * self, PyObject * value, void *type )
|
||||
{
|
||||
return EXPP_setFloatClamped ( value, &self->material->sss_radius[(int)type],
|
||||
return EXPP_setFloatClamped ( value, &self->material->sss_radius[GET_INT_FROM_POINTER(type)],
|
||||
EXPP_MAT_SSS_RADIUS_MIN,
|
||||
EXPP_MAT_SSS_RADIUS_MAX);
|
||||
}
|
||||
@ -2636,7 +2636,7 @@ void EXPP_incr_mats_us( Material ** matlist, int len )
|
||||
static PyObject *Material_getColorComponent( BPy_Material * self,
|
||||
void * closure )
|
||||
{
|
||||
switch ( (int)closure ) {
|
||||
switch ( GET_INT_FROM_POINTER(closure) ) {
|
||||
case EXPP_MAT_COMP_R:
|
||||
return PyFloat_FromDouble( ( double ) self->material->r );
|
||||
case EXPP_MAT_COMP_G:
|
||||
|
@ -7039,7 +7039,7 @@ static PyObject *Mesh_getColorLayerNames( BPy_Mesh * self )
|
||||
static PyObject *Mesh_getActiveLayer( BPy_Mesh * self, void *type )
|
||||
{
|
||||
CustomData *data = &self->mesh->fdata;
|
||||
int layer_type = (int)type;
|
||||
int layer_type = GET_INT_FROM_POINTER(type);
|
||||
int i;
|
||||
if (layer_type < 0) { /* hack, if negative, its the renderlayer.*/
|
||||
layer_type = -layer_type;
|
||||
@ -7058,7 +7058,7 @@ static int Mesh_setActiveLayer( BPy_Mesh * self, PyObject * value, void *type )
|
||||
{
|
||||
CustomData *data = &self->mesh->fdata;
|
||||
char *name;
|
||||
int i,ok,n,layer_type = (int)type, render=0;
|
||||
int i,ok,n,layer_type = GET_INT_FROM_POINTER(type), render=0;
|
||||
|
||||
if( !PyString_Check( value ) )
|
||||
return EXPP_ReturnIntError( PyExc_ValueError,
|
||||
@ -7112,7 +7112,7 @@ static PyObject *Mesh_getMultires( BPy_Mesh * self, void *type )
|
||||
{
|
||||
int i=0;
|
||||
if (self->mesh->mr) {
|
||||
switch ((int)type) {
|
||||
switch (GET_INT_FROM_POINTER(type)) {
|
||||
case MESH_MULTIRES_LEVEL:
|
||||
i = self->mesh->mr->newlvl;
|
||||
break;
|
||||
@ -7156,7 +7156,7 @@ static int Mesh_setMultires( BPy_Mesh * self, PyObject *value, void *type )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"value out of range" );
|
||||
|
||||
switch ((int)type) {
|
||||
switch (GET_INT_FROM_POINTER(type)) {
|
||||
case MESH_MULTIRES_LEVEL:
|
||||
self->mesh->mr->newlvl = i;
|
||||
multires_set_level_cb(self->object, self->mesh);
|
||||
|
@ -414,7 +414,7 @@ static PyObject *Map_socketdef_getter(BPy_NodeSocketLists *self, void *closure)
|
||||
{
|
||||
PyObject *sockets = NULL;
|
||||
|
||||
switch ((int)closure) {
|
||||
switch (GET_INT_FROM_POINTER(closure)) {
|
||||
case 'I': /* inputs */
|
||||
Py_INCREF(self->input);
|
||||
sockets = self->input;
|
||||
@ -448,7 +448,7 @@ static int Map_socketdef(BPy_NodeSocketLists *self, PyObject *args, void *closur
|
||||
if(BTST2(node->custom1, NODE_DYNAMIC_READY, NODE_DYNAMIC_ADDEXIST))
|
||||
return 0;
|
||||
|
||||
switch((int)closure) {
|
||||
switch(GET_INT_FROM_POINTER(closure)) {
|
||||
case 'I':
|
||||
if (args) {
|
||||
if(PySequence_Check(args)) {
|
||||
@ -1096,7 +1096,7 @@ static PyObject *Node_GetInputMap(BPy_Node *self) {
|
||||
static PyObject *ShadeInput_getAttribute(BPy_ShadeInput *self, void *type) {
|
||||
PyObject *obj = NULL;
|
||||
if(self->shi) {
|
||||
switch((int)type) {
|
||||
switch(GET_INT_FROM_POINTER(type)) {
|
||||
case SURFACEVIEWVECTOR:
|
||||
obj = Py_BuildValue("(fff)", self->shi->view[0], self->shi->view[1], self->shi->view[2]);
|
||||
break;
|
||||
|
@ -3553,7 +3553,7 @@ static PyObject *getIntAttr( BPy_Object *self, void *type )
|
||||
int param;
|
||||
struct Object *object = self->object;
|
||||
|
||||
switch( (int)type ) {
|
||||
switch( GET_INT_FROM_POINTER(type) ) {
|
||||
case EXPP_OBJ_ATTR_LAYERMASK:
|
||||
param = object->lay;
|
||||
break;
|
||||
@ -3609,7 +3609,7 @@ static int setIntAttrClamp( BPy_Object *self, PyObject *value, void *type )
|
||||
struct Object *object = self->object;
|
||||
int min, max, size;
|
||||
|
||||
switch( (int)type ) {
|
||||
switch( GET_INT_FROM_POINTER(type) ) {
|
||||
case EXPP_OBJ_ATTR_DUPON:
|
||||
min = 1;
|
||||
max = 1500;
|
||||
@ -3685,7 +3685,7 @@ static int setIntAttrRange( BPy_Object *self, PyObject *value, void *type )
|
||||
|
||||
/* these parameters require clamping */
|
||||
|
||||
switch( (int)type ) {
|
||||
switch( GET_INT_FROM_POINTER(type) ) {
|
||||
case EXPP_OBJ_ATTR_COLBITS:
|
||||
min = 0;
|
||||
max = 0xffff;
|
||||
@ -3710,20 +3710,20 @@ static PyObject *getFloatAttr( BPy_Object *self, void *type )
|
||||
float param;
|
||||
struct Object *object = self->object;
|
||||
|
||||
if( (int)type >= EXPP_OBJ_ATTR_PI_SURFACEDAMP &&
|
||||
(int)type <= EXPP_OBJ_ATTR_PI_SBOFACETHICK ) {
|
||||
if( GET_INT_FROM_POINTER(type) >= EXPP_OBJ_ATTR_PI_SURFACEDAMP &&
|
||||
GET_INT_FROM_POINTER(type) <= EXPP_OBJ_ATTR_PI_SBOFACETHICK ) {
|
||||
if( !self->object->pd && !setupPI(self->object) )
|
||||
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
|
||||
"particle deflection could not be accessed" );
|
||||
}
|
||||
else if( (int)type >= EXPP_OBJ_ATTR_SB_NODEMASS &&
|
||||
(int)type <= EXPP_OBJ_ATTR_SB_INFRICT ) {
|
||||
else if( GET_INT_FROM_POINTER(type) >= EXPP_OBJ_ATTR_SB_NODEMASS &&
|
||||
GET_INT_FROM_POINTER(type) <= EXPP_OBJ_ATTR_SB_INFRICT ) {
|
||||
if( !self->object->soft && !setupSB(self->object) )
|
||||
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
|
||||
"softbody could not be accessed" );
|
||||
}
|
||||
|
||||
switch( (int)type ) {
|
||||
switch( GET_INT_FROM_POINTER(type) ) {
|
||||
case EXPP_OBJ_ATTR_LOC_X:
|
||||
param = object->loc[0];
|
||||
break;
|
||||
@ -3868,20 +3868,20 @@ static int setFloatAttrClamp( BPy_Object *self, PyObject *value, void *type )
|
||||
struct Object *object = self->object;
|
||||
float min, max;
|
||||
|
||||
if( (int)type >= EXPP_OBJ_ATTR_PI_SURFACEDAMP &&
|
||||
(int)type <= EXPP_OBJ_ATTR_PI_SBOFACETHICK ) {
|
||||
if( GET_INT_FROM_POINTER(type) >= EXPP_OBJ_ATTR_PI_SURFACEDAMP &&
|
||||
GET_INT_FROM_POINTER(type) <= EXPP_OBJ_ATTR_PI_SBOFACETHICK ) {
|
||||
if( !self->object->pd && !setupPI(self->object) )
|
||||
return EXPP_ReturnIntError( PyExc_RuntimeError,
|
||||
"particle deflection could not be accessed" );
|
||||
}
|
||||
else if( (int)type >= EXPP_OBJ_ATTR_SB_NODEMASS &&
|
||||
(int)type <= EXPP_OBJ_ATTR_SB_INFRICT ) {
|
||||
else if( GET_INT_FROM_POINTER(type) >= EXPP_OBJ_ATTR_SB_NODEMASS &&
|
||||
GET_INT_FROM_POINTER(type) <= EXPP_OBJ_ATTR_SB_INFRICT ) {
|
||||
if( !self->object->soft && !setupSB(self->object) )
|
||||
return EXPP_ReturnIntError( PyExc_RuntimeError,
|
||||
"softbody could not be accessed" );
|
||||
}
|
||||
|
||||
switch( (int)type ) {
|
||||
switch( GET_INT_FROM_POINTER(type) ) {
|
||||
case EXPP_OBJ_ATTR_DRAWSIZE:
|
||||
min = EXPP_OBJECT_DRAWSIZEMIN;
|
||||
max = EXPP_OBJECT_DRAWSIZEMAX;
|
||||
@ -4027,7 +4027,7 @@ static int setFloatAttr( BPy_Object *self, PyObject *value, void *type )
|
||||
|
||||
param = (float)PyFloat_AsDouble( value );
|
||||
|
||||
switch( (int)type ) {
|
||||
switch( GET_INT_FROM_POINTER(type) ) {
|
||||
case EXPP_OBJ_ATTR_LOC_X:
|
||||
object->loc[0] = param;
|
||||
break;
|
||||
@ -4099,7 +4099,7 @@ static PyObject *getFloat3Attr( BPy_Object *self, void *type )
|
||||
float *param;
|
||||
struct Object *object = self->object;
|
||||
|
||||
switch( (int)type ) {
|
||||
switch( GET_INT_FROM_POINTER(type) ) {
|
||||
case EXPP_OBJ_ATTR_LOC:
|
||||
param = object->loc;
|
||||
break;
|
||||
@ -4142,7 +4142,7 @@ static int setFloat3Attr( BPy_Object *self, PyObject *value, void *type )
|
||||
}
|
||||
|
||||
Py_DECREF( value );
|
||||
switch( (int)type ) {
|
||||
switch( GET_INT_FROM_POINTER(type) ) {
|
||||
case EXPP_OBJ_ATTR_LOC:
|
||||
dst = object->loc;
|
||||
break;
|
||||
@ -4176,7 +4176,7 @@ static int setFloat3Attr( BPy_Object *self, PyObject *value, void *type )
|
||||
|
||||
static PyObject *Object_getShapeFlag( BPy_Object *self, void *type )
|
||||
{
|
||||
if (self->object->shapeflag & (int)type)
|
||||
if (self->object->shapeflag & GET_INT_FROM_POINTER(type))
|
||||
Py_RETURN_TRUE;
|
||||
else
|
||||
Py_RETURN_FALSE;
|
||||
@ -4186,9 +4186,9 @@ static int Object_setShapeFlag( BPy_Object *self, PyObject *value,
|
||||
void *type )
|
||||
{
|
||||
if (PyObject_IsTrue(value) )
|
||||
self->object->shapeflag |= (int)type;
|
||||
self->object->shapeflag |= GET_INT_FROM_POINTER(type);
|
||||
else
|
||||
self->object->shapeflag &= ~(int)type;
|
||||
self->object->shapeflag &= ~GET_INT_FROM_POINTER(type);
|
||||
|
||||
self->object->recalc |= OB_RECALC_OB;
|
||||
return 0;
|
||||
@ -4196,7 +4196,7 @@ static int Object_setShapeFlag( BPy_Object *self, PyObject *value,
|
||||
|
||||
static PyObject *Object_getRestricted( BPy_Object *self, void *type )
|
||||
{
|
||||
if (self->object->restrictflag & (int)type)
|
||||
if (self->object->restrictflag & GET_INT_FROM_POINTER(type))
|
||||
Py_RETURN_TRUE;
|
||||
else
|
||||
Py_RETURN_FALSE;
|
||||
@ -4211,16 +4211,16 @@ static int Object_setRestricted( BPy_Object *self, PyObject *value,
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
if ( param )
|
||||
self->object->restrictflag |= (int)type;
|
||||
self->object->restrictflag |= GET_INT_FROM_POINTER(type);
|
||||
else
|
||||
self->object->restrictflag &= ~(int)type;
|
||||
self->object->restrictflag &= ~GET_INT_FROM_POINTER(type);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyObject *Object_getDrawModeBits( BPy_Object *self, void *type )
|
||||
{
|
||||
return EXPP_getBitfield( (void *)&self->object->dtx, (int)type, 'b' );
|
||||
return EXPP_getBitfield( (void *)&self->object->dtx, GET_INT_FROM_POINTER(type), 'b' );
|
||||
}
|
||||
|
||||
static int Object_setDrawModeBits( BPy_Object *self, PyObject *value,
|
||||
@ -4228,13 +4228,13 @@ static int Object_setDrawModeBits( BPy_Object *self, PyObject *value,
|
||||
{
|
||||
self->object->recalc |= OB_RECALC_OB;
|
||||
return EXPP_setBitfield( value, (void *)&self->object->dtx,
|
||||
(int)type, 'b' );
|
||||
GET_INT_FROM_POINTER(type), 'b' );
|
||||
}
|
||||
|
||||
static PyObject *Object_getTransflagBits( BPy_Object *self, void *type )
|
||||
{
|
||||
return EXPP_getBitfield( (void *)&self->object->transflag,
|
||||
(int)type, 'h' );
|
||||
GET_INT_FROM_POINTER(type), 'h' );
|
||||
}
|
||||
|
||||
static int Object_setTransflagBits( BPy_Object *self, PyObject *value,
|
||||
@ -4242,7 +4242,7 @@ static int Object_setTransflagBits( BPy_Object *self, PyObject *value,
|
||||
{
|
||||
self->object->recalc |= OB_RECALC_OB;
|
||||
return EXPP_setBitfield( value, (void *)&self->object->transflag,
|
||||
(int)type, 'h' );
|
||||
GET_INT_FROM_POINTER(type), 'h' );
|
||||
}
|
||||
|
||||
static PyObject *Object_getLayers( BPy_Object * self )
|
||||
|
@ -144,7 +144,7 @@ static PyObject *PoseBonesDict_repr(BPy_PoseBonesDict *self)
|
||||
{
|
||||
char buffer[128], *str;
|
||||
PyObject *key, *value;
|
||||
int pos = 0;
|
||||
Py_ssize_t pos = 0;
|
||||
|
||||
/* probably a bit of overkill but better then crashing */
|
||||
str = MEM_mallocN( 64 + ( PyDict_Size( self->bonesMap ) * 128), "PoseBonesDict_repr" );
|
||||
@ -1052,7 +1052,7 @@ static int PoseBone_setStretch(BPy_PoseBone *self, PyObject *value, void *closur
|
||||
//Gets the pose bones IK stiffness
|
||||
static PyObject *PoseBone_getStiff(BPy_PoseBone *self, void *axis)
|
||||
{
|
||||
return PyFloat_FromDouble( self->posechannel->stiffness[(int)axis] );
|
||||
return PyFloat_FromDouble( self->posechannel->stiffness[GET_INT_FROM_POINTER(axis)] );
|
||||
}
|
||||
|
||||
//------------------------PoseBone.stiffX/Y/Z (setter)
|
||||
@ -1068,7 +1068,7 @@ static int PoseBone_setStiff(BPy_PoseBone *self, PyObject *value, void *axis)
|
||||
stiff = (float)PyFloat_AsDouble(value);
|
||||
if (stiff<0) stiff = 0;
|
||||
if (stiff>0.990) stiff = 0.990f;
|
||||
self->posechannel->stiffness[(int)axis] = stiff;
|
||||
self->posechannel->stiffness[GET_INT_FROM_POINTER(axis)] = stiff;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1102,7 +1102,7 @@ static int PoseBone_setFlag(BPy_PoseBone *self, PyObject *value, void *flag)
|
||||
//Gets the pose bones ikflag
|
||||
static PyObject *PoseBone_getIKFlag(BPy_PoseBone *self, void *flag)
|
||||
{
|
||||
if (self->posechannel->ikflag & (int)flag)
|
||||
if (self->posechannel->ikflag & GET_INT_FROM_POINTER(flag))
|
||||
Py_RETURN_TRUE;
|
||||
else
|
||||
Py_RETURN_FALSE;
|
||||
@ -1119,9 +1119,9 @@ static int PoseBone_setIKFlag(BPy_PoseBone *self, PyObject *value, void *flag)
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
if ( param )
|
||||
self->posechannel->ikflag |= (int)flag;
|
||||
self->posechannel->ikflag |= GET_INT_FROM_POINTER(flag);
|
||||
else
|
||||
self->posechannel->ikflag &= ~(int)flag;
|
||||
self->posechannel->ikflag &= ~GET_INT_FROM_POINTER(flag);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1238,7 +1238,7 @@ int SceneObSeq_setObjects( BPy_SceneObSeq *self, PyObject *value, void *_mode_)
|
||||
Scene *scene= self->bpyscene->scene;
|
||||
Object *blen_ob;
|
||||
Base *base;
|
||||
int size, mode = (int)_mode_;
|
||||
int size, mode = GET_INT_FROM_POINTER(_mode_);
|
||||
|
||||
SCENE_DEL_CHECK_INT(self->bpyscene);
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "BKE_library.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_utildefines.h"
|
||||
#include "BIF_editfont.h" /* do_textedit() */
|
||||
#include "Curve.h"
|
||||
#include "constant.h"
|
||||
@ -255,7 +256,7 @@ static PyObject *getFloatAttr( BPy_Text3d *self, void *type )
|
||||
float param;
|
||||
struct Curve *curve= self->curve;
|
||||
|
||||
switch( (int)type ) {
|
||||
switch( GET_INT_FROM_POINTER(type) ) {
|
||||
case EXPP_T3D_ATTR_FRAME_WIDTH:
|
||||
param = curve->tb[curve->actbox-1].w;
|
||||
break;
|
||||
@ -282,7 +283,7 @@ static int setFloatAttrClamp( BPy_Text3d *self, PyObject *value, void *type )
|
||||
struct Curve *curve= self->curve;
|
||||
float min, max;
|
||||
|
||||
switch( (int)type ) {
|
||||
switch( GET_INT_FROM_POINTER(type) ) {
|
||||
case EXPP_T3D_ATTR_FRAME_WIDTH:
|
||||
min = 0.0;
|
||||
max = 50.0;
|
||||
|
@ -1593,10 +1593,10 @@ static int Texture_setImageFlags( BPy_Texture * self, PyObject * value,
|
||||
* so set/clear the bit in the bitfield based on the type
|
||||
*/
|
||||
|
||||
if( (int)type ) {
|
||||
if( GET_INT_FROM_POINTER(type) ) {
|
||||
int err;
|
||||
param = self->texture->imaflag;
|
||||
err = EXPP_setBitfield( value, ¶m, (int)type, 'h' );
|
||||
err = EXPP_setBitfield( value, ¶m, GET_INT_FROM_POINTER(type), 'h' );
|
||||
if( err )
|
||||
return err;
|
||||
|
||||
@ -1640,9 +1640,9 @@ static int Texture_setIUserFlags( BPy_Texture * self, PyObject * value,
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
if( param )
|
||||
self->texture->iuser.flag |= (int)flag;
|
||||
self->texture->iuser.flag |= GET_INT_FROM_POINTER(flag);
|
||||
else
|
||||
self->texture->iuser.flag &= ~(int)flag;
|
||||
self->texture->iuser.flag &= ~GET_INT_FROM_POINTER(flag);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1714,7 +1714,7 @@ static int Texture_setNoiseBasis2( BPy_Texture * self, PyObject * value,
|
||||
* attribute, so check the range and set the whole value
|
||||
*/
|
||||
|
||||
if( (int)type == EXPP_TEX_NOISEBASIS2 ) {
|
||||
if( GET_INT_FROM_POINTER(type) == EXPP_TEX_NOISEBASIS2 ) {
|
||||
int param;
|
||||
if( !PyInt_Check( value ) )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
@ -1744,7 +1744,7 @@ static int Texture_setNoiseBasis2( BPy_Texture * self, PyObject * value,
|
||||
return EXPP_ReturnIntError( PyExc_ValueError,
|
||||
"expected int value of 1" );
|
||||
|
||||
self->texture->noisebasis2 = (short)(int)type;
|
||||
self->texture->noisebasis2 = (short)GET_INT_FROM_POINTER(type);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -2104,15 +2104,15 @@ static PyObject *Texture_getImageFlags( BPy_Texture *self, void *type )
|
||||
* other types means attribute "mipmap", "calcAlpha", etc
|
||||
*/
|
||||
|
||||
if( (int)type )
|
||||
return EXPP_getBitfield( &self->texture->imaflag, (int)type, 'h' );
|
||||
if( GET_INT_FROM_POINTER(type) )
|
||||
return EXPP_getBitfield( &self->texture->imaflag, GET_INT_FROM_POINTER(type), 'h' );
|
||||
else
|
||||
return PyInt_FromLong( self->texture->imaflag );
|
||||
}
|
||||
|
||||
static PyObject *Texture_getIUserFlags( BPy_Texture *self, void *flag )
|
||||
{
|
||||
if( self->texture->iuser.flag & (int)flag )
|
||||
if( self->texture->iuser.flag & GET_INT_FROM_POINTER(flag) )
|
||||
Py_RETURN_TRUE;
|
||||
else
|
||||
Py_RETURN_FALSE;
|
||||
@ -2139,10 +2139,10 @@ static PyObject *Texture_getNoiseBasis2( BPy_Texture *self, void *type )
|
||||
* other types means attribute "sine", "saw", or "tri" attribute
|
||||
*/
|
||||
|
||||
if( (int)type == EXPP_TEX_NOISEBASIS2 )
|
||||
if( GET_INT_FROM_POINTER(type) == EXPP_TEX_NOISEBASIS2 )
|
||||
return PyInt_FromLong( self->texture->noisebasis2 );
|
||||
else
|
||||
return PyInt_FromLong( ( self->texture->noisebasis2 == (int)type ) ? 1 : 0 );
|
||||
return PyInt_FromLong( ( self->texture->noisebasis2 == GET_INT_FROM_POINTER(type) ) ? 1 : 0 );
|
||||
}
|
||||
|
||||
static PyObject *Texture_getNoiseDepth( BPy_Texture *self )
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "DNA_userdef_types.h"
|
||||
#include "../api2_2x/gen_utils.h"
|
||||
#include "bpy_config.h"
|
||||
#include "BKE_utildefines.h"
|
||||
|
||||
enum conf_consts {
|
||||
/*string*/
|
||||
@ -88,7 +89,7 @@ static PyObject *getStrAttr( BPy_Config *self, void *type )
|
||||
{
|
||||
char *param = NULL;
|
||||
|
||||
switch( (int)type ) {
|
||||
switch( GET_INT_FROM_POINTER(type) ) {
|
||||
case EXPP_CONF_ATTR_PATH_YF_EXPORT:
|
||||
param = U.yfexportdir;
|
||||
break;
|
||||
@ -139,7 +140,7 @@ static int setStrAttr( BPy_Config *self, PyObject *value, void *type )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"error, must assign a python string for setStrAttr");
|
||||
|
||||
switch( (int)type ) {
|
||||
switch( GET_INT_FROM_POINTER(type) ) {
|
||||
case EXPP_CONF_ATTR_PATH_YF_EXPORT:
|
||||
param = U.yfexportdir;
|
||||
break;
|
||||
@ -186,7 +187,7 @@ static PyObject *getIntAttr( BPy_Config *self, void *type )
|
||||
{
|
||||
int param;
|
||||
|
||||
switch( (int)type ) {
|
||||
switch( GET_INT_FROM_POINTER(type) ) {
|
||||
case EXPP_CONF_ATTR_UNDOSTEPS:
|
||||
param = (int)U.undosteps;
|
||||
break;
|
||||
@ -220,7 +221,7 @@ static int setIntAttrClamp( BPy_Config *self, PyObject *value, void *type )
|
||||
void *param;
|
||||
int min, max, size;
|
||||
|
||||
switch( (int)type ) {
|
||||
switch( GET_INT_FROM_POINTER(type) ) {
|
||||
case EXPP_CONF_ATTR_UNDOSTEPS:
|
||||
min = 0;
|
||||
max = 64;
|
||||
|
@ -4950,7 +4950,7 @@ static void verify_vertexgroup_name_func(void *datav, void *data2_unused)
|
||||
static void skgen_reorder(void *option, void *arg2)
|
||||
{
|
||||
char tmp;
|
||||
switch ((int)option)
|
||||
switch (GET_INT_FROM_POINTER(option))
|
||||
{
|
||||
case 0:
|
||||
tmp = G.scene->toolsettings->skgen_subdivisions[0];
|
||||
|
@ -227,7 +227,7 @@ static void print_help(void)
|
||||
printf (" -v\t\tPrint Blender version and exit\n");
|
||||
printf (" --\t\tEnds option processing. Following arguments are \n");
|
||||
printf (" \t\t passed unchanged. Access via Python's sys.argv\n");
|
||||
printf ("\nEnironment Variables:\n");
|
||||
printf ("\nEnvironment Variables:\n");
|
||||
printf (" $HOME\t\t\tStore files such as .blender/ .B.blend .Bfs .Blog here.\n");
|
||||
#ifdef WIN32
|
||||
printf (" $TEMP\t\tStore temporary files here.\n");
|
||||
@ -271,7 +271,6 @@ int main(int argc, char **argv)
|
||||
{
|
||||
int a, i, stax=0, stay=0, sizx, sizy, scr_init = 0;
|
||||
SYS_SystemHandle syshandle;
|
||||
Scene *sce;
|
||||
|
||||
#if defined(WIN32) || defined (__linux__)
|
||||
int audio = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user