Module World

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