Header file clean up and warning fixes

- Mostly this cleans up the #includes and header files in the python project.
- Warning fixes are mostly casting issues and misc fixes. General warning clean up.
- #include Python.h MUST come as the first include to avoid the POSIX redefine warning in the unix makefiles
- fno-strict-aliasing flag added to makefile to fix a unavoidable type punning warning in types.c
This commit is contained in:
Joseph Gilbert 2005-07-18 03:50:37 +00:00
parent 9919df089d
commit e60291d39c
103 changed files with 899 additions and 1161 deletions

@ -30,52 +30,40 @@
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <Python.h>
#include "compile.h" /* for the PyCodeObject */
#include "eval.h" /* for PyEval_EvalCode */
#include <stdio.h>
#include <MEM_guardedalloc.h>
#include <BLI_blenlib.h> /* for BLI_last_slash() */
#include "BIF_gl.h" /* glPushAttrib, glPopAttrib for DRAW space handlers */
#include <BIF_interface.h> /* for pupmenu() */
#include <BIF_space.h>
#include <BIF_screen.h>
#include <BIF_toolbox.h>
#include <BKE_global.h>
#include <BKE_library.h>
#include <BKE_main.h>
#include <BKE_object.h> /* during_scriptlink() */
#include <BKE_text.h>
#include <BKE_utildefines.h>
#include <BPI_script.h>
#include <DNA_camera_types.h>
#include <DNA_ID.h>
#include <DNA_lamp_types.h>
#include <DNA_material_types.h>
#include <DNA_object_types.h>
#include <DNA_scene_types.h>
#include <DNA_screen_types.h>
#include <DNA_scriptlink_types.h>
#include <DNA_space_types.h>
#include <DNA_text_types.h>
#include <DNA_world_types.h>
#include <DNA_userdef_types.h> /* for U.pythondir */
#include "BLI_blenlib.h" /* for BLI_last_slash() */
#include "BIF_interface.h" /* for pupmenu() */
#include "BIF_space.h"
#include "BIF_screen.h"
#include "BIF_toolbox.h"
#include "BKE_library.h"
#include "BKE_object.h" /* during_scriptlink() */
#include "BKE_text.h"
#include "DNA_screen_types.h"
#include "DNA_userdef_types.h" /* for U.pythondir */
#include "MEM_guardedalloc.h"
#include "BPY_extern.h"
#include "BPY_menus.h"
#include "BPI_script.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "api2_2x/EXPP_interface.h"
#include "api2_2x/constant.h"
#include "api2_2x/gen_utils.h"
#include "api2_2x/modules.h"
#include "api2_2x/BGL.h"
#include "api2_2x/Blender.h"
#include "api2_2x/Camera.h"
#include "api2_2x/Draw.h"
#include "api2_2x/Lamp.h"
#include "api2_2x/NMesh.h"
#include "api2_2x/Object.h"
#include "api2_2x/Registry.h"
#include "api2_2x/Scene.h"
#include "api2_2x/World.h"
/* bpy_registryDict is declared in api2_2x/Registry.h and defined
* in api2_2x/Registry.c
@ -83,7 +71,7 @@
* choose to preserve after they are executed, so user changes can be
* restored next time the script is used. Check the Blender.Registry module.
*/
#include "api2_2x/Registry.h"
//#include "api2_2x/Registry.h"
/*************************************************************************
* Structure definitions
@ -449,7 +437,7 @@ void BPY_Err_Handle( char *script_name )
* the last frame in the current file is adressed."'
*/
while( 1 ) {
for(;;) {
v = PyObject_GetAttrString( tb, "tb_next" );
if( !v || v == Py_None ||
@ -1059,7 +1047,7 @@ void BPY_do_pyscript( ID * id, short event )
* is running nested inside another. Blender.Load needs this info to
* avoid trouble with invalid slink pointers. */
during_slink++;
disable_where_scriptlink( during_slink );
disable_where_scriptlink( (short)during_slink );
/* set globals in Blender module to identify scriptlink */
PyDict_SetItemString( g_blenderdict, "bylink", EXPP_incr_ret_True() );
@ -1099,7 +1087,7 @@ void BPY_do_pyscript( ID * id, short event )
}
}
disable_where_scriptlink( during_slink - 1 );
disable_where_scriptlink( (short)(during_slink - 1) );
/* cleanup bylink flag and clear link so PyObject
* can be released
@ -1210,7 +1198,7 @@ int BPY_add_spacehandler(Text *text, ScrArea *sa, char spacetype)
if (!sa || !text) return -1;
handlertype = BPY_is_spacehandler(text, spacetype);
handlertype = (unsigned short)BPY_is_spacehandler(text, spacetype);
if (handlertype) {
ScriptLink *slink = &sa->scriptlink;
@ -1276,7 +1264,7 @@ int BPY_do_spacehandlers( ScrArea *sa, unsigned short event,
* is running nested inside another. Blender.Load needs this info to
* avoid trouble with invalid slink pointers. */
during_slink++;
disable_where_scriptlink( during_slink );
disable_where_scriptlink( (short)during_slink );
/* set globals in Blender module to identify space handler scriptlink */
PyDict_SetItemString(g_blenderdict, "bylink", EXPP_incr_ret_True());
@ -1338,7 +1326,7 @@ int BPY_do_spacehandlers( ScrArea *sa, unsigned short event,
}
disable_where_scriptlink( during_slink - 1 );
disable_where_scriptlink( (short)(during_slink - 1) );
PyDict_SetItemString(g_blenderdict, "bylink", EXPP_incr_ret_False());
PyDict_SetItemString(g_blenderdict, "link", EXPP_incr_ret(Py_None));

@ -35,38 +35,21 @@
* from Blender menus. To know more, please start with its header file.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "BPY_menus.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <Python.h>
#ifndef WIN32
#include <dirent.h>
#include <dirent.h>
#else
#include "BLI_winstuff.h"
#include <io.h>
#include <direct.h>
#include "BLI_winstuff.h"
#endif
#include "BKE_global.h"
#include "BKE_utildefines.h"
#include "BLI_blenlib.h"
#include "MEM_guardedalloc.h"
#include <DNA_userdef_types.h> /* for U.pythondir */
#include "BPY_extern.h"
#include "BPY_menus.h"
#include "DNA_userdef_types.h" /* for U.pythondir */
#include "api2_2x/EXPP_interface.h" /* for bpy_gethome() */
#include <errno.h>
#define BPYMENU_DATAFILE "Bpymenus"
#define MAX_DIR_DEPTH 4 /* max depth for traversing scripts dirs */
#define MAX_DIR_NUMBER 30 /* max number of dirs in scripts dirs trees */
@ -494,7 +477,7 @@ static int bpymenu_CreateFromFile( void )
}
if( parsing == 1 ) { /* got menu group string */
group = bpymenu_group_atoi( w1 );
group = (short)bpymenu_group_atoi( w1 );
if( group < 0 && DEBUG ) { /* invalid type */
fprintf(stderr,
"BPyMenus error parsing config file: wrong group: %s,\n\
@ -503,7 +486,7 @@ will use 'Misc'.\n", w1 );
} else
continue;
while( 1 ) {
for(;;) {
tip = NULL; /* optional tooltip */
fgets( line, 255, fp );
if( line[0] == '}' )
@ -592,7 +575,7 @@ static void bpymenu_WriteDataFile( void )
pymenu = BPyMenuTable[i];
if( !pymenu )
continue;
fprintf( fp, "\n%s {\n", BPyMenu_group_itoa( i ) );
fprintf( fp, "\n%s {\n", BPyMenu_group_itoa( (short)i ) );
while( pymenu ) {
fprintf( fp, "'%s' %d %s %d", pymenu->name,
pymenu->version, pymenu->filename,
@ -629,7 +612,7 @@ void BPyMenu_PrintAllEntries( void )
for( i = 0; i < PYMENU_TOTAL; i++ ) {
pymenu = BPyMenuTable[i];
printf( "\n%s {\n", BPyMenu_group_itoa( i ) );
printf( "\n%s {\n", BPyMenu_group_itoa( (short)i ) );
while( pymenu ) {
printf( "'%s' %d %s %d", pymenu->name, pymenu->version,
pymenu->filename, pymenu->dir );
@ -690,7 +673,7 @@ static int bpymenu_ParseFile(FILE *file, char *fname, int is_userdir)
int parser_state;
char script_name[100];
int script_version;
int script_version = 1;
int script_group;
BPyMenu *scriptMenu = NULL;
@ -751,7 +734,7 @@ static int bpymenu_ParseFile(FILE *file, char *fname, int is_userdir)
}
else { /* register script */
scriptMenu = bpymenu_AddEntry(script_group,
scriptMenu = bpymenu_AddEntry((short)script_group,
(short int)script_version, script_name, fname, is_userdir,NULL);
if (scriptMenu == NULL) {
if (DEBUG)

@ -30,21 +30,18 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "Armature.h"
#include "Armature.h" /*This must come first*/
#include "BKE_main.h"
#include "BKE_global.h"
#include "BKE_armature.h"
#include "BKE_library.h"
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
#include "MEM_guardedalloc.h"
#include "Bone.h"
#include "NLA.h"
#include <stdio.h>
#include <BKE_main.h>
#include <BKE_global.h>
#include <BKE_object.h>
#include <BKE_armature.h>
#include <BKE_library.h>
#include <BLI_blenlib.h>
#include <MEM_guardedalloc.h>
#include <BLI_arithb.h>
#include "constant.h"
#include "gen_utils.h"
#include "Types.h"
//---------------- Python API function prototypes for the Armature module---
static PyObject *M_Armature_New( PyObject * self, PyObject * args );

@ -34,11 +34,12 @@
#define EXPP_ARMATURE_H
#include <Python.h>
#include <DNA_armature_types.h>
#include "DNA_armature_types.h"
//---------------------Python BPy_Armature structure definition-------
typedef struct {
PyObject_HEAD bArmature * armature;
PyObject_HEAD
bArmature * armature;
} BPy_Armature;
//--------------------visible prototypes------------------------------

@ -35,8 +35,10 @@
* implementation. The BGL submodule "wraps" OpenGL functions and constants,
* allowing script writers to make OpenGL calls in their Python scripts. */
#include "BGL.h"
#include "BGL.h" /*This must come first */
#include "MEM_guardedalloc.h"
#include "gen_utils.h"
static int type_size( int type );
static Buffer *make_buffer( int type, int ndimensions, int *dimensions );

@ -43,28 +43,9 @@
#include <config.h>
#endif
#include "MEM_guardedalloc.h"
#include "BMF_Api.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_text_types.h"
#include "BKE_global.h"
#include <Python.h>
#include "BIF_gl.h"
#include "BIF_screen.h"
#include "BIF_space.h"
#include "BIF_interface.h"
#include "BIF_mywindow.h"
#include "interface.h"
#include "mydevice.h" /*@ for all the event constants */
#include "Python.h"
#include "gen_utils.h"
/*@ Buffer Object */
/*@ For Python access to OpenGL functions requiring a pointer. */

@ -30,19 +30,9 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "BezTriple.h"
#include "BezTriple.h" /*This must come first */
#include <Python.h>
#include <BKE_main.h>
#include <BKE_global.h>
#include <BKE_object.h>
#include <BKE_library.h>
#include <BLI_blenlib.h>
#include <DNA_ipo_types.h>
#include <MEM_guardedalloc.h>
#include "constant.h"
#include "MEM_guardedalloc.h"
#include "gen_utils.h"
@ -72,7 +62,7 @@ static void BezTripleDeAlloc( BPy_BezTriple * self );
static int BezTripleSetAttr( BPy_BezTriple * self, char *name, PyObject * v );
static PyObject *BezTripleGetAttr( BPy_BezTriple * self, char *name );
static PyObject *BezTripleRepr( BPy_BezTriple * self );
static PyObject *BezTriple_Str( BPy_BezTriple * self );
//static PyObject *BezTriple_Str( BPy_BezTriple * self );
/****************************************************************************
Python method structure definition for Blender.BezTriple module:
@ -258,7 +248,7 @@ static PyObject *BezTriple_setPoints( BPy_BezTriple * self, PyObject * args )
printf( "\n bad o. o no!\n" );
/* bezt->vec[1][i] = PyFloat_AsDouble (PyTuple_GetItem (popo, i)); */
bezt->vec[1][i] = PyFloat_AsDouble( o );
bezt->vec[1][i] = (float)PyFloat_AsDouble( o );
bezt->vec[0][i] = bezt->vec[1][i] - 1;
bezt->vec[2][i] = bezt->vec[1][i] + 1;
}
@ -362,12 +352,12 @@ static PyObject *BezTripleRepr( BPy_BezTriple * self )
display object as string.
equivalent to python str(o)
*/
/*
static PyObject *BezTriple_Str( BPy_BezTriple * self )
{
BezTriple *p = self->beztriple;
/* fixme: */
// fixme:
return PyString_FromFormat(
"BezTriple (%f %f %f) (%f %f %f) (%f %f %f) alpha %f\n (%d %d) (%d %d) (%d %d) h1:%d h2:%d f1:%d f2:%d f3:%d hide:%d",
p->vec[0][0], p->vec[0][1], p->vec[0][2],
@ -382,7 +372,7 @@ static PyObject *BezTriple_Str( BPy_BezTriple * self )
p->hide );
}
*/
/*
BezTriple_Init

@ -34,7 +34,7 @@
#define EXPP_BEZTRIPLE_H
#include <Python.h>
#include <DNA_curve_types.h>
#include "DNA_curve_types.h"
extern PyTypeObject BezTriple_Type;

@ -29,19 +29,12 @@
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
struct ID; /*keep me up here */
#include <Python.h>
#include <stdio.h>
#include "Blender.h" /*This must come first */
/* for open, close in Blender_Load */
#include <fcntl.h>
#ifndef WIN32
#include <unistd.h>
#else
#include <io.h>
#endif
#include "BKE_utildefines.h"
#include "BDR_editobject.h" /* exit_editmode() */
#include "BIF_usiblender.h"
#include "BLI_blenlib.h"
@ -49,29 +42,51 @@
#include "BKE_exotic.h"
#include "BKE_global.h"
#include "BKE_packedFile.h"
#include "BKE_utildefines.h"
#include "BKE_object.h"
#include "BKE_text.h"
#include "BKE_ipo.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BPI_script.h"
#include "BSE_headerbuttons.h"
#include "DNA_ID.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h" /* for SPACE_VIEW3D */
#include "DNA_space_types.h" /* for SPACE_VIEW3D */
#include "DNA_scriptlink_types.h"
#include "DNA_userdef_types.h"
#include "BKE_ipo.h"
#include "blendef.h"
#include "EXPP_interface.h" /* for bpy_gethome() */
#include "gen_utils.h"
#include "modules.h"
#include "constant.h"
#include "../BPY_extern.h" /* BPY_txt_do_python_Text */
#include "../BPY_menus.h" /* to update menus */
#include "Armature.h"
#include "BezTriple.h"
#include "Camera.h"
#include "Curve.h"
#include "CurNurb.h"
#include "Draw.h"
#include "Effect.h"
#include "Ipo.h"
#include "Ipocurve.h"
#include "Lamp.h"
#include "Lattice.h"
#include "Mathutils.h"
#include "Metaball.h"
#include "NMesh.h"
#include "Object.h"
#include "Registry.h"
#include "Scene.h"
#include "Sound.h"
#include "Sys.h"
#include "Text.h"
#include "Texture.h"
#include "Window.h"
#include "World.h"
extern PyObject *bpy_registryDict; /* defined in ../BPY_interface.c */
/**********************************************************/
/* Python API function prototypes for the Blender module. */
/**********************************************************/
@ -200,7 +215,7 @@ static PyObject *Blender_Set( PyObject * self, PyObject * args )
return ( NULL );
}
G.scene->r.cfra = framenum;
G.scene->r.cfra = (short)framenum;
update_for_newframe( );
} else {

@ -33,6 +33,8 @@
#ifndef EXPP_BLENDER_H
#define EXPP_BLENDER_H
#include <Python.h>
extern PyObject *g_blenderdict;
void M_Blender_Init( void );

@ -29,33 +29,23 @@
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
struct ScrArea; /*keep me up here */
#include "Bone.h"
#include "Bone.h" /*This must come first */
#include "BKE_main.h"
#include "BKE_global.h"
#include "BKE_object.h"
#include "BKE_armature.h"
#include "BKE_library.h"
#include "BLI_blenlib.h"
#include "DNA_action_types.h"
#include "DNA_armature_types.h"
#include "DNA_ipo_types.h"
#include "BIF_poseobject.h"
#include "BKE_action.h"
#include "BSE_editaction.h"
#include "BKE_constraint.h"
#include "MEM_guardedalloc.h"
#include "BKE_utildefines.h"
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
#include "constant.h"
#include "BSE_editaction.h"
#include "DNA_object_types.h"
#include "DNA_ipo_types.h"
#include "MEM_guardedalloc.h"
#include "gen_utils.h"
#include "NLA.h"
#include "quat.h"
#include "matrix.h"
#include "vector.h"
#include "Types.h"
//--------------------Python API function prototypes for the Bone module----
static PyObject *M_Bone_New( PyObject * self, PyObject * args );
@ -313,7 +303,7 @@ int updateBoneData( BPy_Bone * self, Bone * parent )
strlen( self->name ) + 1 );
self->bone->roll = self->roll;
self->bone->flag = self->flag;
self->bone->boneclass = self->boneclass;
self->bone->boneclass = (short)self->boneclass;
self->bone->dist = self->dist;
self->bone->weight = self->weight;
self->bone->parent = parent; //parent will be checked from self->parent string in addBone()
@ -1521,29 +1511,29 @@ static PyObject *Bone_setPose( BPy_Bone * self, PyObject * args )
//set action keys
if( setChan->flag & POSE_ROT ) {
set_action_key( object->action, setChan, AC_QUAT_X,
makeCurve );
(short)makeCurve );
set_action_key( object->action, setChan, AC_QUAT_Y,
makeCurve );
(short)makeCurve );
set_action_key( object->action, setChan, AC_QUAT_Z,
makeCurve );
(short)makeCurve );
set_action_key( object->action, setChan, AC_QUAT_W,
makeCurve );
(short)makeCurve );
}
if( setChan->flag & POSE_SIZE ) {
set_action_key( object->action, setChan, AC_SIZE_X,
makeCurve );
(short)makeCurve );
set_action_key( object->action, setChan, AC_SIZE_Y,
makeCurve );
(short)makeCurve );
set_action_key( object->action, setChan, AC_SIZE_Z,
makeCurve );
(short)makeCurve );
}
if( setChan->flag & POSE_LOC ) {
set_action_key( object->action, setChan, AC_LOC_X,
makeCurve );
(short)makeCurve );
set_action_key( object->action, setChan, AC_LOC_Y,
makeCurve );
(short)makeCurve );
set_action_key( object->action, setChan, AC_LOC_Z,
makeCurve );
(short)makeCurve );
}
//rebuild ipos
remake_action_ipos( object->action );
@ -1587,7 +1577,7 @@ static PyObject *Bone_setBoneclass( BPy_Bone * self, PyObject * args )
self->boneclass = boneclass;
} else {
//use bone datastruct
self->bone->boneclass = boneclass;
self->bone->boneclass = (short)boneclass;
}
return EXPP_incr_ret( Py_None );
}
@ -1610,8 +1600,6 @@ static PyObject *Bone_hasIK( BPy_Bone * self )
return EXPP_incr_ret_False();
}
}
return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
"couldn't get Bone.Boneclass attribute" ) );
}
//--------------- BPy_Bone.getRestMatrix()-------------------------

@ -34,10 +34,8 @@
#define EXPP_BONE_H
#include <Python.h>
#include <DNA_armature_types.h>
#include "vector.h"
#include "quat.h"
#include "matrix.h"
#include "DNA_armature_types.h"
#include "Mathutils.h"
//--------------------------Python BPy_Bone structure definition.-------
typedef struct {

@ -30,19 +30,14 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "Build.h"
#include "Effect.h"
#include "Build.h" /*This must come first */
#include "DNA_object_types.h"
#include "BKE_effect.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "gen_utils.h"
#include <BLI_arithb.h>
#include <BLI_blenlib.h>
#include <BKE_main.h>
#include <BKE_global.h>
#include <BKE_object.h>
#include <BKE_library.h>
#include <stdio.h>
/* prototypes */
PyObject *Build_Init( void );
@ -134,7 +129,6 @@ PyObject *M_Build_New( PyObject * self, PyObject * args )
pyeffect->effect = bleffect;
return ( PyObject * ) pyeffect;
return 0;
}
/*****************************************************************************/

@ -34,10 +34,8 @@
#define EXPP_BUILD_H
#include <Python.h>
#include <DNA_effect_types.h>
#include "Effect.h"
extern PyTypeObject Build_Type;
#define BPy_Build_Check(v) ((v)->ob_type==&Build_Type)

