1
2
3 """
4 The Blender.Lamp submodule.
5
6 B{New}: L{Lamp.clearScriptLinks} accepts a parameter now.
7
8 Lamp Data
9 =========
10
11 This module provides control over B{Lamp Data} objects in Blender.
12
13 Example::
14
15 from Blender import Lamp, Scene
16 l = Lamp.New('Spot') # create new 'Spot' lamp data
17 l.setMode('Square', 'Shadow') # set these two lamp mode flags
18 scn = Scene.GetCurrent()
19 ob = scn.objects.new(l)
20
21 @type Types: read-only dictionary
22 @var Types: The lamp types.
23 - 'Lamp': 0
24 - 'Sun' : 1
25 - 'Spot': 2
26 - 'Hemi': 3
27 - 'Area': 4
28 - 'Photon': 5
29 @type Falloffs: read-only dictionary
30 @var Falloffs: The lamp falloff types.
31 - CONSTANT - Constant falloff
32 - INVLINEAR - Inverse linear
33 - INVSQUARE - Inverse square
34 - CUSTOM - Custom curve
35 - LINQUAD - Lin/Quad weighted
36 @type Modes: read-only dictionary
37 @var Modes: The lamp modes. Modes may be ORed together.
38 - 'Shadows'
39 - 'Halo'
40 - 'Layer'
41 - 'Quad'
42 - 'Negative'
43 - 'OnlyShadow'
44 - 'Sphere'
45 - 'Square'
46 - 'NoDiffuse'
47 - 'NoSpecular'
48 - 'RayShadow'
49 @type BufferTypes: read-only dictionary
50 @var BufferTypes: The lamp shadowbuffer types.
51 - 'Regular'
52 - 'Irregular'
53 - 'Halfway'
54
55 Example::
56 from Blender import Lamp, Object
57 # Change the mode of selected lamp objects.
58 for ob in Object.GetSelected(): # Loop through the current selection
59 if ob.getType() == "Lamp": # if this is a lamp.
60 lamp = ob.getData() # get the lamp data.
61 if lamp.type == Lamp.Types["Spot"]: # Lamp type is not a flag
62 lamp.mode &= ~Lamp.Modes["RayShadow"] # Disable RayShadow.
63 lamp.mode |= Lamp.Modes["Shadows"] # Enable Shadowbuffer shadows
64 """
65
66 -def New (type = 'Lamp', name = 'LampData'):
67 """
68 Create a new Lamp Data object.
69 @type type: string
70 @param type: The Lamp type: 'Lamp', 'Sun', 'Spot', 'Hemi', 'Area', or 'Photon'.
71 @type name: string
72 @param name: The Lamp Data name.
73 @rtype: Blender Lamp
74 @return: The created Lamp Data object.
75 """
76
77 -def Get (name = None):
78 """
79 Get the Lamp Data object(s) from Blender.
80 @type name: string
81 @param name: The name of the Lamp Data.
82 @rtype: Blender Lamp or a list of Blender Lamps
83 @return: It depends on the I{name} parameter:
84 - (name): The Lamp Data object with the given I{name};
85 - (): A list with all Lamp Data objects in the current scene.
86 """
87
89 """
90 The Lamp Data object
91 ====================
92 This object gives access to Lamp-specific data in Blender.
93
94 @ivar B: Lamp color blue component.
95 Value is clamped to the range [0.0,1.0].
96 @type B: float
97 @ivar G: Lamp color green component.
98 Value is clamped to the range [0.0,1.0].
99 @type G: float
100 @ivar R: Lamp color red component.
101 Value is clamped to the range [0.0,1.0].
102 @type R: float
103 @ivar bias: Lamp shadow map sampling bias.
104 Value is clamped to the range [0.01,5.0].
105 @type bias: float
106 @ivar bufferSize: Lamp shadow buffer size.
107 Value is clamped to the range [512,5120].
108 @type bufferSize: int
109 @ivar bufferType: Lamp shadowbuffer type. See L{BufferTypes} for values.
110 @type bufferType: int
111 @ivar clipEnd: Lamp shadow map clip end.
112 Value is clamped to the range [1.0,5000.0].
113 @type clipEnd: float
114 @ivar clipStart: Lamp shadow map clip start.
115 Value is clamped to the range [0.1,1000.0].
116 @type clipStart: float
117 @ivar col: Lamp RGB color triplet.
118 Components are clamped to the range [0.0,1.0].
119 @type col: RGB tuple
120 @ivar dist: Lamp clipping distance.
121 Value is clamped to the range [0.1,5000.0].
122 @type dist: float
123 @ivar energy: Lamp light intensity.
124 Value is clamped to the range [0.0,10.0].
125 @type energy: float
126 @ivar haloInt: Lamp spotlight halo intensity.
127 Value is clamped to the range [0.0,5.0].
128 @type haloInt: float
129 @ivar haloStep: Lamp volumetric halo sampling frequency.
130 Value is clamped to the range [0,12].
131 @type haloStep: int
132 @ivar ipo: Lamp Ipo.
133 Contains the Ipo if one is assigned to the object, B{None} otherwise. Setting to B{None} clears the current Ipo..
134 @type ipo: Blender Ipo
135 @ivar mode: Lamp mode bitfield. See L{Modes} for values.
136 @type mode: int
137 @ivar quad1: Quad lamp linear distance attenuation.
138 Value is clamped to the range [0.0,1.0].
139 @type quad1: float
140 @ivar quad2: Quad lamp quadratic distance attenuation.
141 Value is clamped to the range [0.0,1.0].
142 @type quad2: float
143 @ivar samples: Lamp shadow map samples.
144 Value is clamped to the range [1,16].
145 @type samples: int
146 @ivar sampleBuffers: Lamp amount of shadow map sample buffers.
147 Number of sample buffers for shadow buffer: 1, 4 or 9.
148 @type sampleBuffers: int
149 @ivar raySamplesX: Lamp raytracing X samples (X is used for the Y axis with square area lamps).
150 Value is clamped to the range [1,16].
151 @type raySamplesX: int
152 @ivar raySamplesY: Lamp raytracing Y samples (Y is only used for rectangle area lamps).
153 Value is clamped to the range [1,16].
154 @type raySamplesY: int
155 @ivar areaSizeX: Lamp X size (X is used for the Y axis with square area lamps)
156 Value is clamped to the range [0.01,100.0].
157 @type areaSizeX: float
158 @ivar areaSizeY: Lamp Y size (Y is only used for rectangle area lamps).
159 Value is clamped to the range [0.01,100.0].
160 @type areaSizeY: float
161 @ivar softness: Lamp shadow sample area size.
162 Value is clamped to the range [1.0,100.0].
163 @type softness: float
164 @ivar spotBlend: Lamp spotlight edge softness.
165 Value is clamped to the range [0.0,1.0].
166 @type spotBlend: float
167 @ivar spotSize: Lamp spotlight beam angle (in degrees).
168 Value is clamped to the range [1.0,180.0].
169 @type spotSize: float
170 @ivar type: Lamp type. See L{Types} for values.
171 @type type: int
172 @ivar falloffType: Lamp falloff type. See L{Falloffs} for values.
173 @type falloffType: int
174 @type textures: a tuple of Blender MTex objects.
175 @ivar textures: The Lamp's texture list. Empty texture channels contains None.
176
177 @warning: Most member variables assume values in some [Min, Max] interval.
178 When trying to set them, the given parameter will be clamped to lie in
179 that range: if val < Min, then val = Min, if val > Max, then val = Max.
180 """
181
183 """
184 Get the name of this Lamp Data object.
185 @rtype: string
186 """
187
189 """
190 Set the name of this Lamp Data object.
191 @type name: string
192 @param name: The new name.
193 """
194
196 """
197 Get this Lamp's type.
198 @rtype: int
199 """
200
202 """
203 Set this Lamp's type.
204 @type type: string
205 @param type: The Lamp type: 'Lamp', 'Sun', 'Spot', 'Hemi', 'Area', or 'Photon'
206 """
207
209 """
210 Get this Lamp's mode flags.
211 @rtype: int
212 @return: B{OR'ed value}. Use the Modes dictionary to check which flags
213 are 'on'.
214
215 Example::
216 flags = mylamp.getMode()
217 if flags & mylamp.Modes['Shadows']:
218 print "This lamp produces shadows"
219 else:
220 print "The 'Shadows' flag is off"
221 """
222
223 - def setMode(m = None, m2 = None, m3 = None, m4 = None,
224 m5 = None, m6 = None, m7 = None, m8 = None):
225 """
226 Set this Lamp's mode flags. Mode strings given are turned 'on'.
227 Those not provided are turned 'off', so lamp.setMode() -- without
228 arguments -- turns off all mode flags for Lamp lamp.
229 @type m: string
230 @param m: A mode flag. From 1 to 8 can be set at the same time.
231 """
232
234 """
235 Get this lamp's samples value.
236 @rtype: int
237 """
238
240 """
241 Set the samples value.
242 @type samples: int
243 @param samples: The new samples value.
244 """
245
247 """
248 Get this lamp's raytracing sample value on the X axis.
249 This value is only used for area lamps.
250 @rtype: int
251 """
252
254 """
255 Set the lamp's raytracing sample value on the X axis, between 1 and 16.
256 This value is only used for area lamps.
257 @rtype: int
258 """
259
261 """
262 Get this lamp's raytracing sample value on the Y axis.
263 This value is only used for rectangle area lamps.
264 @rtype: int
265 """
266
268 """
269 Set the lamp's raytracing sample value on the Y axis, between 1 and 16.
270 This value is only used for rectangle area lamps.
271 @rtype: int
272 """
273
275 """
276 Get this lamp's size on the X axis.
277 This value is only used for area lamps.
278 @rtype: int
279 """
280
282 """
283 Set this lamp's size on the X axis.
284 This value is only used for area lamps.
285 @rtype: int
286 """
287
289 """
290 Get this lamp's size on the Y axis.
291 This value is only used for rectangle area lamps.
292 @rtype: int
293 """
294
296 """
297 Set this lamp's size on the Y axis.
298 This value is only used for rectangle area lamps.
299 @rtype: int
300 """
301
303 """
304 Get this lamp's buffer size.
305 @rtype: int
306 """
307
309 """
310 Set the buffer size value.
311 @type bufsize: int
312 @param bufsize: The new buffer size value.
313 """
314
316 """
317 Get this lamp's halo step value.
318 @rtype: int
319 """
320
322 """
323 Set the halo step value.
324 @type hastep: int
325 @param hastep: The new halo step value.
326 """
327
329 """
330 Get this lamp's energy intensity value.
331 @rtype: float
332 """
333
335 """
336 Set the energy intensity value.
337 @type energy: float
338 @param energy: The new energy value.
339 """
340
342 """
343 Get this lamp's distance value.
344 @rtype: float
345 """
346
348 """
349 Set the distance value.
350 @type distance: float
351 @param distance: The new distance value.
352 """
353
355 """
356 Get this lamp's spot size value.
357 @rtype: float
358 """
359
361 """
362 Set the spot size value.
363 @type spotsize: float
364 @param spotsize: The new spot size value.
365 """
366
368 """
369 Get this lamp's spot blend value.
370 @rtype: float
371 """
372
374 """
375 Set the spot blend value.
376 @type spotblend: float
377 @param spotblend: The new spot blend value.
378 """
379
381 """
382 Get this lamp's clip start value.
383 @rtype: float
384 """
385
387 """
388 Set the clip start value.
389 @type clipstart: float
390 @param clipstart: The new clip start value.
391 """
392
394 """
395 Get this lamp's clip end value.
396 @rtype: float
397 """
398
400 """
401 Set the clip end value.
402 @type clipend: float
403 @param clipend: The new clip end value.
404 """
405
407 """
408 Get this lamp's bias value.
409 @rtype: float
410 """
411
413 """
414 Set the bias value.
415 @type bias: float
416 @param bias: The new bias value.
417 """
418
420 """
421 Get this lamp's softness value.
422 @rtype: float
423 """
424
426 """
427 Set the softness value.
428 @type softness: float
429 @param softness: The new softness value.
430 """
431
433 """
434 Get this lamp's halo intensity value.
435 @rtype: float
436 """
437
439 """
440 Set the halo intensity value.
441 @type haloint: float
442 @param haloint: The new halo intensity value.
443 """
444
446 """
447 Get this lamp's quad 1 value.
448 @rtype: float
449 @warning: this only applies to Lamps with the 'Quad' flag on.
450 """
451
453 """
454 Set the quad 1 value.
455 @type quad1: float
456 @warning: this only applies to Lamps with the 'Quad' flag on.
457 """
458
460 """
461 Get this lamp's quad 2 value.
462 @rtype: float
463 @warning: this only applies to Lamps with the 'Quad' flag on.
464 """
465
467 """
468 Set the quad 2 value.
469 @type quad2: float
470 @param quad2: The new quad 2 value.
471 @warning: this only applies to Lamps with the 'Quad' flag on.
472 """
473
475 """
476 Get a list with this Lamp's script links of type 'event'.
477 @type event: string
478 @param event: "FrameChanged", "Redraw" or "Render".
479 @rtype: list
480 @return: a list with Blender L{Text} names (the script links of the given
481 'event' type) or None if there are no script links at all.
482 """
483
485 """
486 Delete script links from this Lamp. If no list is specified, all
487 script links are deleted.
488 @type links: list of strings
489 @param links: None (default) or a list of Blender L{Text} names.
490 """
491
493 """
494 Add a new script link to this Lamp.
495 @type text: string
496 @param text: the name of an existing Blender L{Text}.
497 @type event: string
498 @param event: "FrameChanged", "Redraw" or "Render".
499 """
500
502 """
503 Get the Ipo associated with this Lamp object, if any.
504 @rtype: Ipo
505 @return: the wrapped ipo or None.
506 """
507
509 """
510 Link an ipo to this Lamp object.
511 @type ipo: Blender Ipo
512 @param ipo: a "lamp data" ipo.
513 """
514
516 """
517 Unlink the ipo from this Lamp object.
518 @return: True if there was an ipo linked or False otherwise.
519 """
520
522 """
523 Inserts keytype values in lamp ipo at curframe. Uses module constants.
524 @type keytype: Integer
525 @param keytype:
526 -RGB
527 -ENERGY
528 -SPOTSIZE
529 -OFFSET
530 -SIZE
531 @return: None
532 """
533
535 """
536 Make a copy of this lamp
537 @rtype: Lamp
538 @return: a copy of this lamp
539 """
540
541 import id_generics
542 Lamp.__doc__ += id_generics.attributes
543