~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to source/blender/python/api2_2x/doc/World.py

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2007-05-17 11:47:59 UTC
  • mfrom: (1.2.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070517114759-yp4ybrnhp2u7pk66
Tags: 2.44-1
* New upstream release.
* Drop debian/patches/01_64bits_stupidity, not needed anymore: as of this
  version blender is 64 bits safe again. Adjust README.Debian accordingly.

Show diffs side-by-side

added added

removed removed

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