Blender Materials: getShader

getShader()
  • Returns the shader envelope. 

Return Type: 

  • BL_Shader vertex shader code
     
  • BL_Shader fragment shader code
Note:
  • GLSL and Multitexture shading have shader envelopes
     
  • Singletexture shading doesn't have shader envelopes
Sample Code

###################### get the shader envelope

# import bge

import bge
 
# get the current scene
scene = bge.logic.getCurrentScene()

# get a list of the objects in the scene
objList = scene.objects

# get object named Cube
objCube = objList["Cube"]

# only one mesh on my cube
mesh = objCube.meshes[0]

# only one material on this mesh
mat = mesh.materials[0]

# get shader envelope
shader = mat.getShader()