From 01744abd8187d1566b336bf38033673aa05b6786 Mon Sep 17 00:00:00 2001 From: Benoit Bolsee Date: Fri, 9 Sep 2011 11:55:38 +0000 Subject: GPU: add gpu python module with export_shader() function to export GLSL shader. shader = gpu.export_shader(scene,material) Returns the GLSL shader that blender generates to produce the visual effect of material in scene for the purpose of reusing the shader in an external engine. This function is meant to be used in a material exporter so that the GLSL shader can be exported entirely. The return value is a dictionary containing the shader source code and all associated data. The full documentation is under sphinx. Warning: there has been an API between the patch and this commit: uniform['lamp'] and uniform['image'] now return python reference to ID block instead of ID name as before. The X3D exporter that uses this function must be adapted. --- source/blender/python/intern/bpy_interface.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source/blender/python/intern/bpy_interface.c') diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index e5e90380d61..e5bfc1d633f 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -40,6 +40,7 @@ #include "RNA_types.h" #include "bpy.h" +#include "gpu.h" #include "bpy_rna.h" #include "bpy_util.h" #include "bpy_traceback.h" @@ -181,6 +182,7 @@ static struct _inittab bpy_internal_modules[]= { #ifdef WITH_AUDASPACE {(char *)"aud", AUD_initPython}, #endif + {(char *)"gpu", GPU_initPython}, {NULL, NULL} }; -- cgit v1.2.3