Module Material :: Class Material
[frames | no frames]

Class Material


The Material object

This object gives access to Materials in Blender.

Warning: Most member variables assume values in some [Min, Max] interval. When trying to set them, the given parameter will be clamped to lie in that range: if val < Min, then val = Min, if val > Max, then val = Max.

Method Summary
  addScriptLink(text, event)
Add a new script link to this Material.
  clearIpo()
Unlink the ipo from this material.
  clearScriptLinks(links)
Delete script links from this Material.
  clearTexture(index)
Clear the ith (given by 'index') texture channel of this material.
float getAdd()
Get the glow factor.
float getAlpha()
Get the alpha (transparency) value.
float getAmb()
Get the ambient color blend factor.
float getEmit()
Get the emitting light intensity.
float getFlareBoost()
Get the flare's extra strength.
int getFlareSeed()
Get flare's offset in the seed table.
float getFlareSize()
Get the ratio: flareSize / haloSize.
float getFresnelMirr()
Get power of Fresnel for mirror reflection.
float getFresnelMirrFac()
Get the number of Ray Mirror.
float getFresnelTrans()
Get power of Fresnel for transparency.
float getFresnelTransFac()
Get blending factor for Fresnel.
int getHaloSeed()
Get the seed for random ring dimension and line location in halos.
float getHaloSize()
Get the halo size.
int getHardness()
Get the hardness of the specularity.
float getIOR()
Get the angular index of refraction for raytrace.
Ipo getIpo()
Get the Ipo associated with this material, if any.
list of 3 floats getMirCol()
Get the mirror color triplet sequence.
int getMode()
Get this Material's mode flags.
string getName()
Get the name of this Material object.
int getNFlares()
Get the number of halo subflares.
int getNLines()
Get the number of star shaped lines on each halo.
int getNRings()
Get the number of rings on each halo.
int getNStars()
Get the number of points in the halo stars.
float getRayMirr()
Get amount mirror reflection for raytrace.
int getRayMirrDepth()
Get amount of inter-reflections calculated maximal.
float getRef()
Get the reflectivity value.
list of 3 floats getRGBCol()
Get the rgb color triplet sequence.
list getScriptLinks(event)
Get a list with this Material's script links of type 'event'.
float getSpec()
Get the specularity value.
list of 3 floats getSpecCol()
Get the specular color triplet sequence.
float getSpecTransp()
Get the specular transparency.
float getSubSize()
Get the dimension of subflare, dots and circles.
list of MTex getTextures()
Get this Material's Texture list.
int getTransDepth()
Get amount of refractions calculated maximal.
float getZOffset()
Get the artificial offset for faces with this Material.
  insertIpoKey(keytype)
Inserts keytype values in material ipo at curframe.
  setAdd(add)
Set the glow factor.
  setAlpha(alpha)
Set the alpha (transparency) value.
  setAmb(amb)
Set the ambient color blend factor.
  setEmit(emit)
Set the emitting light intensity.
  setFlareBoost(flareboost)
Set the flare's extra strength.
  setFlareSeed(flareseed)
Set flare's offset in the seed table.
  setFlareSize(flaresize)
Set the ratio: flareSize / haloSize.
  setFresnelMirr(nrmirr)
Set power of Fresnel for mirror reflection.
  setFresnelMirrFac(nrmirr)
Set the number of ray mirror
  setFresnelTrans(nrmirr)
Set power of Fresnel for transparency.
  setFresnelTransFac(nrmirr)
Set blending factor for Fresnel.
  setHaloSeed(haloseed)
Set the seed for random ring dimension and line location in halos.
  setHaloSize(halosize)
Set the halo size.
  setHardness(hardness)
Set the hardness of the specularity.
  setIOR(nrmirr)
Set the angular index of refraction for raytrace.
  setIpo(ipo)
Link an ipo to this material.
  setMirCol(rgb)
Set the mirror color triplet sequence.
  setMode(param, stringN)
Set this Material's mode flags.
  setName(name)
Set the name of this Material object.
  setNFlares(nflares)
Set the number of halo subflares.
  setNLines(nlines)
Set the number of star shaped lines on each halo.
  setNRings(nrings)
