Module NLA

Source Code for Module NLA

  1  # Blender.Armature.NLA module and the Action PyType object 
  2   
  3  """ 
  4  The Blender.Armature.NLA submodule. 
  5   
  6  NLA 
  7  === 
  8   
  9  This module provides access to B{Action} objects in Blender.  Actions are a 
 10  series of keyframes/Ipo curves that define the movement of a bone.  
 11  Actions are linked to objects of type armature. 
 12   
 13  @type Flags: readonly dictionary 
 14  @var Flags: Constant dict used by the L{ActionStrip.flag} attribute. 
 15  It is a bitmask and settings are ORed together. 
 16          - SELECT: action strip is selected in NLA window 
 17          - STRIDE_PATH: play action based on path position and stride. 
 18          - HOLD: continue displaying the last frame past the end of the strip 
 19          - ACTIVE: action strip is active in NLA window 
 20          - LOCK_ACTION: action start/end are automatically mapped to strip duration 
 21          - MUTE: action strip does not contribute to the NLA solution 
 22   
 23  @type StrideAxes: readonly dictionary 
 24  @var StrideAxes: Constant dict used by the L{ActionStrip.strideAxis} attribute. 
 25  Values are STRIDEAXIS_X, STRIDEAXIS_Y, and STRIDEAXIS_Z. 
 26   
 27  @type Modes: readonly dictionary 
 28  @var Modes: Constant dict used by the L{ActionStrip.mode} attribute. 
 29  Currently the only value is MODE_ADD. 
 30  """ 
 31   
32 -def NewAction (name = 'DefaultAction'):
33 """ 34 Create a new Action object. 35 @type name: string 36 @param name: The Action name. 37 @rtype: PyAction 38 """
39
40 -def CopyAction (action):
41 """ 42 Copy an action and it's keyframes 43 @type action: PyAction 44 @param action: The action to be copied. 45 @rtype: PyAction 46 @return: A copied action 47 """
48
49 -def GetActions ():
50 """ 51 Get all actions and return them as a Key : Value Dictionary. 52 @rtype: Dictionary of PyActions 53 @return: All the actions in blender 54 """
55
56 -class Action:
57 """ 58 The Action object 59 ================= 60 This object gives access to Action-specific data in Blender. 61 """ 62
63 - def getName():
64 """ 65 Get the name of this Action. 66 @rtype: string 67 """
68
69 - def setName(name):
70 """ 71 Set the name of this Action. 72 @type name: string 73 @param name: The new name 74 """
75
76 - def setActive(object):
77 """ 78 Set this action as the current action for an object. 79 @type object: PyObject 80 @param object: The object whose action is to be set 81 """
82
83 - def getChannelIpo(channel):
84 """ 85 Get the Ipo for the named channel in this action 86 @type channel: string 87 @param channel: The name of a channel in this action 88 @rtype: PyIpo or None 89 @return: the Ipo for the channel 90 """
91
92 - def getFrameNumbers():
93 """ 94 Gets the frame numbers at which a key was inserted into this action 95 @rtype: PyList 96 @return: a list of ints 97 """
98
99 - def removeChannel(channel):
100 """ 101 Remove a named channel from this action 102 @type channel: string 103 @param channel: The name of a channel in this action to be removed 104 """
105
106 - def getAllChannelIpos():
107 """ 108 Get the all the Ipos for this action 109 @rtype: Dictionary [channel : PyIpo or None] 110 @return: the Ipos for all the channels in the action 111 """
112
113 - def getChannelNames():
114 """ 115 Returns a list of channel names 116 @rtype: list 117 @return: the channel names that match bone and constraint names. 118 """
119
120 - def renameChannel(nameFrom, nameTo):
121 """ 122 rename an existing channel to a new name. 123 124 if the nameFrom channel dosnt exist or the nameTo exists, an error will be raised. 125 @return: None 126 """
127 128 import id_generics 129 Action.__doc__ += id_generics.attributes 130 131
132 -class ActionStrips:
133 """ 134 The ActionStrips object 135 ======================= 136 This object gives access to sequence of L{ActionStrip} objects for 137 a particular Object. 138 """ 139
140 - def __getitem__(index):
141 """ 142 This operator returns one of the action strips in the stack. 143 @type index: int 144 @return: an action strip object 145 @rtype: ActionStrip 146 @raise KeyError: index was out of range 147 """
148
149 - def __len__():
150 """ 151 Returns the number of action strips for the object. 152 @return: number of action strips 153 @rtype: int 154 """
155
156 - def append(action):
157 """ 158 Appends a new action to the end of the action strip sequence. 159 @type action: L{Action<NLA.Action>} 160 @param action: the action to use in the action strip 161 @rtype: ActionStrip 162 @return: the new action strip 163 """
164
165 - def remove(actionstrip):
166 """ 167 Remove an action strip from this object's actionstrip sequence. 168 @type actionstrip: an action strip from this sequence to remove. 169 @note: Accessing attributes of the action strip after it is removed will 170 throw an exception. 171 """
172
173 - def moveDown(actionstrip):
174 """ 175 Move the action strip down in the object's actionstrip sequence. 176 @type actionstrip: an action strip from this sequence. 177 """
178
179 - def moveUp(actionstrip):
180 """ 181 Move the action strip up in the object's actionstrip sequence. 182 @type actionstrip: an action strip from this sequence. 183 """
184
185 -class ActionStrip:
186 """ 187 The ActionStrip object 188 ====================== 189 This object gives access to a particular action strip. 190 @ivar action: Action associated with the strip. 191 @type action: BPy Action object 192 @ivar stripStart: Starting frame of the strip. 193 @type stripStart: float 194 @ivar stripEnd: Ending frame of the strip. 195 @type stripEnd: float 196 @ivar actionStart: Starting frame of the action. 197 @type actionStart: float 198 @ivar actionEnd: Ending frame of the action. 199 @type actionEnd: float 200 @ivar repeat: The number of times to repeat the action range. 201 @type repeat: float 202 @ivar mode: Controls the ActionStrip mode. See L{Modes} for 203 valid values. 204 @type mode: int 205 @ivar flag: Controls various ActionStrip attributes. Values can be ORed. 206 See L{Flags} for valid values. 207 @type flag: int 208 @ivar strideAxis: Dominant axis for stride bone. See L{StrideAxes} for 209 valid values. 210 @type strideAxis: int 211 @ivar strideLength: Distance covered by one complete cycle of the action 212 specified in the Action Range. 213 @type strideLength: float 214 @ivar strideBone: Name of Bone used for stride 215 @type strideBone: string 216 @ivar groupTarget: Armature object within DupliGroup for local animation 217 @type groupTarget: object 218 @ivar blendIn: Number of frames of motion blending. 219 @type blendIn: float 220 @ivar blendOut: Number of frames of ease-out. 221 @type blendOut: float 222 """ 223
224 - def resetActionLimits():
225 """ 226 Activates the functionality found in NLA Strip menu under "Reset Action 227 Start/End". This method restores the values of ActionStart and 228 ActionEnd to their defaults, usually the first and last frames within 229 an action that contain keys. 230 @rtype: None 231 """
232
233 - def resetStripSize():
234 """ 235 Activates the functionality found in NLA Strip menu under "Reset Strip 236 Size". This method resets the action strip size to its creation values. 237 @rtype: None 238 """
239
240 - def snapToFrame():
241 """ 242 Activates the functionality found in NLA Strip menu under "Snap to Frame". 243 This function snaps the ends of the action strip to the nearest whole 244 numbered frame. 245 @rtype: None 246 """
247