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

« back to all changes in this revision

Viewing changes to source/blender/python/api2_2x/doc/Armature.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:
114
114
  """
115
115
 
116
116
def New (name = None):
117
 
  """
118
 
  Return a new armature.
119
 
  @type name: string or nothing
120
 
  @param name: The string name of the new armature.
121
 
  @rtype: Blender Armature.
122
 
  @return: A new armature.
123
 
  """
 
117
        """
 
118
        Return a new armature.
 
119
        @type name: string or nothing
 
120
        @param name: The string name of the new armature.
 
121
        @rtype: Blender Armature.
 
122
        @return: A new armature.
 
123
        """
124
124
 
125
125
class Armature:
126
 
  """
127
 
  The Armature object
128
 
  ===================
129
 
    This object gives access to Armature-specific data in Blender.
130
 
  @ivar name: The Armature name.
131
 
  @type name: String
132
 
  @ivar bones: A Dictionary of Bones (BonesDict) that make up this armature.
133
 
  @type bones: BonesDict Object
134
 
  @ivar vertexGroups: Whether vertex groups define deformation
135
 
  @type vertexGroups: Bool
136
 
  @ivar envelopes: Whether bone envelopes define deformation
137
 
  @type envelopes: Bool
138
 
  @ivar restPosition: Show rest position (no posing possible)
139
 
  @type restPosition: Bool
140
 
  @ivar delayDeform: Don't deform children when manipulating bones
141
 
  @type delayDeform: Bool
142
 
  @ivar drawAxes: Draw bone axes
143
 
  @type drawAxes: Bool
144
 
  @ivar drawNames: Draw bone names
145
 
  @type drawNames: Bool
146
 
  @ivar ghost: Draw ghosts around frame for current Action
147
 
  @type ghost: Bool
148
 
  @ivar ghostStep: Number of frames between ghosts
149
 
  @type ghostStep: Int
150
 
  @ivar drawType: The drawing type that is used to display the armature
151
 
  Acceptable values are:
152
 
      - Armature.OCTAHEDRON: bones drawn as octahedrons
153
 
      - Armature.STICK: bones drawn as sticks
154
 
      - Armature.BBONE: bones drawn as b-bones
155
 
      - Armature.ENVELOPE: bones drawn as sticks with envelopes
156
 
  @type drawType: Constant Object
157
 
  @ivar mirrorEdit: X-axis mirrored editing
158
 
  @type mirrorEdit: Bool
159
 
  @ivar autoIK: Adds temporary IK chains while grabbing bones
160
 
  @type autoIK: Bool
161
 
  @ivar users: The number of users of the armature.  Read-only.
162
 
  @type users: int
163
 
  @ivar fakeUser: The fake user status.
164
 
    Enabling this will keep it in the blend even if there are no users.
165
 
  @type fakeUser: bool
166
 
  """
167
 
 
168
 
  def __init__(name = 'myArmature'):
169
 
    """
170
 
    Initializer for the Armature TypeObject.
171
 
    Example::
172
 
        myNewArmature = Blender.Armature.Armature('AR_1')
173
 
    @param name: The name for the new armature
174
 
    @type name: string
175
 
    @return: New Armature Object
176
 
    @rtype: Armature Object
177
 
    """
178
 
  
179
 
  def makeEditable():
180
 
    """
181
 
    Put the armature into EditMode for editing purposes. (Enters Editmode)
182
 
    @warning: Using Window.Editmode() to switch the editmode manually will cause problems and possibly even crash Blender.
183
 
    @warning: This is only needed for operations such as adding and removing bones.
184
 
    @warning: Do access pose data until you have called update() or settings will be lost. 
185
 
    @warning: The armature should not be in manual editmode
186
 
    prior to calling this method. The armature must be parented
187
 
    to an object prior to editing.
188
 
    @rtype: None
189
 
    """
190
 
 
191
 
  def update():
192
 
    """
193
 
    Save all changes and update the armature. (Leaves Editmode)
194
 
    @note: Must have called makeEditable() first.
195
 
    @rtype: None
196
 
    """
 
126
        """
 
127
        The Armature object
 
128
        ===================
 
129
                This object gives access to Armature-specific data in Blender.
 
130
        @ivar bones: A Dictionary of Bones (BonesDict) that make up this armature.
 
131
        @type bones: BonesDict Object
 