@ -30,22 +30,17 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include <BKE_main.h>
#include <BKE_global.h>
#include <BKE_object.h>
#include <BKE_library.h>
#include <BLI_blenlib.h>
#include <BIF_editview.h>
#include <BSE_editipo.h>
#include <BIF_space.h>
#include <mydevice.h>
#include "Camera.h" /*This must come first */
#include <Python.h>
#include "constant.h"
#include "BKE_main.h"
#include "BKE_global.h"
#include "BKE_object.h"
#include "BKE_library.h"
#include "BLI_blenlib.h"
#include "BSE_editipo.h"
#include "BIF_space.h"
#include "mydevice.h"
#include "gen_utils.h"
#include "Camera.h"
#include "Ipo.h"

@ -34,7 +34,7 @@
#define EXPP_CAMERA_H
#include <Python.h>
#include <DNA_camera_types.h>
#include "DNA_camera_types.h"
extern PyTypeObject Camera_Type;
@ -66,13 +66,13 @@ typedef struct {
#define EXPP_CAM_LENS_MIN 1.0
#define EXPP_CAM_LENS_MAX 250.0
#define EXPP_CAM_SCALE_MIN 0.01
#define EXPP_CAM_SCALE_MIN 0.01f
#define EXPP_CAM_SCALE_MAX 1000.0
#define EXPP_CAM_CLIPSTART_MIN 0.0
#define EXPP_CAM_CLIPSTART_MAX 100.0
#define EXPP_CAM_CLIPEND_MIN 1.0
#define EXPP_CAM_CLIPEND_MAX 5000.0
#define EXPP_CAM_DRAWSIZE_MIN 0.1
#define EXPP_CAM_DRAWSIZE_MIN 0.1f
#define EXPP_CAM_DRAWSIZE_MAX 10.0
PyObject *Camera_Init( void );

@ -29,14 +29,12 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "Python.h"
#include "DNA_curve_types.h"
#include "CurNurb.h" /*This must come first */
#include "BKE_curve.h"
#include "BDR_editcurve.h" /* for convertspline */
#include "MEM_guardedalloc.h"
#include "gen_utils.h"
#include "CurNurb.h"
#include "BezTriple.h"
@ -593,7 +591,7 @@ static PyObject *CurNurb_setMatIndex( BPy_CurNurb * self, PyObject * args )
"expected integer argument" ) );
/* fixme: some range checking would be nice! */
self->nurb->mat_nr = index;
self->nurb->mat_nr = (short)index;
Py_INCREF( Py_None );
return Py_None;
@ -651,7 +649,7 @@ static PyObject *CurNurb_setFlagU( BPy_CurNurb * self, PyObject * args )
"expected integer argument" ) );
if( self->nurb->flagu != flagu ) {
self->nurb->flagu = flagu;
self->nurb->flagu = (short)flagu;
makeknots( self->nurb, 1, self->nurb->flagu >> 1 );
}
@ -694,7 +692,7 @@ static PyObject *CurNurb_setFlagV( BPy_CurNurb * self, PyObject * args )
"expected integer argument" ) );
if( self->nurb->flagv != flagv ) {
self->nurb->flagv = flagv;
self->nurb->flagv = (short)flagv;
makeknots( self->nurb, 2, self->nurb->flagv >> 1 );
}

@ -32,7 +32,8 @@
#ifndef EXPP_NURB_H
#define EXPP_NURB_H
#include <DNA_curve_types.h>
#include <Python.h>
#include "DNA_curve_types.h"
extern PyTypeObject CurNurb_Type;

