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 @type gravity: float 88 @ivar gravity: World physics gravity setting between 0.0 and 25.0 89 """ 90
91 - def getRange():
92 """ 93 Retrieves the range parameter of a world object. 94 @rtype: float 95 @return: the range 96 """
97
98 - def setRange(range):
99 """ 100 Sets the range parameter of a world object. 101 @type range: float 102 @param range: the new range parameter 103 @rtype: None 104 @return: None 105 """
106
107 - def getName():
108 """ 109 Retrieves the name of a world object 110 @rtype: string 111 @return: the name of the world object. 112 """
113
114 - def setName(name):
115 """ 116 Sets the name of a world object. 117 @type name: string 118 @param name : the new name. 119 @rtype: None 120 @return: None 121 """
122
123 - def getIpo():
124 """ 125 Get the Ipo associated with this world object, if any. 126 @rtype: Ipo 127 @return: the wrapped ipo or None. 128 """
129
130 - def setIpo(ipo):
131 """ 132 Link an ipo to this world object. 133 @type ipo: Blender Ipo 134 @param ipo: a "camera data" ipo. 135 """
136
137 - def clearIpo():
138 """ 139 Unlink the ipo from this world object. 140 @return: True if there was an ipo linked or False otherwise. 141 """
142
143 - def getSkytype():
144 """ 145 Retrieves the skytype of a world object. 146 The skytype is a combination of 3 bits : Bit 0 : Blend; Bit 1 : Real; Bit 2 : paper. 147 @rtype: int 148 @return: the skytype of the world object. 149 """
150
151 - def setSkytype(skytype):
152 """ 153 Sets the skytype of a world object. 154 See getSkytype for the semantics of the parameter. 155 @type skytype: int 156 @param skytype : the new skytype. 157 @rtype: None 158 @return: None 159 """
160
161 - def getMode():
162 """ 163 Retrieves the mode of a world object. 164 The mode is a combination of 5 bits: 165 - Bit 0 : mist simulation 166 - Bit 1 : starfield simulation 167 - Bit 2,3 : reserved 168 - Bit 4 : ambient occlusion 169 @rtype: int 170 @return: the mode of the world object. 171 """
172
173 - def setMode(mode):
174 """ 175 Sets the mode of a world object. 176 See getMode for the semantics of the parameter. 177 @type mode: int 178 @param mode : the new mode. 179 @rtype: None 180 @return: None 181 """
182
183 - def getMistype():
184 """ 185 Retrieves the mist type of a world object. 186 The mist type is an integer 0 : quadratic; 1 : linear; 2 : square. 187 @rtype: int 188 @return: the mistype of the world object. 189 """
190
191 - def setMistype(mistype):
192 """ 193 Sets the mist type of a world object. 194 See getMistype for the semantics of the parameter. 195 @type mistype: int 196 @param mistype : the new mist type. 197 @rtype: None 198 @return: None 199 """
200
201 - def getHor():
202 """ 203 Retrieves the horizon color of a world object. 204 This color is a list of 3 floats. 205 @rtype: list of three floats 206 @return: the horizon color of the world object. 207 """
208
209 - def setHor(hor):
210 """ 211 Sets the horizon color of a world object. 212 @type hor: list of three floats 213 @param hor : the new hor. 214 @rtype: None 215 @return: None 216 """
217
218 - def getZen():
219 """ 220 Retrieves the zenith color of a world object. 221 This color is a list of 3 floats. 222 @rtype: list of three floats 223 @return: the zenith color of the world object. 224 """
225
226 - def setZen(zen):
227 """ 228 Sets the zenith color of a world object. 229 @type zen: list of three floats 230 @param zen : the new zenith color. 231 @rtype: None 232 @return: None 233 """
234
235 - def getAmb():
236 """ 237 Retrieves the ambient color of a world object. 238 This color is a list of 3 floats. 239 @rtype: list of three floats 240 @return: the ambient color of the world object. 241 """
242
243 - def setAmb(amb):
244 """ 245 Sets the ambient color of a world object. 246 @type amb: list of three floats 247 @param amb : the new ambient color. 248 @rtype: None 249 @return: None 250 """
251
252 - def getStar():
253 """ 254 Retrieves the star parameters of a world object. 255 It is a list of nine floats : 256 red component of the color 257 green component of the color 258 blue component of the color 259 size of the stars 260 minimal distance between the stars 261 average distance between the stars 262 variations of the stars color 263 @rtype: list of nine floats 264 @return: the star parameters 265 """
266
267 - def setStar(star):
268 """ 269 Sets the star parameters of a world object. 270 See getStar for the semantics of the parameter. 271 @type star: list of 9 floats 272 @param star : the new star parameters. 273 @rtype: None 274 @return: None 275 """
276
277 - def getMist():
278 """ 279 Retrieves the mist parameters of a world object. 280 It is a list of four floats : 281 intensity of the mist 282 start of the mist 283 end of the mist 284 height of the mist 285 @rtype: list of four floats 286 @return: the mist parameters 287 """
288
289 - def setMist(mist):
290 """ 291 Sets the mist parameters of a world object. 292 See getMist for the semantics of the parameter. 293 @type mist: list of 4 floats 294 @param mist : the new mist parameters. 295 @rtype: None 296 @return: None 297 """
298 308 316 325
326 - def setCurrent ():
327 """ 328 Make this world active in the current scene. 329 @rtype: None 330 @return: None 331 """
332
333 - def insertIpoKey(keytype):
334 """ 335 Inserts keytype values in world ipo at curframe. Uses module constants. 336 @type keytype: Integer 337 @param keytype: 338 -ZENTIH 339 -HORIZON 340 -MIST 341 -STARS 342 -OFFSET 343 -SIZE 344 @return: py_none 345 """
346
347 - def __copy__ ():
348 """ 349 Make a copy of this world 350 @rtype: World 351 @return: a copy of this world 352 """
353 354 import id_generics 355 World.__doc__ += id_generics.attributes 356