132
        @ivar vertexGroups: Whether vertex groups define deformation
 
133
        @type vertexGroups: Bool
 
134
        @ivar envelopes: Whether bone envelopes define deformation
 
135
        @type envelopes: Bool
 
136
        @ivar restPosition: Show rest position (no posing possible)
 
137
        @type restPosition: Bool
 
138
        @ivar delayDeform: Don't deform children when manipulating bones
 
139
        @type delayDeform: Bool
 
140
        @ivar drawAxes: Draw bone axes
 
141
        @type drawAxes: Bool
 
142
        @ivar drawNames: Draw bone names
 
143
        @type drawNames: Bool
 
144
        @ivar ghost: Draw ghosts around frame for current Action
 
145
        @type ghost: Bool
 
146
        @ivar ghostStep: Number of frames between ghosts
 
147
        @type ghostStep: Int
 
148
        @ivar drawType: The drawing type that is used to display the armature
 
149
        Acceptable values are:
 
150
                        - Armature.OCTAHEDRON: bones drawn as octahedrons
 
151
                        - Armature.STICK: bones drawn as sticks
 
152
                        - Armature.BBONE: bones drawn as b-bones
 
153
                        - Armature.ENVELOPE: bones drawn as sticks with envelopes
 
154
        @type drawType: Constant Object
 
155
        @ivar mirrorEdit: X-axis mirrored editing
 
156
        @type mirrorEdit: Bool
 
157
        @ivar autoIK: Adds temporary IK chains while grabbing bones
 
158
        @type autoIK: Bool
 
159
        """
 
160
 
 
161
        def __init__(name = 'myArmature'):
 
162
                """
 
163
                Initializer for the Armature TypeObject.
 
164
                Example::
 
165
                          myNewArmature = Blender.Armature.Armature('AR_1')
 
166
                @param name: The name for the new armature
 
167
                @type name: string
 
168
                @return: New Armature Object
 
169
                @rtype: Armature Object
 
170
                """
 
171
        
 
172
        def makeEditable():
 
173
                """
 
174
                Put the armature into EditMode for editing purposes. (Enters Editmode)
 
175
                @warning: Using Window.Editmode() to switch the editmode manually will cause problems and possibly even crash Blender.
 
176
                @warning: This is only needed for operations such as adding and removing bones.
 
177
                @warning: Do access pose data until you have called update() or settings will be lost. 
 
178
                @warning: The armature should not be in manual editmode
 
179
                prior to calling this method. The armature must be parented
 
180
                to an object prior to editing.
 
181
                @rtype: None
 
182
                """
 
183
 
 
184
        def update():
 
185
                """
 
186
                Save all changes and update the armature. (Leaves Editmode)
 
187
                @note: Must have called makeEditable() first.
 
188
                @rtype: None
 
189
                """
 
190
 
 
191
import id_generics
 
192
Armature.__doc__ += id_generics.attributes 
197
193
 
198
194
class BonesDict:
199
 
  """
200
 
  The BonesDict object
201
 
  ====================
202
 
    This object gives gives dictionary like access to the bones in an armature. 
203
 
    It is internal to blender but is called as 'Armature.bones'
204
 
 
205
 
    Removing a bone: 
206
 
    Example::
207
 
      del myArmature.bones['bone_name']
208
 
    Adding a bone:
209
 
    Example::
210
 
      myEditBone = Armature.Editbone()
211
 
      myArmature.bones['bone_name'] = myEditBone
212
 
  """
213
 
 
214
 
  def items():
215
 
    """
216
 
    Return the key, value pairs in this dictionary
217
 
    @rtype: string, BPy_bone
218
 
    @return: All strings, and py_bones in the armature (in that order)
219
 
    """
220
 
 
221
 
  def keys():
222
 
    """
223
 
    Return the keys in this dictionary
224
 
    @rtype: string
225
 
    @return: All strings representing the bone names
226
 
    """
227
 
 
228
 
  def values():
229
 
    """
230
 
    Return the values in this dictionary
231
 
    @rtype: BPy_bone
232
 
    @return: All BPy_bones in this dictionary
233
 
    """
 
195
        """
 
196
        The BonesDict object
 
197
        ====================
 
198
                This object gives gives dictionary like access to the bones in an armature. 
 
199
                It is internal to blender but is called as 'Armature.bones'
 
200
 
 
201
                Removing a bone: 
 