@ -29,21 +29,14 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include <Python.h>
#include "Curve.h"
#include <stdio.h>
#include <BLI_arithb.h>
#include <BLI_blenlib.h>
#include <BKE_main.h>
#include <BKE_displist.h>
#include <BKE_global.h>
#include <BKE_object.h>
#include <BKE_library.h>
#include <BKE_curve.h>
#include <BKE_utildefines.h>
#include <MEM_guardedalloc.h> /* because we wil be mallocing memory */
#include "Curve.h" /*This must come first*/
#include "BKE_main.h"
#include "BKE_displist.h"
#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_curve.h"
#include "MEM_guardedalloc.h" /* because we wil be mallocing memory */
#include "CurNurb.h"
#include "Material.h"
#include "Object.h"
@ -783,7 +776,7 @@ static PyObject *Curve_setControlPoint( BPy_Curve * self, PyObject * args )
{
PyObject *listargs = 0;
Nurb *ptrnurb = self->curve->nurb.first;
int numcourbe, numpoint, i, j;
int numcourbe = 0, numpoint = 0, i, j;
if( !ptrnurb ) {
Py_INCREF( Py_None );
@ -809,14 +802,14 @@ static PyObject *Curve_setControlPoint( BPy_Curve * self, PyObject * args )
if( ptrnurb->bp )
for( i = 0; i < 4; i++ )
ptrnurb->bp[numpoint].vec[i] =
PyFloat_AsDouble( PyList_GetItem
(float)PyFloat_AsDouble( PyList_GetItem
( listargs, i ) );
if( ptrnurb->bezt )
for( i = 0; i < 3; i++ )
for( j = 0; j < 3; j++ )
ptrnurb->bezt[numpoint].vec[i][j] =
PyFloat_AsDouble( PyList_GetItem
(float)PyFloat_AsDouble( PyList_GetItem
( listargs,
i * 3 + j ) );
@ -904,7 +897,7 @@ static PyObject *Curve_setLoc( BPy_Curve * self, PyObject * args )
( PyExc_TypeError, "expected a list" ) );
for( i = 0; i < 3; i++ ) {
PyObject *xx = PyList_GetItem( listargs, i );
self->curve->loc[i] = PyFloat_AsDouble( xx );
self->curve->loc[i] = (float)PyFloat_AsDouble( xx );
}
Py_INCREF( Py_None );
return Py_None;
@ -934,7 +927,7 @@ static PyObject *Curve_setRot( BPy_Curve * self, PyObject * args )
( PyExc_TypeError, "expected a list" ) );
for( i = 0; i < 3; i++ ) {
PyObject *xx = PyList_GetItem( listargs, i );
self->curve->rot[i] = PyFloat_AsDouble( xx );
self->curve->rot[i] = (float)PyFloat_AsDouble( xx );
}
Py_INCREF( Py_None );
return Py_None;
@ -963,7 +956,7 @@ static PyObject *Curve_setSize( BPy_Curve * self, PyObject * args )
( PyExc_TypeError, "expected a list" ) );
for( i = 0; i < 3; i++ ) {
PyObject *xx = PyList_GetItem( listargs, i );
self->curve->size[i] = PyFloat_AsDouble( xx );
self->curve->size[i] = (float)PyFloat_AsDouble( xx );
}
Py_INCREF( Py_None );
return Py_None;
@ -984,7 +977,7 @@ static PyObject *Curve_getNumCurves( BPy_Curve * self )
/* get curve */
ptrnurb = self->curve->nurb.first;
if( ptrnurb ) { /* we have some nurbs in this curve */
while( 1 ) {
for(;;) {
++num_curves;
ptrnurb = ptrnurb->next;
if( !ptrnurb ) /* no more curves */

@ -33,7 +33,8 @@
#ifndef EXPP_CURVE_H
#define EXPP_CURVE_H
#include <DNA_curve_types.h>
#include <Python.h>
#include "DNA_curve_types.h"
extern PyTypeObject Curve_Type;

@ -35,40 +35,28 @@
* implementation. Non-trivial original comments are marked with an
* @ symbol at their beginning. */
#include "Draw.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "Draw.h" /*This must come first*/
#include "BLI_blenlib.h"
#include "MEM_guardedalloc.h"
#include "BMF_Api.h"
#include "DNA_screen_types.h"
#include "DNA_text_types.h"
#include "BKE_global.h"
#include "BKE_image.h"
#include "BKE_library.h"
#include "BKE_object.h"
#include "BKE_main.h"
#include "BIF_gl.h"
#include "BIF_screen.h"
#include "BIF_space.h"
#include "BIF_interface.h"
#include "BIF_mywindow.h"
#include "BIF_toolbox.h"
#include "BPI_script.h" /* script struct */
#include "Image.h" /* for accessing Blender.Image objects */
#include "IMB_imbuf_types.h" /* for the IB_rect define */
#include "interface.h"
#include "mydevice.h" /*@ for all the event constants */
#include "gen_utils.h"
#include "Window.h"
/* these delimit the free range for button events */
#define EXPP_BUTTON_EVENTS_OFFSET 1001
@ -716,7 +704,7 @@ static PyObject *Method_Create( PyObject * self, PyObject * args )
but = newbutton( );
if( PyFloat_Check( in ) ) {
but->type = 2;
but->val.asfloat = PyFloat_AsDouble( in );
but->val.asfloat = (float)PyFloat_AsDouble( in );
} else if( PyInt_Check( in ) ) {
but->type = 1;
but->val.asint = PyInt_AsLong( in );
@ -776,7 +764,7 @@ static PyObject *Method_Button( PyObject * self, PyObject * args )
block = Get_uiBlock( );
if( block )
uiDefBut( block, BUT, event, name, x, y, w, h, 0, 0, 0, 0, 0,
uiDefBut( block, BUT, event, name, (short)x, (short)y, (short)w, (short)h, 0, 0, 0, 0, 0,
tip );
return EXPP_incr_ret( Py_None );
@ -805,7 +793,7 @@ static PyObject *Method_Menu( PyObject * self, PyObject * args )
block = Get_uiBlock( );
if( block )
uiDefButI( block, MENU, event, name, x, y, w, h,
uiDefButI( block, MENU, event, name, (short)x, (short)y, (short)w, (short)h,
&but->val.asint, 0, 0, 0, 0, tip );
return ( PyObject * ) but;
@ -834,7 +822,7 @@ static PyObject *Method_Toggle( PyObject * self, PyObject * args )
block = Get_uiBlock( );
if( block )
uiDefButI( block, TOG, event, name, x, y, w, h,
uiDefButI( block, TOG, event, name, (short)x, (short)y, (short)w, (short)h,
&but->val.asint, 0, 0, 0, 0, tip );
return ( PyObject * ) but;
@ -863,7 +851,7 @@ static void py_slider_update( void *butv, void *data2_unused )
disable_where_script( 1 );
spacescript_do_pywin_buttons( curarea->spacedata.first,
uiButGetRetVal( but ) );
(unsigned short)uiButGetRetVal( but ) );
/* XXX useless right now, investigate better before a bcon 5 */
ret = M_Window_Redraw( 0, ref );
@ -901,9 +889,9 @@ static PyObject *Method_Slider( PyObject * self, PyObject * args )
if( PyFloat_Check( inio ) ) {
float ini, min, max;
ini = PyFloat_AsDouble( inio );
min = PyFloat_AsDouble( mino );
max = PyFloat_AsDouble( maxo );
ini = (float)PyFloat_AsDouble( inio );
min = (float)PyFloat_AsDouble( mino );
max = (float)PyFloat_AsDouble( maxo );
but->type = 2;
but->val.asfloat = ini;
@ -911,8 +899,8 @@ static PyObject *Method_Slider( PyObject * self, PyObject * args )
block = Get_uiBlock( );
if( block ) {
uiBut *ubut;
ubut = uiDefButF( block, NUMSLI, event, name, x, y, w,
h, &but->val.asfloat, min, max, 0, 0,
ubut = uiDefButF( block, NUMSLI, event, name, (short)x, (short)y, (short)w,
(short)h, &but->val.asfloat, min, max, 0, 0,
tip );
if( realtime )
uiButSetFunc( ubut, py_slider_update, ubut,
@ -931,8 +919,8 @@ static PyObject *Method_Slider( PyObject * self, PyObject * args )
block = Get_uiBlock( );
if( block ) {
uiBut *ubut;
ubut = uiDefButI( block, NUMSLI, event, name, x, y, w,
h, &but->val.asint, min, max, 0, 0,
ubut = uiDefButI( block, NUMSLI, event, name, (short)x, (short)y, (short)w,
(short)h, &but->val.asint, (float)min, (float)max, 0, 0,
tip );
if( realtime )
uiButSetFunc( ubut, py_slider_update, ubut,
@ -974,16 +962,16 @@ another int and string as arguments" );
else
but->type = 1;
ini = PyFloat_AsDouble( inio );
min = PyFloat_AsDouble( mino );
max = PyFloat_AsDouble( maxo );
ini = (float)PyFloat_AsDouble( inio );
min = (float)PyFloat_AsDouble( mino );
max = (float)PyFloat_AsDouble( maxo );
if( but->type == 2 ) {
but->val.asfloat = ini;
block = Get_uiBlock( );
if( block ) {
uiBut *ubut;
ubut = uiDefButF( block, SCROLL, event, "", x, y, w, h,
ubut = uiDefButF( block, SCROLL, event, "", (short)x, (short)y, (short)w, (short)h,
&but->val.asfloat, min, max, 0, 0,
tip );
if( realtime )
@ -991,11 +979,11 @@ another int and string as arguments" );
NULL );
}
} else {
but->val.asint = ini;
but->val.asint = (int)ini;
block = Get_uiBlock( );
if( block ) {
uiBut *ubut;
ubut = uiDefButI( block, SCROLL, event, "", x, y, w, h,
ubut = uiDefButI( block, SCROLL, event, "", (short)x, (short)y, (short)w, (short)h,
&but->val.asint, min, max, 0, 0,
tip );
if( realtime )
@ -1031,16 +1019,16 @@ static PyObject *Method_Number( PyObject * self, PyObject * args )
if( PyFloat_Check( inio ) ) {
float ini, min, max;
ini = PyFloat_AsDouble( inio );
min = PyFloat_AsDouble( mino );
max = PyFloat_AsDouble( maxo );
ini = (float)PyFloat_AsDouble( inio );
min = (float)PyFloat_AsDouble( mino );
max = (float)PyFloat_AsDouble( maxo );
but->type = 2;
but->val.asfloat = ini;
block = Get_uiBlock( );
if( block )
uiDefButF( block, NUM, event, name, x, y, w, h,
uiDefButF( block, NUM, event, name, (short)x, (short)y, (short)w, (short)h,
&but->val.asfloat, min, max, 0, 0, tip );
} else {
int ini, min, max;
@ -1054,8 +1042,8 @@ static PyObject *Method_Number( PyObject * self, PyObject * args )
block = Get_uiBlock( );
if( block )
uiDefButI( block, NUM, event, name, x, y, w, h,
&but->val.asint, min, max, 0, 0, tip );
uiDefButI( block, NUM, event, name, (short)x, (short)y, (short)w, (short)h,
&but->val.asint, (float)min, (float)max, 0, 0, tip );
}
return ( PyObject * ) but;
@ -1101,8 +1089,8 @@ static PyObject *Method_String( PyObject * self, PyObject * args )
block = Get_uiBlock( );
if( block )
uiDefBut( block, TEX, event, info_str, x, y, w, h,
but->val.asstr, 0, len, 0, 0, tip );
uiDefBut( block, TEX, event, info_str, (short)x, (short)y, (short)w, (short)h,
but->val.asstr, 0, (float)len, 0, 0, tip );
return ( PyObject * ) but;
}
@ -1201,7 +1189,7 @@ static PyObject *Method_PupIntInput( PyObject * self, PyObject * args )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected 1 string and 3 int arguments" );
if( button( &var, min, max, text ) == 0 ) {
if( button( &var, (short)min, (short)max, text ) == 0 ) {
Py_INCREF( Py_None );
return Py_None;
}

@ -37,14 +37,10 @@
#ifndef EXPP_DRAW_H_
#define EXPP_DRAW_H_
#include <Python.h>
#include "DNA_space_types.h"
#include "DNA_text_types.h"
#include "Python.h"
#include "gen_utils.h"
#include "Window.h"
void initDraw( void );
/*

@ -30,20 +30,12 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include <stdio.h>
#include <Python.h>
#include <BKE_global.h>
#include <BKE_library.h>
#include <BKE_main.h>
#include <BLI_blenlib.h>
#include <DNA_space_types.h> /* for FILE_MAXDIR, FILE_MAXFILE */
#include "EXPP_interface.h"
#include "BLI_blenlib.h"
#include "DNA_space_types.h" /* for FILE_MAXDIR, FILE_MAXFILE */
#include "Blender.h"
#include "Registry.h"
#include "gen_utils.h"
extern char bprogname[]; /* argv[0] from creator.c */

@ -33,8 +33,6 @@
#ifndef EXPP_INTERFACE_H
#define EXPP_INTERFACE_H
#include <DNA_ID.h>
struct Script;
void initBlenderApi2_2x( void );

@ -29,10 +29,15 @@
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "Effect.h"
#include "Effect.h" /*This must come first */
#include "DNA_object_types.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "Build.h"
#include "Particle.h"
#include "Wave.h"
#include "gen_utils.h"
/*****************************************************************************/
/* Python BPy_Effect methods table: */
@ -88,13 +93,13 @@ struct PyMethodDef M_Effect_methods[] = {
/*****************************************************************************/
PyObject *M_Effect_New( PyObject * self, PyObject * args )
{
BPy_Effect *pyeffect;
/* BPy_Effect *pyeffect;
Effect *bleffect = 0;
int type = -1;
char *btype = NULL;
char *btype = NULL;*/
Py_INCREF( Py_None );
return Py_None;
if( !PyArg_ParseTuple( args, "s", &btype ) )
/* if( !PyArg_ParseTuple( args, "s", &btype ) )
return ( EXPP_ReturnPyObjError( PyExc_TypeError,
"expected type argument(wave,build or particle)" ) );
if( !strcmp( btype, "wave" ) )
@ -122,7 +127,7 @@ PyObject *M_Effect_New( PyObject * self, PyObject * args )
pyeffect->effect = bleffect;
return ( PyObject * ) pyeffect;
return ( PyObject * ) pyeffect;*/
}
/*****************************************************************************/
@ -268,7 +273,7 @@ PyObject *Effect_setType( BPy_Effect * self, PyObject * args )
if( !PyArg_ParseTuple( args, "i", &value ) )
return ( EXPP_ReturnPyObjError( PyExc_TypeError,
"expected an int as argument" ) );
self->effect->type = value;
self->effect->type = (short)value;
Py_INCREF( Py_None );
return Py_None;
}
@ -289,7 +294,7 @@ PyObject *Effect_setFlag( BPy_Effect * self, PyObject * args )
if( !PyArg_ParseTuple( args, "i", &value ) )
return ( EXPP_ReturnPyObjError( PyExc_TypeError,
"expected an int as argument" ) );
self->effect->flag = value;
self->effect->flag = (short)value;
Py_INCREF( Py_None );
return Py_None;
}

@ -34,19 +34,7 @@
#define EXPP_EFFECT_H
#include <Python.h>
#include <stdio.h>
#include <BLI_arithb.h>
#include <BLI_blenlib.h>
#include <BKE_main.h>
#include <BKE_global.h>
#include <BKE_object.h>
#include <BKE_library.h>
#include <BKE_effect.h>
#include <DNA_effect_types.h>
#include"gen_utils.h"
#include "DNA_effect_types.h"
extern PyTypeObject Effect_Type;

@ -28,12 +28,13 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "BKE_global.h"
#include "BKE_packedFile.h"
#include "DNA_vfont_types.h"
#include "Font.h" /*This must come first*/
#include "DNA_packedFile_types.h"
#include "Text3d.h"
#include "Font.h"
#include "BKE_packedFile.h"
#include "BKE_global.h"
#include "BLI_blenlib.h"
#include "gen_utils.h"
extern PyObject *M_Text3d_LoadFont( PyObject * self, PyObject * args );

@ -34,6 +34,7 @@
#define EXPP_FONT_H
#include <Python.h>
#include "DNA_vfont_types.h"
typedef struct {
PyObject_HEAD /* required py macro */

@ -30,20 +30,20 @@
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "Image.h" /*This must come first*/
#include <BDR_drawmesh.h> /* free_realtime_image */
#include <BKE_main.h>
#include <BKE_global.h>
#include <BKE_library.h>
#include <BKE_image.h>
#include <BIF_drawimage.h>
#include <BLI_blenlib.h>
#include <DNA_space_types.h> /* FILE_MAXDIR = 160 */
#include <IMB_imbuf_types.h> /* for the IB_rect define */
#include <BIF_gl.h>
#include "BDR_drawmesh.h" /* free_realtime_image */
#include "BKE_main.h"
#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_image.h"
#include "BIF_drawimage.h"
#include "BLI_blenlib.h"
#include "DNA_space_types.h" /* FILE_MAXDIR = 160 */
#include "IMB_imbuf_types.h" /* for the IB_rect define */
#include "BIF_gl.h"
#include "gen_utils.h"
#include "Image.h"
/*****************************************************************************/
/* Python BPy_Image defaults: */

@ -34,14 +34,15 @@
#define EXPP_IMAGE_H
#include <Python.h>
#include <DNA_image_types.h>
#include "DNA_image_types.h"
/*****************************************************************************/
/* Python BPy_Image structure definition */
/*****************************************************************************/
typedef struct {
PyObject_HEAD Image * image;
PyObject_HEAD
Image * image;
} BPy_Image;

@ -31,22 +31,18 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "Ipo.h"
#include <BKE_main.h>
#include <BKE_global.h>
#include <BKE_object.h>
#include <BKE_library.h>
#include <BSE_editipo.h>
#include <BLI_blenlib.h>
#include <BIF_space.h>
#include <BSE_editipo.h>
#include <mydevice.h>
#include <DNA_curve_types.h>
#include <MEM_guardedalloc.h>
#include "Ipo.h" /*This must come first*/
#include "BKE_main.h"
#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_ipo.h"
#include "BLI_blenlib.h"
#include "BIF_space.h"
#include "BSE_editipo.h"
#include "MEM_guardedalloc.h"
#include "mydevice.h"
#include "Ipocurve.h"
#include "constant.h"
#include "gen_utils.h"
/*****************************************************************************/
@ -1167,7 +1163,7 @@ static PyObject *Ipo_setCurveBeztriple( BPy_Ipo * self, PyObject * args )
for( i = 0; i < 9; i++ ) {
PyObject *xx = PyTuple_GetItem( listargs, i );
ptrbt->vec[i / 3][i % 3] = PyFloat_AsDouble( xx );
ptrbt->vec[i / 3][i % 3] = (float)PyFloat_AsDouble( xx );
}
Py_INCREF( Py_None );

@ -34,7 +34,7 @@
#define EXPP_IPO_H
#include <Python.h>
#include <DNA_ipo_types.h>
#include "DNA_ipo_types.h"
/*****************************************************************************/
/* Python BPy_Ipo structure definition: */

@ -30,21 +30,15 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "Ipocurve.h"
#include "Ipocurve.h" /*This must come first*/
#include <BKE_main.h>
#include <BKE_global.h>
#include <BKE_object.h>
#include <BKE_library.h>
#include <BKE_ipo.h>
#include <BLI_blenlib.h>
#include <BSE_editipo.h>
#include <MEM_guardedalloc.h>
#include <DNA_ipo_types.h>
#include "constant.h"
#include "gen_utils.h"
#include "BKE_global.h"
#include "BKE_ipo.h"
#include "BSE_editipo.h"
#include "MEM_guardedalloc.h"
#include "DNA_ipo_types.h"
#include "BezTriple.h"
#include "gen_utils.h"
/*****************************************************************************/
/* Python API function prototypes for the IpoCurve module. */
@ -219,7 +213,7 @@ static PyObject *IpoCurve_setInterpolation( C_IpoCurve * self,
return ( EXPP_ReturnPyObjError
( PyExc_TypeError, "bad interpolation type" ) );
self->ipocurve->ipo = id;
self->ipocurve->ipo = (short)id;
Py_INCREF( Py_None );
return Py_None;
}
@ -262,7 +256,7 @@ static PyObject *IpoCurve_setExtrapolation( C_IpoCurve * self,
if( id == -1 )
return ( EXPP_ReturnPyObjError
( PyExc_TypeError, "bad interpolation type" ) );
self->ipocurve->extrap = id;
self->ipocurve->extrap = (short)id;
Py_INCREF( Py_None );
return Py_None;
}
@ -297,8 +291,8 @@ static PyObject *IpoCurve_addBezier( C_IpoCurve * self, PyObject * args )
return ( EXPP_ReturnPyObjError
( PyExc_TypeError, "expected tuple argument" ) );
x = PyFloat_AsDouble( PyTuple_GetItem( popo, 0 ) );
y = PyFloat_AsDouble( PyTuple_GetItem( popo, 1 ) );
x = (float)PyFloat_AsDouble( PyTuple_GetItem( popo, 0 ) );
y = (float)PyFloat_AsDouble( PyTuple_GetItem( popo, 1 ) );
icu = self->ipocurve;
npoints = icu->totvert;
tmp = icu->bezt;
@ -445,8 +439,6 @@ static PyObject *IpoCurve_getName( C_IpoCurve * self )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"This function doesn't support this ipocurve type yet" );
}
return PyString_FromString( "" );
}
static void IpoCurveDeAlloc( C_IpoCurve * self )

@ -34,7 +34,7 @@
#define EXPP_IPOCURVE_H
#include <Python.h>
#include <DNA_curve_types.h> /* declaration of IpoCurve */
#include "DNA_curve_types.h" /* declaration of IpoCurve */
/*****************************************************************************/
/* Python C_IpoCurve structure definition: */

@ -30,23 +30,18 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "Lamp.h" /*This must come first*/
#include <stdio.h>
#include <BKE_main.h>
#include <BKE_global.h>
#include <BKE_object.h>
#include <BKE_library.h>
#include <BLI_blenlib.h>
#include <BIF_space.h>
#include <BSE_editipo.h>
#include <mydevice.h>
#include "Lamp.h"
#include "BKE_main.h"
#include "BKE_global.h"
#include "BKE_object.h"
#include "BKE_library.h"
#include "BLI_blenlib.h"
#include "BIF_space.h"
#include "BSE_editipo.h"
#include "mydevice.h"
#include "Ipo.h"
#include "constant.h"
#include "rgbTuple.h"
#include "gen_utils.h"
/*****************************************************************************/
@ -96,17 +91,17 @@
#define EXPP_LAMP_BUFFERSIZE_MAX 5120
#define EXPP_LAMP_ENERGY_MIN 0.0
#define EXPP_LAMP_ENERGY_MAX 10.0
#define EXPP_LAMP_DIST_MIN 0.1
#define EXPP_LAMP_DIST_MIN 0.1f
#define EXPP_LAMP_DIST_MAX 5000.0
#define EXPP_LAMP_SPOTSIZE_MIN 1.0
#define EXPP_LAMP_SPOTSIZE_MAX 180.0
#define EXPP_LAMP_SPOTBLEND_MIN 0.00
#define EXPP_LAMP_SPOTBLEND_MAX 1.00
#define EXPP_LAMP_CLIPSTART_MIN 0.1
#define EXPP_LAMP_CLIPSTART_MIN 0.1f
#define EXPP_LAMP_CLIPSTART_MAX 1000.0
#define EXPP_LAMP_CLIPEND_MIN 1.0
#define EXPP_LAMP_CLIPEND_MAX 5000.0
#define EXPP_LAMP_BIAS_MIN 0.01
#define EXPP_LAMP_BIAS_MIN 0.01f
#define EXPP_LAMP_BIAS_MAX 5.00
#define EXPP_LAMP_SOFTNESS_MIN 1.0
#define EXPP_LAMP_SOFTNESS_MAX 100.0
@ -982,7 +977,7 @@ static PyObject *Lamp_setSamples( BPy_Lamp * self, PyObject * args )
return ( EXPP_ReturnPyObjError( PyExc_TypeError,
"expected int argument in [1,16]" ) );
self->lamp->samp = EXPP_ClampInt( value,
self->lamp->samp = (short)EXPP_ClampInt( value,
EXPP_LAMP_SAMPLES_MIN,
EXPP_LAMP_SAMPLES_MAX );
@ -998,7 +993,7 @@ static PyObject *Lamp_setBufferSize( BPy_Lamp * self, PyObject * args )
return ( EXPP_ReturnPyObjError( PyExc_TypeError,
"expected int argument in [512, 5120]" ) );
self->lamp->bufsize = EXPP_ClampInt( value,
self->lamp->bufsize = (short)EXPP_ClampInt( value,
EXPP_LAMP_BUFFERSIZE_MIN,
EXPP_LAMP_BUFFERSIZE_MAX );
@ -1014,7 +1009,7 @@ static PyObject *Lamp_setHaloStep( BPy_Lamp * self, PyObject * args )
return ( EXPP_ReturnPyObjError( PyExc_TypeError,
"expected int argument in [0,12]" ) );
self->lamp->shadhalostep = EXPP_ClampInt( value,
self->lamp->shadhalostep = (short)EXPP_ClampInt( value,
EXPP_LAMP_HALOSTEP_MIN,
EXPP_LAMP_HALOSTEP_MAX );

@ -34,7 +34,7 @@
#define EXPP_LAMP_H
#include <Python.h>
#include <DNA_lamp_types.h>
#include "DNA_lamp_types.h"
#include "rgbTuple.h"
extern PyTypeObject Lamp_Type;

@ -30,25 +30,19 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "Lattice.h"
#include "Lattice.h" /*This must come first*/
#include <BKE_main.h>
#include <BKE_global.h>
#include <BKE_library.h>
#include <BKE_lattice.h>
#include <BKE_utildefines.h>
#include <BKE_key.h>
#include <BLI_blenlib.h>
#include <DNA_key_types.h>
#include <DNA_curve_types.h>
#include <DNA_scene_types.h>
#include <BIF_editlattice.h>
#include <BIF_editkey.h>
#include "BKE_main.h"
#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_lattice.h"
#include "BLI_blenlib.h"
#include "DNA_object_types.h"
#include "DNA_key_types.h"
#include "DNA_curve_types.h"
#include "DNA_scene_types.h"
#include "BIF_editkey.h"
#include "blendef.h"
#include "mydevice.h"
#include "constant.h"
#include "gen_utils.h"
@ -684,7 +678,7 @@ static PyObject *Lattice_applyDeform( BPy_Lattice * self, PyObject *args )
{
//Object* ob; unused
Base *base;
Object *par;
Object *par = NULL;
int forced = 0;
if( !Lattice_IsLinkedToObject( self ) )
@ -698,7 +692,8 @@ static PyObject *Lattice_applyDeform( BPy_Lattice * self, PyObject *args )
/* deform children */
base = FIRSTBASE;
while( base ) {
if( ( par = base->object->parent ) ) { /* check/assign if ob has parent */
par = base->object->parent;
if( par != NULL ) { /* check/assign if ob has parent */
/* meshes have their mverts deformed, others ob types use displist,
* so we're not doing meshes here (unless forced), or else they get
* deformed twice, since parenting a Lattice to an object and redrawing
@ -733,7 +728,7 @@ static PyObject *Lattice_insertKey( BPy_Lattice * self, PyObject * args )
if( frame > 0 ) {
frame = EXPP_ClampInt( frame, 1, MAXFRAME );
oldfra = G.scene->r.cfra;
G.scene->r.cfra = frame;
G.scene->r.cfra = (short)frame;
}
// else just use current frame, then
// return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
@ -743,7 +738,7 @@ static PyObject *Lattice_insertKey( BPy_Lattice * self, PyObject * args )
insert_lattkey( lt );
if( frame > 0 )
G.scene->r.cfra = oldfra;
G.scene->r.cfra = (short)oldfra;
Py_INCREF( Py_None );
return Py_None;

@ -34,7 +34,7 @@
#define EXPP_Lattice_H
#include <Python.h>
#include <DNA_lattice_types.h>
#include "DNA_lattice_types.h"
@ -42,7 +42,8 @@
/* Python BPy_Lattice structure definition: */
/*****************************************************************************/
typedef struct {
PyObject_HEAD Lattice * Lattice;
PyObject_HEAD
Lattice * Lattice;
} BPy_Lattice;

@ -34,19 +34,18 @@
*/
#include <Python.h>
#include <stdio.h>
#include <DNA_ID.h>
#include <DNA_curve_types.h>
#include <BKE_library.h> /* for all_local */
#include "DNA_curve_types.h"
#include "DNA_object_types.h"
#include "BKE_library.h" /* for all_local */
#include "BKE_font.h" /* for text_to_curve */
#include <BLO_readfile.h>
#include <BLI_linklist.h>
#include <MEM_guardedalloc.h>
#include "BKE_global.h"
#include "BKE_main.h"
#include "BLO_readfile.h"
#include "BLI_linklist.h"
#include "MEM_guardedalloc.h"
#include "gen_utils.h"
/**
* Global variables.
*/
@ -338,7 +337,6 @@ PyObject *M_Library_Load( PyObject * self, PyObject * args )
*/
PyObject *M_Library_Update( PyObject * self )
{ /* code adapted from do_library_append in src/filesel.c: */
Object *ob = NULL;
Library *lib = NULL;
/* Displist code that was here is obsolete... depending on what

@ -29,18 +29,10 @@
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "MTex.h" /*This must come first*/
#include <BKE_main.h>
#include <BKE_global.h>
#include <BKE_object.h>
#include <BKE_library.h>
#include <BLI_blenlib.h>
#include <BKE_texture.h>
#include <BKE_utildefines.h>
#include "MTex.h"
#include "BKE_utildefines.h"
#include "Texture.h"
#include "constant.h"
#include "gen_utils.h"
@ -204,7 +196,7 @@ static int MTex_setAttr( BPy_MTex * self, char *name, PyObject * value )
if( PyInt_Check( value ) ) {
int texco = PyInt_AsLong( value );
/* TODO: sanity-check this input! */
self->mtex->texco = texco;
self->mtex->texco = (short)texco;
Py_INCREF( Py_None ); /* because we decref it below */
error = Py_None;
}
@ -212,7 +204,7 @@ static int MTex_setAttr( BPy_MTex * self, char *name, PyObject * value )
if( PyInt_Check( value ) ) {
int mapto = PyInt_AsLong( value );
/* TODO: sanity-check this input! */
self->mtex->mapto = mapto;
self->mtex->mapto = (short)mapto;
Py_INCREF( Py_None ); /* because we decref it below */
error = Py_None;
}

@ -34,8 +34,7 @@
#define EXPP_MTEX_H
#include <Python.h>
#include <DNA_texture_types.h>
#include "DNA_texture_types.h"
/*****************************************************************************/

@ -40,6 +40,7 @@ include nan_compile.mk
ifeq ($(OS),$(findstring $(OS), "beos darwin freebsd linux openbsd solaris windows"))
CFLAGS += -funsigned-char
CFLAGS += -fno-strict-aliasing
endif
CFLAGS += $(LEVEL_1_C_WARNINGS)

@ -31,29 +31,25 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include <BKE_main.h>
#include <BKE_global.h>
#include <BKE_library.h>
#include <MEM_guardedalloc.h>
#include <DNA_ID.h>
#include <BLI_blenlib.h>
#include <BSE_editipo.h>
#include <BIF_space.h>
#include <mydevice.h>
#include "Material.h" /*This must come first*/
#include "constant.h"
#include "gen_utils.h"
#include "MTex.h"
#include "Texture.h"
#include "Material.h"
#include "Ipo.h"
/* only used for .oopsLoc at the moment */
#include "DNA_oops_types.h"
#include "DNA_space_types.h"
#include "BKE_main.h"
#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_material.h"
#include "BKE_texture.h"
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BSE_editipo.h"
#include "BIF_space.h"
#include "mydevice.h"
#include "constant.h"
#include "MTex.h"
#include "Texture.h"
#include "Ipo.h"
#include "gen_utils.h"
/*****************************************************************************/
/* Python BPy_Material defaults: */
@ -107,11 +103,11 @@
#define EXPP_MAT_ZOFFS_MAX 10.0
#define EXPP_MAT_HALOSIZE_MIN 0.0
#define EXPP_MAT_HALOSIZE_MAX 100.0
#define EXPP_MAT_FLARESIZE_MIN 0.1
#define EXPP_MAT_FLARESIZE_MIN 0.1f
#define EXPP_MAT_FLARESIZE_MAX 25.0
#define EXPP_MAT_FLAREBOOST_MIN 0.1
#define EXPP_MAT_FLAREBOOST_MIN 0.1f
#define EXPP_MAT_FLAREBOOST_MAX 10.0
#define EXPP_MAT_SUBSIZE_MIN 0.1
#define EXPP_MAT_SUBSIZE_MIN 0.1f
#define EXPP_MAT_SUBSIZE_MAX 25.0
#define EXPP_MAT_HARD_MIN 1
@ -1715,7 +1711,7 @@ static PyObject *Material_setHaloSeed( BPy_Material * self, PyObject * args )
return ( EXPP_ReturnPyObjError( PyExc_TypeError,
"expected int argument in [1, 255]" ) );
self->material->seed1 = EXPP_ClampInt( value, EXPP_MAT_HALOSEED_MIN,
self->material->seed1 = (char)EXPP_ClampInt( value, EXPP_MAT_HALOSEED_MIN,
EXPP_MAT_HALOSEED_MAX );
return EXPP_incr_ret( Py_None );
@ -1729,7 +1725,7 @@ static PyObject *Material_setFlareSeed( BPy_Material * self, PyObject * args )
return ( EXPP_ReturnPyObjError( PyExc_TypeError,
"expected int argument in [1, 255]" ) );
self->material->seed2 = EXPP_ClampInt( value, EXPP_MAT_FLARESEED_MIN,
self->material->seed2 = (char)EXPP_ClampInt( value, EXPP_MAT_FLARESEED_MIN,
EXPP_MAT_FLARESEED_MAX );
return EXPP_incr_ret( Py_None );
@ -1744,7 +1740,7 @@ static PyObject *Material_setHardness( BPy_Material * self, PyObject * args )
return ( EXPP_ReturnPyObjError( PyExc_TypeError,
"expected int argument in [1, 255]" ) );
self->material->har = EXPP_ClampInt( value, EXPP_MAT_HARD_MIN,
self->material->har = (short)EXPP_ClampInt( value, EXPP_MAT_HARD_MIN,
EXPP_MAT_HARD_MAX );
return EXPP_incr_ret( Py_None );
@ -1758,7 +1754,7 @@ static PyObject *Material_setNFlares( BPy_Material * self, PyObject * args )
return ( EXPP_ReturnPyObjError( PyExc_TypeError,
"expected int argument in [1, 32]" ) );
self->material->flarec = EXPP_ClampInt( value, EXPP_MAT_NFLARES_MIN,
self->material->flarec = (short)EXPP_ClampInt( value, EXPP_MAT_NFLARES_MIN,
EXPP_MAT_NFLARES_MAX );
return EXPP_incr_ret( Py_None );
@ -1772,7 +1768,7 @@ static PyObject *Material_setNStars( BPy_Material * self, PyObject * args )
return ( EXPP_ReturnPyObjError( PyExc_TypeError,
"expected int argument in [3, 50]" ) );
self->material->starc = EXPP_ClampInt( value, EXPP_MAT_NSTARS_MIN,
self->material->starc = (short)EXPP_ClampInt( value, EXPP_MAT_NSTARS_MIN,
EXPP_MAT_NSTARS_MAX );
return EXPP_incr_ret( Py_None );
@ -1786,7 +1782,7 @@ static PyObject *Material_setNLines( BPy_Material * self, PyObject * args )
return ( EXPP_ReturnPyObjError( PyExc_TypeError,
"expected int argument in [0, 250]" ) );
self->material->linec = EXPP_ClampInt( value, EXPP_MAT_NLINES_MIN,
self->material->linec = (short)EXPP_ClampInt( value, EXPP_MAT_NLINES_MIN,
EXPP_MAT_NLINES_MAX );
return EXPP_incr_ret( Py_None );
@ -1800,7 +1796,7 @@ static PyObject *Material_setNRings( BPy_Material * self, PyObject * args )
return ( EXPP_ReturnPyObjError( PyExc_TypeError,
"expected int argument in [0, 24]" ) );
self->material->ringc = EXPP_ClampInt( value, EXPP_MAT_NRINGS_MIN,
self->material->ringc = (short)EXPP_ClampInt( value, EXPP_MAT_NRINGS_MIN,
EXPP_MAT_NRINGS_MAX );
return EXPP_incr_ret( Py_None );
@ -1830,7 +1826,7 @@ static PyObject *Material_setMirrDepth( BPy_Material * self, PyObject * args )
"expected float argument in [0, 10]" ) );
self->material->ray_depth =
EXPP_ClampInt( value, EXPP_MAT_MIRRDEPTH_MIN,
(short)EXPP_ClampInt( value, EXPP_MAT_MIRRDEPTH_MIN,
EXPP_MAT_MIRRDEPTH_MAX );
return EXPP_incr_ret( Py_None );
@ -1891,7 +1887,7 @@ static PyObject *Material_setTransDepth( BPy_Material * self, PyObject * args )
"expected float argument in [0, 10]" ) );
self->material->ray_depth_tra =
EXPP_ClampInt( value, EXPP_MAT_TRANSDEPTH_MIN,
(short)EXPP_ClampInt( value, EXPP_MAT_TRANSDEPTH_MIN,
EXPP_MAT_TRANSDEPTH_MAX );
return EXPP_incr_ret( Py_None );
@ -1957,8 +1953,8 @@ static PyObject *Material_setTexture( BPy_Material * self, PyObject * args )
self->material->mtex[texnum]->tex = bltex;
id_us_plus( &bltex->id );
self->material->mtex[texnum]->texco = texco;
self->material->mtex[texnum]->mapto = mapto;
self->material->mtex[texnum]->texco = (short)texco;
self->material->mtex[texnum]->mapto = (short)mapto;
Py_INCREF( Py_None );
return Py_None;
@ -2082,7 +2078,7 @@ static PyObject *Material_getAttr( BPy_Material * self, char *name )
else if( strcmp( name, "haloSize" ) == 0 )
attr = PyFloat_FromDouble( ( double ) self->material->hasize );
else if( strcmp( name, "haloSeed" ) == 0 )
attr = PyInt_FromLong( ( double ) self->material->seed1 );
attr = PyInt_FromLong( ( long ) self->material->seed1 );
else if( strcmp( name, "flareSize" ) == 0 )
attr = PyFloat_FromDouble( ( double ) self->material->
flaresize );
@ -2090,7 +2086,7 @@ static PyObject *Material_getAttr( BPy_Material * self, char *name )
attr = PyFloat_FromDouble( ( double ) self->material->
flareboost );
else if( strcmp( name, "flareSeed" ) == 0 )
attr = PyInt_FromLong( ( double ) self->material->seed2 );
attr = PyInt_FromLong( ( long ) self->material->seed2 );
else if( strcmp( name, "subSize" ) == 0 )
attr = PyFloat_FromDouble( ( double ) self->material->
subsize );
@ -2118,7 +2114,7 @@ static PyObject *Material_getAttr( BPy_Material * self, char *name )
else if( strcmp( name, "IOR" ) == 0 )
attr = PyFloat_FromDouble( ( double ) self->material->ang );
else if( strcmp( name, "transDepth" ) == 0 )
attr = PyInt_FromLong( ( double ) self->material->
attr = PyInt_FromLong( ( long ) self->material->
ray_depth_tra );
else if( strcmp( name, "fresnelTrans" ) == 0 )
attr = PyFloat_FromDouble( ( double ) self->material->
@ -2127,7 +2123,7 @@ static PyObject *Material_getAttr( BPy_Material * self, char *name )
attr = PyFloat_FromDouble( ( double ) self->material->
fresnel_tra_i );
else if( strcmp( name, "users" ) == 0 )
attr = PyInt_FromLong( ( double ) self->material->
attr = PyInt_FromLong( ( long ) self->material->
id.us );
else if (strcmp(name, "oopsLoc") == 0) {
if (G.soops) {
@ -2499,7 +2495,7 @@ int EXPP_synchronizeMaterialLists( Object * object )
/* More data mats than object mats */
result = expandPtrArray( ( void * ) &object->mat,
object->totcol, *nmaterials );
object->totcol = *nmaterials;
object->totcol = (char)*nmaterials;
}
} /* else no synchronization needed, they are of equal length */

@ -34,16 +34,16 @@
#define EXPP_MATERIAL_H
#include <Python.h>
#include <DNA_material_types.h>
#include <BKE_material.h>
#include "DNA_object_types.h"
#include "DNA_material_types.h"
#include "rgbTuple.h"
/*****************************************************************************/
/* Python BPy_Material structure definition: */
/*****************************************************************************/
typedef struct {
PyObject_HEAD Material * material;
PyObject_HEAD
Material * material;
BPy_rgbTuple *col, *amb, *spec, *mir;
} BPy_Material;

@ -30,20 +30,13 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include <math.h>
#include "BKE_main.h"
#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_utildefines.h"
#include "BLI_blenlib.h"
#include "Mathutils.h"
#include "BLI_arithb.h"
#include "PIL_time.h"
#include "BLI_rand.h"
#include "blendef.h"
#include "mydevice.h"
#include "constant.h"
#include "gen_utils.h"
#include "Mathutils.h"
//-------------------------DOC STRINGS ---------------------------
static char M_Mathutils_doc[] = "The Blender Mathutils module\n\n";
static char M_Mathutils_Vector_doc[] = "() - create a new vector object from a list of floats";
@ -145,7 +138,7 @@ PyObject *column_vector_multiplication(MatrixObject * mat, VectorObject* vec)
for(y = 0; y < mat->colSize; y++) {
dot += mat->matrix[x][y] * vecCopy[y];
}
vecNew[z++] = dot;
vecNew[z++] = (float)dot;
dot = 0.0f;
}
return (PyObject *) newVectorObject(vecNew, vec->size, Py_NEW);
@ -180,7 +173,7 @@ PyObject *row_vector_multiplication(VectorObject* vec, MatrixObject * mat)
for(y = 0; y < mat->rowSize; y++) {
dot += mat->matrix[y][x] * vecCopy[y];
}
vecNew[z++] = dot;
vecNew[z++] = (float)dot;
dot = 0.0f;
}
return (PyObject *) newVectorObject(vecNew, size, Py_NEW);
@ -260,7 +253,7 @@ PyObject *M_Mathutils_Vector(PyObject * self, PyObject * args)
return EXPP_ReturnPyObjError(PyExc_TypeError,
"Mathutils.Vector(): 2-4 floats or ints expected (optionally in a sequence)\n");
}
vec[i]=PyFloat_AS_DOUBLE(f);
vec[i]=(float)PyFloat_AS_DOUBLE(f);
EXPP_decr2(f,v);
}
Py_DECREF(listObject);
@ -479,7 +472,7 @@ PyObject *M_Mathutils_Matrix(PyObject * self, PyObject * args)
return EXPP_ReturnPyObjError(PyExc_AttributeError,
"Mathutils.Matrix(): expects 0-4 numeric sequences of the same size\n");
}
matrix[(seqSize*i)+j]=PyFloat_AS_DOUBLE(f);
matrix[(seqSize*i)+j]=(float)PyFloat_AS_DOUBLE(f);
EXPP_decr2(f,s);
}
Py_DECREF(m);
@ -955,14 +948,14 @@ PyObject *M_Mathutils_Quaternion(PyObject * self, PyObject * args)
return EXPP_ReturnPyObjError(PyExc_TypeError,
"Mathutils.Quaternion(): 4d numeric sequence expected or 3d vector and number\n");
}
quat[i] = PyFloat_AS_DOUBLE(f);
quat[i] = (float)PyFloat_AS_DOUBLE(f);
EXPP_decr2(f, q);
}
if(size == 3){ //calculate the quat based on axis/angle
norm = sqrt(quat[0] * quat[0] + quat[1] * quat[1] + quat[2] * quat[2]);
quat[0] /= norm;
quat[1] /= norm;
quat[2] /= norm;
quat[0] /= (float)norm;
quat[1] /= (float)norm;
quat[2] /= (float)norm;
angle = angle * (Py_PI / 180);
quat[3] =(float) (sin(angle/ 2.0f)) * quat[2];
@ -1026,7 +1019,7 @@ PyObject *M_Mathutils_DifferenceQuats(PyObject * self, PyObject * args)
tempQuat[2] * tempQuat[2] + tempQuat[3] * tempQuat[3]);
for(x = 0; x < 4; x++) {
tempQuat[x] /= (dot * dot);
tempQuat[x] /= (float)(dot * dot);
}
QuatMul(quat, tempQuat, quatV->quat);
return (PyObject *) newQuaternionObject(quat, Py_NEW);
@ -1081,10 +1074,10 @@ PyObject *M_Mathutils_Slerp(PyObject * self, PyObject * args)
y = sin(param * angle) * IsinT;
}
//interpolate
quat[0] = quat_u[0] * x + quat_v[0] * y;
quat[1] = quat_u[1] * x + quat_v[1] * y;
quat[2] = quat_u[2] * x + quat_v[2] * y;
quat[3] = quat_u[3] * x + quat_v[3] * y;
quat[0] = (float)(quat_u[0] * x + quat_v[0] * y);
quat[1] = (float)(quat_u[1] * x + quat_v[1] * y);
quat[2] = (float)(quat_u[2] * x + quat_v[2] * y);
quat[3] = (float)(quat_u[3] * x + quat_v[3] * y);
return (PyObject *) newQuaternionObject(quat, Py_NEW);
}
@ -1135,7 +1128,7 @@ PyObject *M_Mathutils_Euler(PyObject * self, PyObject * args)
return EXPP_ReturnPyObjError(PyExc_TypeError,
"Mathutils.Euler(): 3d numeric sequence expected\n");
}
eul[i]=PyFloat_AS_DOUBLE(f);
eul[i]=(float)PyFloat_AS_DOUBLE(f);
EXPP_decr2(f,e);
}
Py_DECREF(listObject);

@ -30,20 +30,16 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "Metaball.h"
#include "Metaball.h" /*This must come first*/
#include <BKE_main.h>
#include <BKE_global.h>
#include <BKE_mball.h>
#include <BKE_object.h>
#include <BKE_library.h>
#include <BLI_blenlib.h>
#include "constant.h"
#include "BKE_main.h"
#include "BKE_global.h"
#include "BKE_mball.h"
#include "BKE_library.h"
#include "BLI_blenlib.h"
#include "DNA_object_types.h"
#include "gen_utils.h"
/*****************************************************************************/
/* Python API function prototypes for the Metaball module. */
/*****************************************************************************/
@ -421,14 +417,14 @@ static PyObject *Metaball_addMetaelem( BPy_Metaball * self, PyObject * args )
type = PyInt_AsLong( PyList_GetItem( listargs, 0 ) );
x = PyFloat_AsDouble( PyList_GetItem( listargs, 1 ) );
y = PyFloat_AsDouble( PyList_GetItem( listargs, 2 ) );
z = PyFloat_AsDouble( PyList_GetItem( listargs, 3 ) );
rad = PyFloat_AsDouble( PyList_GetItem( listargs, 4 ) );
s = PyFloat_AsDouble( PyList_GetItem( listargs, 6 ) );
expx = PyFloat_AsDouble( PyList_GetItem( listargs, 7 ) );
expy = PyFloat_AsDouble( PyList_GetItem( listargs, 8 ) );
expz = PyFloat_AsDouble( PyList_GetItem( listargs, 9 ) );
x = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 1 ) );
y = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 2 ) );
z = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 3 ) );
rad = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 4 ) );
s = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 6 ) );
expx = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 7 ) );
expy = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 8 ) );
expz = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 9 ) );
ml = MEM_callocN( sizeof( MetaElem ), "metaelem" );
BLI_addhead( &( self->metaball->elems ), ml );
@ -439,11 +435,11 @@ static PyObject *Metaball_addMetaelem( BPy_Metaball * self, PyObject * args )
ml->rad = rad;
ml->s = s;
ml->flag = SELECT;
ml->type = type;
ml->type = (short)type;
ml->expx = expx;
ml->expy = expy;
ml->expz = expz;
ml->type = type;
ml->type = (short)type;
allqueue( 0X4013, 0 );
Py_INCREF( Py_None );
return Py_None;
@ -540,7 +536,7 @@ static PyObject *Metaball_setloc( BPy_Metaball * self, PyObject * args )
( PyExc_TypeError, "expected a list" ) );
for( i = 0; i < 3; i++ ) {
PyObject *xx = PyList_GetItem( listargs, i );
self->metaball->loc[i] = PyFloat_AsDouble( xx );
self->metaball->loc[i] = (float)PyFloat_AsDouble( xx );
}
Py_INCREF( Py_None );
return Py_None;
@ -567,7 +563,7 @@ static PyObject *Metaball_setrot( BPy_Metaball * self, PyObject * args )
( PyExc_TypeError, "expected a list" ) );
for( i = 0; i < 3; i++ ) {
PyObject *xx = PyList_GetItem( listargs, i );
self->metaball->rot[i] = PyFloat_AsDouble( xx );
self->metaball->rot[i] = (float)PyFloat_AsDouble( xx );
}
Py_INCREF( Py_None );
return Py_None;
@ -617,7 +613,7 @@ static PyObject *Metaball_setsize( BPy_Metaball * self, PyObject * args )
( PyExc_TypeError, "expected a list" ) );
for( i = 0; i < 3; i++ ) {
PyObject *xx = PyList_GetItem( listargs, i );
self->metaball->size[i] = PyFloat_AsDouble( xx );
self->metaball->size[i] = (float)PyFloat_AsDouble( xx );
}
Py_INCREF( Py_None );
return Py_None;
@ -762,7 +758,7 @@ static PyObject *Metaball_setMetadata( BPy_Metaball * self, PyObject * args )
ptr = ptr->next;
}
if( !strcmp( name, "type" ) ) {
ptr->type = intval;
ptr->type = (short)intval;
return ( PyInt_FromLong( intval ) );
}
if( !strcmp( name, "x" ) ) {
@ -841,7 +837,7 @@ static PyObject *Metaball_setMetatype( BPy_Metaball * self, PyObject * args )
for( i = 0; i < num; i++ ) {
ptr = ptr->next;
}
ptr->type = val;
ptr->type = (short)val;
Py_INCREF( Py_None );
return Py_None;
@ -1166,11 +1162,11 @@ static PyObject *Metaelem_setdims( BPy_Metaelem * self, PyObject * args )
return ( EXPP_ReturnPyObjError
( PyExc_TypeError, "expected a list" ) );
self->metaelem->expx =
PyFloat_AsDouble( PyList_GetItem( listargs, 0 ) );
(float)PyFloat_AsDouble( PyList_GetItem( listargs, 0 ) );
self->metaelem->expy =
PyFloat_AsDouble( PyList_GetItem( listargs, 1 ) );
(float)PyFloat_AsDouble( PyList_GetItem( listargs, 1 ) );
self->metaelem->expz =
PyFloat_AsDouble( PyList_GetItem( listargs, 2 ) );
(float)PyFloat_AsDouble( PyList_GetItem( listargs, 2 ) );
Py_INCREF( Py_None );
return Py_None;
}
@ -1197,9 +1193,9 @@ static PyObject *Metaelem_setcoords( BPy_Metaelem * self, PyObject * args )
if( !PyList_Check( listargs ) )
return ( EXPP_ReturnPyObjError
( PyExc_TypeError, "expected a list" ) );
self->metaelem->x = PyFloat_AsDouble( PyList_GetItem( listargs, 0 ) );
self->metaelem->y = PyFloat_AsDouble( PyList_GetItem( listargs, 1 ) );
self->metaelem->z = PyFloat_AsDouble( PyList_GetItem( listargs, 2 ) );
self->metaelem->x = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 0 ) );
self->metaelem->y = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 1 ) );
self->metaelem->z = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 2 ) );
Py_INCREF( Py_None );
return Py_None;
}
@ -1252,11 +1248,11 @@ static int MetaelemSetAttr( BPy_Metaelem * self, char *name, PyObject * value )
return 0;
}
if( !strcmp( name, "rad" ) ) {
self->metaelem->rad = PyFloat_AsDouble( value );
self->metaelem->rad = (float)PyFloat_AsDouble( value );
return 0;
}
if( !strcmp( name, "stif" ) ) {
self->metaelem->s = PyFloat_AsDouble( value );
self->metaelem->s = (float)PyFloat_AsDouble( value );
return 0;
}
return ( EXPP_ReturnIntError

@ -34,7 +34,7 @@
#define EXPP_METABALL_H
#include <Python.h>
#include <DNA_meta_types.h>
#include "DNA_meta_types.h"
extern PyTypeObject Metaball_Type;

@ -30,14 +30,16 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "NLA.h"
#include "Object.h"
#include <BKE_action.h>
#include <BKE_global.h>
#include <BKE_main.h>
#include "NLA.h" /*This must come first*/
#include "BKE_action.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_library.h"
#include "BLI_blenlib.h"
#include "Object.h"
#include "Ipo.h"
#include "Types.h"
#include "gen_utils.h"
/*****************************************************************************/
/* Python API function prototypes for the NLA module. */

@ -34,14 +34,15 @@
#define EXPP_NLA_H
#include <Python.h>
#include <DNA_action_types.h>
#include "DNA_action_types.h"
/** NLA module initialization function. */
PyObject *NLA_Init( void );
/** Python BPy_NLA structure definition. */
typedef struct {
PyObject_HEAD bAction * action;
PyObject_HEAD
bAction * action;
} BPy_Action;
PyObject *Action_CreatePyObject( struct bAction *action );

@ -31,45 +31,40 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "NMesh.h"
#include "NMesh.h" /*This must come first*/
#include "DNA_key_types.h"
#include "DNA_listBase.h"
#include "DNA_object_types.h"
#include "DNA_material_types.h"
#include "DNA_armature_types.h"
#include "DNA_scene_types.h"
#include "DNA_oops_types.h"
#include "DNA_space_types.h"
#include "BDR_editface.h" /* make_tfaces */
#include "BDR_vpaint.h"
#include "BDR_editobject.h"
#include "BIF_editdeform.h"
#include "BIF_editkey.h" /* insert_meshkey */
#include "BIF_editmesh.h"
#include "BIF_meshtools.h"
#include "BIF_space.h"
#include "BIF_meshtools.h" /* current loc of vertexnormals_mesh() */
#include "BIF_editview.h"
#include "BKE_deform.h"
#include "BKE_mesh.h"
#include "BKE_material.h"
#include "BKE_main.h"
#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_displist.h"
#include "BKE_DerivedMesh.h"
#include "BKE_screen.h"
#include "BKE_object.h"
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
#include "MEM_guardedalloc.h"
#include "BKE_utildefines.h"
#include "blendef.h"
#include "mydevice.h"
#include "Object.h"
#include "Mathutils.h"
#include "constant.h"
#include "gen_utils.h"
/* only used for ob.oopsloc at the moment */
#include "DNA_oops_types.h"
#include "DNA_space_types.h"
extern void countall(void);
/* EXPP Mesh defines */
@ -333,7 +328,7 @@ static PyObject *M_NMesh_Col( PyObject * self, PyObject * args )
short r = 255, g = 255, b = 255, a = 255;
if( PyArg_ParseTuple( args, "|hhhh", &r, &g, &b, &a ) )
return ( PyObject * ) newcol( r, g, b, a );
return ( PyObject * ) newcol( (unsigned char)r, (unsigned char)g, (unsigned char)b, (unsigned char)a );
return NULL;
}
@ -367,13 +362,13 @@ static int NMCol_setattr( PyObject * self, char *name, PyObject * v )
ival = ( short ) EXPP_ClampInt( ival, 0, 255 );
if( strcmp( name, "r" ) == 0 )
mc->r = ival;
mc->r = (unsigned char)ival;
else if( strcmp( name, "g" ) == 0 )
mc->g = ival;
mc->g = (unsigned char)ival;
else if( strcmp( name, "b" ) == 0 )
mc->b = ival;
mc->b = (unsigned char)ival;
else if( strcmp( name, "a" ) == 0 )
mc->a = ival;
mc->a = (unsigned char)ival;
else
return -1;
@ -606,7 +601,7 @@ static int NMFace_setattr( PyObject * self, char *name, PyObject * v )
}
} else if( !strcmp( name, "mat" ) || !strcmp( name, "materialIndex" ) ) {
PyArg_Parse( v, "h", &ival );
mf->mat_nr = ival;
mf->mat_nr = (char)ival;
return 0;
} else if( strcmp( name, "smooth" ) == 0 ) {
@ -648,7 +643,7 @@ static int NMFace_setattr( PyObject * self, char *name, PyObject * v )
return 0;
} else if( strcmp( name, "transp" ) == 0 ) {
PyArg_Parse( v, "h", &ival );
mf->transp = ival;
mf->transp = (unsigned char)ival;
return 0;
} else if( strcmp( name, "image" ) == 0 ) {
@ -847,7 +842,7 @@ static int NMVert_ass_item( BPy_NMVert * self, int i, PyObject * ob )
return EXPP_ReturnIntError( PyExc_IndexError,
"NMVert member must be a number" );
self->co[i] = PyFloat_AsDouble( ob );
self->co[i] = (float)PyFloat_AsDouble( ob );
return 0;
}
@ -1147,7 +1142,7 @@ static PyObject *NMesh_insertKey( PyObject * self, PyObject * args )
if( fra > 0 ) {
fra = EXPP_ClampInt( fra, 1, NMESH_FRAME_MAX );
oldfra = G.scene->r.cfra;
G.scene->r.cfra = fra;
G.scene->r.cfra = (short)fra;
}
if( !mesh )
@ -1157,7 +1152,7 @@ static PyObject *NMesh_insertKey( PyObject * self, PyObject * args )
insert_meshkey( mesh, typenum );
if( fra > 0 )
G.scene->r.cfra = oldfra;
G.scene->r.cfra = (short)oldfra;
return EXPP_incr_ret( Py_None );
}
@ -1334,7 +1329,7 @@ static PyObject *NMesh_update( PyObject *self, PyObject *a, PyObject *kwd )
while (base) {
if (base->object == nmesh->object) {
base->flag |= SELECT;
nmesh->object->flag = base->flag;
nmesh->object->flag = (short)base->flag;
set_active_base (base);
needs_redraw = 0; /* already done in make_vertexcol */
break;
@ -1757,7 +1752,7 @@ static int NMesh_setattr( PyObject * self, char *name, PyObject * v )
smoothresh = ( short ) PyInt_AsLong( v );
me->smoothresh =
EXPP_ClampInt( smoothresh, NMESH_SMOOTHRESH_MIN,
(short)EXPP_ClampInt( smoothresh, NMESH_SMOOTHRESH_MIN,
NMESH_SMOOTHRESH_MAX );
}
@ -1938,9 +1933,9 @@ static BPy_NMVert *nmvert_from_data( MVert * vert, MSticky * st, float *co,
mv->co[1] = co[1];
mv->co[2] = co[2];
mv->no[0] = vert->no[0] / 32767.0;
mv->no[1] = vert->no[1] / 32767.0;
mv->no[2] = vert->no[2] / 32767.0;
mv->no[0] = (float)(vert->no[0] / 32767.0);
mv->no[1] = (float)(vert->no[1] / 32767.0);
mv->no[2] = (float)(vert->no[2] / 32767.0);
if( st ) {
mv->uvco[0] = st->co[0];
@ -2201,9 +2196,9 @@ static void mvert_from_data( MVert * mv, MSticky * st, BPy_NMVert * from )
mv->co[1] = from->co[1];
mv->co[2] = from->co[2];
mv->no[0] = from->no[0] * 32767.0;
mv->no[1] = from->no[1] * 32767.0;
mv->no[2] = from->no[2] * 32767.0;
mv->no[0] = (short)(from->no[0] * 32767.0);
mv->no[1] = (short)(from->no[1] * 32767.0);
mv->no[2] = (short)(from->no[2] * 32767.0);
mv->flag = ( from->flag & 1 );
mv->mat_nr = 0;
@ -2271,7 +2266,7 @@ static int assignFaceUV( TFace * tf, BPy_NMFace * nmface )
tf->tpage = 0;
tf->mode = nmface->mode; /* copy mode */
tf->flag = nmface->flag; /* copy flag */
tf->flag = (char)nmface->flag; /* copy flag */
tf->transp = nmface->transp; /* copy transp flag */
/* assign vertex colours */
@ -2448,7 +2443,7 @@ Material **nmesh_updateMaterials( BPy_NMesh * nmesh )
} else {
matlist = 0;
}
mesh->totcol = len;
mesh->totcol = (short)len;
/**@ This is another ugly fix due to the weird material handling of blender.
* it makes sure that object material lists get updated (by their length)
@ -2475,8 +2470,8 @@ PyObject *NMesh_assignMaterials_toObject( BPy_NMesh * nmesh, Object * ob )
nmats = PyList_Size( nmesh->materials );
if( nmats > 0 && !mesh->mat ) {
ob->totcol = nmats;
mesh->totcol = nmats;
ob->totcol = (char)nmats;
mesh->totcol = (short)nmats;
mesh->mat =
MEM_callocN( sizeof( void * ) * nmats, "bpy_memats" );
@ -3513,7 +3508,7 @@ static PyObject *NMesh_removeVertGroup( PyObject * self, PyObject * args )
return EXPP_ReturnPyObjError( PyExc_AttributeError,
"no deform groups assigned to mesh" );
nIndex++;
object->actdef = nIndex;
object->actdef = (unsigned short)nIndex;
del_defgroup( object );
@ -3659,7 +3654,7 @@ static PyObject *NMesh_removeVertsFromGroup( PyObject * self, PyObject * args )
}
//set current vertex group
nIndex++;
object->actdef = nIndex;
object->actdef = (unsigned short)nIndex;
//clear all dVerts in active group
remove_verts_defgroup( 1 );

@ -35,19 +35,15 @@
#ifndef EXPP_NMESH_H
#define EXPP_NMESH_H
#include "Python.h"
#include <Python.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <DNA_mesh_types.h>
#include <DNA_meshdata_types.h>
#include <BIF_editview.h> /* for set_active_base */
#include <BSE_edit.h> /* for countall */
#include <BDR_vpaint.h> /* for make_vertexcol */
#include "DNA_object_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "Material.h"
#include "Image.h"

@ -38,9 +38,9 @@
/************************/
#include <Python.h>
#include <math.h>
#include <BLI_blenlib.h>
#include <DNA_texture_types.h>
#include "BLI_blenlib.h"
#include "DNA_texture_types.h"
#include "constant.h"
/*-----------------------------------------*/
@ -136,10 +136,10 @@ static void randuvec( float v[3] )
float r;
v[2] = 2.f * frand( ) - 1.f;
if( ( r = 1.f - v[2] * v[2] ) > 0.f ) {
float a = 6.283185307f * frand( );
r = sqrt( r );
v[0] = r * cos( a );
v[1] = r * sin( a );
float a = (float)(6.283185307f * frand( ));
r = (float)sqrt( r );
v[0] = (float)(r * cos( a ));
v[1] = (float)(r * sin( a ));
} else
v[2] = 1.f;
}
@ -191,11 +191,11 @@ static PyObject *Noise_noise( PyObject * self, PyObject * args )
static void vNoise( float x, float y, float z, int nb, float v[3] )
{
/* Simply evaluate noise at 3 different positions */
v[0] = 2.0 * BLI_gNoise( 1.f, x + 9.321f, y - 1.531f, z - 7.951f, 0,
nb ) - 1.0;
v[1] = 2.0 * BLI_gNoise( 1.f, x, y, z, 0, nb ) - 1.0;
v[2] = 2.0 * BLI_gNoise( 1.f, x + 6.327f, y + 0.1671f, z - 2.672f, 0,
nb ) - 1.0;
v[0] = (float)(2.0 * BLI_gNoise( 1.f, x + 9.321f, y - 1.531f, z - 7.951f, 0,
nb ) - 1.0);
v[1] = (float)(2.0 * BLI_gNoise( 1.f, x, y, z, 0, nb ) - 1.0);
v[2] = (float)(2.0 * BLI_gNoise( 1.f, x + 6.327f, y + 0.1671f, z - 2.672f, 0,
nb ) - 1.0);
}
static PyObject *Noise_vNoise( PyObject * self, PyObject * args )
@ -218,17 +218,17 @@ static float turb( float x, float y, float z, int oct, int hard, int nb,
float amp, out, t;
int i;
amp = 1.f;
out = 2.0 * BLI_gNoise( 1.f, x, y, z, 0, nb ) - 1.0;
out = (float)(2.0 * BLI_gNoise( 1.f, x, y, z, 0, nb ) - 1.0);
if( hard )
out = fabs( out );
out = (float)fabs( out );
for( i = 1; i < oct; i++ ) {
amp *= ampscale;
x *= freqscale;
y *= freqscale;
z *= freqscale;
t = amp * ( 2.0 * BLI_gNoise( 1.f, x, y, z, 0, nb ) - 1.0 );
t = (float)(amp * ( 2.0 * BLI_gNoise( 1.f, x, y, z, 0, nb ) - 1.0 ));
if( hard )
t = fabs( t );
t = (float)fabs( t );
out += t;
}
return out;
@ -257,9 +257,9 @@ static void vTurb( float x, float y, float z, int oct, int hard, int nb,
amp = 1.f;
vNoise( x, y, z, nb, v );
if( hard ) {
v[0] = fabs( v[0] );
v[1] = fabs( v[1] );
v[2] = fabs( v[2] );
v[0] = (float)fabs( v[0] );
v[1] = (float)fabs( v[1] );
v[2] = (float)fabs( v[2] );
}
for( i = 1; i < oct; i++ ) {
amp *= ampscale;
@ -268,9 +268,9 @@ static void vTurb( float x, float y, float z, int oct, int hard, int nb,
z *= freqscale;
vNoise( x, y, z, nb, t );
if( hard ) {
t[0] = fabs( t[0] );
t[1] = fabs( t[1] );
t[2] = fabs( t[2] );
t[0] = (float)fabs( t[0] );
t[1] = (float)fabs( t[1] );
t[2] = (float)fabs( t[2] );
}
v[0] += amp * t[0];
v[1] += amp * t[1];

@ -35,38 +35,56 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "Object.h"
#include "NLA.h"
#include "logic.h"
#include "blendef.h"
struct SpaceIpo;
struct rctf;
#include "DNA_scene_types.h"
#include "DNA_mesh_types.h"
#include "DNA_curve_types.h"
#include "Object.h" /*This must come first */
#include "DNA_view3d_types.h"
#include "DNA_object_force.h"
#include "DNA_property_types.h"
#include "DNA_userdef_types.h"
#include "BKE_depsgraph.h"
#include "BKE_effect.h"
#include "BKE_font.h"
#include "BKE_property.h"
#include "BKE_mball.h"
#include "BKE_softbody.h"
#include "BKE_utildefines.h"
#include "BKE_armature.h"
#include "BKE_lattice.h"
#include "BKE_mesh.h"
#include "BKE_library.h"
#include "BKE_object.h"
#include "BKE_curve.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "BIF_editview.h"
#include "BSE_editipo.h"
#include "BSE_edit.h"
#include "Ipo.h"
#include "Lattice.h"
#include "modules.h"
#include "Mathutils.h"
#include "constant.h"
/* only used for oops location get/set at the moment */
#include "BIF_space.h"
#include "DNA_oops_types.h"
#include "DNA_space_types.h"
#include <string.h>
#include "BLI_arithb.h"
#include "BLI_blenlib.h"
#include "BDR_editobject.h"
#include "MEM_guardedalloc.h"
#include "mydevice.h"
#include "blendef.h"
#include "Scene.h"
#include "Mathutils.h"
#include "NMesh.h"
#include "Curve.h"
#include "Ipo.h"
#include "Armature.h"
#include "Camera.h"
#include "Lamp.h"
#include "Lattice.h"
#include "Text.h"
#include "Text3d.h"
#include "Metaball.h"
#include "Draw.h"
#include "NLA.h"
#include "logic.h"
#include "gen_utils.h"
/* Defines for insertIpoKey */
@ -631,7 +649,7 @@ PyObject *M_Object_New( PyObject * self, PyObject * args )
object->id.us = 0;
object->flag = 0;
object->type = type;
object->type = (short)type;
/* transforms */
@ -670,9 +688,9 @@ PyObject *M_Object_New( PyObject * self, PyObject * args )
/* Gameengine defaults */
object->mass = 1.0;
object->inertia = 1.0;
object->formfactor = 0.4;
object->damping = 0.04;
object->rdamping = 0.1;
object->formfactor = 0.4f;
object->damping = 0.04f;
object->rdamping = 0.1f;
object->anisotropicFriction[0] = 1.0;
object->anisotropicFriction[1] = 1.0;
object->anisotropicFriction[2] = 1.0;
@ -1757,7 +1775,7 @@ static PyObject *internal_makeParent(Object *parent, PyObject *py_child,
if (partype == PARSKEL && child->type != OB_MESH)
child->partype = PAROBJECT;
else
child->partype = partype;
child->partype = (short)partype;
if (partype == PARVERT3) {
child->par1 = v1;
@ -1850,9 +1868,9 @@ static PyObject *Object_setDrawType( BPy_Object * self, PyObject * args )
static PyObject *Object_setEuler( BPy_Object * self, PyObject * args )
{
float rot1;
float rot2;
float rot3;
float rot1 = 0.0f;
float rot2 = 0.0f;
float rot3 = 0.0f;
int status = 0; /* failure */
PyObject *ob;
@ -2077,8 +2095,8 @@ static PyObject *Object_setMaterials( BPy_Object * self, PyObject * args )
id_us_plus( ( ID * ) matlist[i] );
}
self->object->mat = matlist;
self->object->totcol = len;
self->object->actcol = len;
self->object->totcol = (char)len;
self->object->actcol = (char)len;
switch ( self->object->type ) {
case OB_CURVE: /* fall through */
@ -2224,9 +2242,6 @@ static PyObject *Object_shareFrom( BPy_Object * self, PyObject * args )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"type not supported" );
}
Py_INCREF( Py_None );
return ( Py_None );
}
@ -2245,11 +2260,11 @@ static PyObject *Object_Select( BPy_Object * self, PyObject * args )
if( base->object == self->object ) {
if( sel == 1 ) {
base->flag |= SELECT;
self->object->flag = base->flag;
self->object->flag = (short)base->flag;
set_active_base( base );
} else {
base->flag &= ~SELECT;
self->object->flag = base->flag;
self->object->flag = (short)base->flag;
}
break;
}

@ -34,32 +34,7 @@
#define EXPP_OBJECT_H
#include <Python.h>
#include <stdio.h>
#include "BDR_editobject.h"
#include "BKE_armature.h"
#include "BKE_curve.h"
#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_lattice.h"
#include "BKE_main.h"
#include "BKE_mesh.h"
#include "BKE_object.h"
#include "BKE_scene.h"
#include "BKE_displist.h" /* for makeDispList */
#include "BKE_font.h" /* for text_to_font */
#include "BLI_arithb.h"
#include "BLI_blenlib.h"
#include "DNA_armature_types.h"
#include "DNA_action_types.h"
#include "DNA_ID.h"
#include "DNA_listBase.h"
#include "DNA_scene_types.h"
#include "DNA_userdef_types.h"
#include "DNA_view3d_types.h"
#include "DNA_action_types.h"
#include "gen_utils.h"
#include "DNA_object_types.h"
/* The Object PyType Object defined in Object.c */
extern PyTypeObject Object_Type;
@ -71,7 +46,8 @@ extern PyTypeObject Object_Type;
/* Python BPy_Object structure definition. */
/*****************************************************************************/
typedef struct {
PyObject_HEAD struct Object *object;
PyObject_HEAD
struct Object *object;
} BPy_Object;

@ -30,8 +30,13 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "Particle.h"
#include "Effect.h"
#include "Particle.h" /*This must come first */
#include "DNA_object_types.h"
#include "BKE_effect.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "gen_utils.h"
/*****************************************************************************/
/* Python BPy_Particle methods table: */
@ -205,7 +210,6 @@ PyObject *M_Particle_New( PyObject * self, PyObject * args )
pyeffect->effect = bleffect;
return ( PyObject * ) pyeffect;
return 0;
}
/*****************************************************************************/
@ -582,9 +586,9 @@ PyObject *Particle_setForce( BPy_Particle * self, PyObject * args )
float val[3];
if( PyTuple_Size( args ) == 1 )
args = PyTuple_GetItem( args, 0 );
val[0] = PyFloat_AsDouble( PyTuple_GetItem( args, 0 ) );
val[1] = PyFloat_AsDouble( PyTuple_GetItem( args, 1 ) );
val[2] = PyFloat_AsDouble( PyTuple_GetItem( args, 2 ) );
val[0] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 0 ) );
val[1] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 1 ) );
val[2] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 2 ) );
/*
if (!PyArg_ParseTuple(args, "fff", val,val+1,val+2 ))
return(EXPP_ReturnPyObjError(PyExc_AttributeError,\
@ -613,10 +617,10 @@ PyObject *Particle_setMult( BPy_Particle * self, PyObject * args )
float val[4];
if( PyTuple_Size( args ) == 1 )
args = PyTuple_GetItem( args, 0 );
val[0] = PyFloat_AsDouble( PyTuple_GetItem( args, 0 ) );
val[1] = PyFloat_AsDouble( PyTuple_GetItem( args, 1 ) );
val[2] = PyFloat_AsDouble( PyTuple_GetItem( args, 2 ) );
val[3] = PyFloat_AsDouble( PyTuple_GetItem( args, 3 ) );
val[0] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 0 ) );
val[1] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 1 ) );
val[2] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 2 ) );
val[3] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 3 ) );
ptr->mult[0] = val[0];
ptr->mult[1] = val[1];
ptr->mult[2] = val[2];
@ -644,10 +648,10 @@ PyObject *Particle_setLife( BPy_Particle * self, PyObject * args )
float val[4];
if( PyTuple_Size( args ) == 1 )
args = PyTuple_GetItem( args, 0 );
val[0] = PyFloat_AsDouble( PyTuple_GetItem( args, 0 ) );
val[1] = PyFloat_AsDouble( PyTuple_GetItem( args, 1 ) );
val[2] = PyFloat_AsDouble( PyTuple_GetItem( args, 2 ) );
val[3] = PyFloat_AsDouble( PyTuple_GetItem( args, 3 ) );
val[0] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 0 ) );
val[1] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 1 ) );
val[2] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 2 ) );
val[3] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 3 ) );
ptr->life[0] = val[0];
ptr->life[1] = val[1];
ptr->life[2] = val[2];
@ -674,14 +678,14 @@ PyObject *Particle_setChild( BPy_Particle * self, PyObject * args )
float val[4];
if( PyTuple_Size( args ) == 1 )
args = PyTuple_GetItem( args, 0 );
val[0] = PyFloat_AsDouble( PyTuple_GetItem( args, 0 ) );
val[1] = PyFloat_AsDouble( PyTuple_GetItem( args, 1 ) );
val[2] = PyFloat_AsDouble( PyTuple_GetItem( args, 2 ) );
val[3] = PyFloat_AsDouble( PyTuple_GetItem( args, 3 ) );
ptr->child[0] = val[0];
ptr->child[1] = val[1];
ptr->child[2] = val[2];
ptr->child[3] = val[3];
val[0] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 0 ) );
val[1] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 1 ) );
val[2] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 2 ) );
val[3] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 3 ) );
ptr->child[0] = (short)val[0];
ptr->child[1] = (short)val[1];
ptr->child[2] = (short)val[2];
ptr->child[3] = (short)val[3];
Py_INCREF( Py_None );
return Py_None;
}
@ -704,14 +708,14 @@ PyObject *Particle_setMat( BPy_Particle * self, PyObject * args )
float val[4];
if( PyTuple_Size( args ) == 1 )
args = PyTuple_GetItem( args, 0 );
val[0] = PyFloat_AsDouble( PyTuple_GetItem( args, 0 ) );
val[1] = PyFloat_AsDouble( PyTuple_GetItem( args, 1 ) );
val[2] = PyFloat_AsDouble( PyTuple_GetItem( args, 2 ) );
val[3] = PyFloat_AsDouble( PyTuple_GetItem( args, 3 ) );
ptr->mat[0] = val[0];
ptr->mat[1] = val[1];
ptr->mat[2] = val[2];
ptr->mat[3] = val[3];
val[0] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 0 ) );
val[1] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 1 ) );
val[2] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 2 ) );
val[3] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 3 ) );
ptr->mat[0] = (short)val[0];
ptr->mat[1] = (short)val[1];
ptr->mat[2] = (short)val[2];
ptr->mat[3] = (short)val[3];
Py_INCREF( Py_None );
return Py_None;
}
@ -732,9 +736,9 @@ PyObject *Particle_setDefvec( BPy_Particle * self, PyObject * args )
float val[3];
if( PyTuple_Size( args ) == 1 )
args = PyTuple_GetItem( args, 0 );
val[0] = PyFloat_AsDouble( PyTuple_GetItem( args, 0 ) );
val[1] = PyFloat_AsDouble( PyTuple_GetItem( args, 1 ) );
val[2] = PyFloat_AsDouble( PyTuple_GetItem( args, 2 ) );
val[0] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 0 ) );
val[1] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 1 ) );
val[2] = (float)PyFloat_AsDouble( PyTuple_GetItem( args, 2 ) );
ptr->defvec[0] = val[0];
ptr->defvec[1] = val[1];
ptr->defvec[2] = val[2];

@ -34,17 +34,8 @@
#define EXPP_PARTICLE_H
#include <Python.h>
#include <stdio.h>
#include "DNA_effect_types.h"
#include <BLI_arithb.h>
#include <BLI_blenlib.h>
#include <BKE_main.h>
#include <BKE_global.h>
#include <BKE_object.h>
#include <BKE_library.h>
#include <DNA_effect_types.h>
#include "gen_utils.h"
extern PyTypeObject Particle_Type;

@ -30,11 +30,9 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "Registry.h"
#include <stdio.h>
#include <BKE_global.h> /* G.f & G_DEBUG */
#include "Registry.h" /*This must come first */
#include "BKE_global.h"
#include "gen_utils.h"

