Module Texture
[frames | no frames]

Module Texture

The Blender.Texture submodule.

Texture

This module provides access to Texture objects in Blender.

Example:
   from Blender import Texture,Image,Material
   
   footex = Texture.Get('foo')             # get texture named 'foo'
   footex.setType('Image')                 # make foo be an image texture
   img = Image.Load('test.png')            # load an image
   footex.image = img                      # link the image to the texture

   mat = Material.Get('bar')               # get a material
   mtextures = mat.getTextures()           # get a list of the MTex objects
   for mtex in mtextures:
       if mtex.tex.type == Texture.Types.IMAGE: 
           print mtex.tex.image.filename   # print the filenames of all the
                                           # images in textures linked to "bar"

   mat.setTexture(0, footex)               # set the material's first texture
                                           # to be our texture

Classes
MTex This object links a material to a texture.
Texture This object gives access to Texture-specific data in Blender.

Function Summary
Blender Texture or a list of Blender Textures Get(name)
Get the Texture object(s) from Blender.
Blender Texture New(name)
Create a new Texture object.

Variable Summary
readonly dictionary ExtendModes: Extend, clamp or repeat modes for images
readonly dictionary Flags: The available Texture flags:
readonly dictionary ImageFlags: The available image flags for Texture.imageFlags:
readonly dictionary MapTo: Flags for MTex.mapto.
readonly dictionary STypes: Texture-type specific data.
readonly dictionary TexCo: Flags for MTex.texco.
readonly dictionary Types: The available texture types:

Function Details

Get(name=None)

Get the Texture object(s) from Blender.
Parameters:
name - The name of the Texture.
           (type=string)
Returns:
It depends on the name parameter:
  • (name): The Texture object with the given name;
  • (): A list with all Texture objects in the current scene.

           (type=Blender Texture or a list of Blender Textures)

New(name='Tex')

Create a new Texture object.
Parameters:
name - The Texture name.
           (type=string)
Returns:
The created Texture object.
           (type=Blender Texture)

Variable Details

ExtendModes

Extend, clamp or repeat modes for images
  • EXTEND - Extends the colour of the edge
  • CLIP - Return alpha 0.0 outside image
  • CLIPCUBE - Return alpha 0.0 around cube-shaped area around image
  • REPEAT - Repeat image vertically and horizontally
Type:
readonly dictionary

Flags

The available Texture flags:
  • FLIPBLEND - Flips the blend texture's X and Y directions
  • NEGALPHA - Reverse the alpha value
Type:
readonly dictionary

ImageFlags

The available image flags for Texture.imageFlags:
  • INTERPOL - Interpolate pixels of the image
  • USEALPHA - Use the alpha layer
  • MIPMAP - Enable mipmapping [cannot be used with FIELDS]
  • FIELDS - Work with field images [cannot be used with MIPMAP]
  • ROT90 - Rotate the image 90 degrees when rendering
  • CALCALPHA - Calculate an alpha from the RGB
  • STFIELD - Denotes this is a standard field
  • MOVIE - Use a movie for an image
  • CYCLIC - Repeat animation image
  • ANTI - Use anti-aliasing
  • NORMALMAP - Use image RGB values for normal mapping
Type:
readonly dictionary

MapTo

Flags for MTex.mapto.
  • COL - Make the texture affect the basic colour of the material
  • NOR - Make the texture affect the rendered normal
  • CSP - Make the texture affect the specularity colour
  • CMIR - Make the texture affect the mirror colour
  • REF - Make the texture affect the value of the material's reflectivity
  • SPEC - Make the texture affect the value of specularity
  • HARD - Make the texture affect the hardness value
  • ALPHA - Make the texture affect the alpha value
  • EMIT - Make the texture affext the emit value
Type:
readonly dictionary

STypes

Texture-type specific data. Depending on the value of Texture.type, certain groups will make sense. For instance, when a texture is of type CLOUD, the CLD_xxx stypes can be used. Note that the first value in each group is the default.
  1. Clouds type
    • CLD_DEFAULT - Monochromatic noise
    • CLD_COLOR - RGB noise
  2. Wood type
    • WOD_BANDS - Use standard wood texture
    • WOD_RINGS - Use wood rings
    • WOD_BANDNOISE - Add noise to standard wood
    • WOD_RINGNOISE - Add noise to rings
  3. Magic type
    • MAG_DEFAULT - Magic has no STypes
  4. Marble type
    • MBL_SOFT - Use soft marble
    • MBL_SHARP - Use more clearly defined marble
    • MBL_SHARPER - Use very clearly dfefined marble
  5. Blend type
    • BLN_LIN - Use a linear progression
    • BLN_QUAD - Use a quadratic progression
    • BLN_EASE - Uses a more complicated blend function
    • BLN_DIAG - Use a diagonal progression
    • BLN_SPHERE - Use a progression with the shape of a sphere
    • BLN_HALO - Use a quadratic progression with the shape of a sphere
  6. Stucci type
    • STC_PLASTIC - Standard stucci
    • STC_WALLIN - Creates dimples
    • STC_WALLOUT - Creates ridges
  7. Noise type
    • NSE_DEFAULT - Noise has no STypes
  8. Image type
    • IMG_DEFAULT - Image has no STypes
  9. Plugin type
    • PLG_DEFAULT - Plugin has no STypes
  10. Envmap type
    • ENV_STATIC - Calculate map only once
    • ENV_ANIM - Calculate map each rendering
    • ENV_LOAD - Load map from disk
Type:
readonly dictionary

TexCo

Flags for MTex.texco.
  • ORCO - Use the original coordinates of the mesh
  • REFL - Use reflection vector as texture coordinates
  • NOR - Use normal vector as texture coordinates
  • GLOB - Use global coordinates for the texture coordinates
  • UV - Use UV coordinates for texture coordinates
  • OBJECT - Use linked object's coordinates for texture coordinates
  • WIN - Use screen coordinates as texture coordinates
  • VIEW - Pass camera view vector on to the texture (World texture only!)
  • STICK - Use mesh sticky coordinates for the texture coordinates
Type:
readonly dictionary

Types

The available texture types:
  • NONE - No texture
  • CLOUDS - Clouds texture
  • WOOD - Wood texture
  • MARBLE - Marble texture
  • MAGIC - Magic texture
  • BLEND - Blend texture
  • STUCCI - Stucci texture
  • NOISE - Noise texture
  • IMAGE - Image texture
  • PLUGIN - Plugin texture
  • ENVMAP - EnvMap texture
Type:
readonly dictionary

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