202
                Example::
 
203
                        del myArmature.bones['bone_name']
 
204
                Adding a bone:
 
205
                Example::
 
206
                        myEditBone = Armature.Editbone()
 
207
                        myArmature.bones['bone_name'] = myEditBone
 
208
        """
 
209
 
 
210
        def items():
 
211
                """
 
212
                Return the key, value pairs in this dictionary
 
213
                @rtype: string, BPy_bone
 
214
                @return: All strings, and py_bones in the armature (in that order)
 
215
                """
 
216
 
 
217
        def keys():
 
218
                """
 
219
                Return the keys in this dictionary
 
220
                @rtype: string
 
221
                @return: All strings representing the bone names
 
222
                """
 
223
 
 
224
        def values():
 
225
                """
 
226
                Return the values in this dictionary
 
227
                @rtype: BPy_bone
 
228
                @return: All BPy_bones in this dictionary
 
229
                """
234
230
 
235
231
class Bone:
236
 
  """
237
 
  The Bone object
238
 
  ===============
239
 
    This object gives access to Bone-specific data in Blender. This object
240
 
    cannot be instantiated but is returned by BonesDict when the armature is not in editmode.
241
 
  @ivar name: The name of this Bone.
242
 
  @type name: String
243
 
  @ivar roll: This Bone's roll value.
244
 
    Keys are:
245
 
       - 'ARMATURESPACE' - this roll in relation to the armature
246
 
       - 'BONESPACE' - the roll in relation to itself 
247
 
  @type roll: Dictionary
248
 
  @ivar head: This Bone's "head" ending position when in rest state.
249
 
    Keys are:
250
 
       - 'ARMATURESPACE' - this head position in relation to the armature
251
 
       - 'BONESPACE' - the head position in relation to itself 
252
 
  @type head: Dictionary
253
 
  @ivar tail: This Bone's "tail" ending position when in rest state.
254
 
    Keys are:
255
 
       - 'ARMATURESPACE' - this tail position in relation to the armature
256
 
       - 'BONESPACE' - the tail position in relation to itself 
257
 
  @type tail: Dictionary
258
 
  @ivar matrix: This Bone's matrix. This cannot be set.
259
 
    Keys are:
260
 
       - 'ARMATURESPACE' - this matrix of the bone in relation to the armature
261
 
       - 'BONESPACE' - the matrix of the bone in relation to itself 
262
 
  @type matrix: Matrix Object
263
 
  @ivar parent: The parent Bone.
264
 
  @type parent: Bone Object
265
 
  @ivar children: The children directly attached to this bone.
266
 
  @type children: List of Bone Objects
267
 
  @ivar weight: The bone's weight.
268
 
  @type weight: Float
269
 
  @ivar options: Various bone options which can be:
270
 
       - Armature.CONNECTED: IK to parent
271
 
       - Armature.HINGE: No parent rotation or scaling
272
 
       - Armature.NO_DEFORM: The bone does not deform geometry
273
 
       - Armature.MULTIPLY: Multiply vgroups by envelope
274
 
       - Armature.HIDDEN_EDIT: Hide bones in editmode
275
 
       - Armature.ROOT_SELECTED: Selection of root ball of bone
276
 
       - Armature.BONE_SELECTED: Selection of bone
277
 
       - Armature.TIP_SELECTED: Selection of tip ball of bone
278
 
  @type options: List of Constants
279
 
  @ivar subdivision: The number of bone subdivisions.
280
 
  @type subdivision: Int
281
 
  @ivar deformDist: The deform distance of the bone
282
 
  @type deformDist: Float
283
 
  @ivar length: The length of the bone. This cannot be set.
284
 
  @type length: Float
285
 
  @ivar headRadius: The radius of this bones head (used for envalope bones)
286
 
  @type headRadius: Float
287
 
  @ivar tailRadius: The radius of this bones head (used for envalope bones)
288
 
  @type tailRadius: Float
289
 
  """
290
 
 
291
 
  def hasParent():
292
 
    """
293
 
    Whether or not this bone has a parent
294
 
    @rtype: Bool
295
 
    """
296
 
 
297
 
  def hasChildren():
298
 
    """
299
 
    Whether or not this bone has children
300
 
    @rtype: Bool
301
 
    """
302
 
 
303
 
  def getAllChildren():
304
 
    """