Set the number of rings on each halo.
  setNStars(nstars)
Set the number of points in the halo stars.
  setRayMirr(nrmirr)
Set amount mirror reflection for raytrace.
  setRayMirrDepth(nrmirr)
Set amount mirror reflection for raytrace.
  setRef(ref)
Set the reflectivity value.
  setRGBCol(rgb)
Set the rgb color triplet sequence.
  setSpec(spec)
Set the specularity value.
  setSpecCol(rgb)
Set the specular color triplet sequence.
  setSpecTransp(spectransp)
Set the specular transparency.
  setSubSize(subsize)
Set the dimension of subflare, dots and circles.
  setTexture(index, texture, texco, mapto)
Assign a Blender Texture object to slot number 'number'.
  setTransDepth(nrmirr)
Set amount of refractions calculated maximal.
  setZOffset(zoffset)
Set the artificial offset for faces with this Material.

Class Variable Summary
  add: Glow factor - [0.0, 1.0].
  alpha: Alpha (translucency) component of the Material - [0.0, 1.0].
  amb: Ambient factor - [0.0, 1.0].
  B: Blue component of rgbCol - [0.0, 1.0].
  emit: Emitting light intensity - [0.0, 1.0].
  flareBoost: Flare's extra strength - [0.1, 10.0].
  flareSeed: Offset in the seed table - [0, 255].
  flareSize: Factor the flare is larger than the halo - [0.1, 25.0].
  fresnelDepth: Power of Fresnel for mirror reflection.
  fresnelDepthFac: Blending factor for Fresnel.
  fresnelTrans: Power of Fresnel for transparency.
  fresnelTransFac: Blending factor for Fresnel.
  G: Green component of rgbCol - [0.0, 1.0].
  haloSeed: To use random values for ring dimension and line location - [0, 255].
  haloSize: Dimension of the halo - [0.0, 100.0].
  hard: Hardness of the specularity - [1, 255].
  IOR: Sets the angular index of refraction for raytrace.
Blender Ipo ipo: This Material's ipo.
  mirCol: Mirror color rgb triplet sequence.
int mode: Mode flags as an or'ed int value.
  name: Material's name.
  nFlares: Number of halo subflares - [1, 32].
  nLines: Number of star shaped lines on each halo - [0, 250].
  nRings: Number of halo rings - [0, 24].
  nStars: Number of points on the halo stars - [3, 50].
  R: Red component of rgbCol - [0.0, 1.0].
  rayMirr: Amount mirror reflection for raytrace.
  rayMirrDepth: Amount of inter-reflections calculated maximal.
  ref: Reflectivity - [0.0, 1.0].
  rgbCol: Material's RGB color triplet sequence.
  spec: Specularity - [0.0, 2.0].
  specCol: Specular color rgb triplet sequence.
  specTrans: Makes specular areas opaque on transparent materials.
  specTransp: Specular transparency - [0.0, 1.0].
  subSize: Dimension of subflares, dots and circles - [0.1, 25.0].
  transDepth: Amount of refractions calculated maximal.
  zOffset: Artificial Z offset for faces - [0.0, 10.0].

Method Details

addScriptLink(text, event)

Add a new script link to this Material.
Parameters:
text - the name of an existing Blender Text.
           (type=string)
event - "FrameChanged" or "Redraw".
           (type=string)

clearIpo()

Unlink the ipo from this material.
Returns:
True if there was an ipo linked or False otherwise.

clearScriptLinks(links=None)

Delete script links from this Material. If no list is specified, all script links are deleted.
Parameters:
links - None (default) or a list of Blender Text names.
           (type=list of strings)

clearTexture(index)

Clear the ith (given by 'index') texture channel of this material.
Parameters:
index - material's texture channel index in [0, 9].
           (type=int)

getAdd()

Get the glow factor.
Returns:
float

getAlpha()

Get the alpha (transparency) value.
Returns:
float

getAmb()

Get the ambient color blend factor.
Returns:
float

getEmit()

Get the emitting light intensity.
Returns:
float

getFlareBoost()

Get the flare's extra strength.
Returns:
float

