2003-07-12 18:02:54 +00:00
|
|
|
# Blender.Armature module and the Armature PyType object
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
The Blender.Armature submodule.
|
|
|
|
|
|
|
|
|
|
Armature
|
|
|
|
|
========
|
|
|
|
|
|
|
|
|
|
This module provides access to B{Armature} objects in Blender. These are
|
|
|
|
|
"skeletons", used to deform and animate other objects -- meshes, for
|
|
|
|
|
example.
|
|
|
|
|
|
|
|
|
|
Example::
|
|
|
|
|
import Blender
|
|
|
|
|
from Blender import Armature
|
|
|
|
|
#
|
|
|
|
|
armatures = Armature.Get()
|
|
|
|
|
for a in armatures:
|
|
|
|
|
print "Armature ", a
|
2005-11-21 15:36:36 +00:00
|
|
|
for bone_name, bone in a.bones.items():
|
|
|
|
|
print bone_name, bone.weight
|
2003-07-12 18:02:54 +00:00
|
|
|
|
2005-11-21 15:36:36 +00:00
|
|
|
"""
|
2003-07-12 18:02:54 +00:00
|
|
|
|
|
|
|
|
def Get (name = None):
|
|
|
|
|
"""
|
|
|
|
|
Get the Armature object(s) from Blender.
|
2005-11-21 15:36:36 +00:00
|
|
|
@type name: string, nothing, or list of strings
|
|
|
|
|
@param name: The string name of an armature.
|
2003-07-12 18:02:54 +00:00
|
|
|
@rtype: Blender Armature or a list of Blender Armatures
|
|
|
|
|
@return: It depends on the I{name} parameter:
|
|
|
|
|
- (name): The Armature object with the given I{name};
|
2005-11-21 15:36:36 +00:00
|
|
|
- (name, name, ...): A list of Armature objects
|
2003-07-12 18:02:54 +00:00
|
|
|
- (): A list with all Armature objects in the current scene.
|
|
|
|
|
"""
|
|
|
|
|
|
2005-11-21 15:36:36 +00:00
|
|
|
class ArmatureType:
|
2003-07-12 18:02:54 +00:00
|
|
|
"""
|
2005-11-21 15:36:36 +00:00
|
|
|
The ArmatureType object
|
2005-11-21 15:44:59 +00:00
|
|
|
=======================
|
2003-07-12 18:02:54 +00:00
|
|
|
This object gives access to Armature-specific data in Blender.
|
2005-06-15 06:22:26 +00:00
|
|
|
@ivar name: The Armature name.
|
2005-11-21 15:36:36 +00:00
|
|
|
@ivar bones: A Dictionary of Bones that make up this armature.
|
2005-11-21 20:22:08 +00:00
|
|
|
@ivar vertexGroups: (bool) Whether vertex groups define deformation
|
|
|
|
|
@ivar envelopes: (bool) Whether bone envelopes define deformation
|
|
|
|
|
@ivar restPosition: (bool) Show rest position (no posing possible)
|
|
|
|
|
@ivar delayDeform: (bool) Dont deform children when manipulating bones
|
2005-11-21 20:54:29 +00:00
|
|
|
@ivar drawAxes: (bool) Draw bone axes
|
|
|
|
|
@ivar drawNames: (bool) Draw bone names
|
|
|
|
|
@ivar ghost: Draw ghosts around frame for current Action
|
|
|
|
|
@ivar ghostStep: Number of frames between ghosts
|
2005-11-21 21:26:09 +00:00
|
|
|
@ivar drawType: The drawing type that is used to display the armature
|
|
|
|
|
Acceptable values are:
|
|
|
|
|
- Armature.OCTAHEDRON: bones drawn as octahedrons
|
|
|
|
|
- Armature.STICK: bones drawn as sticks
|
|
|
|
|
- Armature.BBONE: bones drawn as b-bones
|
|
|
|
|
- Armature.ENVELOPE: bones drawn as sticks with envelopes
|
2005-11-21 22:21:46 +00:00
|
|
|
@ivar mirrorEdit: (bool) X-axis mirrored editing
|
|
|
|
|
@ivar autoIK: (bool) Adds temporary IK chains while grabbing bones
|
2003-07-12 18:02:54 +00:00
|
|
|
"""
|
|
|
|
|
|
2005-11-21 15:44:59 +00:00
|
|
|
def __init__(name = 'myArmature'):
|
2005-11-21 15:36:36 +00:00
|
|
|
"""
|
|
|
|
|
Initializer for the ArmatureType TypeObject.
|
|
|
|
|
Example::
|
|
|
|
|
myNewArmature = Blender.Armature.ArmatureType('AR_1')
|
2005-11-21 15:44:59 +00:00
|
|
|
@param name: The name for the new armature
|
|
|
|
|
@type name: string
|
2005-11-21 15:36:36 +00:00
|
|
|
"""
|
2005-11-21 20:22:08 +00:00
|
|
|
|
2005-11-21 15:36:36 +00:00
|
|
|
def makeEditable():
|
|
|
|
|
"""
|
|
|
|
|
Put the armature into EditMode for editing purposes.
|
|
|
|
|
@warning: The armature should not be in manual editmode
|
|
|
|
|
prior to calling this method.
|
|
|
|
|
"""
|
2003-07-12 18:02:54 +00:00
|
|
|
|
2005-11-21 15:36:36 +00:00
|
|
|
def saveChanges():
|
2003-07-12 18:02:54 +00:00
|
|
|
"""
|
2005-11-21 15:36:36 +00:00
|
|
|
Save all changes and update the armature.
|
2005-11-21 15:44:59 +00:00
|
|
|
@note: Must have called makeEditable() first.
|
2003-07-12 18:02:54 +00:00
|
|
|
"""
|
2005-11-21 15:36:36 +00:00
|
|
|
|
|
|
|
|
class BonesDict:
|
|
|
|
|
"""
|
|
|
|
|
The BonesDict object
|
2005-11-21 15:44:59 +00:00
|
|
|
====================
|
2005-11-21 15:36:36 +00:00
|
|
|
This object gives gives dictionary like access to the bones in an armature.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
def items():
|
|
|
|
|
"""
|
|
|
|
|
Retun the key, value pairs in this dictionary
|
|
|
|
|
@rtype: string, BPy_bone
|
|
|
|
|
@return: All strings, and py_bones in the armature (in that order)
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
def keys():
|
2004-04-06 01:01:34 +00:00
|
|
|
"""
|
2005-11-21 15:36:36 +00:00
|
|
|
Retun the keys in this dictionary
|
|
|
|
|
@rtype: string
|
|
|
|
|
@return: All strings representing the bone names
|
2004-04-06 01:01:34 +00:00
|
|
|
"""
|
2005-11-21 15:36:36 +00:00
|
|
|
|
|
|
|
|
def values():
|
2004-04-06 01:01:34 +00:00
|
|
|
"""
|
2005-11-21 15:36:36 +00:00
|
|
|
Retun the values in this dictionary
|
|
|
|
|
@rtype: BPy_bone
|
|
|
|
|
@return: All BPy_bones in this dictionary
|
2005-06-15 06:22:26 +00:00
|
|
|
"""
|
2005-11-21 15:36:36 +00:00
|
|
|
|
|
|
|
|
class BoneType:
|
|
|
|
|
"""
|
|
|
|
|
The BoneType object
|
2005-11-21 15:44:59 +00:00
|
|
|
===================
|
2005-11-21 15:36:36 +00:00
|
|
|
This object gives access to Bone-specific data in Blender.
|
|
|
|
|
@ivar name: The name of this Bone.
|
|
|
|
|
@ivar roll: This Bone's roll value.
|
|
|
|
|
@ivar head: This Bone's "head" ending position when in rest state.
|
|
|
|
|
@ivar tail: This Bone's "tail" ending position when in rest state.
|
|
|
|
|
@ivar matrix: This Bone's matrix.
|
|
|
|
|
@ivar parent: The parent Bone.
|
|
|
|
|
@ivar children: The children bones.
|
|
|
|
|
@ivar weight: The bone's weight.
|
|
|
|
|
@ivar options: Various bone options which can be:
|
|
|
|
|
-CONNECTED: IK to parent
|
|
|
|
|
-HINGE: No parent rotation or scaling
|
|
|
|
|
-NO_DEFORM: The bone does not deform geometetry
|
|
|
|
|
-MULTIPLY: Multiply vgroups by envelope
|
|
|
|
|
-HIDDEN_EDIT: Hide bones in editmode
|
|
|
|
|
@ivar subdivision: The number of bone subdivisions.
|
|
|
|
|
@ivar deform_dist: The deform distance of the bone
|
|
|
|
|
"""
|