Module Radio

Source Code for Module Radio

  1  # Blender.Scene.Radio module and the Radiosity PyType object 
  2   
  3  """ 
  4  The Blender.Scene.Radio submodule. 
  5   
  6  Radio 
  7  ===== 
  8   
  9  This module gives access to B{Scene Radiosity Contexts} in Blender. 
 10   
 11  Example:: 
 12    import Blender 
 13    from Blender import Scene 
 14   
 15    # Only the current scene has a radiosity context. 
 16    # Naturally, any scene can be made the current one 
 17    # with scene.makeCurrent() 
 18   
 19    scn = Scene.GetCurrent() 
 20   
 21    # this is the only way to access the radiosity object: 
 22   
 23    radio = scn.getRadiosityContext() 
 24   
 25    radio.setDrawType('Gouraud') 
 26    radio.setMode('ShowLimits', 'Z') 
 27   
 28    radio.collectMeshes() # prepare patches 
 29    radio.go() # calculate radiosity 
 30    Blender.Redraw(-1) 
 31   
 32   
 33  @type Modes: readonly dictionary 
 34  @var Modes: 
 35      - ShowLimits 
 36      - Z 
 37   
 38  @type DrawTypes: readonly dictionary 
 39  @var DrawTypes: 
 40      - Wire 
 41      - Solid 
 42      - Gouraud 
 43  """ 
 44   