getFlareSeed()

Get flare's offset in the seed table.
Returns:
int

getFlareSize()

Get the ratio: flareSize / haloSize.
Returns:
float

getFresnelMirr()

Get power of Fresnel for mirror reflection.
Returns:
float

getFresnelMirrFac()

Get the number of Ray Mirror.
Returns:
float

getFresnelTrans()

Get power of Fresnel for transparency.
Returns:
float

getFresnelTransFac()

Get blending factor for Fresnel.
Returns:
float

getHaloSeed()

Get the seed for random ring dimension and line location in halos.
Returns:
int

getHaloSize()

Get the halo size.
Returns:
float

getHardness()

Get the hardness of the specularity.
Returns:
int

getIOR()

Get the angular index of refraction for raytrace.
Returns:
float

getIpo()

Get the Ipo associated with this material, if any.
Returns:
the wrapped ipo or None.
           (type=Ipo)

getMirCol()

Get the mirror color triplet sequence.
Returns:
[mirR, mirG, mirb]
           (type=list of 3 floats)

getMode()

Get this Material's mode flags.
Returns:

OR'ed value. Use the Modes dictionary to check which flags are 'on'.

Example:
 import Blender
 from Blender import Material
 flags = mymat.getMode()
 if flags & Material.Modes['HALO']:
   print "This material is rendered as a halo"
 else:
   print "Not a halo"

           (type=int)

getName()

Get the name of this Material object.
Returns:
string

getNFlares()

Get the number of halo subflares.
Returns:
int

getNLines()

Get the number of star shaped lines on each halo.
Returns:
int

getNRings()

Get the number of rings on each halo.
Returns:
int

getNStars()

Get the number of points in the halo stars.
Returns:
int

getRayMirr()

Get amount mirror reflection for raytrace.
Returns:
float

getRayMirrDepth()

Get amount of inter-reflections calculated maximal.
Returns:
int

getRef()

Get the reflectivity value.
Returns:
float

getRGBCol()

Get the rgb color triplet sequence.
Returns:
[r, g, b]
           (type=list of 3 floats)

getScriptLinks(event)

Get a list with this Material's script links of type 'event'.
Parameters:
event - "FrameChanged" or "Redraw".
           (type=string)
Returns:
a list with Blender Text names (the script links of the given 'event' type) or None if there are no script links at all.
           (type=list)

getSpec()

Get the specularity value.
Returns:
float

getSpecCol()

Get the specular color triplet sequence.
Returns:
[specR, specG, specB]
           (type=list of 3 floats)

getSpecTransp()

Get the specular transparency.
Returns:
float

getSubSize()

Get the dimension of subflare, dots and circles.
Returns:
float

getTextures()

Get this Material's Texture list.
Returns:
a list of Blender MTex objects. None is returned for each empty texture slot.
           (type=list of MTex)

getTransDepth()

Get amount of refractions calculated maximal.
Returns:
int

getZOffset()

Get the artificial offset for faces with this Material.
Returns:
float

insertIpoKey(keytype)

Inserts keytype values in material ipo at curframe. Uses module constants.
Parameters:
keytype - -RGB -ALPHA -HALOSIZE -MODE -ALLCOLOR -ALLMIRROR -OFS -SIZE -ALLMAPPING
           (type=Integer)
Returns:
py_none

setAdd(add)

Set the glow factor.
Parameters:
add - The new value in [0.0, 1.0].
           (type=float)

setAlpha(alpha)

Set the alpha (transparency) value.
Parameters:
alpha - The new value in [0.0, 1.0].
           (type=float)

setAmb(amb)

Set the ambient color blend factor.
Parameters:
amb - The new value in [0.0, 1.0].
           (type=float)

setEmit(emit)

Set the emitting light intensity.
Parameters:
emit - The new value in [0.0, 1.0].
           (type=float)

setFlareBoost(flareboost)

Set the flare's extra strength.
Parameters:
flareboost - The new value in [0.1, 10.0].
           (type=float)

setFlareSeed(flareseed)

Set flare's offset in the seed table.
Parameters:
flareseed - The new value in [0, 255].
           (type=int)

setFlareSize(flaresize)