@ -30,36 +30,30 @@
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
struct View3D;
#include <MEM_guardedalloc.h> /* for MEM_callocN */
#include <DNA_screen_types.h> /* SPACE_VIEW3D, SPACE_SEQ */
#include <DNA_scriptlink_types.h>
#include <BKE_depsgraph.h>
#include <BKE_global.h>
#include <BKE_library.h>
#include <BKE_main.h>
#include <BKE_scene.h>
#include <BLI_blenlib.h>
#include <BSE_drawview.h> /* for play_anim */
#include <BSE_headerbuttons.h> /* for copy_scene */
#include <BIF_drawscene.h> /* for set_scene */
#include <BIF_space.h> /* for copy_view3d_lock() */
#include <BIF_screen.h> /* curarea */
#include <mydevice.h> /* for #define REDRAW */
#include "Scene.h" /*This must come first */
#include "BKE_global.h"
#include "BKE_main.h"
#include "MEM_guardedalloc.h" /* for MEM_callocN */
#include "DNA_screen_types.h" /* SPACE_VIEW3D, SPACE_SEQ */
#include "BKE_depsgraph.h"
#include "BKE_library.h"
#include "BKE_scene.h"
#include "BLI_blenlib.h"
#include "BSE_drawview.h" /* for play_anim */
#include "BSE_headerbuttons.h" /* for copy_scene */
#include "BIF_drawscene.h" /* for set_scene */
#include "BIF_space.h" /* for copy_view3d_lock() */
#include "BIF_screen.h" /* curarea */
#include "mydevice.h" /* for #define REDRAW */
#include "DNA_view3d_types.h"
#include "Object.h"
#include "constant.h"
#include "gen_utils.h"
#include "sceneRender.h"
#include "sceneRadio.h"
#include "Scene.h"
static Base *EXPP_Scene_getObjectBase( Scene * scene, Object * object );
PyObject *M_Object_Get( PyObject * self, PyObject * args ); /* from Object.c */

