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

« back to all changes in this revision

Viewing changes to source/blender/python/api2_2x/doc/Camera.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:
12
12
 
13
13
Example::
14
14
 
15
 
  from Blender import Camera, Object, Scene
16
 
  cam = Camera.New('ortho')   # create new ortho camera data
17
 
  cam.scale = 6.0             # set scale value for ortho view
18
 
  scn = Scene.GetCurrent()    # get current scene
19
 
  ob = scn.objects.new(cam)   # add a new camera object from the data
20
 
  scn.setCurrentCamera(ob)    # make this camera the active
 
15
        from Blender import Camera, Object, Scene
 
16
        cam = Camera.New('ortho')   # create new ortho camera data
 
17
        cam.scale = 6.0             # set scale value for ortho view
 
18
        scn = Scene.GetCurrent()    # get current scene
 
19
        ob = scn.objects.new(cam)   # add a new camera object from the data
 
20
        scn.setCurrentCamera(ob)    # make this camera the active
21
21
"""
22
22
 
23
23
def New (type = 'persp', name = 'CamData'):
24
 
  """
25
 
  Create a new Camera Data object.
26
 
  @type type: string
27
 
  @param type: The Camera type: 'persp' or 'ortho'.
28
 
  @type name: string
29
 
  @param name: The Camera Data name.
30
 
  @rtype: Blender Camera
31
 
  @return: The created Camera Data object.
32
 
  """
 
24
        """
 
25
        Create a new Camera Data object.
 
26
        @type type: string
 
27
        @param type: The Camera type: 'persp' or 'ortho'.
 
28
        @type name: string
 
29
        @param name: The Camera Data name.
 
30
        @rtype: Blender Camera
 
31
        @return: The created Camera Data object.
 
32
        """
33
33
 
34
34
def Get (name = None):
35
 
  """
36
 
  Get the Camera Data object(s) from Blender.
37
 
  @type name: string
38
 
  @param name: The name of the Camera Data.
39
 
  @rtype: Blender Camera or a list of Blender Cameras
40
 
  @return: It depends on the I{name} parameter:
41
 
      - (name): The Camera Data object with the given I{name};
42
 
      - ():     A list with all Camera Data objects in the current scene.
43
 
  """
 
35
        """
 
36
        Get the Camera Data object(s) from Blender.
 
37
        @type name: string
 
38
        @param name: The name of the Camera Data.
 
39
        @rtype: Blender Camera or a list of Blender Cameras
 
40
        @return: It depends on the I{name} parameter:
 
41
                        - (name): The Camera Data object with the given I{name};
 
42
                        - ():     A list with all Camera Data objects in the current scene.
 
43
        """
44
44
 
45
45
class Camera:
46
 
  """
47
 
  The Camera Data object
48
 
  ======================
49
 
    This object gives access to Camera-specific data in Blender.
50
 
  @ivar name: The Camera Data name.
51
 
  @ivar type: The Camera type: 'persp' or 'ortho'
52
 
  @ivar mode: The mode flags: B{ORed value}: 'showLimits':1, 'showMist':2.
53
 
  @ivar lens: The lens value in [1.0, 250.0], only relevant to *persp* cameras.
54
 
  @ivar scale: The scale value in [0.01, 1000.00], only relevant to *ortho* cameras.
55
 
  @ivar clipStart: The clip start value in [0.0, 100.0].
56
 
  @ivar clipEnd: The clip end value in [1.0, 5000.0].
57
 
  @ivar dofDist: The dofDist value in [0.0, 5000.0].
58
 
  @ivar shiftx: The horizontal offset of the camera [-2.0, 2.0].
59
 
  @ivar shifty: The vertical offset of the camera [-2.0, 2.0].
60
 
  @ivar alpha: The PassePart alpha [0.0, 1.0].
61
 
  @ivar drawSize: The display size for the camera an the 3d view [0.1, 10.0].
62
 
  @type ipo: Blender Ipo
63
 
  @ivar ipo: The "camera data" ipo linked to this camera data object.
64
 
    Set to None to clear the ipo.
65
 
 
66
 
  @ivar drawLimits: Toggle the option to show limits in the 3d view.
67
 
  @ivar drawName: Toggle the option to show the camera name in the 3d view.