Set the ratio: flareSize / haloSize.
Parameters:
flaresize - The new value in [0.1, 25.0].
           (type=float)

setFresnelMirr(nrmirr)

Set power of Fresnel for mirror reflection.
Parameters:
nrmirr - The new value in [0.0, 1.0].
           (type=float)

setFresnelMirrFac(nrmirr)

Set the number of ray mirror
Parameters:
nrmirr - The new value in [0.0, 1.0].
           (type=float)

setFresnelTrans(nrmirr)

Set power of Fresnel for transparency.
Parameters:
nrmirr - The new value in [0.0, 1.0].
           (type=float)

setFresnelTransFac(nrmirr)

Set blending factor for Fresnel.
Parameters:
nrmirr - The new value in [0.0, 1.0].
           (type=float)

setHaloSeed(haloseed)

Set the seed for random ring dimension and line location in halos.
Parameters:
haloseed - The new value in [0, 255].
           (type=int)

setHaloSize(halosize)

Set the halo size.
Parameters:
halosize - The new value in [0.0, 100.0].
           (type=float)

setHardness(hardness)

Set the hardness of the specularity.
Parameters:
hardness - The new value in [1, 511].
           (type=int)

setIOR(nrmirr)

Set the angular index of refraction for raytrace.
Parameters:
nrmirr - The new value in [0.0, 1.0].
           (type=float)

setIpo(ipo)

Link an ipo to this material.
Parameters:
ipo - a material type ipo.
           (type=Blender Ipo)

setMirCol(rgb=None)

Set the mirror color triplet sequence. If rgb is None, set the color to black.
Parameters:
rgb - The rgb color values in [0.0, 1.0] as:
  • a list of three floats: setMirCol ([r, g, b]) or
  • three floats as separate parameters: setMirCol (r,g,b).

           (type=three floats or a list of three floats)

setMode(param, stringN=None)

Set this Material's mode flags. Up to 22 mode strings can be given and specify the modes which are turned 'on'. Those not provided are turned 'off', so mat.setMode() -- without arguments -- turns off all mode flags for Material mat. Valid mode strings are "Traceable", "Shadow", "Shadeless", "Wire", "VColLight", "VColPaint", "Halo", "ZTransp", "ZInvert", "HaloRings", "HaloLines", "OnlyShadow", "HaloXAlpha", "HaloStar", "TexFace", "HaloTex", "HaloPuno", "NoMist", "HaloShaded", "HaloFlare", "Radio", "RayMirr", "ZTransp", "RayTransp", "OnlyShadow", "NoMist", "Env"

An integer can also be given, which directly sets the mode flag. The Modes dictionary keys can (and should) be added or ORed to specify which modes to turn 'on'. The value returned from getMode() can also be modified and input to this method.
Parameters:
param - A mode value (int) or flag (string). Can also be None.
           (type=string, None or int)
stringN - A mode flag. Up to 22 flags can be set at the same time.
           (type=string)

setName(name)

Set the name of this Material object.
Parameters:
name - The new name.
           (type=string)

setNFlares(nflares)

Set the number of halo subflares.
Parameters:
nflares - The new value in [1, 32].
           (type=int)

setNLines(nlines)

Set the number of star shaped lines on each halo.
Parameters:
nlines - The new value in [0, 250].
           (type=int)

setNRings(nrings)

Set the number of rings on each halo.
Parameters:
nrings - The new value in [0, 24].
           (type=int)

setNStars(nstars)

Set the number of points in the halo stars.
Parameters:
nstars - The new value in [3, 50].
           (type=int)

setRayMirr(nrmirr)

Set amount mirror reflection for raytrace.
Parameters:
nrmirr - The new value in [0.0, 1.0].
           (type=float)

setRayMirrDepth(nrmirr)

Set amount mirror reflection for raytrace.
Parameters:
nrmirr - The new value in [0.0, 1.0].
           (type=int)

setRef(ref)

Set the reflectivity value.
Parameters:
ref - The new value in [0.0, 1.0].
           (type=float)

setRGBCol(rgb=None)

