Module Camera
[hide private]
[frames] | no frames]

Source Code for Module Camera

  1  # Blender.Camera module and the Camera PyType object 
  2   
  3  """ 
  4  The Blender.Camera submodule. 
  5   
  6  B{New}: L{Camera.clearScriptLinks} accepts a parameter now. 
  7   
  8  Camera Data 
  9  =========== 
 10   
 11  This module provides access to B{Camera Data} objects in Blender. 
 12   
 13  Example:: 
 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 
 21  """ 
 22   
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 """
33
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 """
44
45 -class Camera:
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 221 229 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 258