Pose Lab

io.github.hpdkhoav0.2.0更新于 Oct 8, 2026

Measured spatial answers for posing first-person arms and a rifle in Blender

已验证STDIO仅桌面Developer ToolsMedia & Design

概览

AI 生成的概览

让助手在 Blender 中测量并摆出第一人称手臂与步枪姿势,返回间隙、可见性和可达性的具体数值,而不是靠猜测。

功能
Pose Lab 驱动一个无界面 Blender 工作进程,回答关于第一人称手臂与步枪骨架的空间问题。工具可以列出和加载骨架、设置姿势、移动枪械或通过手臂 IK 移动手部,并报告位置、距离以及步枪嵌入前臂、手掌或手指的深度。它还能测量表面正对视线的程度和眼睛能看到的部分,用求解器搜索满足目标的枪械移动,并逐帧扫描或修复动画片段。它也可以渲染带标注的接触表,并把片段保存为骨骼数据或 FBX。
适用场景
当你在 Blender 中摆放或检查第一人称武器动画,需要测量结果而非目测判断时使用,例如某次转动能否露出抛壳口、手指是否插进机匣,或者片段中哪些帧发生漂移或跳变。适用于用 FBX 文件描述的骨架,也适用于内置示例骨架。
运行要求
同一台机器上需要 Blender 和 Python 3.10 或更高版本;已在 Windows 10 上以 Blender 5.2.2 和 Python 3.14 测试,macOS、Linux 和更旧的 Blender 尚未测试。通过 uvx 或 pip 安装,作为本地 stdio 进程运行。可选环境变量:POSELAB_BLENDER 指定 Blender 可执行文件,POSELAB_RIGS 指定描述自有 FBX 骨架的 rigs.json,POSELAB_OUT 指定输出目录,默认为 ~/.poselab。
安装前请注意
它读取你的骨架和片段文件,并且只在 POSELAB_OUT 内写入渲染图、保存的片段和日志。Blender 工作进程只监听 127.0.0.1 上的空闲端口,并且只接受携带本次会话随机令牌的请求。修复和保存类工具会修改片段副本并写入文件,用于项目前请先检查输出。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Pose Lab,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

Pose Lab

Measured spatial answers for posing first-person arms and a rifle in Blender, over MCP.

[The built-in sample rig: four Blender views of first-person arms holding a rifle]

Models are weak at judging 3D space from pictures: which side of a rifle faces the eye, whether a finger sits inside the receiver, whether any turn of the gun can ever show its ejection port. Pose Lab gives a model numbers instead. It reports positions in named frames and how deep anything clips. It measures how squarely a surface faces the eye and what the eye can see. Its solver searches rifle moves against goals and reports which goals no move can meet. For animation, it scans a clip frame by frame against the same checks and mends what fails.

I built it while hand-making chamber checks for my first-person shooter. One question took me several full Blender runs: can turning the rifle show its ejection port to the eye? With Pose Lab it is one solve call. On my game's AK rig, turning alone met the goal in 0 of 60 samples. That is a fact of the geometry: the eye looks along the barrel. Turning and moving the rifle met each goal on its own, but no sample of 400 met all four goals together. So that check needs a new hand pose, not only a new rifle position. On the built-in sample rig, turning alone also met the port goal in 0 of 60 samples, and turning and moving met every goal in 9 s.

What it gives a model

ToolAnswers
list_rigs, load_rig, describethe rigs, the frames, the sign rules, named points, clips, moving parts
pose_idle, pose_clip, move_part, snapshotput the rig in a pose: a clip at a time, the carrier drawn back, saved poses
move_gunroll, swing, pitch and move the rifle; the hands keep their hold by arm IK
reacha wrist onto a point by arm IK (try elbow poles to clear a forearm)
where, distancepositions in a named frame
clearancehow deep the rifle sits inside a forearm, palm or finger, and where
faces_eye, visible, screenhow squarely a surface faces the eye, how much of it the eye sees, where it falls on screen
solvesearches rifle moves against goals; reports each goal and how often any sample met it
rendera contact sheet: the player's eye and outside views, each tile labelled as a Blender view
record_clip, load_clipa clip from keyed poses, or from a file: .pose.json, FBX or BVH
scan_clipevery frame against checks; the worst value, when, and the time spans that fail
fix_clipmends what fails and reports the scan before and after, and what no fix can reach
save_clipwrites a clip as .pose.json bone data and as FBX for a game engine

Frames and signs

Every position goes in and comes out in a named frame, so no one has to guess axes:

  • gun: the gun bone as it stands, Unreal-style axes, cm: +X the gun's left, +Y along the barrel, +Z up (the default)
  • arms: the arms' space, Unreal-style axes, cm
  • view: from the eye, cm: +X right, +Y forward, +Z up

Turns use the player's words: roll + turns the gun's right side up, swing + takes the muzzle left, pitch + the muzzle up. Moves (right, forward, up) are in the view.