305
 
    Gets all the children under this bone including the children's children.
306
 
    @rtype: List of Bone object
307
 
    @return: all bones under this one
308
 
    """
 
232
        """
 
233
        The Bone object
 
234
        ===============
 
235
                This object gives access to Bone-specific data in Blender. This object
 
236
                cannot be instantiated but is returned by BonesDict when the armature is not in editmode.
 
237
        @ivar name: The name of this Bone.
 
238
        @type name: String
 
239
        @ivar roll: This Bone's roll value.
 
240
                Keys are:
 
241
                         - 'ARMATURESPACE' - this roll in relation to the armature
 
242
                         - 'BONESPACE' - the roll in relation to itself 
 
243
        @type roll: Dictionary
 
244
        @ivar head: This Bone's "head" ending position when in rest state.
 
245
                Keys are:
 
246
                         - 'ARMATURESPACE' - this head position in relation to the armature
 
247
                         - 'BONESPACE' - the head position in relation to itself.
 
248
        @type head: Dictionary
 
249
        @ivar tail: This Bone's "tail" ending position when in rest state.
 
250
                Keys are:
 
251
                         - 'ARMATURESPACE' - this tail position in relation to the armature
 
252
                         - 'BONESPACE' - the tail position in relation to itself 
 
253
        @type tail: Dictionary
 
254
        @ivar matrix: This Bone's matrix. This cannot be set.
 
255
                Keys are:
 
256
                         - 'ARMATURESPACE' - this matrix of the bone in relation to the armature
 
257
                         - 'BONESPACE' - the matrix of the bone in relation to itself 
 
258
        @type matrix: Matrix Object
 
259
        @ivar parent: The parent Bone.
 
260
        @type parent: Bone Object
 
261
        @ivar children: The children directly attached to this bone.
 
262
        @type children: List of Bone Objects
 
263
        @ivar weight: The bone's weight.
 
264
        @type weight: Float
 
265
        @ivar options: Various bone options which can be:
 
266
                         - Armature.CONNECTED: IK to parent
 
267
                         - Armature.HINGE: No parent rotation or scaling
 
268
                         - Armature.NO_DEFORM: The bone does not deform geometry
 
269
                         - Armature.MULTIPLY: Multiply vgroups by envelope
 
270
                         - Armature.HIDDEN_EDIT: Hide bones in editmode
 
271
                         - Armature.ROOT_SELECTED: Selection of root ball of bone
 
272
                         - Armature.BONE_SELECTED: Selection of bone
 
273
                         - Armature.TIP_SELECTED: Selection of tip ball of bone
 
274
        @type options: List of Constants
 
275
        @ivar subdivision: The number of bone subdivisions.
 
276
        @type subdivision: Int
 
277
        @ivar deformDist: The deform distance of the bone
 
278
        @type deformDist: Float
 
279
        @ivar length: The length of the bone. This cannot be set.
 
280
        @type length: Float
 
281
        @ivar headRadius: The radius of this bones head (used for envalope bones)
 
282
        @type headRadius: Float
 
283
        @ivar tailRadius: The radius of this bones head (used for envalope bones)
 
284
        @type tailRadius: Float
 
285
        """
 
286
 
 
287
        def hasParent():
 
288
                """
 
289
                Whether or not this bone has a parent
 
290
                @rtype: Bool
 
291
                """
 
292
 
 
293
        def hasChildren():
 
294
                """
 
295
                Whether or not this bone has children
 
296
                @rtype: Bool
 
297
                """
 
298
 
 
299
        def getAllChildren():
 
300
                """
 
301
                Gets all the children under this bone including the children's children.
 
302
                @rtype: List of Bone object
 
303
                @return: all bones under this one
 
304
                """
309
305
 
310
306
class Editbone:
311
 
  """
312
 
  The Editbone Object
313
 
  ===================
314
 
    This object is a wrapper for editbone data and is used only in the manipulation
315
 
    of the armature in editmode.
316
 
  @ivar name: The name of this Bone.
317
 
  @type name: String
318
 
  @ivar roll: This Bone's roll value (armaturespace).
319
 
  @type roll: Float
320
 
  @ivar head: This Bone's "head" ending position when in rest state (armaturespace).
321
 
  @type head: Vector Object
322
 
  @ivar tail: This Bone's "tail" ending position when in rest state (armaturespace).
