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

Source Code for Module World

  1  # Blender.World module and the World PyType  
  2   
  3  """ 
  4  The Blender.World submodule 
  5   
  6  B{New}: L{World.clearScriptLinks} accepts a parameter now. 
  7   
  8  World 
  9  ===== 
 10   
 11  The module world allows you to access all the data of a Blender World. 
 12   
 13  Example:: 
 14          import Blender 
 15          w = Blender.Get('World') #assume there exists a world named "world" 
 16          print w.getName() 
 17          w.hor = [1,1,.2] 
 18          print w.getHor() 
 19   
 20  Example:: 
 21          import Blender 
 22          from Blender import * 
 23   
 24          AllWorlds = Blender.World.Get()  # returns a list of created world objects 
 25          AvailWorlds = len(AllWorlds)    #       returns the number of available world objects 
 26          PropWorld = dir(AllWorlds[0])   # returns the properties of the class world 
 27          NameWorld = AllWorlds[0].getName() # get name of the first world object 
 28   
 29          MiType = AllWorlds[0].getMistype()      # get kind of mist from the first world object 
 30          MiParam = AllWorlds[0].getMist()        # get the parameters intensity, start, end and height of the mist 
 31   
 32          HorColor = AllWorlds[0].getHor()        # horizon color of the first world object 
 33          HorColorR = HorColor[0]         # get the red channel (RGB) of the horizon color 
 34   
 35          ZenColor = AllWorlds[0].getZen()        # zenith color of the first world object 
 36          ZenColorB = ZenColor[2]         # get the blue channel (RGB) of the Zenith color 
 37   
 38          blending = AllWorlds[0].getSkytype() # get the blending modes (real, blend, paper) of the first world object     
 39  """ 
 40   
