diff options
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/SConscript | 2 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Blender.c | 47 |
2 files changed, 48 insertions, 1 deletions
diff --git a/source/blender/python/SConscript b/source/blender/python/SConscript index c187720fbb9..d06afc5f489 100644 --- a/source/blender/python/SConscript +++ b/source/blender/python/SConscript @@ -6,7 +6,7 @@ sources = Split('BPY_interface.c BPY_menus.c') + env.Glob('api2_2x/*.c') incs = 'api2_2x ../blenkernel ../nodes ../blenlib ../blenloader' incs += ' ../render/extern/include ../radiosity/extern/include' incs += ' ../makesdna #intern/guardedalloc #intern/bmfont ../imbuf ../include' -incs += ' #extern/glew/include' +incs += ' #extern/glew/include ../gpu' incs += ' ' + env['BF_PYTHON_INC'] incs += ' ' + env['BF_OPENGL_INC'] diff --git a/source/blender/python/api2_2x/Blender.c b/source/blender/python/api2_2x/Blender.c index d8385c1d660..b1febbbfdd3 100644 --- a/source/blender/python/api2_2x/Blender.c +++ b/source/blender/python/api2_2x/Blender.c @@ -56,6 +56,7 @@ struct ID; /*keep me up here */ #include "DNA_screen_types.h" /* for SPACE_VIEW3D */ #include "DNA_userdef_types.h" #include "DNA_packedFile_types.h" +#include "GPU_material.h" #include "EXPP_interface.h" /* for bpy_gethome() */ #include "gen_utils.h" #include "modules.h" @@ -315,6 +316,40 @@ static PyObject *Blender_Set( PyObject * self, PyObject * args ) U.gameflags |= USER_DISABLE_MIPMAP; set_mipmap(!(U.gameflags & USER_DISABLE_MIPMAP)); + } + else if(StringEqual( name, "glsl_lights" ) || + StringEqual( name, "glsl_shaders" ) || + StringEqual( name, "glsl_shadows" ) || + StringEqual( name, "glsl_ramps" ) || + StringEqual( name, "glsl_nodes" ) || + StringEqual( name, "glsl_extra_textures" )) { + + int value = PyObject_IsTrue( arg ); + int flag = 0; + + if (value==-1) + return EXPP_ReturnPyObjError( PyExc_ValueError, + "expected an integer" ); + + if(StringEqual( name, "glsl_lights" )) + flag = G_FILE_GLSL_NO_LIGHTS; + else if(StringEqual( name, "glsl_shaders" )) + flag = G_FILE_GLSL_NO_SHADERS; + else if(StringEqual( name, "glsl_shadows" )) + flag = G_FILE_GLSL_NO_SHADOWS; + else if(StringEqual( name, "glsl_ramps" )) + flag = G_FILE_GLSL_NO_RAMPS; + else if(StringEqual( name, "glsl_nodes" )) + flag = G_FILE_GLSL_NO_NODES; + else if(StringEqual( name, "glsl_extra_textures" )) + flag = G_FILE_GLSL_NO_EXTRA_TEX; + + if (value) + G.fileflags &= ~flag; + else + G.fileflags |= flag; + + GPU_materials_free(); }else return ( EXPP_ReturnPyObjError( PyExc_AttributeError, "value given is not a blender setting" ) ); @@ -548,6 +583,18 @@ static PyObject *Blender_Get( PyObject * self, PyObject * value ) ret = PyInt_FromLong( (U.flag & USER_FILECOMPRESS) >> 15 ); else if(StringEqual( str, "mipmap" )) ret = PyInt_FromLong( (U.gameflags & USER_DISABLE_MIPMAP)!=0 ); + else if(StringEqual( str, "glsl_lights" )) + ret = PyInt_FromLong( (G.fileflags & G_FILE_GLSL_NO_LIGHTS)==0 ); + else if(StringEqual( str, "glsl_shaders" )) + ret = PyInt_FromLong( (G.fileflags & G_FILE_GLSL_NO_SHADERS)==0 ); + else if(StringEqual( str, "glsl_shadows" )) + ret = PyInt_FromLong( (G.fileflags & G_FILE_GLSL_NO_SHADOWS)==0 ); + else if(StringEqual( str, "glsl_ramps" )) + ret = PyInt_FromLong( (G.fileflags & G_FILE_GLSL_NO_RAMPS)==0 ); + else if(StringEqual( str, "glsl_nodes" )) + ret = PyInt_FromLong( (G.fileflags & G_FILE_GLSL_NO_NODES)==0 ); + else if(StringEqual( str, "glsl_extra_textures" )) + ret = PyInt_FromLong( (G.fileflags & G_FILE_GLSL_NO_EXTRA_TEX)==0 ); else if(StringEqual( str, "add_view_align" )) ret = PyInt_FromLong( ((U.flag & USER_ADD_VIEWALIGNED)!=0) ); else if(StringEqual( str, "add_editmode" )) |