Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Radio.py « doc « api2_2x « python « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f336ea56765b00e2e9d664a8b7e84e2be3d1a2a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
# Blender.Scene.Radio module and the Radiosity PyType object

"""
The Blender.Scene.Radio submodule.

Radio
=====

This module gives access to B{Scene Radiosity Contexts} in Blender.

Example::
  import Blender
  from Blender import Scene

  # Only the current scene has a radiosity context.
  # Naturally, any scene can be made the current one
  # with scene.makeCurrent()

  scn = Scene.GetCurrent()

  # this is the only way to access the radiosity object:

  radio = scn.getRadiosityContext()

  radio.setDrawType('Gouraud')
  radio.setMode('ShowLimits', 'Z')

  radio.collectMeshes() # prepare patches
  radio.go() # calculate radiosity
  Blender.Redraw(-1)


@type Modes: readonly dictionary
@var Modes:
    - ShowLimits
    - Z

@type DrawTypes: readonly dictionary
@var DrawTypes:
    - Wire
    - Solid
    - Gouraud
"""

class Radio:
  """
  The Radiosity object
  ====================
    This object wraps the current Scene's radiosity context in Blender.
  """
 
  def go():
    """
    Start the radiosity simulation.  It is necessary to call L{collectMeshes}
    first.
    """

  def collectMeshes():
    """
    Convert B{selected} visible meshes to patches for radiosity calculation.
    @note: L{Object.Object.select} can be used to (un)select objects via
       bpython.
    """

  def freeData():
    """
    Release all memory used by radiosity.
    """

  def addMesh():
    """
    Add the new mesh created by the radiosity simulation (see L{go}) to
    Blender.  The radiosity results are stored in this mesh's vertex colors.
    @note: see L{replaceMeshes} for a destructive alternative.
    """

  def replaceMeshes():
    """
    Replace the original input meshes with the B{one} calculated by the
    radiosity simulation.  The radiosity results are stored in this mesh's
    vertex colors.
    @note: see L{addMesh} for a non-destructive alternative.
    """

  def limitSubdivide():
    """
    Subdivide patches (optional, it may improve results).
    """

  def filterFaces():
    """
    Force an extra smoothing.  This method can be called only after the
    simulation has been calculated (L{go}).
    """

  def filterElems():
    """
    Filter elements to remove aliasing artifacts.  This method can be called
    only after the simulation has been calculated (L{go}).
    """

  def subdividePatches():
    """
    Pre-subdivision: detect high-energy patches and subdivide them
    (optional, it may improve results).
    """

  def subdivideElems():
    """
    Pre-subdivision: detect high-energy elements (nodes) and subdivide them
    (optional, it may improve results).
    """

  def removeDoubles():
    """
    Join elements (nodes) which differ less than the defined element limit.
    This method can be called only after the simulation has been calculated
    (L{go}).
    """

  def getHemiRes():
    """
    Get hemicube size.
    @rtype: int
    @return: the current hemicube size.
    """

  def setHemiRes(ival):
    """
    Set hemicube size.  The range is [100, 1000].
    @type ival: int
    @param ival: the new size.
    """

  def getMaxIter():
    """
    Get maximum number of radiosity rounds.
    @rtype: int
    @return: the current maxiter value.
    """

  def setMaxIter(ival):
    """
    Set maximum number of radiosity rounds.  The range is [0, 10000].
    @type ival: int
    @param ival: the maxiter new value.
    """

  def getSubShPatch():
    """
    Get maximum number of times the environment is tested to detect patches.
    @rtype: int
    @return: the current value.
    """

  def setSubShPatch(ival):
    """
    Set the maximum number of times the environment is tested to detect
    patches.  The range is [0, 10].
    @type ival: int
    @param ival: the new value.
    """

  def getSubShElem():
    """
    Get the number of times the environment is tested to detect elements.
    @rtype: int
    @return: the current value.
    """

  def setSubShElem(ival):
    """
    Set number of times the environment is tested to detect elements.  The
    range is [0, 10].
    @type ival: int
    @param ival: the new value.
    """

  def getElemLimit():
    """
    Get the range for removing doubles.
    @rtype: int
    @return: the current value.
    """

  def setElemLimit(ival):
    """
    Set the range for removing doubles.  The range is [0, 50].
    @type ival: int
    @param ival: the new value.
    """

  def getMaxSubdivSh():
    """
    Get the maximum number of initial shoot patches evaluated.
    @rtype: int
    @return: the current value.
    """

  def setMaxSubdivSh(ival):
    """
    Set the maximum number of initial shoot patches evaluated.  The range is
    [1, 250].
    @type ival: int
    @param ival: the new value.
    """

  def getPatchMax():
    """
    Get the maximum size of a patch.
    @rtype: int
    @return: the current value.
    """

  def setPatchMax(ival):
    """
    Set the maximum size of a patch.  The range is [10, 1000].
    @type ival: int
    @param ival: the new value.
    """

  def getPatchMin():
    """
    Get the minimum size of a patch.
    @rtype: int
    @return: the current value.
    """

  def setPatchMin(ival):
    """
    Set the minimum size of a patch.  The range is [10, 1000].
    @type ival: int
    @param ival: the new value.
    """

  def getElemMax():
    """
    Get the maximum size of an element.
    @rtype: int
    @return: the current value.
    """

  def setElemMax(ival):
    """
    Set the maximum size of an element.  The range is [1, 100].
    @type ival: int
    @param ival: the new value.
    """

  def getElemMin():
    """
    Get the minimum size of an element.  The range is [1, 100].
    @rtype: int
    @return: the current value.
    """

  def setElemMin(ival):
    """
    Set the minimum size of an element.  The range is [1, 100].
    @type ival: int
    @param ival: the new value.
    """

  def getMaxElems():
    """
    Get the maximum number of elements.
    @rtype: int
    @return: the current value.
    """

  def setMaxElems(ival):
    """
    Set the maximum number of elements.  The range is [1, 250000].
    @type ival: int
    @param ival: the new value.
    """

  def getConvergence():
    """
    Get lower thresholdo of unshot energy.
    @rtype: float
    @return: the current value.
    """

  def setConvergence(fval):
    """
    Set lower threshold of unshot energy.  The range is [0.0, 1.0].
    @type fval: float
    @param fval: the new value.
    """

  def getMult():
    """
    Get the energy value multiplier.
    @rtype: float
    @return: the current value.
    """

  def setMult (fval):
    """
    Set the energy value multiplier.  The range is [0.001, 250.0].
    @type fval: float
    @param fval: the new value.
    """

  def getGamma():
    """
    Get change in the contrast of energy values.
    @rtype: float
    @return: the current value.
    """

  def setGamma (fval):
    """
    Set change in the contrast of energy values.  The range is [0.2, 10.0].
    @type fval: float
    @param fval: the new value.
    """

  def getDrawType():
    """
    Get the draw type: Wire, Solid or Gouraud as an int value, see L{DrawTypes}.
    @rtype: int
    @return: the current draw type.
    """

  def setDrawType (dt):
    """
    Set the draw type.
    @type dt: string or int
    @param dt: either 'Wire', 'Solid' or 'Gouraud' or the equivalent entry in
        the L{DrawTypes} dictionary.
    """

  def getMode():
    """
    Get mode as an int (or'ed bitflags), see L{Modes} dictionary.
    @rtype: int
    @return: the current value.
    """

  def setMode (mode1 = None, mode2 = None):
    """
    Set mode flags as strings: 'ShowLimits' and 'Z'.  To set one give it as
    only argument.  Strings not passed in are unset, so setMode() unsets
    both.
    @type mode1: string
    @param mode1: optional mode string.
    @type mode2: string
    @param mode2: optional mode string.
    """