A hand round its grip touches the rifle on the idle pose already (a finger on the trigger, fingers round the handguard). Call clearance at pose_idle for that baseline, and leave those segments out with ignore wildcards.

Motion: scan and fix clips

scan_clip plays a clip frame by frame and runs checks on each frame. The checks are the solver's goals (clearance, faces_eye, visible, on_screen, barrel) and three more:

  • contact: a point of the hand on its mark, such as a fingertip on the charging handle (a, b, max_cm)
  • hold: how far a hand drifts on the rifle from its grip at ref_s (side, max_cm)
  • pop: a sudden jump, as the fastest bone speed between frames (bones, max_cm_per_s)

Any check takes during: [from_s, to_s]. fix_clip then mends a copy of the clip:

  • a pop: it blends the jumping frames again from the good frames round them
  • a hold: it puts the hand back on its grip by arm IK
  • a contact: it moves the wrist until the point touches its mark
  • clearance: it swings each elbow about the shoulder to wrist line by the least angle that clears, wrist kept, and eases that swing over the neighbouring frames

It reports the scan before and after. It also lists the frames where a hand must be somewhere its arm cannot reach, since only a new pose can mend those.

examples/motion_test.py records a clip on the sample rig with two common faults. The rifle rolls 75 degrees and back, keyed only at its ends, so the hands drift off the rifle between keys. One frame also jumps 15 cm. The scan and the fix gave these numbers:

CheckBeforeAfter
left hand drift on the rifle1.76 cm0.48 cm
right hand drift on the rifle1.14 cm0.49 cm
fastest hand speed (the pop)450 cm/s33 cm/s
clearance0.0 cm0.0 cm

The fix changed 26 of 43 frames, and every check passed after it. It also flagged 5 frames where the left arm fell 0.46 cm short of its grip. That still passed the 0.5 cm limit.

Install

You need Blender and Python 3.10 or newer. I tested it on Windows 10 with Blender 5.2.2 and Python 3.14. I have not tested macOS, Linux or older Blender versions yet.

uvx poselab-mcp

or pip install poselab-mcp and run poselab-mcp.

Add it to Claude Code:

claude mcp add poselab -- uvx poselab-mcp

or to any MCP client's configuration:

json
{  "mcpServers": {    "poselab": {      "command": "uvx",      "args": ["poselab-mcp"],      "env": { "POSELAB_BLENDER": "C:/Program Files/Blender Foundation/Blender 5.2/blender.exe" }    }  }}

Settings

VariableMeaning
POSELAB_BLENDERBlender's executable, if it is not on the PATH or in the usual install folder
POSELAB_RIGSa rigs.json describing your own rigs (see examples/rigs.example.json)
POSELAB_OUTthe only folder Pose Lab writes to (renders, saved clips, the worker's log); default ~/.poselab

Rigs

The built-in sample (load_rig {"rig": "sample"}) needs no files. Pose Lab builds it in Blender from code: two arms with Unreal mannequin bone names hold an AR-style rifle with a charging handle that slides back.

Your own rigs come from FBX files: the arms mesh, an idle pose, the rifle, and clips. Describe them in a rigs.json (copy examples/rigs.example.json) and point POSELAB_RIGS at it. Clips can be FBX animations on the same skeleton, or <clip>.pose.json bone data: {"fps": 30, "frames": [{"bone": [[x, y, z], [w, x, y, z]], ...}, ...]}, local location and rotation per bone on the idle armature. (Blender misreads an FBX animation it exported itself when it imports it again; bone data avoids that. describe reports each FBX clip's skeleton fit.)

Safety

  • Pose Lab only reads your rig and clip files. It writes renders, saved clips and its log, and only inside POSELAB_OUT.
  • The Blender worker listens on 127.0.0.1 only, on a free port, and answers only requests that carry the session's random token. It runs only Pose Lab's own commands.

How it works

  • poselab_mcp/server.py: the MCP server (the official Python SDK, stdio).
  • poselab_mcp/worker_client.py: starts one headless Blender on the first call and keeps the rig loaded.
  • poselab_mcp/blender/lab.py: inside Blender: the rig, the frames, the measures, the IK, the solver, the renders.
  • poselab_mcp/blender/sample.py: the built-in sample rig.

Test

python examples/selftest.py

It starts the server as an MCP client does and loads the sample rig. Then it replays the question above: turning alone never shows the port, and turning and moving does. The contact sheet lands in ~/.poselab/renders/sheet.png.

python examples/motion_test.py

It records the faulty clip described above, scans it, fixes it, and saves roll_fixed.pose.json and roll_fixed.fbx in ~/.poselab/clips/.

License

MIT

来源:README.md,提交 3a680b5

工具

0
工具元数据尚未被收录。

版本历史

1
  1. v0.2.0最新Oct 8, 2026