Skip to content
SnuuxPublic

About

CLI that lets AI agents drive Autodesk Maya: inspect, model, skin, animate and export game assets

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

197 Commits

Folders and files

Repository files navigation

bmaya-cli: Autodesk Maya for AI agents, one command at a time. A terminal runs bmaya exec, shot and export; a barrel appears in the Maya viewport, then a picture and an FBX file

Maya 2027 Python 3.10+ MIT license

bmaya is a command-line tool that lets an AI agent or a script work in Autodesk Maya: inspect the scene, run maya.cmds, look at a screenshot, audit meshes, export FBX. Anything with a shell can use it: Claude Code, Codex, Cursor, CI.

  • Each command prints one line of JSON and exits. No server to run, no dependencies.
  • Little sits in the agent's context: a short bmaya guide, then one topic (modeling, skin, animation, export...) only when the work needs it.
  • Works in the Maya you have open, or starts one without a window when none is running.
  • Several agents can share one Maya: each undoes only its own steps.
  • Errors say what to try next, and every command is journaled before it runs, so a crash leaves a trace.

An agent or script runs bmaya in a shell; each bmaya process talks to a bridge inside Maya over a local socket

Install

You need Autodesk Maya (tested on 2027) and uv. Only Windows is tested.

git clone https://github.com/Snuux/bmaya-cli.git
uv tool install ./bmaya-cli

That is enough for a Maya without a window. To also use a Maya you open yourself, copy the bridge into it and restart Maya:

bmaya install

For .glb and .gltf export and import, also run bmaya install --gltf. It adds the optional maya-glb-io library; everything else works without it. bmaya install --draco also adds the decoder for Draco-compressed files.

bmaya doctor checks the result. To update: git pull, uv tool install --reinstall ./bmaya-cli, bmaya install, restart Maya.

Quick start

No Maya needs to be open. The first command starts one without a window, which takes 10 to 20 seconds.

bmaya scene
bmaya exec "result = cmds.polyCube(name='crate')"
bmaya shot -o shot.png
bmaya undo

Each prints one line (the first is shortened here):

{"file":"untitled","unit":"cm","up":"y","fps":24,"nodes":[],"shown":0,"total":0}
{"stdout":"","result":["crate","polyCube1"],"truncated":false}
{"path":"C:/work/shot.png","width":800,"height":450,"frames":[1],"offscreen":true}
{"undone":1}

A Maya without a window runs until you stop it:

bmaya file save crate.ma
bmaya stop

bmaya demo runs the whole loop (build, animate, audit, export, screenshot) in a running Maya and writes the results to demo/.

Tell your agent

An agent does not know the tool exists until told. Paste this into your project's CLAUDE.md or AGENTS.md:

## Maya

Autodesk Maya is driven with the `bmaya` command in the shell.
Run `bmaya guide` once before the first use: a short manual, with `bmaya guide TOPIC` for modeling, skinning, animation, export and the rest. `bmaya --help` lists the commands by group.
Every command prints one line of JSON on stdout. Errors go to stderr as `error:` and `hint:` lines; follow the hint.
Exit code 3 means Maya is still starting or still busy: wait and check `bmaya sessions`, do not send the command again.
Pass multi-line code through stdin (`bmaya exec <<'PY' ... PY`) or `bmaya exec -f FILE`, not as an argument.
Look at your work with `bmaya shot -o shot.png`, or `bmaya views NAME -o views.png` for a model, and open that file.
If a `note:` line says a Maya was started for you, save with `bmaya file save PATH` and run `bmaya stop` when the work is done.

What it can do

Commands Read more
Look scene object shot views playblast Modeling, Animation
Change exec undo file file status wait Scene changes
Model audit diff remesh reduce cleanup mirror Modeling
UVs and edge flow uv topo UVs and textures, Topology
Skin and skeleton skin bones pose rig transfer Skin weights, Skeletons and mirroring
Animate anim clip motion Animation
Export export inspect Export: FBX presets for Unity, Unreal and Godot, glTF, the Game Exporter
Run Maya sessions use start stop doctor logs Sessions, Troubleshooting

Pictures are PNG files an agent opens and reads: viewport shots and contact sheets, a model from several sides, skin weights, UV layouts, edge loops, animation curves. Checks answer with numbers and a list of issues. Exports are read back from disk and compared with the scene.

A low-poly character drawn from the front, the right and three-quarter view, colored by the joint that moves each vertex, with edges on top and its width and height in centimetres

That sheet is bmaya views --style influence --views front,right,persp -o views.png, drawn in a Maya without a window: a color per joint of the skin. The character is from Kenney's Animated Characters (CC0).

All commands with their options are on one page, with the exit codes. bmaya COMMAND --help explains each one with examples, and bmaya guide prints the manual for agents, one topic at a time.

Security

The bridge listens on 127.0.0.1 only, on a random port, and every request carries a per-session token kept in ~/.bmaya/sessions/. This is not a sandbox: bmaya exec runs arbitrary Python in Maya with your user rights, and any local process that can read your home folder can read the token.

Uninstall

bmaya uninstall
uv tool uninstall bmaya-cli

Delete ~/.bmaya/ if you don't need the logs.

Development

uv sync
uv run pytest
uv run ruff check
"C:\Program Files\Autodesk\Maya2027\bin\mayapy.exe" tests/maya/check_handlers.py

The tests don't need Maya. The last command checks the Maya-side handlers in Maya's own Python.

License

MIT, see LICENSE.

About

CLI that lets AI agents drive Autodesk Maya: inspect, model, skin, animate and export game assets

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages