Blender Documentation Volume II - Reference Guide: Last modified March 29 2004 S68
<<< Previous | Python API Reference | Next >>>

# Material

This module provides access to Material objects in Blender.

Example:

     import Blender
     from Blender import Material
     mat = Material.New('newMat')          # create a new Material called 'newMat'
     print mat.rgbCol                      # print its rgb color triplet
     mat.rgbCol = [0.8, 0.2, 0.2]          # change its color
     mat.setAlpha(0.2)                     # mat.alpha = 0.2 -- almost transparent
     mat.emit = 0.7                        # equivalent to mat.setEmit(0.8)
     mat.mode |= Material.Modes.ZTRANSP    # turn on Z-Buffer transparency
     mat.setName('RedBansheeSkin')         # change its name
     mat.setAdd(0.8)                       # make it glow
     mat.setMode('Halo')                   # turn 'Halo' "on" and all others "off"

Warning: Some Modes are only available when the 'Halo' mode is off and others only when it is on. But these two subsets of modes share the same numerical values in their Blender C #defines. So, for example, if 'Halo' is on, then 'NoMist' is actually interpreted as 'HaloShaded'. We marked all such possibilities in the Modes dict below: each halo-related mode that uses an already taken value is preceded by "-" and appear below the normal mode which also uses that value.

Classes |
`Material` | This object gives access to Materials in Blender.

Function Summary |
Blender Material or a list of Blender Materials | `Get(name)` Get the Material object(s) from Blender.
Blender Material | `New(name)` Create a new Material object.

Variable Summary |
readonly dictionary | `Modes` - The available Material Modes.

Function Details |

Get(name=None) Get the Material object(s) from Blender. Parameters: `name` - The name of the Material. (type=string) Returns: It depends on the 'name' parameter: (name): The Material object with the given name; (): A list with all Material objects in the current scene. (type=Blender Material or a list of Blender Materials)

New(name='Mat') Create a new Material object. Parameters: `name` - The Material name. (type=string) Returns: The created Material object. (type=Blender Material)

Variable Details |

Modes The available Material Modes. TRACEABLE - Make Material visible for shadow lamps. SHADOW - Enable Material for shadows. SHADELESS - Make Material insensitive to light or shadow. WIRE - Render only the edges of faces. VCOL_LIGHT - Add vertex colors as extra light. VCOL_PAINT - Replace basic colors with vertex colors. HALO - Render as a halo. ZTRANSP - Z-buffer transparent faces. ZINVERT - Render with inverted Z-buffer. - HALORINGS - Render rings over the basic halo. ENV - Do not render Material. - HALOLINES - Render star shaped lines over the basic halo. ONLYSHADOW - Let alpha be determined on the degree of shadow. - HALOXALPHA - Use extreme alpha. TEXFACE - UV-Editor assigned texture gives color and texture info for faces. - HALOSTAR - Render halo as a star. NOMIST - Set the Material insensitive to mist. - HALOSHADED - Let halo receive light. HALOTEX - Give halo a texture. HALOPUNO - Use the vertex normal to specify the dimension of the halo. HALOFLARE - Render halo as a lens flare. Type: readonly dictionary

<<< Previous | Home | Next >>>
Module Material | Up | Class Material