Module Material
[hide private]
[frames] | no frames]

Source Code for Module Material

   1  # Blender.Material module and the Material PyObject 
   2   
   3  """ 
   4  The Blender.Material submodule. 
   5   
   6  B{New}: access to shader data. 
   7   
   8  Material  
   9  ======== 
  10   
  11  This module provides access to B{Material} objects in Blender. 
  12   
  13  Example:: 
  14          import Blender 
  15          from Blender import Material 
  16          mat = Material.New('newMat')          # create a new Material called 'newMat' 
  17          print mat.rgbCol                      # print its rgb color triplet sequence 
  18          mat.rgbCol = [0.8, 0.2, 0.2]          # change its color 
  19          mat.setAlpha(0.2)                     # mat.alpha = 0.2 -- almost transparent 
  20          mat.emit = 0.7                        # equivalent to mat.setEmit(0.8) 
  21          mat.mode |= Material.Modes.ZTRANSP    # turn on Z-Buffer transparency 
  22          mat.setName('RedBansheeSkin')         # change its name 
  23          mat.setAdd(0.8)                       # make it glow 
  24          mat.setMode('Halo')                   # turn 'Halo' "on" and all others "off" 
  25   
  26  @type Modes: readonly dictionary 
  27  @var Modes: The available Material Modes. 
  28   
  29          B{Note}: Some Modes are only available when the 'Halo' mode is I{off} and 
  30          others only when it is I{on}.  But these two subsets of modes share the same 
  31          numerical values in their Blender C #defines. So, for example, if 'Halo' is 
  32          on, then 'NoMist' is actually interpreted as 'HaloShaded'.  We marked all 
  33          such possibilities in the Modes dict below: each halo-related mode that 
  34          uses an already taken value is preceded by "+" and appear below the normal 
  35          mode which also uses that value. 
  36   
  37                  - TRACEABLE    - Make Material visible for shadow lamps. 
  38                  - SHADOW       - Enable Material for shadows. 
  39                  - SHADOWBUF    - Enable Material to cast shadows with shadow buffers. 
  40                  - SHADELESS    - Make Material insensitive to light or shadow. 
  41                  - WIRE         - Render only the edges of faces. 
  42                  - VCOL_LIGHT   - Add vertex colors as extra light. 
  43                  - VCOL_PAINT   - Replace basic colors with vertex colors. 
  44                  - HALO         - Render as a halo. 
  45                  - ZTRANSP      - Z-buffer transparent faces. 
  46                  - ZINVERT      - Render with inverted Z-buffer. 
  47                  - + HALORINGS  - Render rings over the basic halo. 
  48                  - ENV          - Do not render Material. 
  49                  - + HALOLINES  - Render star shaped lines over the basic halo. 
  50                  - ONLYSHADOW   - Let alpha be determined on the degree of shadow. 
  51                  - + HALOXALPHA - Use extreme alpha. 
  52                  - TEXFACE      - UV-Editor assigned texture gives color and texture info for faces. 
  53                  - TEXFACE_ALPHA - When TEXFACE is enabled, use the alpha as well. 
  54                  - + HALOSTAR   - Render halo as a star. 
  55                  - NOMIST       - Set the Material insensitive to mist. 
  56                  - + HALOSHADED - Let halo receive light. 
  57                  - HALOTEX      - Give halo a texture. 
  58                  - HALOPUNO     - Use the vertex normal to specify the dimension of the halo. 
  59                  - HALOFLARE    - Render halo as a lens flare. 
  60                  - RAYMIRROR    - Enables raytracing for mirror reflection rendering. 
  61                  - RAYTRANSP    - Enables raytracing for transparency rendering. 
  62                  - RAYBIAS      - Prevent ray traced shadow errors with Phong interpolated normals. 
  63                  - RAMPCOL      - Status of colorband ramp for Material's diffuse color.  This is a read-only bit. 
  64                  - RAMPSPEC     - Status of colorband ramp for Material's specular color.  This is a read-only bit. 
  65                  - TANGENTSTR   - Uses direction of strands as normal for tangent-shading. 
  66                  - TRANSPSHADOW - Lets Material receive transparent shadows based on material color and alpha. 
  67                  - FULLOSA      - Force rendering of all OSA samples. 
  68                  - TANGENT_V    - Use the tangent vector in V direction for shading 
  69                  - NMAP_TS      - Tangent space normal mapping. 
  70                  - GROUP_EXCLUSIVE       - Light from this group even if the lights are on a hidden Layer. 
  71   
  72  @type ShadeModes: readonly dictionary 
  73  @var ShadeModes: The available Material Shade Modes. 
  74                  - CUBIC    - Use cubic interpolation of diffuse values, for smoother transitions. 
  75                  - OBCOLOR  - Modulate result with a per object color. 
  76   
  77  @type Shaders: readonly dictionary 
  78  @var Shaders: The available Material Shaders. 
  79                  - DIFFUSE_LAMBERT    - Make Material use the lambert diffuse shader. 
  80                  - DIFFUSE_ORENNAYAR       - Make Material use the Oren-Nayer diffuse shader. 
  81                  - DIFFUSE_TOON    - Make Material use the toon diffuse shader. 
  82                  - DIFFUSE_MINNAERT  - Make Material use the minnaert diffuse shader. 
  83                  - SPEC_COOKTORR   - Make Material use the Cook-Torr specular shader. 
  84                  - SPEC_PHONG   - Make Material use the Phong specular shader. 
  85                  - SPEC_BLINN         - Make Material use the Blinn specular shader. 
  86                  - SPEC_TOON      - Make Material use the toon specular shader. 
  87                  - SPEC_WARDISO      - Make Material use the Ward-iso specular shader. 
  88   
  89  @type ColorbandMethod: readonly dictionary 
  90  @var ColorbandMethod: The available Colorband mixing methods. 
  91                  - ADD  - Make Material use the Add method. 
  92                  - BLEND  - Make Material use the Blend/Mix method. 
  93                  - BURN  - Make Material use the Burn method. 
  94                  - COLOR  - Make Material use the Color method. 
  95                  - DARK  - Make Material use the Darken method. 
  96                  - DIFF  - Make Material use the Difference method. 
  97                  - DIV  - Make Material use the Divide method. 
  98                  - DODGE  - Make Material use the Dodge method. 
  99                  - HUE  - Make Material use the Hue method. 
 100                  - LIGHT  - Make Material use the Lighten method. 
 101                  - MIX  - Make Material use the Blend/Mix method. 
 102                  - MULT  - Make Material use the Multiply method. 
 103                  - OVERLAY  - Make Material use the Overlay method. 
 104                  - SAT  - Make Material use the Saturation method. 
 105                  - SCREEN  - Make Material use the Screen method. 
 106                  - SUB  - Make Material use the Substract method. 
 107                  - VAL  - Make Material use the Value method. 
 108   
 109  @type ColorbandInput: readonly dictionary 
 110  @var ColorbandInput: The available Colorband Input sources. 
 111                  - ENERGY  - Make Material use the Energy input. 
 112                  - NORMAL  - Make Material use the Normal input. 
 113                  - RESULT  - Make Material use the Result input. 
 114                  - SHADER  - Make Material use the Shader input. 
 115   
 116   
 117  """ 
 118   