@ -34,7 +34,7 @@
#define EXPP_SCENE_H
#include <Python.h>
#include <DNA_scene_types.h>
#include "DNA_scene_types.h"
/* The Scene PyType Object defined in Scene.c */
extern PyTypeObject Scene_Type;
@ -44,7 +44,8 @@ extern PyTypeObject Scene_Type;
//---------------------------Python BPy_Scene structure definition----------
typedef struct {
PyObject_HEAD Scene * scene;
PyObject_HEAD
Scene * scene;
} BPy_Scene;
//---------------------------Python BPy_Scene visible prototypes-----------
// Python Scene_Type helper functions needed by Blender (the Init function) and Object modules.

@ -30,20 +30,15 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include <BKE_main.h>
#include <BKE_global.h>
#include <BKE_library.h>
#include <BKE_sound.h>
#include <BLI_blenlib.h>
#include <BIF_editsound.h>
#include <BIF_space.h> /* EXPP_allqueue() */
#include "Sound.h" /*This must come first*/
#include "BKE_global.h"
#include "BKE_main.h"
#include "BLI_blenlib.h"
#include "BIF_editsound.h"
#include "mydevice.h" /* redraw defines */
#include "gen_utils.h"
#include "Sound.h"
/*****************************************************************************/
/* Python BPy_Sound defaults: */
/*****************************************************************************/
@ -485,7 +480,7 @@ static PyObject *Sound_getAttr( BPy_Sound * self, char *name )
static int Sound_setAttr( BPy_Sound * self, char *name, PyObject * value )
{
PyObject *valtuple;
PyObject *error = NULL;
// PyObject *error = NULL;
/* We're playing a trick on the Python API users here. Even if they use
* Sound.member = val instead of Sound.setMember(value), we end up using the
@ -508,13 +503,15 @@ static int Sound_setAttr( BPy_Sound * self, char *name, PyObject * value )
"attribute not found or immutable" ) );
}
/* ===This code is unreachable===
Py_DECREF( valtuple );
if( error != Py_None )
return -1;
Py_DECREF( Py_None ); /* incref'ed by the called set* function */
return 0; /* normal exit */
Py_DECREF( Py_None ); // incref'ed by the called set* function /
return 0; // normal exit
*/
}
/*****************************************************************************/