68
 
  @ivar drawMist: Toggle the option to show mist in the 3d view.
69
 
  @ivar drawTileSafe: Toggle the option to show tile safe in the 3d view.
70
 
  @ivar drawPassepartout: Toggle the option to show pass part out in the 3d view.
71
 
 
72
 
  @warning: Most member variables assume values in some [Min, Max] interval.
73
 
      When trying to set them, the given parameter will be clamped to lie in
74
 
      that range: if val < Min, then val = Min, if val > Max, then val = Max.
75
 
  """
76
 
 
77
 
  def getName():
78
 
    """
79
 
    Get the name of this Camera Data object.  (B{deprecated}) See the L{name} attribute.
80
 
    @rtype: string
81
 
    """
82
 
 
83
 
  def setName(name):
84
 
    """
85
 
    Set the name of this Camera Data object. (B{deprecated}) See the L{name} attribute.
86
 
    @type name: string
87
 
    @param name: The new name.
88
 
    """
89
 
 
90
 
  def getIpo():
91
 
    """
92
 
    Get the Ipo associated with this camera data object, if any. (B{deprecated})
93
 
    @rtype: Ipo
94
 
    @return: the wrapped ipo or None. (B{deprecated}) See the L{ipo} attribute.
95
 
    """
96
 
 
97
 
  def setIpo(ipo):
98
 
    """
99
 
    Link an ipo to this camera data object.  (B{deprecated}) See the L{ipo} attribute.
100
 
    @type ipo: Blender Ipo
101
 
    @param ipo: a "camera data" ipo.
102
 
    """
103
 
 
104
 
  def clearIpo():
105
 
    """
106
 
    Unlink the ipo from this camera data object.  (B{deprecated}) See the L{ipo} attribute.
107
 
    @return: True if there was an ipo linked or False otherwise.
108
 
    """
109
 
 
110
 
  def getType():
111
 
    """
112
 
    Get this Camera's type.  (B{deprecated}) See the L{type} attribute.
113
 
    @rtype: int
114
 
    @return: 0 for 'persp' or 1 for 'ortho'.
115
 
    """
116
 
 
117
 
  def setType(type):
118
 
    """
119
 
    Set this Camera's type.  (B{deprecated}) See the L{type} attribute.
120
 
    @type type: string
121
 
    @param type: The Camera type: 'persp' or 'ortho'.
122
 
    """
123
 
 
124
 
  def getMode():
125
 
    """
126
 
    Get this Camera's mode flags. (B{deprecated}) See the L{mode} attribute.
127
 
    @rtype: int