Set the rgb color triplet sequence. If rgb is None, set the color to black.
Parameters:
rgb - The rgb color values in [0.0, 1.0] as:
  • a list of three floats: setRGBCol ([r, g, b]) or
  • three floats as separate parameters: setRGBCol (r,g,b).

           (type=three floats or a list of three floats)

setSpec(spec)

Set the specularity value.
Parameters:
spec - The new value in [0.0, 2.0].
           (type=float)

setSpecCol(rgb=None)

Set the specular color triplet sequence. If rgb is None, set the color to black.
Parameters:
rgb - The rgb color values in [0.0, 1.0] as:
  • a list of three floats: setSpecCol ([r, g, b]) or
  • three floats as separate parameters: setSpecCol (r,g,b).

           (type=three floats or a list of three floats)

setSpecTransp(spectransp)

Set the specular transparency.
Parameters:
spectransp - The new value in [0.0, 1.0].
           (type=float)

setSubSize(subsize)

Set the dimension of subflare, dots and circles.
Parameters:
subsize - The new value in [0.1, 25.0].
           (type=float)

setTexture(index, texture, texco, mapto)

Assign a Blender Texture object to slot number 'number'.
Parameters:
index - material's texture index in [0, 9].
           (type=int)
texture - a Blender Texture object.
           (type=Blender Texture)
texco - optional or'ed bitflag -- defaults to TexCo.ORCO. See TexCo var in Texture.
           (type=int)
mapto - optional or'ed bitflag -- defaults to MapTo.COL. See MapTo var in Texture.
           (type=int)

setTransDepth(nrmirr)

Set amount of refractions calculated maximal.
Parameters:
nrmirr - The new value in [0.0, 1.0].
           (type=int)

setZOffset(zoffset)

Set the artificial offset for faces with this Material.
Parameters:
zoffset - The new value in [0.0, 10.0].
           (type=float)

Class Variable Details

add

Glow factor - [0.0, 1.0].

alpha

Alpha (translucency) component of the Material - [0.0, 1.0].

amb

Ambient factor - [0.0, 1.0].

B

Blue component of rgbCol - [0.0, 1.0].

emit

Emitting light intensity - [0.0, 1.0].

flareBoost

Flare's extra strength - [0.1, 10.0].

flareSeed

Offset in the seed table - [0, 255].

flareSize

Factor the flare is larger than the halo - [0.1, 25.0].

fresnelDepth

Power of Fresnel for mirror reflection.

fresnelDepthFac

Blending factor for Fresnel.

fresnelTrans

Power of Fresnel for transparency.

fresnelTransFac

Blending factor for Fresnel.

G

Green component of rgbCol - [0.0, 1.0].

haloSeed

To use random values for ring dimension and line location - [0, 255].

haloSize

Dimension of the halo - [0.0, 100.0].

hard

Hardness of the specularity - [1, 255].

IOR

Sets the angular index of refraction for raytrace.

ipo

This Material's ipo.
Type:
Blender Ipo

mirCol

Mirror color rgb triplet sequence.

mode

Mode flags as an or'ed int value. See the Modes dictionary keys and descriptions in Modes.
Type:
int

name

Material's name.

nFlares

Number of halo subflares - [1, 32].

nLines

Number of star shaped lines on each halo - [0, 250].

nRings

Number of halo rings - [0, 24].

nStars

Number of points on the halo stars - [3, 50].

R

Red component of rgbCol - [0.0, 1.0].

rayMirr

Amount mirror reflection for raytrace.

rayMirrDepth

Amount of inter-reflections calculated maximal.

ref

Reflectivity - [0.0, 1.0].

rgbCol

Material's RGB color triplet sequence.

spec

Specularity - [0.0, 2.0].

specCol

Specular color rgb triplet sequence.

specTrans

Makes specular areas opaque on transparent materials.

specTransp

Specular transparency - [0.0, 1.0].

subSize

Dimension of subflares, dots and circles - [0.1, 25.0].

transDepth

Amount of refractions calculated maximal.

zOffset

Artificial Z offset for faces - [0.0, 10.0].

Generated by Epydoc 2.1 on Mon Jun 13 15:31:22 2005 http://epydoc.sf.net