@ -34,13 +34,14 @@
#define EXPP_SOUND_H
#include <Python.h>
#include <DNA_sound_types.h>
#include "DNA_sound_types.h"
/*****************************************************************************/
/* Python BPy_Sound structure definition */
/*****************************************************************************/
typedef struct {
PyObject_HEAD bSound * sound;
PyObject_HEAD
bSound * sound;
} BPy_Sound;
/*****************************************************************************/

@ -30,15 +30,14 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include <BKE_utildefines.h>
#include <BLI_blenlib.h>
#include <DNA_scene_types.h> /* G.scene->r.cfra */
#include <PIL_time.h>
#include <Python.h>
#include <sys/stat.h>
#include "gen_utils.h"
#include "Sys.h" /*This must come first*/
#include "Sys.h"
#include "BKE_utildefines.h"
#include "BKE_global.h"
#include "BLI_blenlib.h"
#include "DNA_scene_types.h" /* G.scene-"r.cfra */
#include "PIL_time.h"
#include "gen_utils.h"
/*****************************************************************************/
/* Python API function prototypes for the sys module. */

@ -33,6 +33,8 @@
#ifndef EXPP_sys_H
#define EXPP_sys_H
#include <Python.h>
PyObject *sys_Init( void );
#endif /* EXPP_sys_H */

@ -30,20 +30,16 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include <Python.h>
#include <stdio.h>
#include "Text.h" /*This must come first*/
#include <BKE_main.h>
#include <BKE_global.h>
#include <BKE_library.h>
#include <BKE_sca.h>
#include <BIF_drawtext.h>
#include <BKE_text.h>
#include <BLI_blenlib.h>
#include <DNA_space_types.h>
#include <DNA_text_types.h>
#include "Text.h"
#include "BKE_library.h"
#include "BKE_sca.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "BIF_drawtext.h"
#include "BKE_text.h"
#include "BLI_blenlib.h"
#include "DNA_space_types.h"
#include "gen_utils.h"
#include "../BPY_extern.h"

@ -33,7 +33,8 @@
#ifndef EXPP_TEXT_H
#define EXPP_TEXT_H
#include <DNA_text_types.h>
#include <Python.h>
#include "DNA_text_types.h"
PyObject *Text_Init( void );
PyObject *Text_CreatePyObject( Text * txt );

@ -30,27 +30,20 @@
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "Text3d.h" /*This must come first*/
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_view3d_types.h"
#include "DNA_vfont_types.h"
#include "MEM_guardedalloc.h"
#include "BKE_object.h"
#include "BDR_editobject.h"
#include "BKE_displist.h"
#include "MEM_guardedalloc.h"
#include "mydevice.h"
#include "blendef.h"
#include "Text3d.h"
#include "BKE_curve.h"
#include "BKE_library.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "Curve.h"
#include "constant.h"
#include "Types.h"
#include "Font.h"
#include "mydevice.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include "gen_utils.h"
//no prototypes declared in header files - external linkage outside of python
extern VFont *get_builtin_font(void);
@ -495,8 +488,8 @@ static PyObject *Text3d_setText( BPy_Text3d * self, PyObject * args )
MEM_freeN( self->curve->str );
self->curve->str = MEM_mallocN( strlen (text)+1, "str" );
strcpy( self->curve->str, text );
self->curve->pos = strlen ( text );
self->curve->len = strlen ( text );
self->curve->pos = (short)strlen ( text );
self->curve->len = (short)strlen ( text );
}
Py_INCREF( Py_None );
return Py_None;
@ -955,7 +948,7 @@ PyObject *M_Text3d_LoadFont( PyObject * self, PyObject * args )
if( file || !strcmp (fontfile, "<builtin>") ) {
load_vfont( fontfile );
if(file) fclose( file );
if( (vf=exist_vfont( fontfile )) )
if( (vf == exist_vfont( fontfile )) )
return Font_CreatePyObject( vf );
return EXPP_incr_ret( Py_None );
}

@ -34,16 +34,7 @@
#define EXPP_TEXT3D_H
#include <Python.h>
#include <stdio.h>
#include <BLI_arithb.h>
#include <BLI_blenlib.h>
#include <BKE_main.h>
#include <BKE_global.h>
#include <BKE_object.h>
#include <BKE_library.h>
#include <BKE_curve.h>
#include <DNA_curve_types.h>
#include"gen_utils.h"
#include "DNA_curve_types.h"
#define BPy_Text3d_Check(v) ((v)->ob_type==&Text3d_Type)
typedef Curve Text3d;

@ -28,24 +28,22 @@
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "Texture.h" /*This must come first*/
#include <BKE_main.h>
#include <BKE_global.h>
#include <BKE_object.h>
#include <BKE_library.h>
#include <BLI_blenlib.h>
#include <BKE_texture.h>
#include <BKE_utildefines.h>
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_library.h"
#include "BLI_blenlib.h"
#include "BKE_texture.h"
#include "BKE_utildefines.h"
#include "DNA_material_types.h"
#include "MTex.h"
#include "Texture.h"
#include "Image.h"
#include "Ipo.h"
#include "constant.h"
#include "gen_utils.h"
/*****************************************************************************/
/* Blender.Texture constants */
/*****************************************************************************/
@ -962,7 +960,7 @@ static PyObject *Texture_setAnimFrames( BPy_Texture * self, PyObject * args )
return EXPP_ReturnPyObjError( PyExc_ValueError,
"frames cannot be negative" );
self->texture->frames = frames;
self->texture->frames = (short)frames;
Py_INCREF( Py_None );
return Py_None;
@ -979,7 +977,7 @@ static PyObject *Texture_setAnimLength( BPy_Texture * self, PyObject * args )
return EXPP_ReturnPyObjError( PyExc_ValueError,
"length cannot be negative" );
self->texture->len = length;
self->texture->len = (short)length;
Py_INCREF( Py_None );
return Py_None;
@ -1006,7 +1004,7 @@ static PyObject *Texture_setAnimMontage( BPy_Texture * self, PyObject * args )
for( i = 0; i < 4; ++i )
for( j = 0; j < 2; ++j )
self->texture->fradur[i][j] = fradur[i][j];
self->texture->fradur[i][j] = (short)fradur[i][j];
Py_INCREF( Py_None );
return Py_None;
@ -1020,7 +1018,7 @@ static PyObject *Texture_setAnimOffset( BPy_Texture * self, PyObject * args )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected an int" );
self->texture->offset = offset;
self->texture->offset = (short)offset;
Py_INCREF( Py_None );
return Py_None;
@ -1038,7 +1036,7 @@ static PyObject *Texture_setAnimStart( BPy_Texture * self, PyObject * args )
return EXPP_ReturnPyObjError( PyExc_ValueError,
"start must be greater than zero" );
self->texture->sfra = sfra;
self->texture->sfra = (short)sfra;
Py_INCREF( Py_None );
return Py_None;
@ -1132,7 +1130,7 @@ static PyObject *Texture_setIntExtend( BPy_Texture * self, PyObject * args )
return EXPP_ReturnPyObjError( PyExc_ValueError,
"invalid extend mode" );
self->texture->extend = extend;
self->texture->extend = (short)extend;
Py_INCREF( Py_None );
return Py_None;
@ -1150,7 +1148,7 @@ static PyObject *Texture_setFieldsPerImage( BPy_Texture * self,
return EXPP_ReturnPyObjError( PyExc_ValueError,
"value must be in range [1,200]" );
self->texture->fie_ima = fie_ima;
self->texture->fie_ima = (short)fie_ima;
Py_INCREF( Py_None );
return Py_None;
@ -1207,7 +1205,7 @@ static PyObject *Texture_setIntFlags( BPy_Texture * self, PyObject * args )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected int argument" );
self->texture->flag = flags;
self->texture->flag = (short)flags;
Py_INCREF( Py_None );
return Py_None;
@ -1286,7 +1284,7 @@ static PyObject *Texture_setIntImageFlags( BPy_Texture * self,
return EXPP_ReturnPyObjError( PyExc_ValueError,
"image flags MIPMAP and FIELDS cannot be used together" );
self->texture->imaflag = flags;
self->texture->imaflag = (short)flags;
Py_INCREF( Py_None );
return Py_None;
@ -1319,7 +1317,7 @@ static PyObject *Texture_setNoiseDepth( BPy_Texture * self, PyObject * args )
return EXPP_ReturnPyObjError( PyExc_ValueError,
"value must be in range [0,6]" );
self->texture->noisedepth = depth;
self->texture->noisedepth = (short)depth;
Py_INCREF( Py_None );
return Py_None;
@ -1414,8 +1412,8 @@ static PyObject *Texture_setRepeat( BPy_Texture * self, PyObject * args )
return EXPP_ReturnPyObjError( PyExc_ValueError,
"values must be in range [1,512]" );
self->texture->xrepeat = repeat[0];
self->texture->yrepeat = repeat[1];
self->texture->xrepeat = (short)repeat[0];
self->texture->yrepeat = (short)repeat[1];
Py_INCREF( Py_None );
return Py_None;
@ -1488,9 +1486,9 @@ static PyObject *Texture_setIntSType( BPy_Texture * self, PyObject * args )
"invalid stype (for this type)" );
if( self->texture->type == EXPP_TEX_TYPE_ENVMAP )
self->texture->env->stype = stype;
self->texture->env->stype = (short)stype;
else
self->texture->stype = stype;
self->texture->stype = (short)stype;
Py_INCREF( Py_None );
return Py_None;
@ -1608,7 +1606,7 @@ static PyObject *Texture_setIntType( BPy_Texture * self, PyObject * args )
return EXPP_ReturnPyObjError( PyExc_ValueError,
"invalid type number" );
self->texture->type = type;
self->texture->type = (short)type;
Py_INCREF( Py_None );
return Py_None;
@ -1804,7 +1802,7 @@ static PyObject *Texture_getAttr( BPy_Texture * self, char *name )
else if( STREQ( name, "type" ) )
attr = PyInt_FromLong( tex->type );
else if( STREQ( name, "hFracDim" ) )
attr = PyInt_FromLong( tex->mg_H );
attr = PyInt_FromLong( (long)tex->mg_H );
else if( STREQ( name, "lacunarity" ) )
attr = PyFloat_FromDouble( tex->mg_lacunarity );
else if( STREQ( name, "octs" ) )

@ -36,16 +36,15 @@
#define EXPP_TEXTURE_H
#include <Python.h>
#include <DNA_texture_types.h>
#include <BKE_texture.h>
#include "DNA_texture_types.h"
/*****************************************************************************/
/* Python BPy_Texture structure definition */
/*****************************************************************************/
typedef struct {
PyObject_HEAD Tex * texture;
PyObject_HEAD
Tex * texture;
} BPy_Texture;
extern PyTypeObject Texture_Type;

@ -103,73 +103,73 @@ PyObject *Types_Init( void )
/* The Blender Object Type */
PyDict_SetItemString( dict, "ObjectType",
( PyObject * ) & Object_Type );
( PyObject * ) &Object_Type );
/* Blender Object Data Types */
PyDict_SetItemString( dict, "SceneType", ( PyObject * ) & Scene_Type );
PyDict_SetItemString( dict, "SceneType", ( PyObject * ) &Scene_Type );
PyDict_SetItemString( dict, "RenderDataType",
( PyObject * ) & RenderData_Type );
( PyObject * ) &RenderData_Type );
PyDict_SetItemString( dict, "NMeshType", ( PyObject * ) & NMesh_Type );
PyDict_SetItemString( dict, "NMeshType", ( PyObject * ) &NMesh_Type );
PyDict_SetItemString( dict, "NMFaceType",
( PyObject * ) & NMFace_Type );
( PyObject * ) &NMFace_Type );
PyDict_SetItemString( dict, "NMVertType",
( PyObject * ) & NMVert_Type );
PyDict_SetItemString( dict, "NMColType", ( PyObject * ) & NMCol_Type );
( PyObject * ) &NMVert_Type );
PyDict_SetItemString( dict, "NMColType", ( PyObject * ) &NMCol_Type );
PyDict_SetItemString( dict, "ArmatureType",
( PyObject * ) & Armature_Type );
PyDict_SetItemString( dict, "BoneType", ( PyObject * ) & Bone_Type );
( PyObject * ) &Armature_Type );
PyDict_SetItemString( dict, "BoneType", ( PyObject * ) &Bone_Type );
PyDict_SetItemString( dict, "CurNurb_Type",
( PyObject * ) & CurNurb_Type );
PyDict_SetItemString( dict, "CurveType", ( PyObject * ) & Curve_Type );
( PyObject * ) &CurNurb_Type );
PyDict_SetItemString( dict, "CurveType", ( PyObject * ) &Curve_Type );
PyDict_SetItemString( dict, "IpoType", ( PyObject * ) & Ipo_Type );
PyDict_SetItemString( dict, "IpoType", ( PyObject * ) &Ipo_Type );
PyDict_SetItemString( dict, "MetaballType",
( PyObject * ) & Metaball_Type );
( PyObject * ) &Metaball_Type );
PyDict_SetItemString( dict, "CameraType",
( PyObject * ) & Camera_Type );
PyDict_SetItemString( dict, "ImageType", ( PyObject * ) & Image_Type );
PyDict_SetItemString( dict, "LampType", ( PyObject * ) & Lamp_Type );
PyDict_SetItemString( dict, "TextType", ( PyObject * ) & Text_Type );
PyDict_SetItemString( dict, "Text3dType", ( PyObject * ) & Text3d_Type );
( PyObject * ) &Camera_Type );
PyDict_SetItemString( dict, "ImageType", ( PyObject * ) &Image_Type );
PyDict_SetItemString( dict, "LampType", ( PyObject * ) &Lamp_Type );
PyDict_SetItemString( dict, "TextType", ( PyObject * ) &Text_Type );
PyDict_SetItemString( dict, "Text3dType", ( PyObject * ) &Text3d_Type );
PyDict_SetItemString( dict, "MaterialType",
( PyObject * ) & Material_Type );
( PyObject * ) &Material_Type );
PyDict_SetItemString( dict, "ButtonType",
( PyObject * ) & Button_Type );
( PyObject * ) &Button_Type );
PyDict_SetItemString( dict, "LatticeType",
( PyObject * ) & Lattice_Type );
( PyObject * ) &Lattice_Type );
PyDict_SetItemString( dict, "TextureType",
( PyObject * ) & Texture_Type );
PyDict_SetItemString( dict, "MTexType", ( PyObject * ) & MTex_Type );
( PyObject * ) &Texture_Type );
PyDict_SetItemString( dict, "MTexType", ( PyObject * ) &MTex_Type );
/* External helper Types available to the main ones above */
PyDict_SetItemString( dict, "vectorType",
( PyObject * ) & vector_Type );
( PyObject * ) &vector_Type );
PyDict_SetItemString( dict, "bufferType",
( PyObject * ) & buffer_Type );
( PyObject * ) &buffer_Type );
PyDict_SetItemString( dict, "constantType",
( PyObject * ) & constant_Type );
( PyObject * ) &constant_Type );
PyDict_SetItemString( dict, "rgbTupleType",
( PyObject * ) & rgbTuple_Type );
( PyObject * ) &rgbTuple_Type );
PyDict_SetItemString( dict, "matrix_Type",
( PyObject * ) & matrix_Type );
PyDict_SetItemString( dict, "eulerType", ( PyObject * ) & euler_Type );
( PyObject * ) &matrix_Type );
PyDict_SetItemString( dict, "eulerType", ( PyObject * ) &euler_Type );
PyDict_SetItemString( dict, "quaternionType",
( PyObject * ) & quaternion_Type );
( PyObject * ) &quaternion_Type );
PyDict_SetItemString( dict, "BezTripleType",
( PyObject * ) & BezTriple_Type );
( PyObject * ) &BezTriple_Type );
PyDict_SetItemString( dict, "ActionType",
( PyObject * ) & Action_Type );
( PyObject * ) &Action_Type );
PyDict_SetItemString( dict, "propertyType",
( PyObject * ) & property_Type );
( PyObject * ) &property_Type );
return submodule;
}

@ -33,7 +33,7 @@
#ifndef EXPP_TYPES_H
#define EXPP_TYPES_H
#include "Python.h"
#include <Python.h>
extern PyTypeObject Action_Type, Armature_Type;
extern PyTypeObject BezTriple_Type, Bone_Type, Build_Type, Button_Type;

@ -30,8 +30,13 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "Wave.h"
#include "Effect.h"
#include "Wave.h" /*This must come first*/
#include "DNA_object_types.h"
#include "BKE_effect.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "gen_utils.h"
/******* prototypes **********/
PyObject *Wave_Init( void );
@ -183,7 +188,6 @@ PyObject *M_Wave_New( PyObject * self, PyObject * args )
pyeffect->effect = bleffect;
return ( PyObject * ) pyeffect;
return 0;
}
/*****************************************************************************/

@ -34,19 +34,7 @@
#define EXPP_WAVE_H
#include <Python.h>
#include <stdio.h>
#include <BLI_arithb.h>
#include <BLI_blenlib.h>
#include <BKE_main.h>
#include <BKE_global.h>
#include <BKE_object.h>
#include <BKE_library.h>
#include <DNA_effect_types.h>
#include"Effect.h"
#include "gen_utils.h"
#include "Effect.h"
extern PyTypeObject Wave_Type;
@ -66,7 +54,6 @@ PyObject *M_Wave_New( PyObject * self, PyObject * args );
PyObject *M_Wave_Get( PyObject * self, PyObject * args );
/*****************************************************************************/
/* Python BPy_Wave methods declarations: */
/*****************************************************************************/