128
 
    @return: B{OR'ed value}: 'showLimits' is 1, 'showMist' is 2, or
129
 
       respectively, 01 and 10 in binary.
130
 
    """
131
 
 
132
 
  def setMode(mode1 = None, mode2 = None):
133
 
    """
134
 
    Set this Camera's mode flags. Mode strings given are turned 'on'.  (B{deprecated}) See the L{mode} attribute.
135
 
    Those not provided are turned 'off', so cam.setMode() -- without 
136
 
    arguments -- turns off all mode flags for Camera cam.
137
 
    @type mode1: string
138
 
    @type mode2: string
139
 
    @param mode1: A mode flag: 'showLimits' or 'showMist'.
140
 
    @param mode2: A mode flag: 'showLimits' or 'showMist'.
141
 
    """
142
 
 
143
 
  def getLens():
144
 
    """
145
 
    Get the lens value.  (B{deprecated}) See the L{lens} attribute.
146
 
    @rtype: float
147
 
    @warn: lens is only relevant for perspective (L{getType}) cameras.
148
 
    """
149
 
 
150
 
  def setLens(lens):
151
 
    """
152
 
    Set the lens value. (B{deprecated}) See the L{lens} attribute.
153
 
    @type lens: float
154
 
    @param lens: The new lens value. 
155
 
    @warn: lens is only relevant for perspective (L{type}) cameras.
156
 
    """
157
 
 
158
 
  def getScale():
159
 
    """
160
 
    Get the scale value. (B{deprecated}) See the L{scale} attribute.
161
 
    @rtype: float
162
 
    @warn: scale is only relevant for ortho (L{type}) cameras.
163
 
    """
164
 
 
165
 
  def setScale(scale):
166
 
    """
167
 
    Set the scale value. (B{deprecated}) See the L{scale} attribute.
168
 
    @type scale: float
169
 
    @param scale: The new scale value in [0.01, 1000.00]. 
170
 
    @warn: scale is only relevant for ortho (L{getType}) cameras.
171
 
    """
172
 
 
173
 
  def getClipStart():
174
 
    """
175
 
    Get the clip start value. (B{deprecated}) See the L{clipStart} attribute.
176
 
    @rtype: float
177
 
    """
178
 
 
179
 
  def setClipStart(clipstart):
180
 
    """
181
 
    Set the clip start value. (B{deprecated}) See the L{clipStart} attribute.
182
 
    @type clipstart: float
183
 
    @param clipstart: The new lens value.
184
 
    """
185
 
 
186
 
  def getClipEnd():
187
 
    """
188
 
    Get the clip end value. (B{deprecated}) See the L{clipEnd} attribute.
189
 
    @rtype: float
190
 
    """
191
 
 
192
 
  def setClipEnd(clipend):
193
 
    """
194
 
    Set the clip end value. (B{deprecated}) See the L{clipEnd} attribute.
195
 
    @type clipend: float
196
 
    @param clipend: The new clip end value.
197
 
    """
198
 
 
199
 
  def getDrawSize():
200
 
    """
201
 
    Get the draw size value. (B{deprecated}) See the L{drawSize} attribute.
202
 
    @rtype: float
203
 
    """
204
 
 
205
 
  def setDrawSize(drawsize):
206
 
    """
207
 
    Set the draw size value. (B{deprecated}) See the L{drawSize} attribute.
208
 
    @type drawsize: float
209
 
    @param drawsize: The new draw size value.
210
 
    """
211
 
 
212
 
  def getScriptLinks (event):
213
 
    """
214
 
    Get a list with this Camera's script links of type 'event'.
215
 
    @type event: string
216
 
    @param event: "FrameChanged", "Redraw" or "Render".
217
 
    @rtype: list
218
 
    @return: a list with Blender L{Text} names (the script links of the given
219
 
        'event' type) or None if there are no script links at all.
220
 
    """
221
 
 
222
 
  def clearScriptLinks (links = None):
223
 
    """
224
 
    Delete script links from this Camera.  If no list is specified, all
225
 
    script links are deleted.
226
 
    @type links: list of strings
227
 
    @param links: None (default) or a list of Blender L{Text} names.
228
 
    """
229
 
 
230
 
  def addScriptLink (text, event):
231
 
    """
232
 
    Add a new script link to this Camera.
233
 
    @type text: string
234
 
    @param text: the name of an existing Blender L{Text}.
235
 
    @type event: string
236
 
    @param event: "FrameChanged", "Redraw" or "Render".
237
 
    """
238
 
 
239
 
  def insertIpoKey(keytype):
240
 
    """
241
 
    Inserts keytype values in camera ipo at curframe. Uses module constants.
242
 
    @type keytype: Integer
243
 
    @param keytype:
244
 
           -LENS
245
 
           -CLIPPING
246
 
    @return: py_none
247
 
    """  
248
 
 
249
 
  def __copy__ ():
250
 
    """
251
 
    Make a copy of this camera
252
 
    @rtype: Camera
253
 
    @return:  a copy of this camera
254
 
    """
 
 
b'\\ No newline at end of file'
 
46
        """
 
47
        The Camera Data object
 
48
        ======================
 
49
                This object gives access to Camera-specific data in Blender.
 
50
        @ivar type: The Camera type: 'persp' or 'ortho'
 
51
        @ivar mode: The mode flags: B{ORed value}: 'showLimits':1, 'showMist':2.
 
52
        @ivar lens: The lens value in [1.0, 250.0], only relevant to *persp* cameras.
 
53
        @ivar angle: The lens value in degrees [7.323871, 172.847331], only relevant to *persp* cameras.
 
54
        @ivar scale: The scale value in [0.01, 1000.00], only relevant to *ortho* cameras.
 
55
        @ivar clipStart: The clip start value in [0.0, 100.0].
 
56
        @ivar clipEnd: The clip end value in [1.0, 5000.0].
 
57
        @ivar dofDist: The dofDist value in [0.0, 5000.0].
 
58
        @ivar shiftX: The horizontal offset of the camera [-2.0, 2.0].
 
59
        @ivar shiftY: The vertical offset of the camera [-2.0, 2.0].
 
60
        @ivar alpha: The PassePart alpha [0.0, 1.0].
 
61
        @ivar drawSize: The display size for the camera an the 3d view [0.1, 10.0].
 
62
        @type ipo: Blender Ipo
 
63
        @ivar ipo: The "camera data" ipo linked to this camera data object.
 
64
                Set to None to clear the ipo.
 
65
 
 
66
        @ivar drawLimits: Toggle the option to show limits in the 3d view.
 
67
        @ivar drawName: Toggle the option to show the camera name in the 3d view.
 
68
        @ivar drawMist: Toggle the option to show mist in the 3d view.
 
69
        @ivar drawTileSafe: Toggle the option to show tile safe in the 3d view.
 
70
        @ivar drawPassepartout: Toggle the option to show pass part out in the 3d view.
 
71
 
 
72
        @warning: Most member variables assume values in some [Min, Max] interval.
 
73
                        When trying to set them, the given parameter will be clamped to lie in
 
74
                        that range: if val < Min, then val = Min, if val > Max, then val = Max.
 
75
        """
 
76
 
 
77
        def getName():
 
78
                """
 
79
                Get the name of this Camera Data object.  (B{deprecated}) See the L{name} attribute.
 
80
                @rtype: string
 
81
                """
 
82
 
 
83
        def setName(name):
 
84
                """
 
85
                Set the name of this Camera Data object. (B{deprecated}) See the L{name} attribute.
 
86
                @type name: string
 
87
                @param name: The new name.
 
88
                """
 
89
 
 
90
        def getIpo():
 
91
                """
 
92
                Get the Ipo associated with this camera data object, if any. (B{deprecated})
 
93
                @rtype: Ipo
 
94
                @return: the wrapped ipo or None. (B{deprecated}) See the L{ipo} attribute.
 
95
                """
 
96
 
 
97
        def setIpo(ipo):
 
98
                """
 
99
                Link an ipo to this camera data object.  (B{deprecated}) See the L{ipo} attribute.
 
100
                @type ipo: Blender Ipo
 
101
                @param ipo: a "camera data" ipo.
 
102
                """
 
103
 
 
104
        def clearIpo():
 
105
                """
 
106
                Unlink the ipo from this camera data object.  (B{deprecated}) See the L{ipo} attribute.
 
107
                @return: True if there was an ipo linked or False otherwise.
 
108
                """
 
109
 
 
110
        def getType():
 
111
                """
 
112
                Get this Camera's type.  (B{deprecated}) See the L{type} attribute.
 
113
                @rtype: int
 
114
                @return: 0 for 'persp' or 1 for 'ortho'.
 
115
                """
 
116
 
 
117
        def setType(type):
 
118
                """
 
119
                Set this Camera's type.  (B{deprecated}) See the L{type} attribute.
 
120
                @type type: string
 
121
                @param type: The Camera type: 'persp' or 'ortho'.
 
122
                """
 
123
 
 
124
        def getMode():
 
125
                """
 
126
                Get this Camera's mode flags. (B{deprecated}) See the L{mode} attribute.
 
127
                @rtype: int
 
128
                @return: B{OR'ed value}: 'showLimits' is 1, 'showMist' is 2, or
 
129
                         respectively, 01 and 10 in binary.
 
130
                """
 
131
 
 
132
        def setMode(mode1 = None, mode2 = None):
 
133
                """
 
134
                Set this Camera's mode flags. Mode strings given are turned 'on'.  (B{deprecated}) See the L{mode} attribute.
 
135
                Those not provided are turned 'off', so cam.setMode() -- without 
 
136
                arguments -- turns off all mode flags for Camera cam.
 
137
                @type mode1: string
 
138
                @type mode2: string
 
139
                @param mode1: A mode flag: 'showLimits' or 'showMist'.
 
140
                @param mode2: A mode flag: 'showLimits' or 'showMist'.
 
141
                """
 
142
 
 
143
        def getLens():
 
144
                """
 
145
                Get the lens value.  (B{deprecated}) See the L{lens} attribute.
 
146
                @rtype: float
 
147
                @warn: lens is only relevant for perspective (L{getType}) cameras.
 
148
                """
 
149
 
 
150
        def setLens(lens):
 
151
                """
 
152
                Set the lens value. (B{deprecated}) See the L{lens} attribute.
 
153
                @type lens: float
 
154
                @param lens: The new lens value. 
 
155
                @warn: lens is only relevant for perspective (L{type}) cameras.
 
156
                """
 
157
 
 
158
        def getScale():
 
159
                """
 
160
                Get the scale value. (B{deprecated}) See the L{scale} attribute.
 
161
                @rtype: float
 
162
                @warn: scale is only relevant for ortho (L{type}) cameras.
 
163
                """
 
164
 
 
165
        def setScale(scale):
 
166
                """
 
167
                Set the scale value. (B{deprecated}) See the L{scale} attribute.
 
168
                @type scale: float
 
169
                @param scale: The new scale value in [0.01, 1000.00]. 
 
170
                @warn: scale is only relevant for ortho (L{getType}) cameras.
 
171
                """
 
172
 
 
173
        def getClipStart():
 
174
                """
 
175
                Get the clip start value. (B{deprecated}) See the L{clipStart} attribute.
 
176
                @rtype: float
 
177
                """
 
178
 
 
179
        def setClipStart(clipstart):
 
180
                """
 
181
                Set the clip start value. (B{deprecated}) See the L{clipStart} attribute.
 
182
                @type clipstart: float
 
183
                @param clipstart: The new lens value.
 
184
                """
 
185
 
 
186
        def getClipEnd():
 
187
                """
 
188
                Get the clip end value. (B{deprecated}) See the L{clipEnd} attribute.
 
189
                @rtype: float
 
190
                """
 
191
 
 
192
        def setClipEnd(clipend):
 
193
                """
 
194
                Set the clip end value. (B{deprecated}) See the L{clipEnd} attribute.
 
195
                @type clipend: float
 
196
                @param clipend: The new clip end value.
 
197
                """
 
198
 
 
199
        def getDrawSize():
 
200
                """
 
201
                Get the draw size value. (B{deprecated}) See the L{drawSize} attribute.
 
202
                @rtype: float
 
203
                """
 
204
 
 
205
        def setDrawSize(drawsize):
 
206
                """
 
207
                Set the draw size value. (B{deprecated}) See the L{drawSize} attribute.
 
208
                @type drawsize: float
 
209
                @param drawsize: The new draw size value.
 
210
                """
 
211
 
 
212
        def getScriptLinks (event):
 
213
                """
 
214
                Get a list with this Camera's script links of type 'event'.
 
215
                @type event: string
 
216
                @param event: "FrameChanged", "Redraw" or "Render".
 
217
                @rtype: list
 
218
                @return: a list with Blender L{Text} names (the script links of the given
 
219
                          'event' type) or None if there are no script links at all.
 
220
                """
 
221
 
 
222
        def clearScriptLinks (links = None):
 
223
                """
 
224
                Delete script links from this Camera.  If no list is specified, all
 
225
                script links are deleted.
 
226
                @type links: list of strings
 
227
                @param links: None (default) or a list of Blender L{Text} names.
 
228
                """
 
229
 
 
230
        def addScriptLink (text, event):
 
231
                """
 
232
                Add a new script link to this Camera.
 
233
                @type text: string
 
234
                @param text: the name of an existing Blender L{Text}.
 
235
                @type event: string
 
236
                @param event: "FrameChanged", "Redraw" or "Render".
 
237
                """
 
238
 
 
239
        def insertIpoKey(keytype):
 
240
                """
 
241
                Inserts keytype values in camera ipo at curframe. Uses module constants.
 
242
                @type keytype: Integer
 
243
                @param keytype:
 
244
                             -LENS
 
245
                             -CLIPPING
 
246
                @return: py_none
 
247
                """  
 
248
 
 
249
        def __copy__ ():
 
250
                """
 
251
                Make a copy of this camera
 
252
                @rtype: Camera
 
253
                @return:  a copy of this camera
 
254
                """
 
255
 
 
256
import id_generics
 
257
Camera.__doc__ += id_generics.attributes