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

Lamp.py « doc « api2_2x « python « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7c8aa9dedc7163b5acff3e9d9427bdd2786689aa (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
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
# Blender.Lamp module and the Lamp PyType object

"""
The Blender.Lamp submodule.

B{New}: L{Lamp.clearScriptLinks} accepts a parameter now.

Lamp Data
=========

This module provides control over B{Lamp Data} objects in Blender.

Example::

  from Blender import Lamp
  l = Lamp.New('Spot')            # create new 'Spot' lamp data
  l.setMode('square', 'shadow')   # set these two lamp mode flags
  ob = Object.New('Lamp')         # create new lamp object
  ob.link(l)                      # link lamp obj with lamp data
"""

def New (type = 'Lamp', name = 'LampData'):
  """
  Create a new Lamp Data object.
  @type type: string
  @param type: The Lamp type: 'Lamp', 'Sun', 'Spot', 'Hemi', 'Area', or 'Photon'.
  @type name: string
  @param name: The Lamp Data name.
  @rtype: Blender Lamp
  @return: The created Lamp Data object.
  """

def Get (name = None):
  """
  Get the Lamp Data object(s) from Blender.
  @type name: string
  @param name: The name of the Lamp Data.
  @rtype: Blender Lamp or a list of Blender Lamps
  @return: It depends on the I{name} parameter:
      - (name): The Lamp Data object with the given I{name};
      - ():     A list with all Lamp Data objects in the current scene.
  """

class Lamp:
  """
  The Lamp Data object
  ====================
    This object gives access to Lamp-specific data in Blender.
  @cvar name: The Lamp Data name.
  @cvar type: The Lamp type (see the Types dict).
  @cvar Types: The Types dictionary.
      - 'Lamp': 0
      - 'Sun' : 1
      - 'Spot': 2
      - 'Hemi': 3
      - 'Area': 4
      - 'Photon': 5
  @cvar mode: The mode flags: B{or'ed value} of the flags in the Modes dict.
  @cvar Modes: The Modes dictionary.
      - 'Shadows'
      - 'Halo'
      - 'Layer'
      - 'Quad'
      - 'Negative'
      - 'OnlyShadow'
      - 'Sphere'
      - 'Square'
  @cvar samples: The number of shadow map samples in [1, 16].
  @cvar bufferSize: The size of the shadow buffer in [512, 5120].
  @cvar haloStep: Volumetric halo sampling frequency in [0, 12].
  @cvar energy: The intensity of the light in [0.0, 10.0].
  @cvar dist: The distance value in [0.1, 5000.0].
  @cvar spotSize: The angle of the spot beam in degrees in [1.0, 180.0].
  @cvar spotBlend: The softness of the spot edge in [0.0, 1.0].
  @cvar clipStart: The shadow map clip start in [0.1, 1000.0].
  @cvar clipEnd: The shadow map clip end in [1.0, 5000.0].
  @cvar bias: The shadow map sampling bias in [0.01, 5.00].
  @cvar softness: The size of the shadow sample area in [1.0, 100.0].
  @cvar haloInt: The intensity of the spot halo in [0.0, 5.0].
  @cvar quad1: Light intensity value 1 for a Quad lamp in [0.0, 1.0].
  @cvar quad2: Light intensity value 2 for a Quad lamp in [0.0, 1.0].
  @cvar col: The color of the light, with each rgb component in [0.0, 1.0].
      This is an rgb tuple whose values can be accessed in many ways:
        - as a tuple: lamp.col, lamp.col[0], same for 1 and 2.
        - as a dictionary: lamp.col['R'], same for 'G' and 'B'.
        - as an object: lamp.col.R, same for G and B.
  @warning: Most member variables assume values in some [Min, Max] interval.
      When trying to set them, the given parameter will be clamped to lie in
      that range: if val < Min, then val = Min, if val > Max, then val = Max.
  """

  def getName():
    """
    Get the name of this Lamp Data object.
    @rtype: string
    """

  def setName(name):
    """
    Set the name of this Lamp Data object.
    @type name: string
    @param name: The new name.
    """

  def getType():
    """
    Get this Lamp's type.
    @rtype: int
    """

  def setType(type):
    """
    Set this Lamp's type.
    @type type: string
    @param type: The Lamp type: 'Lamp', 'Sun', 'Spot', 'Hemi', 'Area', or 'Photon'
    """

  def getMode():
    """
    Get this Lamp's mode flags.
    @rtype: int
    @return: B{OR'ed value}. Use the Modes dictionary to check which flags
        are 'on'.

        Example::
          flags = mylamp.getMode()
          if flags & mylamp.Modes['Shadows']:
            print "This lamp produces shadows"
          else:
            print "The 'Shadows' flag is off"
    """

  def setMode(m = None, m2 = None, m3 = None, m4 = None,
              m5 = None, m6 = None, m7 = None, m8 = None):
    """
    Set this Lamp's mode flags. Mode strings given are turned 'on'.
    Those not provided are turned 'off', so lamp.setMode() -- without 
    arguments -- turns off all mode flags for Lamp lamp.
    @type m: string
    @param m: A mode flag. From 1 to 8 can be set at the same time.
    """

  def getSamples():
    """
    Get this lamp's samples value.
    @rtype: int
    """

  def setSamples(samples):
    """
    Set the samples value.
    @type samples: int
    @param samples: The new samples value.
    """

  def getBufferSize():
    """
    Get this lamp's buffer size.
    @rtype: int
    """

  def setBufferSize(bufsize):
    """
    Set the buffer size value.
    @type bufsize: int
    @param bufsize: The new buffer size value.
    """

  def getHaloStep():
    """
    Get this lamp's halo step value.
    @rtype: int
    """

  def setHaloStep(hastep):
    """
    Set the halo step value.
    @type hastep: int
    @param hastep: The new halo step value.
    """

  def getEnergy():
    """
    Get this lamp's energy intensity value.
    @rtype: float
    """

  def setEnergy(energy):
    """
    Set the energy intensity value.
    @type energy: float
    @param energy: The new energy value.
    """

  def getDist():
    """
    Get this lamp's distance value.
    @rtype: float
    """

  def setDist(distance):
    """
    Set the distance value.
    @type distance: float
    @param distance: The new distance value.
    """

  def getSpotSize():
    """
    Get this lamp's spot size value.
    @rtype: float
    """

  def setSpotSize(spotsize):
    """
    Set the spot size value.
    @type spotsize: float
    @param spotsize: The new spot size value.
    """

  def getSpotBlend():
    """
    Get this lamp's spot blend value.
    @rtype: float
    """

  def setSpotBlend(spotblend):
    """
    Set the spot blend value.
    @type spotblend: float
    @param spotblend: The new spot blend value.
    """

  def getClipStart():
    """
    Get this lamp's clip start value.
    @rtype: float
    """

  def setClipStart(clipstart):
    """
    Set the clip start value.
    @type clipstart: float
    @param clipstart: The new clip start value.
    """

  def getClipEnd():
    """
    Get this lamp's clip end value.
    @rtype: float
    """

  def setClipEnd(clipend):
    """
    Set the clip end value.
    @type clipend: float
    @param clipend: The new clip end value.
    """ 

  def getBias():
    """
    Get this lamp's bias value.
    @rtype: float
    """

  def setBias(bias):
    """
    Set the bias value.
    @type bias: float
    @param bias: The new bias value.
    """ 

  def getSoftness():
    """
    Get this lamp's softness value.
    @rtype: float
    """

  def setSoftness(softness):
    """
    Set the softness value.
    @type softness: float
    @param softness: The new softness value.
    """ 

  def getHaloInt():
    """
    Get this lamp's halo intensity value.
    @rtype: float
    """

  def setHaloInt(haloint):
    """
    Set the halo intensity value.
    @type haloint: float
    @param haloint: The new halo intensity value.
    """ 

  def getQuad1():
    """
    Get this lamp's quad 1 value.
    @rtype: float
    @warning: this only applies to Lamps with the 'Quad' flag on.
    """

  def setQuad1(quad1):
    """
    Set the quad 1 value.
    @type quad1: float
    @warning: this only applies to Lamps with the 'Quad' flag on.
    """ 

  def getQuad2():
    """
    Get this lamp's quad 2 value.
    @rtype: float
    @warning: this only applies to Lamps with the 'Quad' flag on.
    """

  def setQuad2(quad2):
    """
    Set the quad 2 value.
    @type quad2: float
    @param quad2: The new quad 2 value.
    @warning: this only applies to Lamps with the 'Quad' flag on.
    """ 

  def getScriptLinks (event):
    """
    Get a list with this Lamp's script links of type 'event'.
    @type event: string
    @param event: "FrameChanged", "Redraw" or "Render".
    @rtype: list
    @return: a list with Blender L{Text} names (the script links of the given
        'event' type) or None if there are no script links at all.
    """

  def clearScriptLinks (links = None):
    """
    Delete script links from this Lamp.  If no list is specified, all
    script links are deleted.
    @type links: list of strings
    @param links: None (default) or a list of Blender L{Text} names.
    """

  def addScriptLink (text, event):
    """
    Add a new script link to this Lamp.
    @type text: string
    @param text: the name of an existing Blender L{Text}.
    @type event: string
    @param event: "FrameChanged", "Redraw" or "Render".
    """

  def getIpo():
    """
    Get the Ipo associated with this Lamp object, if any.
    @rtype: Ipo
    @return: the wrapped ipo or None.
    """

  def setIpo(ipo):
    """
    Link an ipo to this Lamp object.
    @type ipo: Blender Ipo
    @param ipo: a "lamp data" ipo.
    """

  def clearIpo():
    """
    Unlink the ipo from this Lamp object.
    @return: True if there was an ipo linked or False otherwise.
    """
    
  def insertIpoKey(keytype):
    """
    Inserts keytype values in lamp ipo at curframe. Uses module constants.
    @type keytype: Integer
    @param keytype:
           -RGB
           -ENERGY
           -SPOTSIZE
           -OFFSET
           -SIZE
    @return: py_none
    """