@ -32,15 +32,13 @@
*/
#include <Python.h>
#include <stdio.h>
#include "blendef.h" /* OBACT */
#include "BDR_editobject.h" /* enter / leave editmode */
#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_object.h" /* for during_script() and during_scriptlink() */
#include "BKE_scene.h" /* scene_find_camera() */
#include "BIF_usiblender.h"
#include "BPI_script.h"
#include "BIF_mywindow.h"
#include "BSE_headerbuttons.h"
#include "BSE_filesel.h"
@ -48,25 +46,22 @@
#include "BIF_screen.h"
#include "BIF_space.h"
#include "BIF_drawtext.h"
#include "BIF_mywindow.h" /* L/M/R_MOUSE bitflags */
#include "BIF_spacetypes.h"
#include "mydevice.h"
#include "DNA_view3d_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_scene_types.h"
#include "DNA_text_types.h"
#include "DNA_vec_types.h" /* for rcti struct */
#include "DNA_object_types.h"
#include "mydevice.h"
#include "blendef.h" /* OBACT */
#include "windowTheme.h"
#include "gen_utils.h"
#include "matrix.h"
#include "vector.h"
#include "Mathutils.h"
#include "constant.h"
#include "gen_utils.h"
/* See Draw.c */
extern int EXPP_disable_force_draw;
extern void setcameratoview3d(void);
/*****************************************************************************/
/* Python API function prototypes for the Window module. */

@ -35,6 +35,8 @@
#ifndef EXPP_WINDOW_H
#define EXPP_WINDOW_H
#include <Python.h>
PyObject *Window_Init( void );
PyObject *M_Window_Redraw( PyObject * self, PyObject * args );

@ -43,25 +43,21 @@
* (self, name = "MyName")
*/
#include <BKE_main.h>
#include <BKE_global.h>
#include <BKE_object.h>
#include <BKE_library.h>
#include <BLI_blenlib.h>
#include <BSE_editipo.h>
#include <BIF_space.h>
#include <mydevice.h>
#include "World.h" /*This must come first*/
#include <DNA_scene_types.h> /* for G.scene */
#include "World.h"
#include "DNA_scene_types.h" /* for G.scene */
#include "BKE_global.h"
#include "BKE_world.h"
#include "BKE_main.h"
#include "BKE_library.h"
#include "BLI_blenlib.h"
#include "BSE_editipo.h"
#include "BIF_space.h"
#include "mydevice.h"
#include "Ipo.h"
#include "constant.h"
#include "rgbTuple.h"
#include "gen_utils.h"
#define IPOKEY_ZENITH 0
#define IPOKEY_HORIZON 1
#define IPOKEY_MIST 2
@ -579,7 +575,7 @@ static PyObject *World_setSkytype( BPy_World * self, PyObject * args )
if( !PyArg_ParseTuple( args, "i", &skytype ) )
return ( EXPP_ReturnPyObjError( PyExc_TypeError,
"expected int argument" ) );
self->world->skytype = skytype;
self->world->skytype = (short)skytype;
Py_INCREF( Py_None );
return Py_None;
}
@ -616,7 +612,7 @@ static PyObject *World_setMode( BPy_World * self, PyObject * args )
if( !PyArg_ParseTuple( args, "i", &mode ) )
return ( EXPP_ReturnPyObjError( PyExc_TypeError,
"expected int argument" ) );
self->world->mode = mode;
self->world->mode = (short)mode;
Py_INCREF( Py_None );
return Py_None;
}
@ -665,7 +661,7 @@ static PyObject *World_setMistype( BPy_World * self, PyObject * args )
if( !PyArg_ParseTuple( args, "i", &mistype ) )
return ( EXPP_ReturnPyObjError( PyExc_TypeError,
"expected int argument" ) );
self->world->mistype = mistype;
self->world->mistype = (short)mistype;
Py_INCREF( Py_None );
return Py_None;
}
@ -693,9 +689,9 @@ static PyObject *World_setHor( BPy_World * self, PyObject * args )
if( !PyArg_ParseTuple( args, "O", &listargs ) )
return ( EXPP_ReturnPyObjError( PyExc_TypeError,
"expected list argument" ) );
self->world->horr = PyFloat_AsDouble( PyList_GetItem( listargs, 0 ) );
self->world->horg = PyFloat_AsDouble( PyList_GetItem( listargs, 1 ) );
self->world->horb = PyFloat_AsDouble( PyList_GetItem( listargs, 2 ) );
self->world->horr = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 0 ) );
self->world->horg = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 1 ) );
self->world->horb = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 2 ) );
Py_INCREF( Py_None );
return Py_None;
}
@ -720,9 +716,9 @@ static PyObject *World_setZen( BPy_World * self, PyObject * args )
if( !PyArg_ParseTuple( args, "O", &listargs ) )
return ( EXPP_ReturnPyObjError( PyExc_TypeError,
"expected list argument" ) );
self->world->zenr = PyFloat_AsDouble( PyList_GetItem( listargs, 0 ) );
self->world->zeng = PyFloat_AsDouble( PyList_GetItem( listargs, 1 ) );
self->world->zenb = PyFloat_AsDouble( PyList_GetItem( listargs, 2 ) );
self->world->zenr = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 0 ) );
self->world->zeng = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 1 ) );
self->world->zenb = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 2 ) );
Py_INCREF( Py_None );
return Py_None;
}
@ -755,9 +751,9 @@ static PyObject *World_setAmb( BPy_World * self, PyObject * args )
if( PyList_Size( listargs ) != 3 )
return ( EXPP_ReturnPyObjError
( PyExc_TypeError, "wrong list size" ) );
self->world->ambr = PyFloat_AsDouble( PyList_GetItem( listargs, 0 ) );
self->world->ambg = PyFloat_AsDouble( PyList_GetItem( listargs, 1 ) );
self->world->ambb = PyFloat_AsDouble( PyList_GetItem( listargs, 2 ) );
self->world->ambr = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 0 ) );
self->world->ambg = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 1 ) );
self->world->ambb = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 2 ) );
Py_INCREF( Py_None );
return Py_None;
}
@ -792,17 +788,17 @@ static PyObject *World_setStar( BPy_World * self, PyObject * args )
if( PyList_Size( listargs ) != 7 )
return ( EXPP_ReturnPyObjError
( PyExc_TypeError, "wrong list size" ) );
self->world->starr = PyFloat_AsDouble( PyList_GetItem( listargs, 0 ) );
self->world->starg = PyFloat_AsDouble( PyList_GetItem( listargs, 1 ) );
self->world->starb = PyFloat_AsDouble( PyList_GetItem( listargs, 2 ) );
self->world->starr = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 0 ) );
self->world->starg = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 1 ) );
self->world->starb = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 2 ) );
self->world->starsize =
PyFloat_AsDouble( PyList_GetItem( listargs, 3 ) );
(float)PyFloat_AsDouble( PyList_GetItem( listargs, 3 ) );
self->world->starmindist =
PyFloat_AsDouble( PyList_GetItem( listargs, 4 ) );
(float)PyFloat_AsDouble( PyList_GetItem( listargs, 4 ) );
self->world->stardist =
PyFloat_AsDouble( PyList_GetItem( listargs, 5 ) );
(float)PyFloat_AsDouble( PyList_GetItem( listargs, 5 ) );
self->world->starcolnoise =
PyFloat_AsDouble( PyList_GetItem( listargs, 6 ) );
(float)PyFloat_AsDouble( PyList_GetItem( listargs, 6 ) );
Py_INCREF( Py_None );
return Py_None;
}
@ -838,13 +834,13 @@ static PyObject *World_setMist( BPy_World * self, PyObject * args )
if( PyList_Size( listargs ) != 4 )
return ( EXPP_ReturnPyObjError
( PyExc_TypeError, "wrong list size" ) );
self->world->misi = PyFloat_AsDouble( PyList_GetItem( listargs, 0 ) );
self->world->misi = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 0 ) );
self->world->miststa =
PyFloat_AsDouble( PyList_GetItem( listargs, 1 ) );
(float)PyFloat_AsDouble( PyList_GetItem( listargs, 1 ) );
self->world->mistdist =
PyFloat_AsDouble( PyList_GetItem( listargs, 2 ) );
(float)PyFloat_AsDouble( PyList_GetItem( listargs, 2 ) );
self->world->misthi =
PyFloat_AsDouble( PyList_GetItem( listargs, 3 ) );
(float)PyFloat_AsDouble( PyList_GetItem( listargs, 3 ) );
Py_INCREF( Py_None );
return Py_None;
}

@ -34,10 +34,7 @@
#define EXPP_WORLD_H
#include <Python.h>
#include <DNA_world_types.h>
//#include "bpy_types.h"
#include "DNA_world_types.h"
#define BPy_World_Check(v) ((v)->ob_type==&World_Type)

@ -32,14 +32,6 @@
#ifndef EXPP_bpy_types_h
#define EXPP_bpy_types_h
#include <Python.h>
#include <DNA_curve_types.h>
/*****************************************************************************/
/* Camera Data */

@ -30,7 +30,8 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "charRGBA.h"
#include "charRGBA.h" /*This must come first */
#include "gen_utils.h"
/* This file is heavily based on the old bpython Constant object code in
Blender */
@ -167,10 +168,10 @@ PyObject *charRGBA_setCol( BPy_charRGBA * self, PyObject * args )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected 1-byte ints [b,b,b,b] or b,b,b,b as arguments (or nothing)" );
*( self->rgba[0] ) = EXPP_ClampInt( r, 0, 255 );
*( self->rgba[1] ) = EXPP_ClampInt( g, 0, 255 );
*( self->rgba[2] ) = EXPP_ClampInt( b, 0, 255 );
*( self->rgba[3] ) = EXPP_ClampInt( a, 0, 255 );
*( self->rgba[0] ) = (char)EXPP_ClampInt( r, 0, 255 );
*( self->rgba[1] ) = (char)EXPP_ClampInt( g, 0, 255 );
*( self->rgba[2] ) = (char)EXPP_ClampInt( b, 0, 255 );
*( self->rgba[3] ) = (char)EXPP_ClampInt( a, 0, 255 );
return EXPP_incr_ret( Py_None );
}
@ -226,7 +227,7 @@ static int charRGBA_setAttr( BPy_charRGBA * self, char *name, PyObject * v )
return EXPP_ReturnIntError( PyExc_TypeError,
"expected char argument" );
value = EXPP_ClampInt( value, 0, 255 );
value = (char)EXPP_ClampInt( value, 0, 255 );
if( !strcmp( name, "R" ) || !strcmp( name, "r" ) )
*( self->rgba[0] ) = value;
@ -311,7 +312,7 @@ static int charRGBAAssSubscript( BPy_charRGBA * self, PyObject * key,
else
return EXPP_ReturnIntError( PyExc_AttributeError, name );
*( self->rgba[i] ) = EXPP_ClampInt( PyInt_AsLong( v ), 0, 255 );
*( self->rgba[i] ) = (char)EXPP_ClampInt( PyInt_AsLong( v ), 0, 255 );
return 0;
}
@ -361,7 +362,7 @@ static int charRGBAAssItem( BPy_charRGBA * self, int i, PyObject * ob )
return EXPP_ReturnIntError( PyExc_IndexError,
"color component must be a number" );
*( self->rgba[i] ) = EXPP_ClampInt( PyInt_AsLong( ob ), 0, 255 );
*( self->rgba[i] ) = (char)EXPP_ClampInt( PyInt_AsLong( ob ), 0, 255 );
return 0;
}
@ -395,7 +396,7 @@ static int charRGBAAssSlice( BPy_charRGBA * self, int begin, int end,
return -1;
}
*( self->rgba[count] ) = EXPP_ClampInt( value, 0, 255 );
*( self->rgba[count] ) = (char)EXPP_ClampInt( value, 0, 255 );
Py_DECREF( ob );
}

@ -34,9 +34,6 @@
#define EXPP_charRGBA_H
#include <Python.h>
#include <stdio.h>
#include "gen_utils.h"
/* Objects of <type 'charRGBA'> are used inside other Blender Python
* objects, so this header file must contain only 'public' declarations */
@ -45,7 +42,8 @@
/* Python BPy_charRGBA structure definition: */
typedef struct {
PyObject_HEAD char *rgba[4]; /* array of four pointers to chars */
PyObject_HEAD
char *rgba[4]; /* array of four pointers to chars */
} BPy_charRGBA;

@ -30,7 +30,9 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "constant.h"
#include "constant.h" /*This must come first */
#include "gen_utils.h"
/* This file is heavily based on the old bpython Constant object code in
Blender */

@ -34,9 +34,6 @@
#define EXPP_constant_H
#include <Python.h>
#include <stdio.h>
#include "gen_utils.h"
#define BPy_Constant_Check(v) ((v)->ob_type==&constant_Type)
@ -52,7 +49,8 @@ PyObject *M_constant_New( void );
/* Python BPy_constant structure definition: */
/*****************************************************************************/
typedef struct {
PyObject_HEAD PyObject * dict;
PyObject_HEAD
PyObject * dict;
} BPy_constant;

@ -29,11 +29,13 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "Mathutils.h"
#include "BLI_arithb.h"
#include "BKE_utildefines.h"
#include "Mathutils.h"
#include "gen_utils.h"
#include "BLI_blenlib.h"
#include "gen_utils.h"
//-------------------------DOC STRINGS ---------------------------
char Euler_Zero_doc[] = "() - set all values in the euler to 0";
@ -129,9 +131,9 @@ PyObject *Euler_Unique(EulerObject * self)
heading -= Py_PI;
//back to degrees
self->eul[0] = heading * 180 / (float)Py_PI;
self->eul[1] = pitch * 180 / (float)Py_PI;
self->eul[2] = bank * 180 / (float)Py_PI;
self->eul[0] = (float)(heading * 180 / (float)Py_PI);
self->eul[1] = (float)(pitch * 180 / (float)Py_PI);
self->eul[2] = (float)(bank * 180 / (float)Py_PI);
return (PyObject*)self;
}
@ -213,11 +215,11 @@ static int Euler_setattr(EulerObject * self, char *name, PyObject * e)
}
if(STREQ(name,"x")){
self->eul[0] = PyFloat_AS_DOUBLE(f);
self->eul[0] = (float)PyFloat_AS_DOUBLE(f);
}else if(STREQ(name, "y")){
self->eul[1] = PyFloat_AS_DOUBLE(f);
self->eul[1] = (float)PyFloat_AS_DOUBLE(f);
}else if(STREQ(name, "z")){
self->eul[2] = PyFloat_AS_DOUBLE(f);
self->eul[2] = (float)PyFloat_AS_DOUBLE(f);
}else{
Py_DECREF(f);
return EXPP_ReturnIntError(PyExc_AttributeError,
@ -283,7 +285,7 @@ static int Euler_ass_item(EulerObject * self, int i, PyObject * ob)
return EXPP_ReturnIntError(PyExc_IndexError,
"euler[attribute] = x: array assignment index out of range\n");
}
self->eul[i] = PyFloat_AS_DOUBLE(f);
self->eul[i] = (float)PyFloat_AS_DOUBLE(f);
Py_DECREF(f);
return 0;
}
@ -338,7 +340,7 @@ static int Euler_ass_slice(EulerObject * self, int begin, int end,
return EXPP_ReturnIntError(PyExc_TypeError,
"euler[begin:end] = []: sequence argument not a number\n");
}
eul[i] = PyFloat_AS_DOUBLE(f);
eul[i] = (float)PyFloat_AS_DOUBLE(f);
EXPP_decr2(f,e);
}
//parsed well - now set in vector

@ -34,6 +34,8 @@
#ifndef EXPP_euler_h
#define EXPP_euler_h
#include <Python.h>
#define EulerObject_Check(v) ((v)->ob_type == &euler_Type)
typedef struct {

@ -30,13 +30,14 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "gen_utils.h" /*This must come first*/
#include "DNA_text_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BIF_space.h"
#include "gen_utils.h"
#include "constant.h"
#include "BKE_global.h"
#include "BKE_main.h"
/*****************************************************************************/
/* Description: This function clamps an int to the given interval */
@ -281,7 +282,7 @@ int EXPP_map_getShortVal( const EXPP_map_pair * map,
{
while( map->sval ) {
if( StringEqual( sval, map->sval ) ) {
*ival = map->ival;
*ival = (short)map->ival;
return 1;
}
++map;
@ -420,7 +421,7 @@ PyObject *EXPP_clearScriptLinks( ScriptLink * slink, PyObject * args )
*/
if ( slink->totscript > deleted ) {
slink->totscript -= deleted;
slink->totscript = slink->totscript - (short)deleted;
stmp = slink->scripts;
slink->scripts =
@ -527,7 +528,7 @@ PyObject *EXPP_addScriptLink(ScriptLink *slink, PyObject *args, int is_scene)
}
slink->scripts[slink->totscript] = ( ID * ) bltxt;
slink->flag[slink->totscript] = event;
slink->flag[slink->totscript] = (short)event;
slink->totscript++;

@ -34,18 +34,7 @@
#define EXPP_gen_utils_h
#include <Python.h>
#include "compile.h"
#include "eval.h" /* for PyEval_GetLocals */
#include <stdio.h>
#include <string.h>
#include "BKE_global.h"
#include "BKE_main.h"
#include "BPI_script.h"
#include "DNA_ID.h"
#include "DNA_object_types.h"
#include "DNA_material_types.h"
#include "DNA_scriptlink_types.h"
#include "DNA_listBase.h"

@ -30,10 +30,11 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "logic.h"
#include "logic.h" /*This must come first*/
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "gen_utils.h"
#include <MEM_guardedalloc.h>
#include <BLI_blenlib.h>
//--------------- Python BPy_Property methods declarations:---------------
static PyObject *Property_getName( BPy_Property * self );
@ -121,7 +122,6 @@ int updatePyProperty( BPy_Property * self )
}
return 1;
}
return 0;
}
//--------------- updatePropertyData------------------------------------
@ -146,7 +146,6 @@ int updateProperyData( BPy_Property * self )
}
return 1;
}
return 0;
}
//--------------- checkValidData_ptr--------------------------------
@ -379,7 +378,7 @@ PyObject *newPropertyObject( char *name, PyObject * data, int type )
BLI_strncpy( py_property->name, name, 32 );
py_property->data = data;
py_property->type = type;
py_property->type = (short)type;
return ( PyObject * ) py_property;
}