119 -def New (name = 'Mat'):
120 """ 121 Create a new Material object. 122 @type name: string 123 @param name: The Material name. 124 @rtype: Blender Material 125 @return: The created Material object. 126 """
127
128 -def Get (name = None):
129 """ 130 Get the Material object(s) from Blender. 131 @type name: string 132 @param name: The name of the Material. 133 @rtype: Blender Material or a list of Blender Materials 134 @return: It depends on the 'name' parameter: 135 - (name): The Material object with the given name; 136 - (): A list with all Material objects in the current scene. 137 """
138
139 -class Material:
140 """ 141 The Material object 142 =================== 143 This object gives access to Materials in Blender. 144 @ivar B: Diffuse color (L{rgbCol}) blue component. 145 Value is clamped to the range [0.0,1.0]. 146 @type B: float 147 @ivar G: Diffuse color (L{rgbCol}) green component. 148 Value is clamped to the range [0.0,1.0]. 149 @type G: float 150 @ivar IOR: Angular index of refraction for raytrace. 151 Value is clamped to the range [1.0,3.0]. 152 @type IOR: float 153 @ivar R: Diffuse color (L{rgbCol}) red component. 154 Value is clamped to the range [0.0,1.0]. 155 @type R: float 156 @ivar add: Strength of the add effect. 157 Value is clamped to the range [0.0,1.0]. 158 @type add: float 159 @ivar alpha: Alpha (translucency) component of the material. 160 Value is clamped to the range [0.0,1.0]. 161 @type alpha: float 162 @ivar shadAlpha: Shadow Alpha for irregular shadow buffer. 163 Value is clamped to the range [0.0,1.0]. 164 @type shadAlpha: float 165 @ivar amb: Amount of global ambient color material receives. 166 Value is clamped to the range [0.0,1.0]. 167 @type amb: float 168 @ivar diffuseDarkness: Material's diffuse darkness ("Minnaert" diffuse shader only). 169 Value is clamped to the range [0.0,2.0]. 170 @type diffuseDarkness: float 171 @ivar diffuseShader: Diffuse shader type (see L{Shaders}). 172 Value must be in the range [0,3]. 173 @type diffuseShader: int 174 @ivar diffuseSize: Material's diffuse area size ("Toon" diffuse shader only). 175 Value is clamped to the range [0.0,3.14]. 176 @type diffuseSize: float 177 @ivar diffuseSmooth: Material's diffuse area smoothing ("Toon" diffuse shader only). 178 Value is clamped to the range [0.0,1.0]. 179 @type diffuseSmooth: float 180 @ivar emit: Amount of light the material emits. 181 Value is clamped to the range [0.0,1.0]. 182 @type emit: float 183 @ivar filter: Amount of filtering when transparent raytrace is enabled. 184 Value is clamped to the range [0.0,1.0]. 185 @type filter: float 186 @ivar flareBoost: Flare's extra strength. 187 Value is clamped to the range [0.1,1.0]. 188 @type flareBoost: float 189 @ivar flareSeed: Offset in the flare seed table. 190 Value is clamped to the range [1,255]. 191 @type flareSeed: int 192 @ivar flareSize: Ratio of flare size to halo size. 193 Value is clamped to the range [0.1,25.0]. 194 @type flareSize: float 195 @ivar fresnelDepth: Power of Fresnel for mirror reflection. 196 Value is clamped to the range [0.0,5.0]. 197 @type fresnelDepth: float 198 @ivar fresnelDepthFac: Blending factor for Fresnel mirror. 199 Value is clamped to the range [1.0,5.0]. 200 @type fresnelDepthFac: float 201 @ivar fresnelTrans: Power of Fresnel for transparency. 202 Value is clamped to the range [0.0,5.0]. 203 @type fresnelTrans: float 204 @ivar fresnelTransFac: Blending factor for Fresnel transparency. 205 Value is clamped to the range [1.0,5.0]. 206 @type fresnelTransFac: float 207 @ivar rbFriction: Rigid Body Friction coefficient. 208 Value is clamped to the range [0.0,100.0]. 209 @type rbFriction: float 210 @ivar rbRestitution: Rigid Body Friction restitution. 211 Value is clamped to the range [0.0,1.0]. 212 @type rbRestitution: float 213 @ivar haloSeed: Randomizes halo ring dimension and line location. 214 Value is clamped to the range [1,255]. 215 @type haloSeed: int 216 @ivar haloSize: Dimension of the halo. 217 Value is clamped to the range [0.0,100.0]. 218 @type haloSize: float 219 @ivar hard: Hardness of the specularity. 220 Value is clamped to the range [1,511]. 221 @type hard: int 222 @ivar ipo: Material Ipo data. 223 Contains the Ipo if one is assigned to the object, None otherwise. Setting to None clears the current Ipo. 224 @type ipo: Blender Ipo 225 226 @ivar mirCol: Mirror RGB color triplet. 227 Components are clamped to the range [0.0,1.0]. 228 @type mirCol: list of 3 floats 229 @ivar mirB: Mirror color (L{mirCol}) blue component. 230 Value is clamped to the range [0.0,1.0]. 231 @type mirB: float 232 @ivar mirG: Mirror color (L{mirCol}) green component. 233 Value is clamped to the range [0.0,1.0]. 234 @type mirG: float 235 @ivar mirR: Mirror color (L{mirCol}) red component. 236 Value is clamped to the range [0.0,1.0]. 237 @type mirR: float 238 239 @ivar sssCol: SubSsurface scattering RGB color triplet. 240 Components are clamped to the range [0.0,1.0]. 241 @type sssCol: list of 3 floats 242 @ivar sssB: SubSsurface scattering color (L{sssCol}) blue component. 243 Value is clamped to the range [0.0,1.0]. 244 @type sssB: float 245 @ivar sssG: SubSsurface scattering color (L{sssCol}) green component. 246 Value is clamped to the range [0.0,1.0]. 247 @type sssG: float 248 @ivar sssR: SubSsurface scattering color (L{sssCol}) red component. 249 Value is clamped to the range [0.0,1.0]. 250 @type sssR: float 251 252 @ivar mode: Mode mode bitfield. See L{the Modes dictionary<Modes>} keys and descriptions. 253 @type mode: int 254 @ivar shadeMode: Shade mode bitfield. See L{the ShadeModes dictionary<ShadeModes>} keys and descriptions. 255 @type shadeMode: int 256 @ivar nFlares: Number of subflares with halo. 257 Value is clamped to the range [1,32]. 258 @type nFlares: int 259 @ivar nLines: Number of star-shaped lines with halo. 260 Value is clamped to the range [0,250]. 261 @type nLines: int 262 @ivar nRings: Number of rings with halo. 263 Value is clamped to the range [0,24]. 264 @type nRings: int 265 @ivar nStars: Number of star points with halo. 266 Value is clamped to the range [3,50]. 267 @type nStars: int 268 @ivar oopsLoc: Material OOPs location. Returns None if material not found in list. 269 @type oopsLoc: list of 2 floats 270 @ivar oopsSel: Material OOPs selection flag. 271 Value must be in the range [0,1]. 272 @type oopsSel: int 273 @ivar rayMirr: Mirror reflection amount for raytrace. 274 Value is clamped to the range [0.0,1.0]. 275 @type rayMirr: float 276 @ivar glossMir: Amount of reflection glossy. 277 Value is clamped to the range [0.0,1.0]. 278 @type glossMir: float 279 @ivar sampGloss_mir: Reflection glossy samples. 280 Value is clamped to the range [1,1024]. 281 @type sampGloss_mir: int 282 @ivar glossTra: Amount of refraction glossy. 283 Value is clamped to the range [0.0,1.0]. 284 @type glossTra: float 285 @ivar sampGlossTra: Refraction glossy samples. 286 Value is clamped to the range [1,1024]. 287 @type sampGlossTra: int 288 @ivar anisotropy: The shape of the reflection, from 0.0 (circular) to 1.0 (fully stretched along the tangent). 289 Value is clamped to the range [0.0,1.0]. 290 @type anisotropy: float 291 @ivar threshMir: Threshold below which reflections will not be computed. 292 Value is clamped to the range [0.0,1.0]. 293 @type threshMir: float 294 @ivar threshTra: threshold below which refractions will not be computed. 295 Value is clamped to the range [0.0,1.0]. 296 @type threshTra: float 297 @ivar rayMirrDepth: Amount of raytrace inter-reflections. 298 Value is clamped to the range [0,10]. 299 @type rayMirrDepth: int 300 @ivar ref: Amount of reflections (for shader). 301 Value is clamped to the range [0.0,1.0]. 302 @type ref: float 303 @ivar refracIndex: Material's Index of Refraction (applies to the "Blinn" Specular Shader only. 304 Value is clamped to the range [1.0,10.0]. 305 @type refracIndex: float 306 @ivar rgbCol: Diffuse RGB color triplet. 307 Components are clamped to the range [0.0,1.0]. 308 @type rgbCol: list of 3 floats 309 @ivar rms: Material's surface slope standard deviation ("WardIso" specular shader only). 310 Value is clamped to the range [0.0,0.4]. 311 @type rms: float 312 @ivar roughness: Material's roughness ("Oren Nayar" diffuse shader only). 313 Value is clamped to the range [0.0,3.14]. 314 @type roughness: float 315 @ivar spec: Degree of specularity. 316 Value is clamped to the range [0.0,2.0]. 317 @type spec: float 318 @ivar specB: Specular color (L{specCol}) blue component. 319 Value is clamped to the range [0.0,1.0]. 320 @type specB: float 321 @ivar specCol: Specular RGB color triplet. 322 Components are clamped to the range [0.0,1.0]. 323 @type specCol: list of 3 floats 324 @ivar specG: Specular color (L{specCol}) green component. 325 Value is clamped to the range [0.0,1.0]. 326 @type specG: float 327 @ivar specR: Specular color (L{specCol}) red component. 328 Value is clamped to the range [0.0,1.0]. 329 @type specR: float 330 @ivar specShader: Specular shader type. See L{Shaders}. 331 Value must be in the range [0,4]. 332 @type specShader: int 333 @ivar specSize: Material's specular area size ("Toon" specular shader only). 334 Value is clamped to the range [0.0,1.53]. 335 @type specSize: float 336 @ivar specSmooth: Sets the smoothness of specular toon area. 337 Value is clamped to the range [0.0,1.0]. 338 @type specSmooth: float 339 @ivar specTransp: Makes specular areas opaque on transparent materials. 340 Value is clamped to the range [0.0,1.0]. 341 @type specTransp: float 342 @ivar subSize: Dimension of subflares, dots and circles. 343 Value is clamped to the range [0.1,25.0]. 344 @type subSize: float 345 @ivar transDepth: calculated maximal. Amount of refractions for raytrace. 346 Value is clamped to the range [0,10]. 347 @type transDepth: int 348 @ivar translucency: Amount of diffuse shading of the back side. 349 Value is clamped to the range [0.0,1.0]. 350 @type translucency: float 351 @ivar zOffset: Artificial offset in the Z buffer (for Ztransp option). 352 Value is clamped to the range [0.0,10.0]. 353 @type zOffset: float 354 @ivar lightGroup: Limits lights that affect this material to a group. 355 @type lightGroup: Group or None 356 @ivar uvlayer: The uv layer name to use, when UV mapping is enabled. 357 @type uvlayer: string 358 @ivar colorband: Material colorband, a list of colors, 359 each color a list of 5 floats [0 - 1], [r,g,b,a,pos]. 360 The colorband can have between 1 and 31 colors. 361 @type colorband: list 362 363 @ivar colorbandDiffuse: Material colorband, a list of colors, 364 each color a list of 5 floats [0 - 1], [r,g,b,a,pos]. 365 The colorband can have between 1 and 31 colors. 366 @type colorbandDiffuse: list 367 @ivar colorbandSpecular: Material colorband, a list of colors, 368 each color a list of 5 floats [0 - 1], [r,g,b,a,pos]. 369 The colorband can have between 1 and 31 colors. 370 @type colorbandSpecular: list 371 @ivar colorbandDiffuseInput: Material Diffuse colorband input. 372 The integer result must be compared with L{ColorbandInput} 373 dictionary. 374 @type colorbandDiffuseInput: int 375 @ivar colorbandDiffuseMethod: Material Diffuse colorband method. 376 The integer result must be compared with L{ColorbandMethod} 377 dictionary. 378 @type colorbandDiffuseMethod: int 379 @ivar colorbandDiffuseFactor: Material Diffuse colorband factor. 380 Value is clamped to the range [0.0,1.0]. 381 @type colorbandDiffuseFactor: float 382 @ivar colorbandSpecularInput: Material Specular colorband input. 383 The integer result must be compared with L{ColorbandInput} 384 dictionary. 385 @type colorbandSpecularInput: int 386 @ivar colorbandSpecularMethod: Material Specular colorband method. 387 The integer result must be compared with L{ColorbandMethod} 388 dictionary. 389 @type colorbandSpecularMethod: int 390 @ivar colorbandSpecularFactor: Material Specular colorband factor. 391 Value is clamped to the range [0.0,1.0]. 392 @type colorbandSpecularFactor: float 393 @type enabledTextures: list of integers 394 @ivar enabledTextures: The texture channels enabled in this material. 395 The attribute returns is list of integers in the range [0, 9], each 396 number representing the respective enabled MTex entry (see 397 L{getTextures()<getTextures>}). Enabling is done by assigning 398 a list of ints or an empty list. Attempting to enable a channel 399 which does not have a texture assigned to it will result in a 400 ValueError exception. 401 Example:: 402 mat.enabledTextures = [] # no texture channels are enabled 403 mat.enabledTextures = [0, 6] # texture channels 0 and 6 are enabled 404 ch = mat.enabledTextures 405 ch.append(4) 406 mat.enabledTextures = ch 407 print mat.enabledTextures # will print: [0, 4, 6] 408 409 @type textures: a tuple of Blender MTex objects. 410 @ivar textures: the Material's Texture list. Empty texture channels contains None. 411 @ivar strandTanShad: Uses direction of strands as normal for tangent-shading 412 @type strandTanShad: int 413 @ivar strandSurfDiff: Make diffuse shading more similar to shading the surface 414 @type strandSurfDiff: int 415 @ivar strandDist: Distance in Blender units over which to blend in the surface normal 416 @type strandDist: float 417 @ivar strandBlendUnit: Use actual Blender units for widths instead of pixels 418 @type strandBlendUnit: int 419 @ivar strandStart: Start size of strands 420 @type strandStart: float 421 @ivar strandEnd: End size of strands 422 @type strandEnd: float 423 @ivar strandMin: Minimum size of strands in pixels 424 @type strandMin: float 425 @ivar strandShape: Shape of strands, positive value makes it rounder, negative makes it spiky 426 @type strandShape: float 427 @ivar strandFade: Transparency along the width of the strand 428 @type strandFade: float 429 @ivar enableSSS: If True, subsurface scattering will be rendered on this material. 430 @type enableSSS: bool 431 @ivar sssScale: If True, subsurface scattering will be rendered on this material. 432 Value is clamped to the range [0.1,1000.0]. 433 @type sssScale: bool 434 @ivar sssRadiusRed: Mean red scattering path length. 435 Value is clamped to the range [0.0,10000.0]. 436 @type sssRadiusRed: float 437 @ivar sssRadiusGreen: Mean green scattering path length. 438 Value is clamped to the range [0.0,10000.0]. 439 @type sssRadiusGreen: float 440 @ivar sssRadiusBlue: Mean blue scattering path length. 441 Value is clamped to the range [0.0,10000.0]. 442 @type sssRadiusBlue: float 443 @ivar sssIOR: Refraction index. 444 Value is clamped to the range [0.1,2.0]. 445 @type sssIOR: float 446 @ivar sssError: Error allowance for the calculation (a low value is slower). 447 Value is clamped to the range [0.0,10.0]. 448 @type sssError: float 449 @ivar sssColorBlend: Blend factor for SSS colors. 450 Value is clamped to the range [0.0,1.0]. 451 @type sssColorBlend: float 452 @ivar sssTextureScatter: Texture scattering factor. 453 Value is clamped to the range [0.0,1.0]. 454 @type sssTextureScatter: float 455 @ivar sssFront: Front scattering weight. 456 Value is clamped to the range [0.0,2.0]. 457 @type sssFront: float 458 @ivar sssBack: Back scattering weight 459 Value is clamped to the range [0.0,10.0]. 460 @type sssBack: float 461 462 @warning: Most member variables assume values in some [Min, Max] interval. 463 When trying to set them, the given parameter will be clamped to lie in 464 that range: if val < Min, then val = Min, if val > Max, then val = Max. 465 466 """ 467
468 - def getName():
469 """ 470 Get the name of this Material object. 471 @rtype: string 472 """
473
474 - def setName(name):
475 """ 476 Set the name of this Material object. 477 @type name: string 478 @param name: The new name. 479 """
480
481 - def getIpo():
482 """ 483 Get the Ipo associated with this material, if any. 484 @rtype: Ipo 485 @return: the wrapped ipo or None. 486 """
487
488 - def setIpo(ipo):
489 """ 490 Link an ipo to this material. 491 @type ipo: Blender Ipo 492 @param ipo: a material type ipo. 493 """
494
495 - def clearIpo():
496 """ 497 Unlink the ipo from this material. 498 @return: True if there was an ipo linked or False otherwise. 499 """
500
501 - def insertIpoKey(keytype):
502 """ 503 Inserts keytype values in material ipo at curframe. Uses module constants. 504 @type keytype: Integer 505 @param keytype: 506 -RGB 507 -ALPHA 508 -HALOSIZE 509 -MODE 510 -ALLCOLOR 511 -ALLMIRROR 512 -OFS 513 -SIZE 514 -ALLMAPPING 515 @return: py_none 516 """
517
518 - def getMode():
519 """ 520 Get this Material's mode flags. 521 @rtype: int 522 @return: B{OR'ed value}. Use the Modes dictionary to check which flags 523 are 'on'. 524 525 Example:: 526 import Blender 527 from Blender import Material 528 flags = mymat.getMode() 529 if flags & Material.Modes['HALO']: 530 print "This material is rendered as a halo" 531 else: 532 print "Not a halo" 533 """
534
535 - def setMode(param, stringN=None):
536 """ 537 Set this Material's mode flags. Up to 22 mode strings can be given 538 and specify the modes which are turned 'on'. Those not provided are 539 turned 'off', so mat.setMode() -- without arguments -- turns off all 540 mode flags for Material mat. Valid mode strings are "Traceable", 541 "Shadow", "Shadeless", "Wire", "VColLight", "VColPaint", "Halo", 542 "ZTransp", "ZInvert", "HaloRings", "HaloLines", "OnlyShadow", 543 "HaloXAlpha", "HaloStar", "TexFace", "HaloTex", "HaloPuno", "NoMist", 544 "HaloShaded", "HaloFlare", "Radio", "RayMirr", "ZTransp", "RayTransp", 545 "Env" 546 547 An integer can also be given, which directly sets the mode flag. The 548 Modes dictionary keys can (and should) be added or ORed to specify 549 which modes to turn 'on'. The value returned from getMode() can 550 also be modified and input to this method. 551 552 @type param: string, None or int 553 @param param: A mode value (int) or flag (string). Can also be None. 554 @type stringN: string 555 @param stringN: A mode flag. Up to 22 flags can be set at the same time. 556 """
557
558 - def getRGBCol():
559 """ 560 Get the rgb color triplet sequence. 561 @rtype: list of 3 floats 562 @return: [r, g, b] 563 """
564
565 - def setRGBCol(rgb = None):
566 """ 567 Set the rgb color triplet sequence. If B{rgb} is None, set the color to black. 568 @type rgb: three floats or a list of three floats 569 @param rgb: The rgb color values in [0.0, 1.0] as: 570 - a list of three floats: setRGBCol ([r, g, b]) B{or} 571 - three floats as separate parameters: setRGBCol (r,g,b). 572 """
573
574 - def getSpecCol():
575 """ 576 Get the specular color triplet sequence. 577 @rtype: list of 3 floats 578 @return: [specR, specG, specB] 579 """
580
581 - def setSpecCol(rgb = None):
582 """ 583 Set the specular color triplet sequence. If B{rgb} is None, set the color to black. 584 @type rgb: three floats or a list of three floats 585 @param rgb: The rgb color values in [0.0, 1.0] as: 586 - a list of three floats: setSpecCol ([r, g, b]) B{or} 587 - three floats as separate parameters: setSpecCol (r,g,b). 588 """
589
590 - def getMirCol():
591 """ 592 Get the mirror color triplet sequence. 593 @rtype: list of 3 floats 594 @return: [mirR, mirG, mirb] 595 """
596
597 - def setMirCol(rgb = None):
598 """ 599 Set the mirror color triplet sequence. If B{rgb} is None, set the color to black. 600 @type rgb: three floats or a list of three floats 601 @param rgb: The rgb color values in [0.0, 1.0] as: 602 - a list of three floats: setMirCol ([r, g, b]) B{or} 603 - three floats as separate parameters: setMirCol (r,g,b). 604 """
605
606 - def getAlpha():
607 """ 608 Get the alpha (transparency) value. 609 @rtype: float 610 """
611
612 - def setAlpha(alpha):
613 """ 614 Set the alpha (transparency) value. 615 @type alpha: float 616 @param alpha: The new value in [0.0, 1.0]. 617 """
618
619 - def getAmb():
620 """ 621 Get the ambient color blend factor. 622 @rtype: float 623 """
624
625 - def setAmb(amb):
626 """ 627 Set the ambient color blend factor. 628 @type amb: float 629 @param amb: The new value in [0.0, 1.0]. 630 """
631
632 - def getEmit():
633 """ 634 Get the emitting light intensity. 635 @rtype: float 636 """
637
638 - def setEmit(emit):
639 """ 640 Set the emitting light intensity. 641 @type emit: float 642 @param emit: The new value in [0.0, 1.0]. 643 """
644
645 - def getRef():
646 """ 647 Get the reflectivity value. 648 @rtype: float 649 """
650
651 - def setRef(ref):
652 """ 653 Set the reflectivity value. 654 @type ref: float 655 @param ref: The new value in [0.0, 1.0]. 656 """
657
658 - def getSpec():
659 """ 660 Get the specularity value. 661 @rtype: float 662 """
663
664 - def setSpec(spec):
665 """ 666 Set the specularity value. 667 @type spec: float 668 @param spec: The new value in [0.0, 2.0]. 669 """
670
671 - def getSpecTransp():
672 """ 673 Get the specular transparency. 674 @rtype: float 675 """
676
677 - def setSpecTransp(spectransp):
678 """ 679 Set the specular transparency. 680 @type spectransp: float 681 @param spectransp: The new value in [0.0, 1.0]. 682 """
683
684 - def setSpecShader(specShader):
685 """ 686 Set the material's specular shader from one of the shaders in Material.Shaders dict. 687 @type specShader: int 688 @param specShader: The new value in [0, 4]. 689 """
690
691 - def getSpecShader(specShader):
692 """ 693 Get the material's specular shader from one of the shaders in Material.Shaders dict. 694 @rtype: int 695 """
696
697 - def setDiffuseShader(diffuseShader):
698 """ 699 Set the material's diffuse shader from one of the shaders in Material.Shaders dict. 700 @type diffuseShader: int 701 @param diffuseShader: The new value in [0, 3]. 702 """
703
704 - def getDiffuseShader():
705 """ 706 Get the material's diffuse shader from one of the shaders in Material.Shaders dict. 707 @rtype: int 708 """
709
710 - def setRoughness(roughness):
711 """ 712 Set the material's roughness (applies to the \"Oren Nayar\" Diffuse Shader only) 713 @type roughness: float 714 @param roughness: The new value in [0.0, 3.14]. 715 """
716
717 - def getRoughness():
718 """ 719 Get the material's roughness (applies to the \"Oren Nayar\" Diffuse Shader only) 720 @rtype: float 721 """
722
723 - def setSpecSize(specSize):
724 """ 725 Set the material's size of specular area (applies to the \"Toon\" Specular Shader only) 726 @type specSize: float 727 @param specSize: The new value in [0.0, 1.53]. 728 """
729
730 - def getSpecSize():
731 """ 732 Get the material's size of specular area (applies to the \"Toon\" Specular Shader only) 733 @rtype specSize: float 734 """
735
736 - def setSpecSize(diffuseSize):
737 """ 738 Set the material's size of diffuse area (applies to the \"Toon\" Diffuse Shader only) 739 @type diffuseSize: float 740 @param diffuseSize: The new value in [0.0, 3.14]. 741 """
742
743 - def getSpecSize():
744 """ 745 Get the material's size of diffuse area (applies to the \"Toon\" Diffuse Shader only) 746 @rtype: float 747 """
748
749 - def setSpecSmooth(specSmooth):
750 """ 751 Set the material's smoothing of specular area (applies to the \"Toon\" Specular Shader only) 752 @type specSmooth: float 753 @param specSmooth: The new value in [0.0, 1.0]. 754 """
755
756 - def getSpecSmooth():
757 """ 758 Get the material's smoothing of specular area (applies to the \"Toon\" Specular Shader only) 759 @rtype: float 760 """
761
762 - def setDiffuseSmooth(diffuseSmooth):
763 """ 764 Set the material's smoothing of diffuse area (applies to the \"Toon\" Diffuse Shader only) 765 @type diffuseSmooth: float 766 @param diffuseSmooth: The new value in [0.0, 1.0]. 767 """
768
769 - def getDiffuseSmooth():
770 """ 771 Get the material's smoothing of diffuse area (applies to the \"Toon\" Diffuse Shader only) 772 @rtype: float 773 """
774
775 - def setDiffuseDarkness(diffuseDarkness):
776 """ 777 Set the material's diffuse darkness (applies to the \"Minnaert\" Diffuse Shader only) 778 @type diffuseDarkness: float 779 @param diffuseDarkness: The new value in [0.0, 2.0]. 780 """
781
782 - def getDiffuseDarkness():
783 """ 784 Get the material's diffuse darkness (applies to the \"Minnaert\" Diffuse Shader only) 785 @rtype: float 786 """
787
788 - def setRefracIndex(refracIndex):
789 """ 790 Set the material's Index of Refraction (applies to the \"Blinn\" Specular Shader only) 791 @type refracIndex: float 792 @param refracIndex: The new value in [1.0, 10.0]. 793 """
794
795 - def getRefracIndex():
796 """ 797 Get the material's Index of Refraction (applies to the \"Blinn\" Specular Shader only) 798 @rtype: float 799 """
800
801 - def setRms(rms):
802 """ 803 Set the material's standard deviation of surface slope (applies to the \"WardIso\" Specular Shader only) 804 @type rms: float 805 @param rms: The new value in [0.0, 0.4]. 806 """
807
808 - def getRms():
809 """ 810 Get the material's standard deviation of surface slope (applies to the \"WardIso\" Specular Shader only) 811 @rtype: float 812 """
813
814 - def setFilter(filter):
815 """ 816 Set the material's amount of filtering when transparent raytrace is enabled 817 @type filter: float 818 @param filter: The new value in [0.0, 1.0]. 819 """
820
821 - def getFilter():
822 """ 823 Get the material's amount of filtering when transparent raytrace is enabled 824 @rtype: float 825 """
826
827 - def setTranslucency(translucency):
828 """ 829 Set the material's amount of diffuse shading of the back side 830 @type translucency: float 831 @param translucency: The new value in [0.0, 1.0]. 832 """
833
834 - def getTranslucency():
835 """ 836 Get the material's amount of diffuse shading of the back side 837 @rtype: float 838 """
839
840 - def getAdd():
841 """ 842 Get the glow factor. 843 @rtype: float 844 """
845
846 - def setAdd(add):
847 """ 848 Set the glow factor. 849 @type add: float 850 @param add: The new value in [0.0, 1.0]. 851 """
852
853 - def getZOffset():
854 """ 855 Get the artificial offset for faces with this Material. 856 @rtype: float 857 """
858
859 - def setZOffset(zoffset):
860 """ 861 Set the artificial offset for faces with this Material. 862 @type zoffset: float 863 @param zoffset: The new value in [0.0, 10.0]. 864 """
865
866 - def getHaloSize():
867 """ 868 Get the halo size. 869 @rtype: float 870 """
871
872 - def setHaloSize(halosize):
873 """ 874 Set the halo size. 875 @type halosize: float 876 @param halosize: The new value in [0.0, 100.0]. 877 """
878
879 - def getHaloSeed():
880 """ 881 Get the seed for random ring dimension and line location in halos. 882 @rtype: int 883 """
884
885 - def setHaloSeed(haloseed):
886 """ 887 Set the seed for random ring dimension and line location in halos. 888 @type haloseed: int 889 @param haloseed: The new value in [0, 255]. 890 """
891
892 - def getFlareSize():
893 """ 894 Get the ratio: flareSize / haloSize. 895 @rtype: float 896 """
897
898 - def setFlareSize(flaresize):
899 """ 900 Set the ratio: flareSize / haloSize. 901 @type flaresize: float 902 @param flaresize: The new value in [0.1, 25.0]. 903 """
904
905 - def getFlareSeed():
906 """ 907 Get flare's offset in the seed table. 908 @rtype: int 909 """
910
911 - def setFlareSeed(flareseed):
912 """ 913 Set flare's offset in the seed table. 914 @type flareseed: int 915 @param flareseed: The new value in [0, 255]. 916 """
917
918 - def getFlareBoost():
919 """ 920 Get the flare's extra strength. 921 @rtype: float 922 """
923
924 - def setFlareBoost(flareboost):
925 """ 926 Set the flare's extra strength. 927 @type flareboost: float 928 @param flareboost: The new value in [0.1, 10.0]. 929 """
930
931 - def getSubSize():
932 """ 933 Get the dimension of subflare, dots and circles. 934 @rtype: float 935 """
936
937 - def setSubSize(subsize):
938 """ 939 Set the dimension of subflare, dots and circles. 940 @type subsize: float 941 @param subsize: The new value in [0.1, 25.0]. 942 """
943
944 - def getHardness():
945 """ 946 Get the hardness of the specularity. 947 @rtype: int 948 """
949
950 - def setHardness(hardness):
951 """ 952 Set the hardness of the specularity. 953 @type hardness: int 954 @param hardness: The new value in [1, 511]. 955 """
956
957 - def getNFlares():
958 """ 959 Get the number of halo subflares. 960 @rtype: int 961 """
962
963 - def setNFlares(nflares):
964 """ 965 Set the number of halo subflares. 966 @type nflares: int 967 @param nflares: The new value in [1, 32]. 968 """
969
970 - def getNStars():
971 """ 972 Get the number of points in the halo stars. 973 @rtype: int 974 """
975
976 - def setNStars(nstars):
977 """ 978 Set the number of points in the halo stars. 979 @type nstars: int 980 @param nstars: The new value in [3, 50]. 981 """
982
983 - def getNLines():
984 """ 985 Get the number of star shaped lines on each halo. 986 @rtype: int 987 """
988
989 - def setNLines(nlines):
990 """ 991 Set the number of star shaped lines on each halo. 992 @type nlines: int 993 @param nlines: The new value in [0, 250]. 994 """
995
996 - def getNRings():
997 """ 998 Get the number of rings on each halo. 999 @rtype: int 1000 """
1001
1002 - def setNRings(nrings):
1003 """ 1004 Set the number of rings on each halo. 1005 @type nrings: int 1006 @param nrings: The new value in [0, 24]. 1007 """
1008
1009 - def getRayMirr():
1010 """ 1011 Get amount mirror reflection for raytrace. 1012 @rtype: float 1013 """
1014
1015 - def setRayMirr(nrmirr):
1016 """ 1017 Set amount mirror reflection for raytrace. 1018 @type nrmirr: float 1019 @param nrmirr: The new value in [0.0, 1.0]. 1020 """
1021
1022 - def getRayMirrDepth():
1023 """ 1024 Get amount of inter-reflections calculated maximal. 1025 @rtype: int 1026 """
1027
1028 - def setRayMirrDepth(nrmirr):
1029 """ 1030 Set amount mirror reflection for raytrace. 1031 @type nrmirr: int 1032 @param nrmirr: The new value in [0.0, 1.0]. 1033 """
1034
1035 - def getFresnelMirr():
1036 """ 1037 Get power of Fresnel for mirror reflection. 1038 @rtype: float 1039 """
1040
1041 - def setFresnelMirr(nrmirr):
1042 """ 1043 Set power of Fresnel for mirror reflection. 1044 @type nrmirr: float 1045 @param nrmirr: The new value in [0.0, 1.0]. 1046 """
1047
1048 - def getFresnelMirrFac():
1049 """ 1050 Get the number of Ray Mirror. 1051 @rtype: float 1052 """
1053
1054 - def setFresnelMirrFac(nrmirr):
1055 """ 1056 Set the number of ray mirror 1057 @type nrmirr: float 1058 @param nrmirr: The new value in [0.0, 1.0]. 1059 """
1060
1061 - def getIOR():
1062 """ 1063 Get the angular index of refraction for raytrace. 1064 @rtype: float 1065 """
1066
1067 - def setIOR(nrmirr):
1068 """ 1069 Set the angular index of refraction for raytrace. 1070 @type nrmirr: float 1071 @param nrmirr: The new value in [0.0, 1.0]. 1072 """
1073
1074 - def getTransDepth():
1075 """ 1076 Get amount of refractions calculated maximal. 1077 @rtype: int 1078 """
1079
1080 - def setTransDepth(nrmirr):
1081 """ 1082 Set amount of refractions calculated maximal. 1083 @type nrmirr: int 1084 @param nrmirr: The new value in [0.0, 1.0]. 1085 """
1086
1087 - def getFresnelTrans():
1088 """ 1089 Get power of Fresnel for transparency. 1090 @rtype: float 1091 """
1092
1093 - def setFresnelTrans(nrmirr):
1094 """ 1095 Set power of Fresnel for transparency. 1096 @type nrmirr: float 1097 @param nrmirr: The new value in [0.0, 1.0]. 1098 """
1099
1100 - def getFresnelTransFac():
1101 """ 1102 Get blending factor for Fresnel. 1103 @rtype: float 1104 """
1105
1106 - def setFresnelTransFac(nrmirr):
1107 """ 1108 Set blending factor for Fresnel. 1109 @type nrmirr: float 1110 @param nrmirr: The new value in [0.0, 1.0]. 1111 """
1112
1113 - def setTexture(index, texture, texco, mapto):
1114 """ 1115 Assign a Blender Texture object to channel number 'number'. 1116 @type index: int 1117 @param index: material's texture index in [0, 9]. 1118 @type texture: Blender Texture 1119 @param texture: a Blender Texture object. 1120 @type texco: int 1121 @param texco: optional ORed bitflag -- defaults to TexCo.ORCO. See TexCo var in L{Texture}. 1122 @type mapto: int 1123 @param mapto: optional ORed bitflag -- defaults to MapTo.COL. See MapTo var in L{Texture}. 1124 """
1125
1126 - def clearTexture(index):
1127 """ 1128 Clear the ith (given by 'index') texture channel of this material. 1129 @type index: int 1130 @param index: material's texture channel index in [0, 9]. 1131 """
1132
1133 - def getTextures ():
1134 """ 1135 Get this Material's Texture list. 1136 @rtype: list of MTex 1137 @return: a list of Blender MTex objects. None is returned for each empty 1138 texture channel. 1139 """
1140 1150 1158 1167
1168 - def __copy__ ():
1169 """ 1170 Make a copy of this material 1171 @rtype: Material 1172 @return: a copy of this material 1173 """
1174
1175 - def freeNodes ():
1176 """ 1177 Removes the node tree from this material. 1178 @rtype: bool 1179 @return: true if nodes were freed from this material. 1180 """
1181 1182 import id_generics 1183 Material.__doc__ += id_generics.attributes 1184