Module Texture

Module Texture

source code

The Blender.Texture submodule.

New:

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
  Texture
This object gives access to Texture-specific data in Blender.
  MTex
This object links a material to a texture.
Functions
Blender Texture
New(name='Tex')
Create a new Texture object.
source code
Blender Texture or a list of Blender Textures
Get(name=None)
Get the Texture object(s) from Blender.
source code
Variables
readonly dictionary BlendModes
The available texture blending modes:
readonly dictionary ExtendModes
Extend, clip, repeat or checker modes for image textures
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 Mappings
The available 2D texture coordinate mappings for images:
readonly dictionary Noise
Noise types and bases.
readonly dictionary Proj
The available projections per axis:
readonly dictionary STypes
Texture-type specific data.
readonly dictionary TexCo
Flags for MTex.texco.
readonly dictionary Types
The available texture types:
Function Details

New(name='Tex')

source code 
Create a new Texture object.
Parameters:
  • name (string) - The Texture name.
Returns: Blender Texture
The created Texture object.

Get(name=None)

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

Variables Details

BlendModes

The available texture blending modes:
  • MIX - mix texture with value
  • MULTIPLY - multiply texture with value
  • ADD - add texture to value
  • SUBTRACT - subtract texture from value
  • DIVIDE - divide value by texture
  • DARKEN - replace value with texture if texture is darker
  • DIFFERENCE - difference of texture from value
  • LIGHTEN - replace value with texture if texture is lighter
  • SCREEN - 'screen' mode
Type:
readonly dictionary

ExtendModes

Extend, clip, repeat or checker modes for image textures
  • EXTEND - Extends the color 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
  • CHECKER - Repeat image in checkerboard pattern
Type:
readonly dictionary

Flags

The available Texture flags:
  • FLIPBLEND - Flips the blend texture's X and Y directions
  • NEGALPHA - Reverse the alpha value
  • CHECKER_ODD - Fill the "odd" checkerboard tiles
  • CHECKER_EVEN - Fill the "even" checkerboard tiles
  • COLORBAND - Enable colorband for this texture
  • PREVIEW_ALPHA - Show alpha in preview
  • REPEAT_XMIR - Mirrors X direction repeat
  • REPEAT_YMIR - Mirrors Y direction repeat
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 color of the material
  • NOR - Make the texture affect the rendered normal
  • CSP - Make the texture affect the specularity color
  • CMIR - Make the texture affect the mirror color
  • REF - Make the texture affect the diffuse reflectivity value
  • SPEC - Make the texture affect the specularity value
  • HARD - Make the texture affect the hardness value
  • ALPHA - Make the texture affect the alpha value
  • EMIT - Make the texture affect the emit value
  • RAYMIR - Make the texture affect the mirror reflectivity value
  • DISP - Make the texture displace the mesh
  • TRANSLU - Make the texture affect the translucency value
  • AMB - Make the texture affect the ambient value
  • WARP - Make the texture affect texture coordinates for the following textures
Type:
readonly dictionary

Mappings

The available 2D texture coordinate mappings for images:
  • FLAT - flat projection
  • CUBE - cube projection
  • TUBE - cylindrical projection
  • SPHERE - spherical projection
Type:
readonly dictionary

Noise

Noise types and bases. SINE, SAW and TRI are only used for marble and wood textures, while the remainder are used for all textures which has a noise basis function (for these textures, the constant should be used with the second noise basis setting).
  • SINE - Produce bands using sine wave (marble, wood textures)
  • SAW - Produce bands using saw wave (marble, wood textures)
  • TRI - Produce bands using triangle wave (marble, wood textures)
  • BLENDER - Original Blender algorithm
  • PERLIN - Ken Perlin's original (1985) algorithm
  • IMPROVEDPERLIN - Ken Perlin's newer (2002) algorithm
  • VORONOIF1 - none
  • VORONOIF2 - none
  • VORONOIF3 - none
  • VORONOIF4 - none
  • VORONOIF2F1 - none
  • VORONOICRACKLE - none
  • CELLNOISE - Steven Worley's cellular basis algorithm (1996)
Type:
readonly dictionary

Proj

The available projections per axis:
  • NONE - axis isn't used
  • X - axis is used as final x axis
  • Y - axis is used as final y axis
  • Z - axis is used as final z axis
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
  11. Musgrave type
    • MUS_MFRACTAL - Hetero Multifractal
    • MUS_RIDGEDMF - Ridged Multifractal
    • MUS_HYBRIDMF - Hybrid Multifractal
    • MUS_FBM - Fractal Brownian Motion
    • MUS_HTERRAIN - Hetero Terrain
  12. Voronoi type
    • VN_INT - Only calculate intensity
    • VN_COL1 - Color cells by position
    • VN_COL2 - Same as Col1 plus outline based on F2-F1
    • VN_COL3 - Same as Col2 multiplied by intensity
  13. Distorted noise type
    • DN_BLENDER - Original Blender algorithm
    • DN_PERLIN - Ken Perlin's original (1985) algorithm
    • DN_IMPROVEDPERLIN - Ken Perlin's newer (2002) algorithm
    • DN_VORONOIF1 - none
    • DN_VORONOIF2 - none
    • DN_VORONOIF3 - none
    • DN_VORONOIF4 - none
    • DN_VORONOIF2F1 - none
    • DN_VORONOICRACKLE - none
    • DN_CELLNOISE - Steven Worley's cellular basis algorithm (1996)
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
  • STRESS - Use mesh stress coordinates for the texture coordinates
  • TANGENT - Use mesh tangent 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
  • MUSGRAVE - Musgrave procedural texture
  • VORONOI - Voronoi procedural texture
  • DISTNOISE - Distorted noise texture
Type:
readonly dictionary