Ligamen

Commands

Animation

This page describes 26 commands in 2 sections. How to call them is explained in Commands.

Playback and keys#

The playhead, playback, markers and keying of the open animation.

lg.anim.play#

Start or pause playback.

Example

lg.anim.play()

lg.anim.play_backward#

Play the active animation backward; press again to pause

Example

lg.anim.play_backward()

lg.anim.stop#

Stop playback.

Example

lg.anim.stop()

lg.anim.go_start#

Move the playhead to the first frame.

Hotkey: Shift+Home.

Example

lg.anim.go_start()

lg.anim.go_end#

Move the playhead to the last frame.

Hotkey: End.

Example

lg.anim.go_end()

lg.anim.first_key#

Jump the playhead to the first key of the active animation

Example

lg.anim.first_key()

lg.anim.last_key#

Jump the playhead to the last key of the active animation

Example

lg.anim.last_key()

lg.anim.next_key#

Jump the playhead to the next key

Example

lg.anim.next_key()

lg.anim.prev_key#

Jump the playhead to the previous key

Example

lg.anim.prev_key()

lg.anim.next_frame#

Move the playhead one frame forward

Example

lg.anim.next_frame()

lg.anim.prev_frame#

Move the playhead one frame back

Example

lg.anim.prev_frame()

lg.anim.frame_forward_10#

Move the playhead ten frames forward

Example

lg.anim.frame_forward_10()

lg.anim.frame_back_10#

Move the playhead ten frames back

Example

lg.anim.frame_back_10()

lg.anim.add_marker#

Pin a named marker to the playhead frame of the active animation

Hotkey: Shift+M.

Example

lg.anim.add_marker()

lg.anim.auto_key#

Automatically key a bone property when it is edited in Animate mode

Synopsis

lg.anim.auto_key(state)

A switch: lg.anim.auto_key(True) turns it on, lg.anim.auto_key(False) off, without an argument it flips it.

Example

lg.anim.auto_key(True)

lg.anim.insert_key#

Key the selected bones' current pose at the playhead

Hotkey: K.

Example

lg.anim.insert_key()

lg.anim.key_active#

Key the current pose of the active bone only (Animate mode)

Example

lg.anim.key_active()

lg.anim.key_shown#

Key the current pose of the bones shown in the Dopesheet (Animate mode)

Example

lg.anim.key_shown()

lg.anim.key_constrained#

Key the pose of the selected bones as constraints leave it (Animate mode)

Example

lg.anim.key_constrained()

lg.anim.delete_key#

Remove any key at the playhead for the selected bones

Hotkey: Shift+K.

Example

lg.anim.delete_key()

lg.anim.adjust#

Editing a bone value also nudges every other dopesheet-selected key on that bone/field by the same relative amount

Synopsis

lg.anim.adjust(state)

A switch: lg.anim.adjust(True) turns it on, lg.anim.adjust(False) off, without an argument it flips it.

Example

lg.anim.adjust(True)

Animation data#

Create and edit animations, write and delete keys, create events.

lg.animation.create_animation#

Create an animation (or copy one) and open it.

Synopsis

lg.animation.create_animation(name, ...)
ArgumentTypeDescription
namestr(required) Name.
duplicate_fromstrCopy this animation.
duration_framesfloatExplicit length in frames.
loopboolLoop flag.
openboolOpen it in the editor (default true).

Example

lg.animation.create_animation(name="walk", duration_frames=24, loop=True)

lg.animation.edit_animation#

Rename an animation or set its duration (frames) / loop flag.

Synopsis

lg.animation.edit_animation(name, ...)
ArgumentTypeDescription
namestr(required) Animation.
new_namestrRename to.
duration_framesfloatLength.
loopboolLoop.

Example

lg.animation.edit_animation(name="walk", duration_frames=30)

lg.animation.set_keys#

Write many keys in ONE undo step. Bone values are ABSOLUTE local values (what Properties shows), not offsets; unspecified fields keep the value the animation currently has at that frame. Author a whole pose or cycle per call.

Synopsis

lg.animation.set_keys(keys, ...)
ArgumentTypeDescription
keyslist(required)
animationstrAnimation (default: open one).

Example

lg.animation.set_keys(animation="walk", keys=[
    {"bone": "arm", "frame": 0, "rotation": 0},
    {"bone": "arm", "frame": 12, "rotation": 40}])

lg.animation.delete_keys#

Delete keys at frames for a bone (optionally one property: rotate, translate, scale, shear, translatex...), a slot, an event, draw order or an IK constraint.

Synopsis

lg.animation.delete_keys(frames, ...)
ArgumentTypeDescription
frameslist(required)
animationstrAnimation.
bonestrBone.
propertystrTimeline property.
slotstrSlot.
eventstrEvent.
draw_orderboolDraw order keys.
ikstrIK name.

Example

lg.animation.delete_keys(animation="walk", frames=[12], bone="arm")

lg.animation.create_event#

Create a setup event (for sounds, footsteps, gameplay triggers).

Synopsis

lg.animation.create_event(name, ...)
ArgumentTypeDescription
namestr(required) Name.
intint
floatfloatFloat value.
stringstrString value.
audiostrAudio file (relative to audio dir).
volumefloat0..1
balancefloat-1..1

Example

lg.animation.create_event(name="step", int=1)