diff options
Diffstat (limited to 'source/blender/python/api2_2x')
-rw-r--r-- | source/blender/python/api2_2x/Blender.c | 22 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Group.c | 31 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Image.c | 4 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Lamp.c | 18 | ||||
-rw-r--r-- | source/blender/python/api2_2x/MTex.c | 10 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Makefile | 6 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Material.c | 3 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Group.py | 2 |
8 files changed, 78 insertions, 18 deletions
diff --git a/source/blender/python/api2_2x/Blender.c b/source/blender/python/api2_2x/Blender.c index 2b190a6c828..47e7bcb2007 100644 --- a/source/blender/python/api2_2x/Blender.c +++ b/source/blender/python/api2_2x/Blender.c @@ -34,7 +34,7 @@ struct ID; /*keep me up here */ /* for open, close in Blender_Load */ #include <fcntl.h> #include "BDR_editobject.h" /* exit_editmode() */ -#include "BDR_drawmesh.h" /* set_mipmap() */ +#include "GPU_draw.h" /* GPU_set_mipmap() */ #include "BIF_usiblender.h" #include "BLI_blenlib.h" #include "BLI_bpath.h" @@ -314,8 +314,8 @@ static PyObject *Blender_Set( PyObject * self, PyObject * args ) else U.gameflags |= USER_DISABLE_MIPMAP; - set_mipmap(!(U.gameflags & USER_DISABLE_MIPMAP)); - }else + GPU_set_mipmap(!(U.gameflags & USER_DISABLE_MIPMAP)); + } else return ( EXPP_ReturnPyObjError( PyExc_AttributeError, "value given is not a blender setting" ) ); Py_RETURN_NONE; @@ -543,7 +543,21 @@ static PyObject *Blender_Get( PyObject * self, PyObject * value ) } /* End 'quick hack' part. */ else if(StringEqual( str, "version" )) ret = PyInt_FromLong( G.version ); - + else if(StringEqual( str, "buildinfo" )) { +#ifdef NAN_BUILDINFO + char buffer[1024]; + extern char * build_date; + extern char * build_time; + extern char * build_rev; + extern char * build_platform; + extern char * build_type; + + sprintf(buffer, "Built on %s %s, Rev-%s Version %s %s", build_date, build_time, build_rev, build_platform, build_type); + ret = PyString_FromString( buffer ); +#else + ret = PyString_FromString( "No Build Info" ); +#endif + } else if(StringEqual( str, "compressfile" )) ret = PyInt_FromLong( (U.flag & USER_FILECOMPRESS) >> 15 ); else if(StringEqual( str, "mipmap" )) diff --git a/source/blender/python/api2_2x/Group.c b/source/blender/python/api2_2x/Group.c index 3e7f02c3797..3152d3a973f 100644 --- a/source/blender/python/api2_2x/Group.c +++ b/source/blender/python/api2_2x/Group.c @@ -46,6 +46,8 @@ #include "gen_utils.h" #include "gen_library.h" +#include "vector.h" + /* checks for the group being removed */ #define GROUP_DEL_CHECK_PY(bpy_group) if (!(bpy_group->group)) return ( EXPP_ReturnPyObjError( PyExc_RuntimeError, "Group has been removed" ) ) #define GROUP_DEL_CHECK_INT(bpy_group) if (!(bpy_group->group)) return ( EXPP_ReturnIntError( PyExc_RuntimeError, "Group has been removed" ) ) @@ -200,6 +202,31 @@ static int Group_setObjects( BPy_Group * self, PyObject * args ) return 0; } +static PyObject *Group_getDupliOfs( BPy_Group * self ) +{ + GROUP_DEL_CHECK_PY(self); + return newVectorObject( self->group->dupli_ofs, 3, Py_WRAP ); +} + +static int Group_setDupliOfs( BPy_Group * self, PyObject * value ) +{ + VectorObject *bpy_vec; + GROUP_DEL_CHECK_INT(self); + if (!VectorObject_Check(value)) + return ( EXPP_ReturnIntError( PyExc_TypeError, + "expected a vector" ) ); + + bpy_vec = (VectorObject *)value; + + if (bpy_vec->size != 3) + return ( EXPP_ReturnIntError( PyExc_ValueError, + "can only assign a 3D vector" ) ); + + self->group->dupli_ofs[0] = bpy_vec->vec[0]; + self->group->dupli_ofs[1] = bpy_vec->vec[1]; + self->group->dupli_ofs[2] = bpy_vec->vec[2]; + return 0; +} /*****************************************************************************/ @@ -251,6 +278,10 @@ static PyGetSetDef BPy_Group_getseters[] = { (getter)Group_getObjects, (setter)Group_setObjects, "objects in this group", NULL}, + {"dupliOffset", + (getter)Group_getDupliOfs, (setter)Group_setDupliOfs, + "offset to use when instancing this group as a DupliGroup", + NULL}, {NULL,NULL,NULL,NULL,NULL} /* Sentinel */ }; diff --git a/source/blender/python/api2_2x/Image.c b/source/blender/python/api2_2x/Image.c index 94da5a77170..5ef2cbadbdc 100644 --- a/source/blender/python/api2_2x/Image.c +++ b/source/blender/python/api2_2x/Image.c @@ -29,7 +29,6 @@ */ #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" @@ -48,6 +47,7 @@ #include "BKE_icons.h" #include "IMB_imbuf.h" #include "IDProp.h" +#include "GPU_draw.h" /* used so we can get G.scene->r.cfra for getting the current image frame, some images change frame if they are a sequence */ @@ -1003,7 +1003,7 @@ static PyObject *Image_glFree( BPy_Image * self ) { Image *image = self->image; - free_realtime_image( image ); + GPU_free_image( image ); /* remove the nocollect flag, image is available for garbage collection again */ image->flag &= ~IMA_NOCOLLECT; Py_RETURN_NONE; diff --git a/source/blender/python/api2_2x/Lamp.c b/source/blender/python/api2_2x/Lamp.c index 53d25a6429d..2e58cb71b90 100644 --- a/source/blender/python/api2_2x/Lamp.c +++ b/source/blender/python/api2_2x/Lamp.c @@ -84,6 +84,8 @@ #define EXPP_LAMP_MODE_NODIFFUSE 2048 #define EXPP_LAMP_MODE_NOSPECULAR 4096 #define EXPP_LAMP_MODE_SHAD_RAY 8192 +#define EXPP_LAMP_MODE_LAYER_SHADOW 32768 + /* Lamp MIN, MAX values */ #define EXPP_LAMP_SAMPLES_MIN 1 @@ -780,6 +782,8 @@ static PyObject *Lamp_ModesDict( void ) PyInt_FromLong( EXPP_LAMP_MODE_NOSPECULAR ) ); PyConstant_Insert( c, "RayShadow", PyInt_FromLong( EXPP_LAMP_MODE_SHAD_RAY ) ); + PyConstant_Insert( c, "LayerShadow", + PyInt_FromLong( EXPP_LAMP_MODE_LAYER_SHADOW ) ); } return Modes; @@ -1011,8 +1015,8 @@ static int Lamp_setType( BPy_Lamp * self, PyObject * value ) static int Lamp_setMode( BPy_Lamp * self, PyObject * value ) { - short param; - static short bitmask = EXPP_LAMP_MODE_SHADOWS + int param; + static int bitmask = EXPP_LAMP_MODE_SHADOWS | EXPP_LAMP_MODE_HALO | EXPP_LAMP_MODE_LAYER | EXPP_LAMP_MODE_QUAD @@ -1022,14 +1026,15 @@ static int Lamp_setMode( BPy_Lamp * self, PyObject * value ) | EXPP_LAMP_MODE_SQUARE | EXPP_LAMP_MODE_NODIFFUSE | EXPP_LAMP_MODE_NOSPECULAR - | EXPP_LAMP_MODE_SHAD_RAY; + | EXPP_LAMP_MODE_SHAD_RAY + | EXPP_LAMP_MODE_LAYER_SHADOW; if( !PyInt_Check ( value ) ) { char errstr[128]; sprintf ( errstr , "expected int bitmask of 0x%04x", bitmask ); return EXPP_ReturnIntError( PyExc_TypeError, errstr ); } - param = (short)PyInt_AS_LONG ( value ); + param = PyInt_AS_LONG ( value ); if ( ( param & bitmask ) != param ) return EXPP_ReturnIntError( PyExc_ValueError, @@ -1373,7 +1378,8 @@ static PyObject *Lamp_getModesConst( void ) EXPP_LAMP_MODE_SQUARE, "NoDiffuse", EXPP_LAMP_MODE_NODIFFUSE, "NoSpecular", EXPP_LAMP_MODE_NOSPECULAR, "RayShadow", - EXPP_LAMP_MODE_SHAD_RAY); + EXPP_LAMP_MODE_SHAD_RAY, "LayerShadow", + EXPP_LAMP_MODE_LAYER_SHADOW); } static PyObject *Lamp_getTypesConst( void ) @@ -1597,6 +1603,8 @@ static PyObject *Lamp_oldsetMode( BPy_Lamp * self, PyObject * args ) flag |= ( short ) EXPP_LAMP_MODE_NOSPECULAR; else if( !strcmp( name, "RayShadow" ) ) flag |= ( short ) EXPP_LAMP_MODE_SHAD_RAY; + else if( !strcmp( name, "LayerShadow" ) ) + flag |= ( short ) EXPP_LAMP_MODE_LAYER_SHADOW; else return EXPP_ReturnPyObjError( PyExc_AttributeError, "unknown lamp flag argument" ); diff --git a/source/blender/python/api2_2x/MTex.c b/source/blender/python/api2_2x/MTex.c index b9a8f7fff65..a95836f0596 100644 --- a/source/blender/python/api2_2x/MTex.c +++ b/source/blender/python/api2_2x/MTex.c @@ -677,7 +677,7 @@ static int MTex_setMapping( BPy_MTex *self, PyObject *value, void *closure) static PyObject *MTex_getFlag( BPy_MTex *self, void *closure ) { - return PyBool_FromLong( self->mtex->texflag & ((int) closure) ); + return PyBool_FromLong( self->mtex->texflag & (GET_INT_FROM_POINTER(closure)) ); } static int MTex_setFlag( BPy_MTex *self, PyObject *value, void *closure) @@ -687,9 +687,9 @@ static int MTex_setFlag( BPy_MTex *self, PyObject *value, void *closure) "expected a bool"); if ( value == Py_True ) - self->mtex->texflag |= (int)closure; + self->mtex->texflag |= GET_INT_FROM_POINTER(closure); else - self->mtex->texflag &= ~((int) closure); + self->mtex->texflag &= ~(GET_INT_FROM_POINTER(closure)); return 0; } @@ -774,7 +774,7 @@ static int MTex_setProjZ( BPy_MTex *self, PyObject *value, void *closure) static PyObject *MTex_getMapToFlag( BPy_MTex *self, void *closure ) { - int flag = (int) closure; + int flag = GET_INT_FROM_POINTER(closure); if ( self->mtex->mapto & flag ) { @@ -786,7 +786,7 @@ static PyObject *MTex_getMapToFlag( BPy_MTex *self, void *closure ) static int MTex_setMapToFlag( BPy_MTex *self, PyObject *value, void *closure) { - int flag = (int) closure; + int flag = GET_INT_FROM_POINTER(closure); int intVal; if ( !PyInt_Check( value ) ) diff --git a/source/blender/python/api2_2x/Makefile b/source/blender/python/api2_2x/Makefile index 7c831952042..a2b77bf8c98 100644 --- a/source/blender/python/api2_2x/Makefile +++ b/source/blender/python/api2_2x/Makefile @@ -37,6 +37,10 @@ include nan_compile.mk CFLAGS += $(LEVEL_1_C_WARNINGS) +ifdef NAN_BUILDINFO + CPPFLAGS += -DNAN_BUILDINFO +endif + ifeq ($(WITH_FFMPEG), true) CPPFLAGS += -DWITH_FFMPEG endif @@ -45,6 +49,7 @@ ifeq ($(WITH_OPENEXR),true) CPPFLAGS += -DWITH_OPENEXR endif +CPPFLAGS += -I$(NAN_GLEW)/include CPPFLAGS += -I$(OPENGL_HEADERS) CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include CPPFLAGS += -I../../makesdna @@ -52,6 +57,7 @@ CPPFLAGS += -I../../blenkernel CPPFLAGS += -I../../blenlib CPPFLAGS += -I../../blenloader CPPFLAGS += -I../../include +CPPFLAGS += -I../../gpu CPPFLAGS += -I../../render/extern/include CPPFLAGS += -I../../radiosity/extern/include CPPFLAGS += -I$(NAN_BMFONT)/include diff --git a/source/blender/python/api2_2x/Material.c b/source/blender/python/api2_2x/Material.c index 20747a167e6..54c2d9b20bd 100644 --- a/source/blender/python/api2_2x/Material.c +++ b/source/blender/python/api2_2x/Material.c @@ -1754,8 +1754,7 @@ static PyObject *Material_getTextures( BPy_Material * self ) } /* turn the array into a tuple */ - tuple = Py_BuildValue( "NNNNNNNNNN", t[0], t[1], t[2], t[3], - t[4], t[5], t[6], t[7], t[8], t[9] ); + tuple = Py_BuildValue( "NNNNNNNNNNNNNNNNNN", t[0], t[1], t[2], t[3], t[4], t[5], t[6], t[7], t[8], t[9], t[10], t[11], t[12], t[13], t[14], t[15], t[16], t[17] ); if( !tuple ) return EXPP_ReturnPyObjError( PyExc_MemoryError, "Material_getTextures: couldn't create PyTuple" ); diff --git a/source/blender/python/api2_2x/doc/Group.py b/source/blender/python/api2_2x/doc/Group.py index 6bd6e105ec3..1266d2efb6e 100644 --- a/source/blender/python/api2_2x/doc/Group.py +++ b/source/blender/python/api2_2x/doc/Group.py @@ -105,6 +105,8 @@ class Group: This object gives access to Groups in Blender. @ivar layers: Layer bitmask for this group. @type layers: int + @ivar dupliOffset: Object offset when instanced as a dupligroup + @type dupliOffset: vector @ivar objects: Objects that this group uses. This is a sequence with-list like access so use list(grp.objects) if you need to use a list (where grp is a group). The groups objects can be set by assigning a list or iterator of objects to the groups objects. |