41 -def New (name):
42 """ 43 Creates a new World. 44 @type name: string 45 @param name: World's name (optional). 46 @rtype: Blender World 47 @return: The created World. If the "name" parameter has not been provided, it will be automatically be set by blender. 48 """
49
50 -def Get (name):
51 """ 52 Get an World from Blender. 53 @type name: string 54 @param name: The name of the world to retrieve. 55 @rtype: Blender World or a list of Blender Worlds 56 @return: 57 - (name): The World corresponding to the name 58 - (): A list with all Worlds in the current scene. 59 """
60 61
62 -def GetCurrent ():
63 """ 64 Get the active world of the scene. 65 @rtype: Blender World or None 66 """
67
68 -class World:
69 """ 70 The World object 71 ================ 72 This object gives access to generic data from all worlds in Blender. 73 Its attributes depend upon its type. 74 75 @ivar skytype: type of the sky. Bit 0 : Blend; Bit 1 : Real; Bit 2 : paper. 76 @ivar mode: 77 @ivar mistype: type of mist : O : quadratic; 1 : linear; 2 : square 78 @ivar hor: the horizon color of a world object. 79 @ivar zen: the zenith color of a world object. 80 @ivar amb: the ambient color of a world object. 81 @ivar star: the star parameters of a world object. See getStar for the semantics of these parameters. 82 @ivar mist: the mist parameters of a world object. See getMist for the semantics of these parameters. 83 @type ipo: Blender Ipo 84 @ivar ipo: The world type ipo linked to this world object. 85 @type textures: a tuple of Blender MTex objects. 86 @ivar textures: The World's texture list. Empty texture channels contains None. 87 """ 88
89 - def getRange():
90 """ 91 Retrieves the range parameter of a world object. 92 @rtype: float 93 @return: the range 94 """
95
96 - def setRange(range):
97 """ 98 Sets the range parameter of a world object. 99 @type range: float 100 @param range: the new range parameter 101 @rtype: None 102 @return: None 103 """
104
105 - def getName():
106 """ 107 Retrieves the name of a world object 108 @rtype: string 109 @return: the name of the world object. 110 """
111
112 - def setName(name):
113 """ 114 Sets the name of a world object. 115 @type name: string 116 @param name : the new name. 117 @rtype: None 118 @return: None 119 """
120
121 - def getIpo():
122 """ 123 Get the Ipo associated with this world object, if any. 124 @rtype: Ipo 125 @return: the wrapped ipo or None. 126 """
127
128 - def setIpo(ipo):
129 """ 130 Link an ipo to this world object. 131 @type ipo: Blender Ipo 132 @param ipo: a "camera data" ipo. 133 """
134
135 - def clearIpo():
136 """ 137 Unlink the ipo from this world object. 138 @return: True if there was an ipo linked or False otherwise. 139 """
140
141 - def getSkytype():
142 """ 143 Retrieves the skytype of a world object. 144 The skytype is a combination of 3 bits : Bit 0 : Blend; Bit 1 : Real; Bit 2 : paper. 145 @rtype: int 146 @return: the skytype of the world object. 147 """
148
149 - def setSkytype(skytype):
150 """ 151 Sets the skytype of a world object. 152 See getSkytype for the semantics of the parameter. 153 @type skytype: int 154 @param skytype : the new skytype. 155 @rtype: None 156 @return: None 157 """
158
159 - def getMode():
160 """ 161 Retrieves the mode of a world object. 162 The mode is a combination of 5 bits: 163 - Bit 0 : mist simulation 164 - Bit 1 : starfield simulation 165 - Bit 2,3 : reserved 166 - Bit 4 : ambient occlusion 167 @rtype: int 168 @return: the mode of the world object. 169 """
170
171 - def setMode(mode):
172 """ 173 Sets the mode of a world object. 174 See getMode for the semantics of the parameter. 175 @type mode: int 176 @param mode : the new mode. 177 @rtype: None 178 @return: None 179 """
180
181 - def getMistype():
182 """ 183 Retrieves the mist type of a world object. 184 The mist type is an integer 0 : quadratic; 1 : linear; 2 : square. 185 @rtype: int 186 @return: the mistype of the world object. 187 """
188
189 - def setMistype(mistype):
190 """ 191 Sets the mist type of a world object. 192 See getMistype for the semantics of the parameter. 193 @type mistype: int 194 @param mistype : the new mist type. 195 @rtype: None 196 @return: None 197 """
198
199 - def getHor():
200 """ 201 Retrieves the horizon color of a world object. 202 This color is a list of 3 floats. 203 @rtype: list of three floats 204 @return: the horizon color of the world object. 205 """
206
207 - def setHor(hor):
208 """ 209 Sets the horizon color of a world object. 210 @type hor: list of three floats 211 @param hor : the new hor. 212 @rtype: None 213 @return: None 214 """
215
216 - def getZen():
217 """ 218 Retrieves the zenith color of a world object. 219 This color is a list of 3 floats. 220 @rtype: list of three floats 221 @return: the zenith color of the world object. 222 """
223
224 - def setZen(zen):
225 """ 226 Sets the zenith color of a world object. 227 @type zen: list of three floats 228 @param zen : the new zenith color. 229 @rtype: None 230 @return: None 231 """
232
233 - def getAmb():
234 """ 235 Retrieves the ambient color of a world object. 236 This color is a list of 3 floats. 237 @rtype: list of three floats 238 @return: the ambient color of the world object. 239 """
240
241 - def setAmb(amb):
242 """ 243 Sets the ambient color of a world object. 244 @type amb: list of three floats 245 @param amb : the new ambient color. 246 @rtype: None 247 @return: None 248 """
249
250 - def getStar():
251 """ 252 Retrieves the star parameters of a world object. 253 It is a list of nine floats : 254 red component of the color 255 green component of the color 256 blue component of the color 257 size of the stars 258 minimal distance between the stars 259 average distance between the stars 260 variations of the stars color 261 @rtype: list of nine floats 262 @return: the star parameters 263 """
264
265 - def setStar(star):
266 """ 267 Sets the star parameters of a world object. 268 See getStar for the semantics of the parameter. 269 @type star: list of 9 floats 270 @param star : the new star parameters. 271 @rtype: None 272 @return: None 273 """
274
275 - def getMist():
276 """ 277 Retrieves the mist parameters of a world object. 278 It is a list of four floats : 279 intensity of the mist 280 start of the mist 281 end of the mist 282 height of the mist 283 @rtype: list of four floats 284 @return: the mist parameters 285 """
286
287 - def setMist(mist):
288 """ 289 Sets the mist parameters of a world object. 290 See getMist for the semantics of the parameter. 291 @type mist: list of 4 floats 292 @param mist : the new mist parameters. 293 @rtype: None 294 @return: None 295 """
296 306 314 323
324 - def setCurrent ():
325 """ 326 Make this world active in the current scene. 327 @rtype: None 328 @return: None 329 """
330
331 - def insertIpoKey(keytype):
332 """ 333 Inserts keytype values in world ipo at curframe. Uses module constants. 334 @type keytype: Integer 335 @param keytype: 336 -ZENTIH 337 -HORIZON 338 -MIST 339 -STARS 340 -OFFSET 341 -SIZE 342 @return: py_none 343 """
344
345 - def __copy__ ():
346 """ 347 Make a copy of this world 348 @rtype: World 349 @return: a copy of this world 350 """
351 352 import id_generics 353 World.__doc__ += id_generics.attributes 354