323
 
  @type tail: Vector Object
324
 
  @ivar matrix: This Bone's matrix. (armaturespace)
325
 
  @type matrix: Matrix Object
326
 
  @ivar parent: The parent Bone.
327
 
  @type parent: Editbone Object
328
 
  @ivar weight: The bone's weight.
329
 
  @type weight: Float
330
 
  @ivar options: Various bone options which can be:
331
 
       - Armature.CONNECTED: IK to parent
332
 
       - Armature.HINGE: No parent rotation or scaling
333
 
       - Armature.NO_DEFORM: The bone does not deform geometry
334
 
       - Armature.MULTIPLY: Multiply vgroups by envelope
335
 
       - Armature.HIDDEN_EDIT: Hide bones in editmode
336
 
       - Armature.ROOT_SELECTED: Selection of root ball of bone
337
 
       - Armature.BONE_SELECTED: Selection of bone
338
 
       - Armature.TIP_SELECTED: Selection of tip ball of bone
339
 
  @type options: List of Constants
340
 
  @ivar subdivision: The number of bone subdivisions.
341
 
  @type subdivision: Int
342
 
  @ivar deformDist: The deform distance of the bone
343
 
  @type deformDist: Float
344
 
  @ivar length: The length of the bone. This cannot be set.
345
 
  @type length: Float
346
 
  @ivar headRadius: The radius of this bones head (used for envalope bones)
347
 
  @type headRadius: Float
348
 
  @ivar tailRadius: The radius of this bones head (used for envalope bones)
349
 
  @type tailRadius: Float
350
 
  """
351
 
 
352
 
  def hasParent():
353
 
    """
354
 
    Whether or not this bone has a parent
355
 
    @rtype: Bool
356
 
    """
357
 
 
358
 
  def clearParent():
359
 
    """
360
 
    Set the parent to None
361
 
    @rtype: None
362
 
    """
 
307
        """
 
308
        The Editbone Object
 
309
        ===================
 
310
                This object is a wrapper for editbone data and is used only in the manipulation
 
311
                of the armature in editmode.
 
312
        @ivar name: The name of this Bone.
 
313
        @type name: String
 
314
        @ivar roll: This Bone's roll value (armaturespace).
 
315
        @type roll: Float
 
316
        @ivar head: This Bone's "head" ending position when in rest state (armaturespace).
 
317
        @type head: Vector Object
 
318
        @ivar tail: This Bone's "tail" ending position when in rest state (armaturespace).
 
319
        @type tail: Vector Object
 
320
        @ivar matrix: This Bone's matrix. (armaturespace)
 
321
        @type matrix: Matrix Object
 
322
        @ivar parent: The parent Bone.
 
323
        @type parent: Editbone Object
 
324
        @ivar weight: The bone's weight.
 
325
        @type weight: Float
 
326
        @ivar options: Various bone options which can be:
 
327
                         - Armature.CONNECTED: IK to parent
 
328
                         - Armature.HINGE: No parent rotation or scaling
 
329
                         - Armature.NO_DEFORM: The bone does not deform geometry
 
330
                         - Armature.MULTIPLY: Multiply vgroups by envelope
 
331
                         - Armature.HIDDEN_EDIT: Hide bones in editmode
 
332
                         - Armature.ROOT_SELECTED: Selection of root ball of bone
 
333
                         - Armature.BONE_SELECTED: Selection of bone
 
334
                         - Armature.TIP_SELECTED: Selection of tip ball of bone
 
335
        @type options: List of Constants
 
336
        @ivar subdivision: The number of bone subdivisions.
 
337
        @type subdivision: Int
 
338
        @ivar deformDist: The deform distance of the bone
 
339
        @type deformDist: Float
 
340
        @ivar length: The length of the bone. This cannot be set.
 
341
        @type length: Float
 
342
        @ivar headRadius: The radius of this bones head (used for envalope bones)
 
343
        @type headRadius: Float
 
344
        @ivar tailRadius: The radius of this bones head (used for envalope bones)
 
345
        @type tailRadius: Float
 
346
        """
 
347
 
 
348
        def hasParent():
 
349
                """
 
350
                Whether or not this bone has a parent
 
351
                @rtype: Bool
 
352
                """
 
353
 
 
354
        def clearParent():
 
355
                """
 
356
                Set the parent to None
 
357
                @rtype: None
 
358
                """