45 -class Radio:
46 """ 47 The Radiosity object 48 ==================== 49 This object wraps the current Scene's radiosity context in Blender. 50 """ 51
52 - def go():
53 """ 54 Start the radiosity simulation. It is necessary to call L{collectMeshes} 55 first. 56 """
57
58 - def collectMeshes():
59 """ 60 Convert B{selected} visible meshes to patches for radiosity calculation. 61 @note: L{Object.Object.select} can be used to (un)select objects via 62 bpython. 63 """
64
65 - def freeData():
66 """ 67 Release all memory used by radiosity. 68 """
69
70 - def addMesh():
71 """ 72 Add the new mesh created by the radiosity simulation (see L{go}) to 73 Blender. The radiosity results are stored in this mesh's vertex colors. 74 @note: see L{replaceMeshes} for a destructive alternative. 75 """
76
77 - def replaceMeshes():
78 """ 79 Replace the original input meshes with the B{one} calculated by the 80 radiosity simulation. The radiosity results are stored in this mesh's 81 vertex colors. 82 @note: see L{addMesh} for a non-destructive alternative. 83 """
84
85 - def limitSubdivide():
86 """ 87 Subdivide patches (optional, it may improve results). 88 """
89
90 - def filterFaces():
91 """ 92 Force an extra smoothing. This method can be called only after the 93 simulation has been calculated (L{go}). 94 """
95
96 - def filterElems():
97 """ 98 Filter elements to remove aliasing artifacts. This method can be called 99 only after the simulation has been calculated (L{go}). 100 """
101
102 - def subdividePatches():
103 """ 104 Pre-subdivision: detect high-energy patches and subdivide them 105 (optional, it may improve results). 106 """
107
108 - def subdivideElems():
109 """ 110 Pre-subdivision: detect high-energy elements (nodes) and subdivide them 111 (optional, it may improve results). 112 """
113
114 - def removeDoubles():
115 """ 116 Join elements (nodes) which differ less than the defined element limit. 117 This method can be called only after the simulation has been calculated 118 (L{go}). 119 """
120
121 - def getHemiRes():
122 """ 123 Get hemicube size. 124 @rtype: int 125 @return: the current hemicube size. 126 """
127
128 - def setHemiRes(ival):
129 """ 130 Set hemicube size. The range is [100, 1000]. 131 @type ival: int 132 @param ival: the new size. 133 """
134
135 - def getMaxIter():
136 """ 137 Get maximum number of radiosity rounds. 138 @rtype: int 139 @return: the current maxiter value. 140 """
141
142 - def setMaxIter(ival):
143 """ 144 Set maximum number of radiosity rounds. The range is [0, 10000]. 145 @type ival: int 146 @param ival: the maxiter new value. 147 """
148
149 - def getSubShPatch():
150 """ 151 Get maximum number of times the environment is tested to detect patches. 152 @rtype: int 153 @return: the current value. 154 """
155
156 - def setSubShPatch(ival):
157 """ 158 Set the maximum number of times the environment is tested to detect 159 patches. The range is [0, 10]. 160 @type ival: int 161 @param ival: the new value. 162 """
163
164 - def getSubShElem():
165 """ 166 Get the number of times the environment is tested to detect elements. 167 @rtype: int 168 @return: the current value. 169 """
170
171 - def setSubShElem(ival):
172 """ 173 Set number of times the environment is tested to detect elements. The 174 range is [0, 10]. 175 @type ival: int 176 @param ival: the new value. 177 """
178
179 - def getElemLimit():
180 """ 181 Get the range for removing doubles. 182 @rtype: int 183 @return: the current value. 184 """
185
186 - def setElemLimit(ival):
187 """ 188 Set the range for removing doubles. The range is [0, 50]. 189 @type ival: int 190 @param ival: the new value. 191 """
192
193 - def getMaxSubdivSh():
194 """ 195 Get the maximum number of initial shoot patches evaluated. 196 @rtype: int 197 @return: the current value. 198 """
199
200 - def setMaxSubdivSh(ival):
201 """ 202 Set the maximum number of initial shoot patches evaluated. The range is 203 [1, 250]. 204 @type ival: int 205 @param ival: the new value. 206 """
207
208 - def getPatchMax():
209 """ 210 Get the maximum size of a patch. 211 @rtype: int 212 @return: the current value. 213 """
214
215 - def setPatchMax(ival):
216 """ 217 Set the maximum size of a patch. The range is [10, 1000]. 218 @type ival: int 219 @param ival: the new value. 220 """
221
222 - def getPatchMin():
223 """ 224 Get the minimum size of a patch. 225 @rtype: int 226 @return: the current value. 227 """
228
229 - def setPatchMin(ival):
230 """ 231 Set the minimum size of a patch. The range is [10, 1000]. 232 @type ival: int 233 @param ival: the new value. 234 """
235
236 - def getElemMax():
237 """ 238 Get the maximum size of an element. 239 @rtype: int 240 @return: the current value. 241 """
242
243 - def setElemMax(ival):
244 """ 245 Set the maximum size of an element. The range is [1, 100]. 246 @type ival: int 247 @param ival: the new value. 248 """
249
250 - def getElemMin():
251 """ 252 Get the minimum size of an element. The range is [1, 100]. 253 @rtype: int 254 @return: the current value. 255 """
256
257 - def setElemMin(ival):
258 """ 259 Set the minimum size of an element. The range is [1, 100]. 260 @type ival: int 261 @param ival: the new value. 262 """
263
264 - def getMaxElems():
265 """ 266 Get the maximum number of elements. 267 @rtype: int 268 @return: the current value. 269 """
270
271 - def setMaxElems(ival):
272 """ 273 Set the maximum number of elements. The range is [1, 250000]. 274 @type ival: int 275 @param ival: the new value. 276 """
277
278 - def getConvergence():
279 """ 280 Get lower thresholdo of unshot energy. 281 @rtype: float 282 @return: the current value. 283 """
284
285 - def setConvergence(fval):
286 """ 287 Set lower threshold of unshot energy. The range is [0.0, 1.0]. 288 @type fval: float 289 @param fval: the new value. 290 """
291
292 - def getMult():
293 """ 294 Get the energy value multiplier. 295 @rtype: float 296 @return: the current value. 297 """
298
299 - def setMult (fval):
300 """ 301 Set the energy value multiplier. The range is [0.001, 250.0]. 302 @type fval: float 303 @param fval: the new value. 304 """
305
306 - def getGamma():
307 """ 308 Get change in the contrast of energy values. 309 @rtype: float 310 @return: the current value. 311 """
312
313 - def setGamma (fval):
314 """ 315 Set change in the contrast of energy values. The range is [0.2, 10.0]. 316 @type fval: float 317 @param fval: the new value. 318 """
319
320 - def getDrawType():
321 """ 322 Get the draw type: Wire, Solid or Gouraud as an int value, see L{DrawTypes}. 323 @rtype: int 324 @return: the current draw type. 325 """
326
327 - def setDrawType (dt):
328 """ 329 Set the draw type. 330 @type dt: string or int 331 @param dt: either 'Wire', 'Solid' or 'Gouraud' or the equivalent entry in 332 the L{DrawTypes} dictionary. 333 """
334
335 - def getMode():
336 """ 337 Get mode as an int (or'ed bitflags), see L{Modes} dictionary. 338 @rtype: int 339 @return: the current value. 340 """
341
342 - def setMode (mode1 = None, mode2 = None):
343 """ 344 Set mode flags as strings: 'ShowLimits' and 'Z'. To set one give it as 345 only argument. Strings not passed in are unset, so setMode() unsets 346 both. 347 @type mode1: string 348 @param mode1: optional mode string. 349 @type mode2: string 350 @param mode2: optional mode string. 351 """
352