Commands
Files and pipeline
This page describes 32 commands in 5 sections. How to call them is explained in Commands.
File#
The File menu: projects, import, export, atlases and FBX.
lg.file.new#
Start a new empty project.
Hotkey: Ctrl+N.
Example
lg.file.new()
lg.file.new_skeleton#
Add another, empty skeleton to the project.
Example
lg.file.new_skeleton()
lg.file.open#
Open a project (shows the file dialog).
Hotkey: Ctrl+O.
Opens a dialog and waits for you.
Example
lg.file.open()
lg.file.save#
Save the project to its .ligamen file.
Hotkey: Ctrl+S.
Example
lg.file.save()
lg.file.save_as#
Save the project under a new name (shows the file dialog).
Hotkey: Ctrl+Shift+S.
Opens a dialog and waits for you.
Example
lg.file.save_as()
lg.file.package_project#
Pack the project with its images and audio into one .zip file.
Opens a dialog and waits for you.
Example
lg.file.package_project()
lg.file.import_#
Open the Import window.
Opens a dialog and waits for you.
Example
lg.file.import_()
lg.file.export#
Open the Export window.
Hotkey: Ctrl+E.
Opens a dialog and waits for you.
Example
lg.file.export()
lg.file.repeat_export#
Run the last export of the session again with the same options, without a window.
Hotkey: Ctrl+Shift+E.
Example
lg.file.repeat_export()
lg.file.export_unity#
Export the data together with its texture atlas for the Unity runtime.
Opens a dialog and waits for you.
Example
lg.file.export_unity()
lg.file.export_skeleton#
Export an additional skeleton of the project as a separate file.
Opens a dialog and waits for you.
Example
lg.file.export_skeleton()
lg.file.export_image_sequence#
Open the window that renders the animation to images or a video.
Opens a dialog and waits for you.
Example
lg.file.export_image_sequence()
lg.file.pack_atlas#
Open the Texture Packer.
Opens a dialog and waits for you.
Example
lg.file.pack_atlas()
lg.file.unpack_atlas#
Open the Texture Unpacker, which turns an atlas back into separate images.
Opens a dialog and waits for you.
Example
lg.file.unpack_atlas()
lg.file.import_fbx#
Import an FBX file.
Opens a dialog and waits for you.
Example
lg.file.import_fbx()
lg.file.export_fbx#
Export an FBX file.
Opens a dialog and waits for you.
Example
lg.file.export_fbx()
lg.file.quit#
Quit Ligamen Studio.
Hotkey: Ctrl+Q.
Example
lg.file.quit()
Pipeline#
Exchange with Blender.
lg.pipeline.blender_send#
Send the project to Blender.
Opens a dialog and waits for you.
Example
lg.pipeline.blender_send()
lg.pipeline.blender_receive#
Receive the result from Blender.
Opens a dialog and waits for you.
Example
lg.pipeline.blender_receive()
Project#
Create, open and save projects, project settings and what the animator sees.
lg.project.new_project#
Start an empty project.
Synopsis
lg.project.new_project(...)
| Argument | Type | Description |
|---|---|---|
fps | int | |
discard_changes | bool | Drop unsaved changes. |
Example
lg.project.new_project(fps=30)
lg.project.open_project#
Open a .ligamen project or a Spine JSON file.
Synopsis
lg.project.open_project(path, ...)
| Argument | Type | Description |
|---|---|---|
path | str | (required) File path. |
discard_changes | bool | Drop unsaved changes. |
Example
lg.project.open_project(path="/Users/me/knight.ligamen")
lg.project.save_project#
Save as .ligamen (to its current path, or 'path').
Synopsis
lg.project.save_project(...)
| Argument | Type | Description |
|---|---|---|
path | str | Target .ligamen path (required for a never-saved project). |
Example
lg.project.save_project(path="/Users/me/knight.ligamen")
lg.project.set_project#
Project settings: fps, images_dir, audio_dir (relative to the project file).
Synopsis
lg.project.set_project(...)
| Argument | Type | Description |
|---|---|---|
fps | int | |
images_dir | str | Images folder. |
audio_dir | str | Audio folder. |
Example
lg.project.set_project(fps=24, images_dir="images")
lg.project.set_view#
What the animator sees: setup/animate mode, open animation, frame, active skins, selection, playback. Does not change the document.
Synopsis
lg.project.set_view(...)
| Argument | Type | Description |
|---|---|---|
mode | str | Mode. One of: setup, animate. |
animation | str | Open this animation. |
frame | float | Frame at the project FPS (fractional allowed). |
time | float | Time in seconds (alternative to frame). |
skins | list | Active skins. |
select_bones | list | Bones to select. |
select_slots | list | Slots to select. |
frame_all | bool | Fit the view. |
playing | bool | Play/stop. |
Example
lg.project.set_view(mode="animate", animation="walk", frame=0)
Importer#
Bring PSD layers, images, skeletons and animations into the project.
lg.importer.psd#
Import a layered PSD: every layer becomes bone+slot+region (layer PNGs written to the images folder). Save the project first.
Synopsis
lg.importer.psd(path, ...)
| Argument | Type | Description |
|---|---|---|
path | str | (required) PSD file. |
skin | str | Skin (default 'default'). |
parent | str | Parent bone for the new bones. |
on_conflict | str | Existing names. One of: skip, overwrite. |
include_hidden | bool | Also import hidden layers. |
group_as_slot | bool | PSD groups become one slot each. |
images_dir | str | Where to write layer PNGs. |
Example
lg.importer.psd(path="/Users/me/knight.psd", skin="default")
lg.importer.images#
Import a folder of images: one bone+slot+region per image.
Synopsis
lg.importer.images(folder, ...)
| Argument | Type | Description |
|---|---|---|
folder | str | (required) Folder. |
skin | str | Skin. |
parent | str | Parent bone. |
spacing | float | Horizontal spacing between parts. |
on_conflict | str | Existing names. One of: skip, overwrite. |
Example
lg.importer.images(folder="/Users/me/parts", spacing=10)
lg.importer.skeleton#
Merge bones/slots/skins from another Spine JSON or .ligamen.
Synopsis
lg.importer.skeleton(path, ...)
| Argument | Type | Description |
|---|---|---|
path | str | (required) Source file. |
on_conflict | str | Existing names. One of: skip, overwrite. |
Example
lg.importer.skeleton(path="/Users/me/other.ligamen", on_conflict="skip")
lg.importer.animations#
Copy animations from another Spine JSON or .ligamen.
Synopsis
lg.importer.animations(path, ...)
| Argument | Type | Description |
|---|---|---|
path | str | (required) Source file. |
names | list | Only these animations. |
on_conflict | str | Existing names. One of: rename, skip, overwrite. |
Example
lg.importer.animations(path="/Users/me/other.ligamen", names=["walk"])
Exporter#
Write Spine JSON, rendered media and atlases to disk, or send the model to Blender.
lg.exporter.spine_json#
Export Spine JSON (validated first).
Synopsis
lg.exporter.spine_json(path, ...)
| Argument | Type | Description |
|---|---|---|
path | str | (required) Output .json. |
pretty | bool | Indent (default true). |
nonessential | bool | Keep nonessential data (default true). |
Example
lg.exporter.spine_json(path="/Users/me/knight.json")
lg.exporter.media#
Render an animation to png/jpg/psd frames (path = folder) or gif/apng/avi/mov (path = file).
Synopsis
lg.exporter.media(path, ...)
| Argument | Type | Description |
|---|---|---|
path | str | (required) Folder or file. |
format | str | Format. One of: png, jpg, psd, gif, apng, avi, mov, mp4. |
animation | str | Animation (default: open one). |
all_animations | bool | Frames formats only. |
scale | float | Output scale. |
width | int | |
height | int | |
crop | bool | Trim empty margins. |
overlay_bones | bool | Draw bones. |
smoothing | bool | Bilinear filtering (default true). |
Example
lg.exporter.media(format="gif", path="/Users/me/walk.gif", animation="walk")
lg.exporter.pack_atlas#
Pack a folder of images into a .atlas + page PNGs.
Synopsis
lg.exporter.pack_atlas(folder, output, ...)
| Argument | Type | Description |
|---|---|---|
folder | str | (required) Source images. |
output | str | (required) Output .atlas path. |
max_size | int | |
padding | int | |
allow_rotation | bool | Rotate to fit. |
power_of_two | bool | POT pages. |
strip_whitespace | bool | Trim transparent edges (default true). |
Example
lg.exporter.pack_atlas(folder="/Users/me/parts", output="/Users/me/knight.atlas")
lg.exporter.send_to_blender#
Send the project to Blender through the configured bridge.
Synopsis
lg.exporter.send_to_blender()
Example
lg.exporter.send_to_blender()