~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to source/blender/python/api2_2x/doc/Texture.py

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2007-05-17 11:47:59 UTC
  • mfrom: (1.2.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070517114759-yp4ybrnhp2u7pk66
Tags: 2.44-1
* New upstream release.
* Drop debian/patches/01_64bits_stupidity, not needed anymore: as of this
  version blender is 64 bits safe again. Adjust README.Debian accordingly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
The Blender.Texture submodule.
9
9
 
10
10
B{New}:
11
 
  - many new attributes in L{MTex} submodule
12
 
  - new dictionaries (L{Texture.BlendModes}, L{Texture.Mappings}, L{Texture.Proj}) to use for the values of some of the new L{MTex} attributes.
 
11
        - many new attributes in L{MTex} submodule
 
12
        - new dictionaries (L{Texture.BlendModes}, L{Texture.Mappings}, L{Texture.Proj}) to use for the values of some of the new L{MTex} attributes.
13
13
 
14
14
Texture
15
15
=======
17
17
This module provides access to B{Texture} objects in Blender.
18
18
 
19
19
Example::
20
 
    
21
 
    from Blender import Texture,Image,Material
22
 
    
23
 
    footex = Texture.Get('foo')             # get texture named 'foo'
24
 
    footex.setType('Image')                 # make foo be an image texture
25
 
    img = Image.Load('test.png')            # load an image
26
 
    footex.image = img                      # link the image to the texture
27
 
 
28
 
    mat = Material.Get('bar')               # get a material
29
 
    mtextures = mat.getTextures()           # get a list of the MTex objects
30
 
    for mtex in mtextures:
31
 
        if mtex.tex.type == Texture.Types.IMAGE: 
32
 
            print mtex.tex.image.filename   # print the filenames of all the
33
 
                                            # images in textures linked to "bar"
34
 
 
35
 
    mat.setTexture(0, footex)               # set the material's first texture
36
 
                                            # to be our texture
 
20
                
 
21
        from Blender import Texture,Image,Material
 
22
        
 
23
        footex = Texture.Get('foo')             # get texture named 'foo'
 
24
        footex.setType('Image')                 # make foo be an image texture
 
25
        img = Image.Load('test.png')            # load an image
 
26
        footex.image = img                      # link the image to the texture
 
27
 
 
28
        mat = Material.Get('bar')               # get a material
 
29
        mtextures = mat.getTextures()           # get a list of the MTex objects
 
30
        for mtex in mtextures:
 
31
                if mtex.tex.type == Texture.Types.IMAGE: 
 
32
                        print mtex.tex.image.filename   # print the filenames of all the
 
33
                                                                                        # images in textures linked to "bar"
 
34
 
 
35
        mat.setTexture(0, footex)               # set the material's first texture
 
36
                                                                                        # to be our texture
37
37
 
38
38
 
39
39
@type Types: readonly dictionary
40
40
@var Types: The available texture types:
41
 
    - NONE -  No texture
42
 
    - CLOUDS - Clouds texture
43
 
    - WOOD - Wood texture
44
 
    - MARBLE - Marble texture
45
 
    - MAGIC - Magic texture
46
 
    - BLEND - Blend texture
47
 
    - STUCCI - Stucci texture
48
 
    - NOISE - Noise texture
49
 
    - IMAGE - Image texture
50
 
    - PLUGIN - Plugin texture
51
 
    - ENVMAP - EnvMap texture
52
 
    - MUSGRAVE - Musgrave procedural texture
53
 
    - VORONOI - Voronoi procedural texture
54
 
    - DISTNOISE - Distorted noise texture
 
41
                - NONE -  No texture
 
42
                - CLOUDS - Clouds texture
 
43
                - WOOD - Wood texture
 
44
                - MARBLE - Marble texture
 
45
                - MAGIC - Magic texture
 
46
                - BLEND - Blend texture
 
47
                - STUCCI - Stucci texture
 
48
                - NOISE - Noise texture
 
49
                - IMAGE - Image texture
 
50
                - PLUGIN - Plugin texture
 
51
                - ENVMAP - EnvMap texture
 
52
                - MUSGRAVE - Musgrave procedural texture
 
53
                - VORONOI - Voronoi procedural texture
 
54
                - DISTNOISE - Distorted noise texture
55
55
 
56
56
@type Flags: readonly dictionary
57
57
@var Flags: The available Texture flags:
58
 
    - FLIPBLEND - Flips the blend texture's X and Y directions
59
 
    - NEGALPHA - Reverse the alpha value
60
 
    - CHECKER_ODD - Fill the "odd" checkerboard tiles
61
 
    - CHECKER_EVEN - Fill the "even" checkerboard tiles
 
58
                - FLIPBLEND - Flips the blend texture's X and Y directions
 
59
                - NEGALPHA - Reverse the alpha value
 
60
                - CHECKER_ODD - Fill the "odd" checkerboard tiles
 
61
                - CHECKER_EVEN - Fill the "even" checkerboard tiles
62
62
 
63
63
@type ImageFlags: readonly dictionary
64
64
@var ImageFlags: The available image flags for Texture.imageFlags:
65
 
    - INTERPOL - Interpolate pixels of the image
66
 
    - USEALPHA - Use the alpha layer
67
 
    - MIPMAP - Enable mipmapping [cannot be used with FIELDS]
68
 
    - FIELDS - Work with field images [cannot be used with MIPMAP]
69
 
    - ROT90 - Rotate the image 90 degrees when rendering
70
 
    - CALCALPHA - Calculate an alpha from the RGB
71
 
    - STFIELD - Denotes this is a standard field
72
 
    - MOVIE - Use a movie for an image
73
 
    - CYCLIC - Repeat animation image
74
 
    - ANTI - Use anti-aliasing
75
 
    - NORMALMAP - Use image RGB values for normal mapping
 
65
                - INTERPOL - Interpolate pixels of the image
 
66
                - USEALPHA - Use the alpha layer
 
67
                - MIPMAP - Enable mipmapping [cannot be used with FIELDS]
 
68
                - FIELDS - Work with field images [cannot be used with MIPMAP]
 
69
                - ROT90 - Rotate the image 90 degrees when rendering
 
70
                - CALCALPHA - Calculate an alpha from the RGB
 
71
                - STFIELD - Denotes this is a standard field
 
72
                - MOVIE - Use a movie for an image
 
73
                - CYCLIC - Repeat animation image
 
74
                - ANTI - Use anti-aliasing
 
75
                - NORMALMAP - Use image RGB values for normal mapping
76
76
 
77
77
@type ExtendModes: readonly dictionary
78
78
@var ExtendModes: Extend, clip, repeat or checker modes for image textures
79
 
    - EXTEND - Extends the colour of the edge
80
 
    - CLIP - Return alpha 0.0 outside image
81
 
    - CLIPCUBE - Return alpha 0.0 around cube-shaped area around image
82
 
    - REPEAT - Repeat image vertically and horizontally
83
 
    - CHECKER - Repeat image in checkerboard pattern
 
79
                - EXTEND - Extends the colour of the edge
 
80
                - CLIP - Return alpha 0.0 outside image
 
81
                - CLIPCUBE - Return alpha 0.0 around cube-shaped area around image
 
82
                - REPEAT - Repeat image vertically and horizontally
 
83
                - CHECKER - Repeat image in checkerboard pattern
84
84
 
85
85
@type Noise: readonly dictionary
86
86
@var Noise: Noise types and bases.  SINE, SAW and TRI are only used for
87
 
    marble and wood textures, while the remainder are used for all textures
88
 
    which has a noise basis function (for these textures, the constant should
89
 
    be used with the second noise basis setting).
90
 
        - SINE - Produce bands using sine wave (marble, wood textures)
91
 
        - SAW - Produce bands using saw wave (marble, wood textures)
92
 
        - TRI - Produce bands using triangle wave (marble, wood textures)
93
 
        - BLENDER - Original Blender algorithm
94
 
        - PERLIN - Ken Perlin's original (1985) algorithm
95
 
        - IMPROVEDPERLIN - Ken Perlin's newer (2002) algorithm
96
 
        - VORONOIF1 - none
97
 
        - VORONOIF2 - none
98
 
        - VORONOIF3 - none
99
 
        - VORONOIF4 - none
100
 
        - VORONOIF2F1 - none
101
 
        - VORONOICRACKLE - none
102
 
        - CELLNOISE - Steven Worley's cellular basis algorithm (1996)
 
87
                marble and wood textures, while the remainder are used for all textures
 
88
                which has a noise basis function (for these textures, the constant should
 
89
                be used with the second noise basis setting).
 
90
                        - SINE - Produce bands using sine wave (marble, wood textures)
 
91
                        - SAW - Produce bands using saw wave (marble, wood textures)
 
92
                        - TRI - Produce bands using triangle wave (marble, wood textures)
 
93
                        - BLENDER - Original Blender algorithm
 
94
                        - PERLIN - Ken Perlin's original (1985) algorithm
 
95
                        - IMPROVEDPERLIN - Ken Perlin's newer (2002) algorithm
 
96
                        - VORONOIF1 - none
 
97
                        - VORONOIF2 - none
 
98
                        - VORONOIF3 - none
 
99
                        - VORONOIF4 - none
 
100
                        - VORONOIF2F1 - none
 
101
                        - VORONOICRACKLE - none
 
102
                        - CELLNOISE - Steven Worley's cellular basis algorithm (1996)
103
103
 
104
104
@type BlendModes: readonly dictionary
105
105
@var BlendModes: The available texture blending modes:
106
 
    - MIX - mix texture with value
107
 
    - MULTIPLY - multiply texture with value
108
 
    - ADD - add texture to value
109
 
    - SUBTRACT - subtract texture from value
110
 
    - DIVIDE - divide value by texture
111
 
    - DARKEN - replace value with texture if texture is darker
112
 
    - DIFFERENCE - difference of texture from value
113
 
    - LIGHTEN - replace value with texture if texture is lighter
114
 
    - SCREEN - 'screen' mode
 
106
                - MIX - mix texture with value
 
107
                - MULTIPLY - multiply texture with value
 
108
                - ADD - add texture to value
 
109
                - SUBTRACT - subtract texture from value
 
110
                - DIVIDE - divide value by texture
 
111
                - DARKEN - replace value with texture if texture is darker
 
112
                - DIFFERENCE - difference of texture from value
 
113
                - LIGHTEN - replace value with texture if texture is lighter
 
114
                - SCREEN - 'screen' mode
115
115
 
116
116
@type Mappings: readonly dictionary
117
117
@var Mappings: The available 2D texture coordinate mappings for images:
118
 
    - FLAT - flat projection
119
 
    - CUBE - cube projection
120
 
    - TUBE - cylindrical projection
121
 
    - SPHERE - spherical projection
 
118
                - FLAT - flat projection
 
119
                - CUBE - cube projection
 
120
                - TUBE - cylindrical projection
 
121
                - SPHERE - spherical projection
122
122
 
123
123
@type Proj: readonly dictionary
124
124
@var Proj: The available projections per axis:
125
 
    - NONE - axis isn't used
126
 
    - X - axis is used as final x axis
127
 
    - Y - axis is used as final y axis
128
 
    - Z - axis is used as final z axis
 
125
                - NONE - axis isn't used
 
126
                - X - axis is used as final x axis
 
127
                - Y - axis is used as final y axis
 
128
                - Z - axis is used as final z axis
129
129
 
130
130
@type STypes: readonly dictionary
131
131
@var STypes: Texture-type specific data. Depending on the value of
132
 
    Texture.type, certain groups will make sense. For instance, when a texture 
133
 
    is of type CLOUD, the CLD_xxx stypes can be used. Note that the first 
134
 
    value in each group is the default.
135
 
        1. Clouds type
136
 
            - CLD_DEFAULT - Monochromatic noise
137
 
            - CLD_COLOR - RGB noise
138
 
        2. Wood type
139
 
            - WOD_BANDS - Use standard wood texture
140
 
            - WOD_RINGS - Use wood rings
141
 
            - WOD_BANDNOISE - Add noise to standard wood
142
 
            - WOD_RINGNOISE - Add noise to rings
143
 
        3. Magic type
144
 
            - MAG_DEFAULT - Magic has no STypes
145
 
        4. Marble type
146
 
            - MBL_SOFT - Use soft marble
147
 
            - MBL_SHARP - Use more clearly defined marble
148
 
            - MBL_SHARPER - Use very clearly dfefined marble
149
 
        5. Blend type
150
 
            - BLN_LIN - Use a linear progression
151
 
            - BLN_QUAD - Use a quadratic progression
152
 
            - BLN_EASE - Uses a more complicated blend function
153
 
            - BLN_DIAG - Use a diagonal progression
154
 
            - BLN_SPHERE - Use a progression with the shape of a sphere
155
 
            - BLN_HALO - Use a quadratic progression with the shape of a sphere
156
 
        6. Stucci type
157
 
            - STC_PLASTIC - Standard stucci
158
 
            - STC_WALLIN - Creates dimples
159
 
            - STC_WALLOUT - Creates ridges
160
 
        7. Noise type
161
 
            - NSE_DEFAULT - Noise has no STypes
162
 
        8. Image type
163
 
            - IMG_DEFAULT - Image has no STypes
164
 
        9. Plugin type
165
 
            - PLG_DEFAULT - Plugin has no STypes
166
 
        10. Envmap type
167
 
            - ENV_STATIC - Calculate map only once
168
 
            - ENV_ANIM - Calculate map each rendering
169
 
            - ENV_LOAD - Load map from disk
170
 
        11. Musgrave type
171
 
            - MUS_MFRACTAL - Hetero Multifractal
172
 
            - MUS_RIDGEDMF - Ridged Multifractal
173
 
            - MUS_HYBRIDMF - Hybrid Multifractal
174
 
            - MUS_FBM - Fractal Brownian Motion
175
 
            - MUS_HTERRAIN - Hetero Terrain
176
 
        12. Voronoi type
177
 
            - VN_INT - Only calculate intensity
178
 
            - VN_COL1 - Color cells by position
179
 
            - VN_COL2 - Same as Col1 plus outline based on F2-F1
180
 
            - VN_COL3 - Same as Col2 multiplied by intensity
181
 
        13. Distorted noise type
182
 
            - DN_BLENDER - Original Blender algorithm
183
 
            - DN_PERLIN - Ken Perlin's original (1985) algorithm
184
 
            - DN_IMPROVEDPERLIN - Ken Perlin's newer (2002) algorithm
185
 
            - DN_VORONOIF1 - none
186
 
            - DN_VORONOIF2 - none
187
 
            - DN_VORONOIF3 - none
188
 
            - DN_VORONOIF4 - none
189
 
            - DN_VORONOIF2F1 - none
190
 
            - DN_VORONOICRACKLE - none
191
 
            - DN_CELLNOISE - Steven Worley's cellular basis algorithm (1996)
 
132
                Texture.type, certain groups will make sense. For instance, when a texture 
 
133
                is of type CLOUD, the CLD_xxx stypes can be used. Note that the first 
 
134
                value in each group is the default.
 
135
                                1. Clouds type
 
136
                                                - CLD_DEFAULT - Monochromatic noise
 
137
                                                - CLD_COLOR - RGB noise
 
138
                                2. Wood type
 
139
                                                - WOD_BANDS - Use standard wood texture
 
140
                                                - WOD_RINGS - Use wood rings
 
141
                                                - WOD_BANDNOISE - Add noise to standard wood
 
142
                                                - WOD_RINGNOISE - Add noise to rings
 
143
                                3. Magic type
 
144
                                                - MAG_DEFAULT - Magic has no STypes
 
145
                                4. Marble type
 
146
                                                - MBL_SOFT - Use soft marble
 
147
                                                - MBL_SHARP - Use more clearly defined marble
 
148
                                                - MBL_SHARPER - Use very clearly dfefined marble
 
149
                                5. Blend type
 
150
                                                - BLN_LIN - Use a linear progression
 
151
                                                - BLN_QUAD - Use a quadratic progression
 
152
                                                - BLN_EASE - Uses a more complicated blend function
 
153
                                                - BLN_DIAG - Use a diagonal progression
 
154
                                                - BLN_SPHERE - Use a progression with the shape of a sphere
 
155
                                                - BLN_HALO - Use a quadratic progression with the shape of a sphere
 
156
                                6. Stucci type
 
157
                                                - STC_PLASTIC - Standard stucci
 
158
                                                - STC_WALLIN - Creates dimples
 
159
                                                - STC_WALLOUT - Creates ridges
 
160
                                7. Noise type
 
161
                                                - NSE_DEFAULT - Noise has no STypes
 
162
                                8. Image type
 
163
                                                - IMG_DEFAULT - Image has no STypes
 
164
                                9. Plugin type
 
165
                                                - PLG_DEFAULT - Plugin has no STypes
 
166
                                10. Envmap type
 
167
                                                - ENV_STATIC - Calculate map only once
 
168
                                                - ENV_ANIM - Calculate map each rendering
 
169
                                                - ENV_LOAD - Load map from disk
 
170
                                11. Musgrave type
 
171
                                                - MUS_MFRACTAL - Hetero Multifractal
 
172
                                                - MUS_RIDGEDMF - Ridged Multifractal
 
173
                                                - MUS_HYBRIDMF - Hybrid Multifractal
 
174
                                                - MUS_FBM - Fractal Brownian Motion
 
175
                                                - MUS_HTERRAIN - Hetero Terrain
 
176
                                12. Voronoi type
 
177
                                                - VN_INT - Only calculate intensity
 
178
                                                - VN_COL1 - Color cells by position
 
179
                                                - VN_COL2 - Same as Col1 plus outline based on F2-F1
 
180
                                                - VN_COL3 - Same as Col2 multiplied by intensity
 
181
                                13. Distorted noise type
 
182
                                                - DN_BLENDER - Original Blender algorithm
 
183
                                                - DN_PERLIN - Ken Perlin's original (1985) algorithm
 
184
                                                - DN_IMPROVEDPERLIN - Ken Perlin's newer (2002) algorithm
 
185
                                                - DN_VORONOIF1 - none
 
186
                                                - DN_VORONOIF2 - none
 
187
                                                - DN_VORONOIF3 - none
 
188
                                                - DN_VORONOIF4 - none
 
189
                                                - DN_VORONOIF2F1 - none
 
190
                                                - DN_VORONOICRACKLE - none
 
191
                                                - DN_CELLNOISE - Steven Worley's cellular basis algorithm (1996)
192
192
 
193
193
@var TexCo: Flags for MTex.texco.
194
 
    - ORCO - Use the original coordinates of the mesh
195
 
    - REFL - Use reflection vector as texture coordinates
196
 
    - NOR - Use normal vector as texture coordinates
197
 
    - GLOB - Use global coordinates for the texture coordinates
198
 
    - UV - Use UV coordinates for texture coordinates
199
 
    - OBJECT - Use linked object's coordinates for texture coordinates
200
 
    - WIN - Use screen coordinates as texture coordinates
201
 
    - VIEW - Pass camera view vector on to the texture (World texture only!)
202
 
    - STICK - Use mesh sticky coordinates for the texture coordinates
203
 
    - STRESS - Use mesh stress coordinates for the texture coordinates
204
 
    - TANGENT - Use mesh tangent coordinates for the texture coordinates
 
194
                - ORCO - Use the original coordinates of the mesh
 
195
                - REFL - Use reflection vector as texture coordinates
 
196
                - NOR - Use normal vector as texture coordinates
 
197
                - GLOB - Use global coordinates for the texture coordinates
 
198
                - UV - Use UV coordinates for texture coordinates
 
199
                - OBJECT - Use linked object's coordinates for texture coordinates
 
200
                - WIN - Use screen coordinates as texture coordinates
 
201
                - VIEW - Pass camera view vector on to the texture (World texture only!)
 
202
                - STICK - Use mesh sticky coordinates for the texture coordinates
 
203
                - STRESS - Use mesh stress coordinates for the texture coordinates
 
204
                - TANGENT - Use mesh tangent coordinates for the texture coordinates
205
205
@type TexCo: readonly dictionary
206
206
 
207
207
@var MapTo: Flags for MTex.mapto.
208
 
    - COL - Make the texture affect the basic colour of the material
209
 
    - NOR - Make the texture affect the rendered normal
210
 
    - CSP - Make the texture affect the specularity colour
211
 
    - CMIR - Make the texture affect the mirror colour
212
 
    - REF - Make the texture affect the diffuse reflectivity value
213
 
    - SPEC - Make the texture affect the specularity value
214
 
    - HARD - Make the texture affect the hardness value
215
 
    - ALPHA - Make the texture affect the alpha value
216
 
    - EMIT - Make the texture affect the emit value
217
 
    - RAYMIR - Make the texture affect the mirror reflectivity value
218
 
    - DISP - Make the texture displace the mesh
219
 
    - TRANSLU - Make the texture affect the translucency value
220
 
    - AMB - Make the texture affect the ambient value
221
 
    - WARP - Make the texture affect texture coordinates for the following textures
 
208
                - COL - Make the texture affect the basic colour of the material
 
209
                - NOR - Make the texture affect the rendered normal
 
210
                - CSP - Make the texture affect the specularity colour
 
211
                - CMIR - Make the texture affect the mirror colour
 
212
                - REF - Make the texture affect the diffuse reflectivity value
 
213
                - SPEC - Make the texture affect the specularity value
 
214
                - HARD - Make the texture affect the hardness value
 
215
                - ALPHA - Make the texture affect the alpha value
 
216
                - EMIT - Make the texture affect the emit value
 
217
                - RAYMIR - Make the texture affect the mirror reflectivity value
 
218
                - DISP - Make the texture displace the mesh
 
219
                - TRANSLU - Make the texture affect the translucency value
 
220
                - AMB - Make the texture affect the ambient value
 
221
                - WARP - Make the texture affect texture coordinates for the following textures
222
222
@type MapTo: readonly dictionary
223
223
 
224
224
"""
225
225
 
226
226
def New (name = 'Tex'):
227
 
    """
228
 
    Create a new Texture object.
229
 
    @type name: string
230
 
    @param name: The Texture name.
231
 
    @rtype: Blender Texture
232
 
    @return: The created Texture object.
233
 
    """
 
227
        """
 
228
        Create a new Texture object.
 
229
        @type name: string
 
230
        @param name: The Texture name.
 
231
        @rtype: Blender Texture
 
232
        @return: The created Texture object.
 
233
        """
234
234
 
235
235
def Get (name = None):
236
 
    """
237
 
    Get the Texture object(s) from Blender.
238
 
    @type name: string
239
 
    @param name: The name of the Texture.
240
 
    @rtype: Blender Texture or a list of Blender Textures
241
 
    @return: It depends on the I{name} parameter:
242
 
        - (name): The Texture object with the given I{name};
243
 
        - ():     A list with all Texture objects in the current scene.
244
 
    """
 
236
        """
 
237
        Get the Texture object(s) from Blender.
 
238
        @type name: string
 
239
        @param name: The name of the Texture.
 
240
        @rtype: Blender Texture or a list of Blender Textures
 
241
        @return: It depends on the I{name} parameter:
 
242
                        - (name): The Texture object with the given I{name};
 
243
                        - ():     A list with all Texture objects in the current scene.
 
244
        """
245
245
 
246
246
from IDProp import IDGroup, IDArray
247
247
class Texture:
248
 
    """
249
 
    The Texture object
250
 
    ==================
251
 
    This object gives access to Texture-specific data in Blender.
252
 
 
253
 
    Note that many of the attributes of this object are only relevant for
254
 
    specific texture types.
255
 
 
256
 
        @ivar properties: Returns an L{IDGroup<IDProp.IDGroup>} reference to this texture's ID Properties.
257
 
        @type properties: L{IDGroup<IDProp.IDGroup>}
 
248
        """
 
249
        The Texture object
 
250
        ==================
 
251
                This object gives access to Texture-specific data in Blender.
 
252
 
 
253
                Note that many of the attributes of this object are only relevant for
 
254
                specific texture types.
 
255
 
258
256
        @ivar animFrames:  Number of frames of a movie to use.
259
 
        Value is clamped to the range [0,30000].
 
257
        Value is clamped to the range [0,300000].
260
258
        @type animFrames:  int
261
 
        @ivar animLength:  Number of frames of a movie to use (0 for all).
262
 
        Value is clamped to the range [0,9000].
263
 
        @type animLength:  int
264
 
        @ivar animMontage: Montage mode, start frames and durations. Example: C{( (fra1,dur1), (fra2,dur2), (fra3,dur3), (fra4,dur4) )}.
265
 
        @type animMontage:  tuple of 4 (int,int)
266
259
        @ivar animOffset:  Offsets the number of the first movie frame to use.
267
 
        Value is clamped to the range [-9000,9000].
 
260
        Value is clamped to the range [-300000,300000].
268
261
        @type animOffset:  int
269
262
        @ivar animStart:  Starting frame of the movie to use.
270
 
        Value is clamped to the range [1,9000].
 
263
        Value is clamped to the range [1,300000].
271
264
        @type animStart:  int
272
265
        @ivar anti:  Image anti-aliasing enabled.  Also see L{ImageFlags}.
273
266
        @type anti:  int
282
275
        @ivar crop:  Sets the cropping extents (for image textures).
283
276
        @type crop:  tuple of 4 ints
284
277
        @ivar cyclic:  Looping of animated frames enabled. Also see L{ImageFlags}.
285
 
        @type cyclic:  int
 
278
        @type cyclic:  boolean
286
279
        @ivar distAmnt:  Amount of distortion (for distorted noise textures).
287
280
        Value is clamped to the range [0.0,10.0].
288
281
        @type distAmnt:  float
326
319
        @type mipmap:  int
327
320
        @ivar movie:  Movie frames as images enabled. Also see L{ImageFlags}.
328
321
        @type movie:  int
329
 
        @ivar name:  Texture data name.
330
 
        @type name:  string
331
322
        @ivar noiseBasis:  Noise basis type (wood, stucci, marble, clouds,
332
323
        Musgrave, distorted).  See L{Noise} dictionary.
333
324
        @type noiseBasis:  int
373
364
        @type type:  int
374
365
        @ivar useAlpha:  Use of image's alpha channel enabled. Also see L{ImageFlags}.
375
366
        @type useAlpha:  int
376
 
        @ivar users:  Number of texture users.  Read-only.
377
 
        @type users:  int
378
367
        @ivar weight1:  Weight 1 (for Voronoi textures).
379
368
        Value is clamped to the range [-2.0,2.0].
380
369
        @type weight1:  float
387
376
        @ivar weight4:  Weight 4 (for Voronoi textures).
388
377
        Value is clamped to the range [-2.0,2.0].
389
378
        @type weight4:  float
390
 
    """
391
 
    
392
 
    def getExtend():
393
 
        """
394
 
        Get the extend mode of the texture. See L{setExtend}.
395
 
        @rtype: string.
396
 
        """
397
 
    
398
 
    def getImage():
399
 
        """
400
 
        Get the Image associated with this texture (or None).
401
 
        @rtype: Blender Image
402
 
        """
403
 
 
404
 
    def getName():
405
 
        """
406
 
        Get the name of this Texture object.
407
 
        @rtype: string
408
 
        """
409
 
 
410
 
    def getType():
411
 
        """
412
 
        Get this Texture's type.  See L{setType}.
413
 
        @rtype: string
414
 
        """
415
 
 
416
 
    def setExtend(extendmode):
417
 
        """
418
 
        Set the extend mode of this texture (only used for IMAGE textures)
419
 
        @param extendmode: The new extend mode. One of: 
420
 
            'Extend', 'Clip', 'ClipCube' and 'Repeat'
421
 
        @type extendmode: string
422
 
        """
423
 
 
424
 
    def setFlags(f1=None, f2=None, f3=None, f4=None):
425
 
        """
426
 
        Set this object's flags.
427
 
        @param f1,f2,f3,f4: Flags to be set (omitted flags are cleared). Can be any of 
428
 
            'FlipBlendXY', 'NegAlpha', 'CheckerOdd', and 'CheckerEven'
429
 
        @type f1,f2,f3,f4: string
430
 
        """
431
 
 
432
 
    def setImage(image):
433
 
        """
434
 
        Set the Image of this texture.
435
 
        @param image: The new Image.
436
 
        @type image: Blender Image
437
 
        @warning: This sets the texture's type to 'Image' if it is not already.
438
 
        """
439
 
 
440
 
    def setImageFlags(f1=None, f2=None, f3=None, etc=None):
441
 
        """
442
 
        Set the Image flags (only makes sense for IMAGE textures). Omitted
443
 
        flags are cleared.
444
 
        @param f1, f2, f3, etc: Flag to set. See L{ImageFlags} for their meanings. Can be 
445
 
            any of: 'InterPol', 'UseAlpha', 'MipMap', 'Fields', 'Rot90',
446
 
            'CalcAlpha', 'Cyclic', 'Movie', 'StField', 'Anti' and 'NormalMap'
447
 
        @type f1, f2, f3, etc: string
448
 
        """
449
 
 
450
 
    def setName(name):
451
 
        """
452
 
        Set the name of this Texture object.
453
 
        @param name: The new name.
454
 
        @type name: string
455
 
        """
456
 
 
457
 
    def setSType(stype):
458
 
        """
459
 
        Set the SType.
460
 
        @param stype: The new stype. This can be any of the values listed in
461
 
             L{STypes} or 'Default' which sets the stype to the default value.
462
 
        @type stype: string
463
 
 
464
 
        @note: the set of valid parameters is dependent on the current
465
 
        texture type.  Be sure to always set the texture type B{before}
466
 
        setting the texture's stype; otherwise an exception might occur.
467
 
        """
468
 
 
469
 
    def setType(type):
470
 
        """
471
 
        Set this Texture's type.
472
 
        @param type: The new type. Possible options are: 
473
 
            'None', 'Clouds', 'Wood', 'Marble', 'Magic', 'Blend', 'Stucci', 
474
 
            'Noise', 'Image', 'Plugin', 'EnvMap', 'Musgrave', 'Voronoi'
475
 
            and 'DistNoise'
476
 
        @type type: string
477
 
        """
478
 
 
 
379
        @ivar colorband:  Texture colorband, a list of colors, 
 
380
        each color a list of 5 floats [0 - 1], [r,g,b,a,pos].
 
381
        The colorband can have between 1 and 31 colors.
 
382
        @type colorband:  list
 
383
        @ivar autoRefresh: Refresh image on frame changes enabled.
 
384
        @type autoRefresh:  boolean
 
385
        """
 
386
        
 
387
        def getExtend():
 
388
                """
 
389
                Get the extend mode of the texture. See L{setExtend}.
 
390
                @rtype: string.
 
391
                """
 
392
        
 
393
        def getImage():
 
394
                """
 
395
                Get the Image associated with this texture (or None).
 
396
                @rtype: Blender Image
 
397
                """
 
398
 
 
399
        def getName():
 
400
                """
 
401
                Get the name of this Texture object.
 
402
                @rtype: string
 
403
                """
 
404
 
 
405
        def getType():
 
406
                """
 
407
                Get this Texture's type.  See L{setType}.
 
408
                @rtype: string
 
409
                """
 
410
 
 
411
        def setExtend(extendmode):
 
412
                """
 
413
                Set the extend mode of this texture (only used for IMAGE textures)
 
414
                @param extendmode: The new extend mode. One of: 
 
415
                                'Extend', 'Clip', 'ClipCube' and 'Repeat'
 
416
                @type extendmode: string
 
417
                """
 
418
 
 
419
        def setFlags(f1=None, f2=None, f3=None, f4=None):
 
420
                """
 
421
                Set this object's flags.
 
422
                @param f1,f2,f3,f4: Flags to be set (omitted flags are cleared). Can be any of 
 
423
                                'FlipBlendXY', 'NegAlpha', 'CheckerOdd', and 'CheckerEven'
 
424
                @type f1,f2,f3,f4: string
 
425
                """
 
426
 
 
427
        def setImage(image):
 
428
                """
 
429
                Set the Image of this texture.
 
430
                @param image: The new Image.
 
431
                @type image: Blender Image
 
432
                @warning: This sets the texture's type to 'Image' if it is not already.
 
433
                """
 
434
 
 
435
        def setImageFlags(f1=None, f2=None, f3=None, etc=None):
 
436
                """
 
437
                Set the Image flags (only makes sense for IMAGE textures). Omitted
 
438
                flags are cleared.
 
439
                @param f1, f2, f3, etc: Flag to set. See L{ImageFlags} for their meanings. Can be 
 
440
                                any of: 'InterPol', 'UseAlpha', 'MipMap', 'Fields', 'Rot90',
 
441
                                'CalcAlpha', 'Cyclic', 'Movie', 'StField', 'Anti' and 'NormalMap'
 
442
                @type f1, f2, f3, etc: string
 
443
                """
 
444
 
 
445
        def setName(name):
 
446
                """
 
447
                Set the name of this Texture object.
 
448
                @param name: The new name.
 
449
                @type name: string
 
450
                """
 
451
 
 
452
        def setSType(stype):
 
453
                """
 
454
                Set the SType.
 
455
                @param stype: The new stype. This can be any of the values listed in
 
456
                                 L{STypes} or 'Default' which sets the stype to the default value.
 
457
                @type stype: string
 
458
 
 
459
                @note: the set of valid parameters is dependent on the current
 
460
                texture type.  Be sure to always set the texture type B{before}
 
461
                setting the texture's stype; otherwise an exception might occur.
 
462
                """
 
463
 
 
464
        def setType(type):
 
465
                """
 
466
                Set this Texture's type.
 
467
                @param type: The new type. Possible options are: 
 
468
                                'None', 'Clouds', 'Wood', 'Marble', 'Magic', 'Blend', 'Stucci', 
 
469
                                'Noise', 'Image', 'Plugin', 'EnvMap', 'Musgrave', 'Voronoi'
 
470
                                and 'DistNoise'
 
471
                @type type: string
 
472
                """
 
473
        def evaluate(coord):
 
474
                """
 
475
                Evaluates the texture at this location and returns the result.
 
476
                
 
477
                The return value is a 4D vector where (x,y,z,w) are (red, green, blue, intensity)
 
478
                For greyscale textures, often intensity only will be used.
 
479
                @type coord: vector
 
480
                """
 
481
                
 
482
import id_generics
 
483
Texture.__doc__ += id_generics.attributes
479
484
 
480
485
class MTex:
481
 
    """
482
 
    The MTex Object
483
 
    ===============
484
 
 
485
 
    This object links a material to a texture. It allows the same texture to be
486
 
    used in several different ways.
487
 
 
488
 
    @ivar tex: The Texture this is linked to.
489
 
    @type tex: Blender Texture
490
 
    @ivar texco: Texture coordinates ("Map input"). See L{TexCo}
491
 
    @ivar mapto: "Map to" field of texture. OR'd values of L{MapTo}
492
 
    @ivar object: Object whose space to use when texco is Object
493
 
    @type object: Blender Object
494
 
    @ivar col: Color that the texture blends with
495
 
    @ivar dvar: Value that the texture blends with when not blending colors
496
 
    @ivar blendmode: Texture blending mode. L{BlendModes}
497
 
    @ivar colfac: Factor by which texture affects color
498
 
    @ivar norfac: Factor by which texture affects normal
499
 
    @ivar varfac: Factor by which texture affects most variables
500
 
    @ivar dispfac: Factor by which texture affects displacement
501
 
    @ivar warpfac: Factor by which texture affects warp
502
 
    @ivar ofs: Offset to adjust texture space
503
 
    @ivar size: Size to scale texture space
504
 
    @ivar mapping: Mapping of texture coordinates (flat, cube, etc.). L{Mappings}
505
 
    @ivar stencil: Stencil mode
506
 
    @ivar neg: Negate texture values mode
507
 
    @ivar noRGB: Convert texture RGB values to intensity values
508
 
    @ivar correctNor: Correct normal mapping for Texture space and Object space
509
 
    @ivar xproj: Projection of X axis to Texture space. L{Proj}
510
 
    @ivar yproj: Projection of Y axis to Texture space. L{Proj}
511
 
    @ivar zproj: Projection of Z axis to Texture space. L{Proj}
512
 
    @ivar mtCol: How texture maps to color
513
 
    @ivar mtNor: How texture maps to normals
514
 
    @ivar mtCsp: How texture maps to specularity color
515
 
    @ivar mtCmir: How texture maps to mirror color
516
 
    @ivar mtRef: How texture maps to reflectivity
517
 
    @ivar mtSpec: How texture maps to specularity
518
 
    @ivar mtEmit: How texture maps to emit value
519
 
    @ivar mtAlpha: How texture maps to alpha value
520
 
    @ivar mtHard: How texture maps to hardness
521
 
    @ivar mtRayMir: How texture maps to RayMir value
522
 
    @ivar mtTranslu: How texture maps to translucency
523
 
    @ivar mtAmb: How texture maps to ambient value
524
 
    @ivar mtDisp: How texture maps to displacement
525
 
    @ivar mtWarp: How texture maps to warp
526
 
    """
527
 
 
528
 
    def getIpo():
529
 
      """
530
 
      Get the Ipo associated with this texture object, if any.
531
 
      @rtype: Ipo
532
 
      @return: the wrapped ipo or None.
533
 
      """
534
 
 
535
 
    def setIpo(ipo):
536
 
      """
537
 
      Link an ipo to this texture object.
538
 
      @type ipo: Blender Ipo
539
 
      @param ipo: a "texture data" ipo.
540
 
      """
541
 
 
542
 
    def clearIpo():
543
 
      """
544
 
      Unlink the ipo from this texture object.
545
 
      @return: True if there was an ipo linked or False otherwise.
546
 
      """
 
486
        """
 
487
        The MTex Object
 
488
        ===============
 
489
 
 
490
        This object links a material to a texture. It allows the same texture to be
 
491
        used in several different ways.
 
492
 
 
493
        @ivar tex: The Texture this is linked to.
 
494
        @type tex: Blender Texture
 
495
        @ivar texco: Texture coordinates ("Map input"). See L{TexCo}
 
496
        @ivar mapto: "Map to" field of texture. OR'd values of L{MapTo}
 
497
        @ivar object: Object whose space to use when texco is Object
 
498
        @type object: Blender Object
 
499
        @ivar col: Color that the texture blends with
 
500
        @ivar dvar: Value that the texture blends with when not blending colors
 
501
        @ivar blendmode: Texture blending mode. L{BlendModes}
 
502
        @ivar colfac: Factor by which texture affects color
 
503
        @ivar norfac: Factor by which texture affects normal
 
504
        @ivar varfac: Factor by which texture affects most variables
 
505
        @ivar dispfac: Factor by which texture affects displacement
 
506
        @ivar warpfac: Factor by which texture affects warp
 
507
        @ivar ofs: Offset to adjust texture space
 
508
        @ivar size: Size to scale texture space
 
509
        @ivar mapping: Mapping of texture coordinates (flat, cube, etc.). L{Mappings}
 
510
        @ivar stencil: Stencil mode
 
511
        @ivar neg: Negate texture values mode
 
512
        @ivar noRGB: Convert texture RGB values to intensity values
 
513
        @ivar correctNor: Correct normal mapping for Texture space and Object space
 
514
        @ivar xproj: Projection of X axis to Texture space. L{Proj}
 
515
        @ivar yproj: Projection of Y axis to Texture space. L{Proj}
 
516
        @ivar zproj: Projection of Z axis to Texture space. L{Proj}
 
517
        @ivar mtCol: How texture maps to color
 
518
        @ivar mtNor: How texture maps to normals
 
519
        @ivar mtCsp: How texture maps to specularity color
 
520
        @ivar mtCmir: How texture maps to mirror color
 
521
        @ivar mtRef: How texture maps to reflectivity
 
522
        @ivar mtSpec: How texture maps to specularity
 
523
        @ivar mtEmit: How texture maps to emit value
 
524
        @ivar mtAlpha: How texture maps to alpha value
 
525
        @ivar mtHard: How texture maps to hardness
 
526
        @ivar mtRayMir: How texture maps to RayMir value
 
527
        @ivar mtTranslu: How texture maps to translucency
 
528
        @ivar mtAmb: How texture maps to ambient value
 
529
        @ivar mtDisp: How texture maps to displacement
 
530
        @ivar mtWarp: How texture maps to warp
 
531
        """
 
532
 
 
533
        def getIpo():
 
534
                """
 
535
                Get the Ipo associated with this texture object, if any.
 
536
                @rtype: Ipo
 
537
                @return: the wrapped ipo or None.
 
538
                """
 
539
 
 
540
        def setIpo(ipo):
 
541
                """
 
542
                Link an ipo to this texture object.
 
543
                @type ipo: Blender Ipo
 
544
                @param ipo: a "texture data" ipo.
 
545
                """
 
546
 
 
547
        def clearIpo():
 
548
                """
 
549
                Unlink the ipo from this texture object.
 
550
                @return: True if there was an ipo linked or False otherwise.
 
551
                """