@ -33,8 +33,8 @@
#ifndef EXPP_LOGIC_H
#define EXPP_LOGIC_H
#include "Python.h"
#include <DNA_property_types.h>
#include <Python.h>
#include "DNA_property_types.h"
//--------------------------Python BPy_Property structure definition.----
typedef struct {

@ -28,11 +28,12 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "Mathutils.h"
#include "BKE_utildefines.h"
#include "BLI_arithb.h"
#include "Mathutils.h"
#include "gen_utils.h"
#include "BLI_blenlib.h"
#include "gen_utils.h"
//-------------------------DOC STRINGS ---------------------------
char Matrix_Zero_doc[] = "() - set all values in the matrix to 0";
@ -205,7 +206,7 @@ PyObject *Matrix_Invert(MatrixObject * self)
//calculate the determinant
f = Matrix_Determinant(self);
det = PyFloat_AS_DOUBLE(f);
det = (float)PyFloat_AS_DOUBLE(f);
if(det != 0) {
//calculate the classical adjoint
@ -425,7 +426,7 @@ static int Matrix_ass_item(MatrixObject * self, int i, PyObject * ob)
return EXPP_ReturnIntError(PyExc_TypeError,
"matrix[attribute] = x: sequence argument not a number\n");
}
vec[x] = PyFloat_AS_DOUBLE(f);
vec[x] = (float)PyFloat_AS_DOUBLE(f);
EXPP_decr2(m, f);
}
//parsed well - now set in matrix
@ -505,7 +506,7 @@ static int Matrix_ass_slice(MatrixObject * self, int begin, int end,
return EXPP_ReturnIntError(PyExc_TypeError,
"matrix[begin:end] = []: sequence argument not a number\n");
}
mat[(i * self->colSize) + y] = PyFloat_AS_DOUBLE(f);
mat[(i * self->colSize) + y] = (float)PyFloat_AS_DOUBLE(f);
EXPP_decr2(f, m);
}
}else{
@ -614,7 +615,7 @@ static PyObject *Matrix_mul(PyObject * m1, PyObject * m2)
return EXPP_ReturnPyObjError(PyExc_TypeError,
"Matrix multiplication: arguments not acceptable for this operation\n");
}
scalar = PyFloat_AS_DOUBLE(f);
scalar = (float)PyFloat_AS_DOUBLE(f);
for(x = 0; x < mat2->rowSize; x++) {
for(y = 0; y < mat2->colSize; y++) {
mat[((x * mat2->colSize) + y)] = scalar * mat2->matrix[x][y];
@ -638,7 +639,7 @@ static PyObject *Matrix_mul(PyObject * m1, PyObject * m2)
return EXPP_ReturnPyObjError(PyExc_TypeError,
"Matrix multiplication: arguments not acceptable for this operation\n");
}
scalar = PyFloat_AS_DOUBLE(f);
scalar = (float)PyFloat_AS_DOUBLE(f);
for(x = 0; x < mat1->rowSize; x++) {
for(y = 0; y < mat1->colSize; y++) {
mat[((x * mat1->colSize) + y)] = scalar * mat1->matrix[x][y];
@ -658,7 +659,7 @@ static PyObject *Matrix_mul(PyObject * m1, PyObject * m2)
for(z = 0; z < mat1->colSize; z++) {
dot += (mat1->matrix[x][z] * mat2->matrix[z][y]);
}
mat[((x * mat1->rowSize) + y)] = dot;
mat[((x * mat1->rowSize) + y)] = (float)dot;
dot = 0.0f;
}
}

@ -33,6 +33,8 @@
#ifndef EXPP_matrix_h
#define EXPP_matrix_h
#include <Python.h>
#define MatrixObject_Check(v) ((v)->ob_type == &matrix_Type)
typedef float **ptRow;

@ -43,38 +43,7 @@ The #includes commented out below currently do not exist.
Their *_Init() method declarations are hacked in down below.
************************************************************/
#include "Armature.h"
#include "BezTriple.h"
#include "BGL.h"
#include "Blender.h"
#include "Camera.h"
#include "Curve.h"
#include "CurNurb.h"
#include "Draw.h"
#include "Effect.h"
#include "Ipo.h"
#include "Ipocurve.h"
#include "Lamp.h"
#include "Lattice.h"
/* #include "Library.h" */
#include "Material.h"
#include "Mathutils.h"
#include "Metaball.h"
#include "NLA.h"
#include "NMesh.h"
/* #include "Noise.h" */
#include "Object.h"
#include "Registry.h"
#include "Scene.h"
#include "Sound.h"
#include "Sys.h"
#include "Text.h"
#include "Text3d.h"
#include "Texture.h"
#include "Types.h"
#include "Window.h"
#include "World.h"
#include <Python.h>
/*****************************************************************************/
/* Global variables */

@ -29,11 +29,13 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "Mathutils.h"
#include "BLI_arithb.h"
#include "BKE_utildefines.h"
#include "Mathutils.h"
#include "gen_utils.h"
#include "BLI_blenlib.h"
#include "gen_utils.h"
//-------------------------DOC STRINGS ---------------------------
char Quaternion_Identity_doc[] = "() - set the quaternion to it's identity (1, vector)";
@ -105,7 +107,7 @@ PyObject *Quaternion_Inverse(QuaternionObject * self)
}
mag = sqrt(mag);
for(x = 0; x < 4; x++) {
self->quat[x] /= (mag * mag);
self->quat[x] /= (float)(mag * mag);
}
return (PyObject*)self;
@ -186,7 +188,7 @@ static PyObject *Quaternion_getattr(QuaternionObject * self, char *name)
mag = 2 * (acos(mag));
mag = sin(mag / 2);
for(x = 0; x < 3; x++) {
vec[x] = (self->quat[x + 1] / mag);
vec[x] = (float)(self->quat[x + 1] / mag);
}
Normalise(vec);
return (PyObject *) newVectorObject(vec, 3, Py_NEW);
@ -207,13 +209,13 @@ static int Quaternion_setattr(QuaternionObject * self, char *name, PyObject * q)
}
if(STREQ(name,"w")){
self->quat[0] = PyFloat_AS_DOUBLE(f);
self->quat[0] = (float)PyFloat_AS_DOUBLE(f);
}else if(STREQ(name, "x")){
self->quat[1] = PyFloat_AS_DOUBLE(f);
self->quat[1] = (float)PyFloat_AS_DOUBLE(f);
}else if(STREQ(name, "y")){
self->quat[2] = PyFloat_AS_DOUBLE(f);
self->quat[2] = (float)PyFloat_AS_DOUBLE(f);
}else if(STREQ(name, "z")){
self->quat[3] = PyFloat_AS_DOUBLE(f);
self->quat[3] = (float)PyFloat_AS_DOUBLE(f);
}else{
Py_DECREF(f);
return EXPP_ReturnIntError(PyExc_AttributeError,
@ -279,7 +281,7 @@ static int Quaternion_ass_item(QuaternionObject * self, int i, PyObject * ob)
return EXPP_ReturnIntError(PyExc_IndexError,
"quaternion[attribute] = x: array assignment index out of range\n");
}
self->quat[i] = PyFloat_AS_DOUBLE(f);
self->quat[i] = (float)PyFloat_AS_DOUBLE(f);
Py_DECREF(f);
return 0;
}
@ -334,7 +336,7 @@ static int Quaternion_ass_slice(QuaternionObject * self, int begin, int end,
return EXPP_ReturnIntError(PyExc_TypeError,
"quaternion[begin:end] = []: sequence argument not a number\n");
}
quat[i] = PyFloat_AS_DOUBLE(f);
quat[i] = (float)PyFloat_AS_DOUBLE(f);
EXPP_decr2(f,q);
}
//parsed well - now set in vector
@ -414,7 +416,7 @@ static PyObject *Quaternion_mul(PyObject * q1, PyObject * q2)
return EXPP_ReturnPyObjError(PyExc_TypeError,
"Quaternion multiplication: arguments not acceptable for this operation\n");
}
scalar = PyFloat_AS_DOUBLE(f);
scalar = (float)PyFloat_AS_DOUBLE(f);
for(x = 0; x < 4; x++) {
quat[x] = quat2->quat[x] * scalar;
}
@ -431,7 +433,7 @@ static PyObject *Quaternion_mul(PyObject * q1, PyObject * q2)
return EXPP_ReturnPyObjError(PyExc_TypeError,
"Quaternion multiplication: arguments not acceptable for this operation\n");
}
scalar = PyFloat_AS_DOUBLE(f);
scalar = (float)PyFloat_AS_DOUBLE(f);
for(x = 0; x < 4; x++) {
quat[x] = quat1->quat[x] * scalar;
}

@ -34,6 +34,8 @@
#ifndef EXPP_quat_h
#define EXPP_quat_h
#include <Python.h>
#define QuaternionObject_Check(v) ((v)->ob_type == &quaternion_Type)
typedef struct {

@ -30,7 +30,9 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "rgbTuple.h"
#include "rgbTuple.h" /*This must come first */
#include "gen_utils.h"
/* This file is heavily based on the old bpython Constant object code in
Blender */
@ -298,7 +300,7 @@ static int rgbTupleAssSubscript( BPy_rgbTuple * self, PyObject * key,
else
return EXPP_ReturnIntError( PyExc_AttributeError, name );
*( self->rgb[i] ) = EXPP_ClampFloat( PyFloat_AsDouble( v ), 0.0, 1.0 );
*( self->rgb[i] ) = EXPP_ClampFloat( (float)PyFloat_AsDouble( v ), 0.0, 1.0 );
return 0;
}
@ -349,7 +351,7 @@ static int rgbTupleAssItem( BPy_rgbTuple * self, int i, PyObject * ob )
"color component must be a number" );
/* XXX this check above is probably ... */
*( self->rgb[i] ) =
EXPP_ClampFloat( PyFloat_AsDouble( ob ), 0.0, 1.0 );
EXPP_ClampFloat( (float)PyFloat_AsDouble( ob ), 0.0, 1.0 );
return 0;
}

@ -34,9 +34,6 @@
#define EXPP_rgbTuple_H
#include <Python.h>
#include <stdio.h>
#include "gen_utils.h"
/* Objects of <type 'rgbTuple'> are used inside other Blender Python
* objects, so this header file must contain only 'public' declarations */

@ -30,12 +30,14 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "sceneRadio.h" /* includes Python.h */
#include "radio.h"
#include <BKE_object.h> /* disable_where_script() */
#include "sceneRadio.h" /*This must come first*/
#include "BKE_global.h"
#include "BKE_object.h" /* disable_where_script() */
#include "gen_utils.h"
#include "constant.h"
#include "radio.h"
/* bitflags */
#define EXPP_RADIO_flag_SHOWLIM 1
@ -66,10 +68,10 @@
#define EXPP_RADIO_maxnode_MAX 250000
/* floats */
#define EXPP_RADIO_convergence_MIN 0.0
#define EXPP_RADIO_convergence_MAX 0.1
#define EXPP_RADIO_radfac_MIN 0.001
#define EXPP_RADIO_convergence_MAX 0.1f
#define EXPP_RADIO_radfac_MIN 0.001f
#define EXPP_RADIO_radfac_MAX 250.0
#define EXPP_RADIO_gamma_MIN 0.2
#define EXPP_RADIO_gamma_MIN 0.2f
#define EXPP_RADIO_gamma_MAX 10.0
/* drawtypes */
#define EXPP_RADIO_drawtype_WIRE 0

@ -34,12 +34,13 @@
#define EXPP_SCENERADIO_H
#include <Python.h>
#include <DNA_radio_types.h>
#include <DNA_scene_types.h>
#include "DNA_radio_types.h"
#include "DNA_scene_types.h"
/* BPy_Radio declaration */
typedef struct {
PyObject_HEAD struct Radio *radio;
PyObject_HEAD
struct Radio *radio;
struct Scene *scene;
} BPy_Radio;

@ -29,31 +29,22 @@
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
struct View3D; /* keep me up here */
#include <BIF_renderwin.h>
#include <BKE_utildefines.h>
#include <BKE_global.h>
#include <DNA_image_types.h>
#include <BIF_drawscene.h>
#include <BLI_blenlib.h>
#include <BKE_image.h>
#include <BIF_space.h>
#include <DNA_scene_types.h>
#include <DNA_space_types.h>
#include <mydevice.h>
#include <butspace.h>
#include <BKE_bad_level_calls.h>
#include <render.h> /* RE_animrender() */
#include "sceneRender.h"
#include "sceneRender.h" /*This must come first*/
#include "BIF_renderwin.h"
#include "DNA_image_types.h"
#include "BIF_drawscene.h"
#include "BLI_blenlib.h"
#include "BKE_image.h"
#include "BKE_global.h"
#include "mydevice.h"
#include "butspace.h"
#include "render.h" /* RE_animrender() */
#include "blendef.h"
#include "Scene.h"
#include "gen_utils.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
//local defines
#define PY_NONE 0
#define PY_LOW 1
@ -886,7 +877,7 @@ PyObject *RenderData_Render( BPy_RenderData * self )
RE_animrender(NULL);
G.scene->r.efra = end_frame;
G.scene->r.efra = (short)end_frame;
}
return EXPP_incr_ret( Py_None );
@ -1167,7 +1158,7 @@ PyObject *RenderData_SetOversamplingLevel( BPy_RenderData * self,
return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
"expected 5,8,11, or 16" ) );
self->renderContext->osa = level;
self->renderContext->osa = (short)level;
EXPP_allqueue( REDRAWBUTSSCENE, 0 );
return EXPP_incr_ret( Py_None );
@ -1281,7 +1272,7 @@ PyObject *RenderData_SetRenderWinSize( BPy_RenderData * self, PyObject * args )
return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
"expected 25, 50, 75, or 100" ) );
self->renderContext->size = size;
self->renderContext->size = (short)size;
EXPP_allqueue( REDRAWBUTSSCENE, 0 );
return EXPP_incr_ret( Py_None );
@ -1330,7 +1321,7 @@ PyObject *RenderData_EnableBorderRender( BPy_RenderData * self,
//------------------------------------RenderData.SetBorder() ------------
PyObject *RenderData_SetBorder( BPy_RenderData * self, PyObject * args )
{
float xmin, ymin, xmax, ymax;
float xmin = 0.0f, ymin = 0.0f, xmax = 0.0f, ymax = 0.0f;
int status = 0;
PyObject *ob_args;
@ -1562,59 +1553,59 @@ PyObject *RenderData_SizePreset( BPy_RenderData * self, PyObject * args )
if( type == B_PR_PAL ) {
M_Render_DoSizePreset( self, 720, 576, 54, 51, 100,
self->renderContext->xparts,
self->renderContext->yparts, 25, 0.1,
0.9, 0.1, 0.9 );
self->renderContext->yparts, 25, 0.1f,
0.9f, 0.1f, 0.9f );
self->renderContext->mode &= ~R_PANORAMA;
BLI_init_rctf( &self->renderContext->safety, 0.1, 0.9, 0.1,
0.9 );
BLI_init_rctf( &self->renderContext->safety, 0.1f, 0.9f, 0.1f,
0.9f );
} else if( type == B_PR_NTSC ) {
M_Render_DoSizePreset( self, 720, 480, 10, 11, 100, 1, 1,
30, 0.1, 0.9, 0.1, 0.9 );
30, 0.1f, 0.9f, 0.1f, 0.9f );
self->renderContext->mode &= ~R_PANORAMA;
BLI_init_rctf( &self->renderContext->safety, 0.1, 0.9, 0.1,
0.9 );
BLI_init_rctf( &self->renderContext->safety, 0.1f, 0.9f, 0.1f,
0.9f );
} else if( type == B_PR_PRESET ) {
M_Render_DoSizePreset( self, 720, 576, 54, 51, 100, 1, 1,
self->renderContext->frs_sec, 0.1, 0.9,
0.1, 0.9 );
self->renderContext->frs_sec, 0.1f, 0.9f,
0.1f, 0.9f );
self->renderContext->mode = R_OSA + R_SHADOW + R_FIELDS;
self->renderContext->imtype = R_TARGA;
BLI_init_rctf( &self->renderContext->safety, 0.1, 0.9, 0.1,
0.9 );
BLI_init_rctf( &self->renderContext->safety, 0.1f, 0.9f, 0.1f,
0.9f );
} else if( type == B_PR_PRV ) {
M_Render_DoSizePreset( self, 640, 512, 1, 1, 50, 1, 1,
self->renderContext->frs_sec, 0.1, 0.9,
0.1, 0.9 );
self->renderContext->frs_sec, 0.1f, 0.9f,
0.1f, 0.9f );
self->renderContext->mode &= ~R_PANORAMA;
BLI_init_rctf( &self->renderContext->safety, 0.1, 0.9, 0.1,
0.9 );
BLI_init_rctf( &self->renderContext->safety, 0.1f, 0.9f, 0.1f,
0.9f );
} else if( type == B_PR_PC ) {
M_Render_DoSizePreset( self, 640, 480, 100, 100, 100, 1, 1,
self->renderContext->frs_sec, 0.0, 1.0,
0.0, 1.0 );
self->renderContext->frs_sec, 0.0f, 1.0f,
0.0f, 1.0f );
self->renderContext->mode &= ~R_PANORAMA;
BLI_init_rctf( &self->renderContext->safety, 0.0, 1.0, 0.0,
1.0 );
BLI_init_rctf( &self->renderContext->safety, 0.0f, 1.0f, 0.0f,
1.0f );
} else if( type == B_PR_PAL169 ) {
M_Render_DoSizePreset( self, 720, 576, 64, 45, 100, 1, 1,
25, 0.1, 0.9, 0.1, 0.9 );
25, 0.1f, 0.9f, 0.1f, 0.9f );
self->renderContext->mode &= ~R_PANORAMA;
BLI_init_rctf( &self->renderContext->safety, 0.1, 0.9, 0.1,
0.9 );
BLI_init_rctf( &self->renderContext->safety, 0.1f, 0.9f, 0.1f,
0.9f );
} else if( type == B_PR_PANO ) {
M_Render_DoSizePreset( self, 36, 176, 115, 100, 100, 16, 1,
self->renderContext->frs_sec, 0.1, 0.9,
0.1, 0.9 );
self->renderContext->frs_sec, 0.1f, 0.9f,
0.1f, 0.9f );
self->renderContext->mode |= R_PANORAMA;
BLI_init_rctf( &self->renderContext->safety, 0.1, 0.9, 0.1,
0.9 );
BLI_init_rctf( &self->renderContext->safety, 0.1f, 0.9f, 0.1f,
0.9f );
} else if( type == B_PR_FULL ) {
M_Render_DoSizePreset( self, 1280, 1024, 1, 1, 100, 1, 1,
self->renderContext->frs_sec, 0.1, 0.9,
0.1, 0.9 );
self->renderContext->frs_sec, 0.1f, 0.9f,
0.1f, 0.9f );
self->renderContext->mode &= ~R_PANORAMA;
BLI_init_rctf( &self->renderContext->safety, 0.1, 0.9, 0.1,
0.9 );
BLI_init_rctf( &self->renderContext->safety, 0.1f, 0.9f, 0.1f,
0.9f );
} else
return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
"unknown constant - see modules dict for help" ) );
@ -1644,7 +1635,7 @@ PyObject *RenderData_SetYafrayGIQuality( BPy_RenderData * self,
if( type == PY_NONE || type == PY_LOW ||
type == PY_MEDIUM || type == PY_HIGH ||
type == PY_HIGHER || type == PY_BEST ) {
self->renderContext->GIquality = type;
self->renderContext->GIquality = (short)type;
} else
return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
"unknown constant - see modules dict for help" ) );
@ -1664,7 +1655,7 @@ PyObject *RenderData_SetYafrayGIMethod( BPy_RenderData * self,
"expected constant" ) );
if( type == PY_NONE || type == PY_SKYDOME || type == PY_FULL ) {
self->renderContext->GImethod = type;
self->renderContext->GImethod = (short)type;
} else
return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
"unknown constant - see modules dict for help" ) );

@ -34,11 +34,12 @@
#define EXPP_SCENERENDER_H
#include <Python.h>
#include <DNA_scene_types.h>
#include "DNA_scene_types.h"
//------------------------------------Struct definitions-------
typedef struct {
PyObject_HEAD struct RenderData *renderContext;
PyObject_HEAD
struct RenderData *renderContext;
Scene *scene;
} BPy_RenderData;
//------------------------------------Visible prototypes-------

@ -28,10 +28,12 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "BKE_utildefines.h"
#include "Mathutils.h"
#include "gen_utils.h"
#include "BLI_blenlib.h"
#include "BKE_utildefines.h"
#include "gen_utils.h"
//-------------------------DOC STRINGS ---------------------------
char Vector_Zero_doc[] = "() - set all values in the vector to 0";
@ -210,12 +212,12 @@ static int Vector_setattr(VectorObject * self, char *name, PyObject * v)
}
if(STREQ(name,"x")){
self->vec[0] = PyFloat_AS_DOUBLE(f);
self->vec[0] = (float)PyFloat_AS_DOUBLE(f);
}else if(STREQ(name, "y")){
self->vec[1] = PyFloat_AS_DOUBLE(f);
self->vec[1] = (float)PyFloat_AS_DOUBLE(f);
}else if(STREQ(name, "z")){
if(self->size > 2){
self->vec[2] = PyFloat_AS_DOUBLE(f);
self->vec[2] = (float)PyFloat_AS_DOUBLE(f);
}else{
Py_DECREF(f);
return EXPP_ReturnIntError(PyExc_AttributeError,
@ -223,7 +225,7 @@ static int Vector_setattr(VectorObject * self, char *name, PyObject * v)
}
}else if(STREQ(name, "w")){
if(self->size > 3){
self->vec[3] = PyFloat_AS_DOUBLE(f);
self->vec[3] = (float)PyFloat_AS_DOUBLE(f);
}else{
Py_DECREF(f);
return EXPP_ReturnIntError(PyExc_AttributeError,
@ -294,7 +296,7 @@ static int Vector_ass_item(VectorObject * self, int i, PyObject * ob)
return EXPP_ReturnIntError(PyExc_IndexError,
"vector[attribute] = x: array assignment index out of range\n");
}
self->vec[i] = PyFloat_AS_DOUBLE(f);
self->vec[i] = (float)PyFloat_AS_DOUBLE(f);
Py_DECREF(f);
return 0;
}
@ -349,7 +351,7 @@ static int Vector_ass_slice(VectorObject * self, int begin, int end,
return EXPP_ReturnIntError(PyExc_TypeError,
"vector[begin:end] = []: sequence argument not a number\n");
}
vec[i] = PyFloat_AS_DOUBLE(f);
vec[i] = (float)PyFloat_AS_DOUBLE(f);
EXPP_decr2(f,v);
}
//parsed well - now set in vector
@ -444,7 +446,7 @@ static PyObject *Vector_mul(PyObject * v1, PyObject * v2)
return EXPP_ReturnPyObjError(PyExc_TypeError,
"Vector multiplication: arguments not acceptable for this operation\n");
}
scalar = PyFloat_AS_DOUBLE(f);
scalar = (float)PyFloat_AS_DOUBLE(f);
size = vec2->size;
for(x = 0; x < size; x++) {
vec[x] = vec2->vec[x] * scalar;
@ -467,7 +469,7 @@ static PyObject *Vector_mul(PyObject * v1, PyObject * v2)
return EXPP_ReturnPyObjError(PyExc_TypeError,
"Vector multiplication: arguments not acceptable for this operation\n");
}
scalar = PyFloat_AS_DOUBLE(f);
scalar = (float)PyFloat_AS_DOUBLE(f);
size = vec1->size;
for(x = 0; x < size; x++) {
vec[x] = vec1->vec[x] * scalar;

Some files were not shown because too many files have changed in this diff Show More