agent-manifesto-kit 1.1.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -3
- package/collection/bundles/blender-3d/README.md +41 -0
- package/collection/bundles/blender-3d/agents/visual-reviewer.md +51 -0
- package/collection/bundles/blender-3d/skills/blender-mocap-retarget/SKILL.md +96 -0
- package/collection/bundles/blender-3d/skills/blender-mocap-retarget/scripts/check_motion.py +162 -0
- package/collection/bundles/blender-3d/skills/blender-mocap-retarget/scripts/export_gltf_clip.py +71 -0
- package/collection/bundles/blender-3d/skills/blender-mocap-retarget/scripts/godot_verify.py +87 -0
- package/collection/bundles/blender-3d/skills/blender-mocap-retarget/scripts/inspect_motion_source.py +107 -0
- package/collection/bundles/blender-3d/skills/blender-mocap-retarget/scripts/render_frames.py +117 -0
- package/collection/bundles/blender-3d/skills/blender-mocap-retarget/scripts/verify_gltf.py +44 -0
- package/collection/bundles/blender-3d/skills/blender-reference-model/SKILL.md +83 -0
- package/collection/bundles/blender-3d/skills/blender-reference-model/scripts/colors.py +50 -0
- package/collection/bundles/blender-3d/skills/blender-reference-model/scripts/compare.py +77 -0
- package/collection/bundles/blender-3d/skills/blender-reference-model/scripts/contact_sheet.py +51 -0
- package/collection/bundles/blender-3d/skills/blender-reference-model/scripts/diff_renders.py +58 -0
- package/collection/bundles/blender-3d/skills/blender-reference-model/scripts/edges.py +54 -0
- package/collection/bundles/blender-3d/skills/blender-reference-model/scripts/measure_ref.py +137 -0
- package/collection/bundles/blender-3d/skills/blender-reference-model/scripts/mesh_report.py +67 -0
- package/collection/bundles/blender-3d/skills/blender-reference-model/scripts/refspec.py +91 -0
- package/collection/bundles/blender-3d/skills/blender-reference-model/scripts/render_views.py +99 -0
- package/collection/bundles/blender-3d/skills/blender-reference-model/scripts/zoom.py +47 -0
- package/collection/bundles/kit-adopt/README.md +1 -1
- package/collection/bundles/kit-adopt/skills/kit-adopt/SKILL.md +2 -2
- package/dist/agent-format.js +218 -0
- package/dist/catalog.js +13 -13
- package/dist/cli.js +62 -5
- package/dist/commands/adopt.js +13 -3
- package/dist/commands/ingest.js +120 -0
- package/dist/commands/list.js +54 -6
- package/dist/commands/sync.js +201 -0
- package/dist/portability.js +19 -2
- package/dist/providers.js +12 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,6 +31,14 @@ List available capabilities:
|
|
|
31
31
|
agentkit list
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
+
Show one catalog view:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
agentkit list skills
|
|
38
|
+
agentkit list agents
|
|
39
|
+
agentkit list bundles
|
|
40
|
+
```
|
|
41
|
+
|
|
34
42
|
Adopt the Spec-Driven Development bundle for Claude:
|
|
35
43
|
|
|
36
44
|
```bash
|
|
@@ -43,6 +51,12 @@ Adopt the QA Automation bundle for browser and automated-test workflows:
|
|
|
43
51
|
agentkit adopt qa-automation --provider claude
|
|
44
52
|
```
|
|
45
53
|
|
|
54
|
+
Keep skills and agents synced into both Claude and Codex locations of a project:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
agentkit sync blender-3d brainstorm --provider claude,codex
|
|
58
|
+
```
|
|
59
|
+
|
|
46
60
|
Adopt a single skill for Codex:
|
|
47
61
|
|
|
48
62
|
```bash
|
|
@@ -75,18 +89,22 @@ such as templates, under `.claude/<bundle-name>/`.
|
|
|
75
89
|
## Commands
|
|
76
90
|
|
|
77
91
|
```bash
|
|
78
|
-
agentkit list
|
|
92
|
+
agentkit list [skills|agents|bundles]
|
|
79
93
|
agentkit lint [name]
|
|
80
94
|
agentkit adopt <name> [--provider claude|codex|agnostic] [--dest <dir>] [--force] [--cli <cli>]
|
|
95
|
+
agentkit ingest <path> [--bundle <name>] [--replace] [--kit <dir>]
|
|
96
|
+
agentkit sync [<name>...] [--provider claude,codex] [--remove <name,...>] [--dest <dir>] [--force] [--dry-run]
|
|
81
97
|
```
|
|
82
98
|
|
|
83
99
|
Command summary:
|
|
84
100
|
|
|
85
101
|
| Command | Description |
|
|
86
102
|
| --- | --- |
|
|
87
|
-
| `agentkit list` | Show
|
|
103
|
+
| `agentkit list [skills|agents|bundles]` | Show the full catalog or one selected view; bundle views include item summaries |
|
|
88
104
|
| `agentkit lint [name]` | Check all capabilities, or one named capability, for provider-specific tokens |
|
|
89
105
|
| `agentkit adopt <name>` | Copy a capability or bundle into your project |
|
|
106
|
+
| `agentkit ingest <path>` | Import a skill folder or agent file (Claude or Codex format) into the kit's `collection/` |
|
|
107
|
+
| `agentkit sync [<name>...]` | Keep hard copies of skills and agents in a project's native Claude and Codex locations |
|
|
90
108
|
|
|
91
109
|
Global options:
|
|
92
110
|
|
|
@@ -112,12 +130,61 @@ only mechanical provider transforms.
|
|
|
112
130
|
| Provider | Destination | Transform |
|
|
113
131
|
| --- | --- | --- |
|
|
114
132
|
| `claude` | `.claude/` | Copy Claude-native assets as packaged |
|
|
115
|
-
| `codex` | `.codex/` | Rewrite `.claude/` path tokens to
|
|
133
|
+
| `codex` | Skills: `.agents/skills/`; agents: `.codex/agents/*.toml`; other items: `.codex/` | Rewrite `.claude/` path tokens to Codex locations; render agents as Codex TOML (`name`, `description`, `developer_instructions`), mapping read-only Claude tool lists to `sandbox_mode = "read-only"` and dropping other Claude-only frontmatter with a warning |
|
|
116
134
|
| `agnostic` | `.ai/` | Rewrite `.claude/` path tokens to `.ai/` |
|
|
117
135
|
|
|
136
|
+
Codex discovers project skills under `.agents/skills/` and custom agents only as TOML under
|
|
137
|
+
`.codex/agents/`, so those two types do not use the `.codex/` root. An agent may carry Codex-only
|
|
138
|
+
settings in a `codex:` frontmatter block (for example `model_reasoning_effort: high`); they are
|
|
139
|
+
written as TOML keys for Codex and ignored by other providers.
|
|
140
|
+
|
|
118
141
|
Use `agentkit lint` before or after adoption when you want to inspect capabilities for
|
|
119
142
|
provider-specific wording.
|
|
120
143
|
|
|
144
|
+
## Ingest
|
|
145
|
+
|
|
146
|
+
`collection/` is the single source for every provider. `agentkit ingest` brings an existing
|
|
147
|
+
capability into it from either tool's layout:
|
|
148
|
+
|
|
149
|
+
| Source | Result |
|
|
150
|
+
| --- | --- |
|
|
151
|
+
| Skill folder with `SKILL.md` (Claude or Codex) | `collection/skills/<name>/`, all files copied; dotfiles and `__pycache__` skipped |
|
|
152
|
+
| Claude agent `.md` | `collection/agents/<name>.md` |
|
|
153
|
+
| Codex agent `.toml` | `collection/agents/<name>.md`: `developer_instructions` becomes the body; `sandbox_mode = "read-only"` becomes a read-only `tools:` list; other scalar settings are kept under a `codex:` block; tables such as `[mcp_servers]` are reported and skipped |
|
|
154
|
+
|
|
155
|
+
Codex paths inside Markdown (`.agents/skills/`, `.codex/agents/*.toml`) are rewritten to the
|
|
156
|
+
canonical `.claude/` tokens that adopt and sync translate per provider. Pass `--bundle <name>` to
|
|
157
|
+
place the item in `collection/bundles/<name>/`. Ingest refuses a name already used anywhere in the
|
|
158
|
+
catalog, and an existing item at the same location unless you pass `--replace`. It writes into
|
|
159
|
+
the kit checkout that runs the command, or into `--kit <dir>`.
|
|
160
|
+
|
|
161
|
+
## Sync
|
|
162
|
+
|
|
163
|
+
`agentkit sync` maintains hard copies (no symlinks) of skills and agents in a project:
|
|
164
|
+
|
|
165
|
+
| Provider | Skills | Agents |
|
|
166
|
+
| --- | --- | --- |
|
|
167
|
+
| `claude` | `.claude/skills/<name>/` | `.claude/agents/<name>.md` |
|
|
168
|
+
| `codex` | `.agents/skills/<name>/` | `.codex/agents/<name>.toml` |
|
|
169
|
+
|
|
170
|
+
The sync set (item names and providers) and a SHA-256 hash of every written file are recorded
|
|
171
|
+
in `.agentkit-lock.json` at the project root; commit it with the project. Names you pass are
|
|
172
|
+
added to the set, `--remove` drops names, and running `agentkit sync` with no names refreshes
|
|
173
|
+
the set from the current kit.
|
|
174
|
+
|
|
175
|
+
On each run, sync:
|
|
176
|
+
|
|
177
|
+
- creates missing files and updates files it wrote whose contents still match the lock
|
|
178
|
+
- keeps and reports files edited locally, and existing files it did not create; `--force`
|
|
179
|
+
replaces them
|
|
180
|
+
- removes files of dropped items or providers when they are unmodified, and cleans up the
|
|
181
|
+
folders that become empty
|
|
182
|
+
- never touches files outside the lock file's records
|
|
183
|
+
|
|
184
|
+
Sync exits with status 1 when it kept any file, so automation notices. `--dry-run` prints the
|
|
185
|
+
plan without writing. Bundles sync their skills and agents; pipelines, conventions and bundle
|
|
186
|
+
extras stay with `agentkit adopt`.
|
|
187
|
+
|
|
121
188
|
## AI-Assisted Adaptation
|
|
122
189
|
|
|
123
190
|
Pass `--cli` to run an AI assistant after files are copied:
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Blender 3D
|
|
2
|
+
|
|
3
|
+
Build low-poly game models in Blender that match a reference sheet, then retarget library motion
|
|
4
|
+
onto them and export clips a game engine plays correctly, using measured comparisons and an
|
|
5
|
+
independent visual review instead of guesswork.
|
|
6
|
+
|
|
7
|
+
## Contents
|
|
8
|
+
|
|
9
|
+
| Item | Type | Purpose | Depends on |
|
|
10
|
+
| --- | --- | --- | --- |
|
|
11
|
+
| `blender-reference-model` | skill | Scripted modeling against a reference: measure, render at the reference scale, compare, zoom, calibrate colours, check meshes | `visual-reviewer` |
|
|
12
|
+
| `blender-mocap-retarget` | skill | Rig, skin and retarget a source clip onto an existing character; motion QA; single-clip glTF export; re-import and Godot checks | `blender-reference-model` scripts, `visual-reviewer` |
|
|
13
|
+
| `visual-reviewer` | agent | Fresh-context review of comparison sheets and motion contact sheets; at most five ranked findings | — |
|
|
14
|
+
|
|
15
|
+
## Requirements
|
|
16
|
+
|
|
17
|
+
- Blender run headless: `blender -b model.blend --python script.py -- args` (tested on 5.2; 4.2+ expected)
|
|
18
|
+
- System Python 3 with Pillow and numpy for the image scripts
|
|
19
|
+
- Optional: Godot 4 on `PATH` (or `GODOT=/path/to/godot`) for `godot_verify.py`
|
|
20
|
+
- For Codex, the reviewer agent needs image viewing available in its session; if it is not,
|
|
21
|
+
the skills report that the independent review could not run
|
|
22
|
+
|
|
23
|
+
Record your Blender and engine executable paths in your project's instruction file, so agents
|
|
24
|
+
don't have to search for them.
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
The bundle has only skills and an agent, so sync is enough and keeps both tools up to date:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
agentkit sync blender-3d --provider claude,codex
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Use `agentkit adopt blender-3d --provider <provider>` instead for a one-off copy you intend to
|
|
35
|
+
edit locally.
|
|
36
|
+
|
|
37
|
+
## Provenance
|
|
38
|
+
|
|
39
|
+
Distilled from two independent end-to-end sessions that built the same reference-matched
|
|
40
|
+
character (0.94-0.96 silhouette IoU per view) and retargeted a Mixamo walk onto it. The scripts
|
|
41
|
+
reproduce those sessions' measurements on the original assets.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: visual-reviewer
|
|
3
|
+
description: Independent fresh-context visual review of a 3D asset or animation against its reference. Give it the reference image or source motion, the user's explicit requirements, and rendered comparison sheets, zoom crops, extra-angle renders or motion contact sheets. It returns at most five ranked findings. Read-only; it judges only the supplied images and does not read builder code.
|
|
4
|
+
tools: Read, Glob
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Visual Reviewer
|
|
8
|
+
|
|
9
|
+
## Responsibility
|
|
10
|
+
|
|
11
|
+
Judge what the images show, independently of how the asset was built. The author's scores (IoU,
|
|
12
|
+
QA numbers) are context, not proof. Find the differences that matter most to the user's stated
|
|
13
|
+
priorities, which the author may no longer see.
|
|
14
|
+
|
|
15
|
+
## Inputs
|
|
16
|
+
|
|
17
|
+
- The reference: the reference image for a model, or for motion a contact sheet of the source
|
|
18
|
+
clip when available. Also the user's requirements, including any intentional deviations from
|
|
19
|
+
the reference (a requested deviation is not a defect).
|
|
20
|
+
- Image paths: comparison sheets, zoom crops, renders from angles the reference does not show,
|
|
21
|
+
and, for animation, contact sheets of frames from several angles.
|
|
22
|
+
- Optional: known limitations the author already accepts.
|
|
23
|
+
|
|
24
|
+
Review only the images supplied, and do not open builder or rig code: independence from how the
|
|
25
|
+
asset was made is the point. If a view needed for a judgment is missing, say which one instead
|
|
26
|
+
of guessing.
|
|
27
|
+
|
|
28
|
+
## What To Look For
|
|
29
|
+
|
|
30
|
+
- Identity: head shape, hairline and silhouette, beard boundary, facial proportions.
|
|
31
|
+
- Proportion and silhouette: shoulder height, limb taper, torso depth, boot shape.
|
|
32
|
+
- Details inside the outline that overlap scores cannot see: hand pose, pockets, straps,
|
|
33
|
+
equipment placement and side, colours.
|
|
34
|
+
- Construction: floating or unsupported parts, poke-through, hollow backs, unfinished transitions.
|
|
35
|
+
- Motion: feet sliding or sinking, knee pops, limbs passing through the body or equipment,
|
|
36
|
+
stiff or broken joints, loop hitches.
|
|
37
|
+
|
|
38
|
+
## Output
|
|
39
|
+
|
|
40
|
+
At most five findings, most severe first. For each:
|
|
41
|
+
|
|
42
|
+
| Field | Content |
|
|
43
|
+
| --- | --- |
|
|
44
|
+
| Severity | major (visible at gameplay size or breaks a stated priority) or minor |
|
|
45
|
+
| Where | image file and region or frame |
|
|
46
|
+
| Observation | the concrete difference from the reference or the requirement |
|
|
47
|
+
| Suggested fix | the smallest change likely to resolve it |
|
|
48
|
+
|
|
49
|
+
Then one line: `Verdict: ready` or `Verdict: needs another pass`, and any views that could not be
|
|
50
|
+
judged. Report fewer findings when fewer exist. Do not invent defects to fill the list, and label
|
|
51
|
+
matters of taste as optional.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: blender-mocap-retarget
|
|
3
|
+
description: Rig, skin and retarget an existing motion-capture or library clip (for example Mixamo FBX) onto an existing Blender character without changing the character, then verify and export it for a game engine. Use when adding source animation to a finished model; not for modeling, and not for hand-keyed animation from scratch.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Blender Mocap Retarget
|
|
7
|
+
|
|
8
|
+
## Outcome
|
|
9
|
+
|
|
10
|
+
The existing character performs the source motion on its own skeleton, with its proportions,
|
|
11
|
+
materials and modular parts unchanged. Feet plant without sliding or sinking, limbs clear the
|
|
12
|
+
body and equipment, the loop is seamless, and the export plays exactly the intended clips in the
|
|
13
|
+
target engine.
|
|
14
|
+
|
|
15
|
+
## Invariants
|
|
16
|
+
|
|
17
|
+
- Do not remodel. The rest pose must render identically to the unrigged model: render
|
|
18
|
+
baseline views before rigging and diff them against rest-pose renders afterwards (Method
|
|
19
|
+
steps 1 and 7). If deformation truly needs geometry (for example extra loops at joints), add it
|
|
20
|
+
without changing the rest-pose renders, and show the diff.
|
|
21
|
+
- Build the armature on the character's own joints. Never stretch the character to the source
|
|
22
|
+
skeleton; absorb differences in the retarget.
|
|
23
|
+
- Modular objects stay separate. Each deforming part gets its own Armature modifier; rigid
|
|
24
|
+
equipment follows one bone (or a socket bone) with full weight.
|
|
25
|
+
- Keep the source clip, and any imported source rig, out of the export: use a separate hidden
|
|
26
|
+
collection or a separate file.
|
|
27
|
+
- Use a persisted script for rig, weights and retarget, so the result can be rebuilt.
|
|
28
|
+
|
|
29
|
+
## Tools
|
|
30
|
+
|
|
31
|
+
Scripts in this skill's `scripts/` folder (Blender scripts run with `blender -b ... --python`):
|
|
32
|
+
|
|
33
|
+
| Script | Purpose |
|
|
34
|
+
| --- | --- |
|
|
35
|
+
| `inspect_motion_source.py` | Skeleton, fps, frame range, rest pose, root motion, foot height offset, loop seam of the source |
|
|
36
|
+
| `check_motion.py` | Ground penetration, planted-foot slide, interpenetration beyond the rest baseline, loop seam |
|
|
37
|
+
| `render_frames.py` | Frame renders from several angles with following cameras and a checker floor |
|
|
38
|
+
| `export_gltf_clip.py` | GLB export with exactly one clip per named action |
|
|
39
|
+
| `verify_gltf.py` | Re-import the export; report meshes, skinned meshes and bones; fail on missing clips or clips not starting at frame 0 |
|
|
40
|
+
| `godot_verify.py` | Optional: headless Godot import of the GLB, checking meshes, bones, clips and key timing |
|
|
41
|
+
|
|
42
|
+
The sibling skill's scripts are used too, at `../blender-reference-model/scripts/` relative to
|
|
43
|
+
this skill's folder (not the working directory): `render_views.py` and `diff_renders.py` for the
|
|
44
|
+
rest-pose check, and `contact_sheet.py` to tile frame renders.
|
|
45
|
+
|
|
46
|
+
## Method That Works
|
|
47
|
+
|
|
48
|
+
1. Before touching the model, render baseline views with `render_views.py` (the model's
|
|
49
|
+
`ref_spec.json`, or any spec whose views frame the character) into a `before/` folder.
|
|
50
|
+
2. Inspect the source. Plan from its fps, range, rest pose (T or A), root motion and loop
|
|
51
|
+
structure (library walks often end on the first pose plus one stride).
|
|
52
|
+
3. Build the rig with source-compatible bone names (for example Mixamo names without the
|
|
53
|
+
`mixamorig:` prefix) at the character's joints.
|
|
54
|
+
4. Retarget each bone's world-space rotation relative to its rest pose, so differing rest poses
|
|
55
|
+
cancel out. Scale root motion by the leg-length or hip-height ratio: that scale is what stops
|
|
56
|
+
planted feet from sliding. Solve feet with two-bone IK (soft limit, no knee pop) toward the
|
|
57
|
+
scaled source ankle, and add a ground pass that keeps soles on the floor while planted.
|
|
58
|
+
5. For bulky or equipped characters, add an outward arm offset (larger on the back-swing) and
|
|
59
|
+
damp long clavicles, so arms clear the torso and belt kit. Let hip-mounted props swing with the
|
|
60
|
+
thigh through socket bones.
|
|
61
|
+
6. Skin with blend zones at shoulders, elbows, wrists, fingers, hips, knees, ankles and neck.
|
|
62
|
+
Keep hair and beards rigid to the head.
|
|
63
|
+
7. Render the rigged model with the same spec (armatures render in rest pose by default) and run
|
|
64
|
+
`diff_renders.py before/ after/`. It must report the views identical within tolerance.
|
|
65
|
+
8. Iterate with `check_motion.py` and frame renders from front, side, 3/4, back and close-ups at
|
|
66
|
+
the hips, shoulders and feet. Targets that worked: ground within about 3 mm, planted-foot slide
|
|
67
|
+
of a few mm per frame, no interpenetration beyond the rest baseline, zero rotation difference
|
|
68
|
+
at the loop seam.
|
|
69
|
+
9. Export with `export_gltf_clip.py`, then run `verify_gltf.py`, and `godot_verify.py` when the
|
|
70
|
+
target is Godot.
|
|
71
|
+
10. Have the `visual-reviewer` agent review contact sheets of the motion before handing over.
|
|
72
|
+
Include a contact sheet of the source clip at the same frames when you can render it, plus
|
|
73
|
+
the user's requirements. If the reviewer cannot run or cannot view images, say so in the
|
|
74
|
+
evidence.
|
|
75
|
+
|
|
76
|
+
## Known Pitfalls
|
|
77
|
+
|
|
78
|
+
- Blender 5.x stores animation in layered actions. F-curves live under
|
|
79
|
+
`action.layers[].strips[].channelbags[].fcurves`; `action.fcurves` no longer lists them.
|
|
80
|
+
- Mixamo FBX armatures import with object scale 0.01, and a walk's feet can sit above the rest
|
|
81
|
+
pose (about 1.4 cm in Mixamo's Walking). Subtract that offset before scaling, or feet float.
|
|
82
|
+
- Exported clip time counts from scene frame 0, so an action that starts at frame 1 arrives
|
|
83
|
+
offset by one frame. Put each action on its own NLA track, named after the clip, with the
|
|
84
|
+
strip at frame 0, and export in `NLA_TRACKS` mode. Confirm the first key is at time 0 with
|
|
85
|
+
`verify_gltf.py` or `godot_verify.py`. In the sessions this came from, `ACTIVE_ACTIONS` named
|
|
86
|
+
the clip "Animation" and `ACTIONS` also exported stray source actions.
|
|
87
|
+
- For a loop whose last frame repeats the first plus one stride, set the scene range to exclude
|
|
88
|
+
the repeated frame, so playback does not stutter.
|
|
89
|
+
- Overlap tests between adjacent regions of one mesh report shared edges. Pair regions that
|
|
90
|
+
should never touch.
|
|
91
|
+
|
|
92
|
+
## Evidence To Report
|
|
93
|
+
|
|
94
|
+
Source facts, the rest-pose identity check, `check_motion.py` results, contact sheets from
|
|
95
|
+
several angles, the export verification output, the review findings with their resolution, and
|
|
96
|
+
any motion that could only be judged in the engine.
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"""Per-frame motion QA for a rigged, animated character (read-only).
|
|
2
|
+
|
|
3
|
+
blender -b model.blend --python check_motion.py -- --rig Armature \
|
|
4
|
+
--feet Boot_L,Boot_R --pairs "Shirt@LeftForeArm:Belt;Shirt@RightForeArm:Pouch_R;Boot_L:Boot_R" [--json qa.json]
|
|
5
|
+
|
|
6
|
+
Checks over the scene frame range (or --frames A-B):
|
|
7
|
+
- ground: lowest point of each --feet part per frame; below -tolerance is penetration
|
|
8
|
+
- slide: horizontal travel of foot vertices that stay in floor contact between frames
|
|
9
|
+
- interpenetration: overlapping triangles per --pairs entry, minus the count already present
|
|
10
|
+
in the rest pose (bridged seams and tucked cloth are not motion errors)
|
|
11
|
+
- loop seam: rotation difference between the action's first and last frame, and root delta
|
|
12
|
+
|
|
13
|
+
Neighbouring regions of one mesh share edges, and deforming them can register as overlap; pair
|
|
14
|
+
regions that should never touch (arm vs belt kit, arm vs torso front) rather than adjacent ones.
|
|
15
|
+
A part is an object name, optionally narrowed to polygons whose dominant vertex group contains a
|
|
16
|
+
substring: "Shirt@LeftArm" = Shirt polygons weighted mostly to a group containing "LeftArm".
|
|
17
|
+
Judge motion quality from playback renders too; these numbers catch regressions, not style.
|
|
18
|
+
"""
|
|
19
|
+
import argparse
|
|
20
|
+
import json
|
|
21
|
+
import math
|
|
22
|
+
import sys
|
|
23
|
+
|
|
24
|
+
import bpy
|
|
25
|
+
from mathutils.bvhtree import BVHTree
|
|
26
|
+
|
|
27
|
+
argv = sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else []
|
|
28
|
+
p = argparse.ArgumentParser()
|
|
29
|
+
p.add_argument("--rig", required=True)
|
|
30
|
+
p.add_argument("--feet", default="", help="comma-separated parts that touch the floor")
|
|
31
|
+
p.add_argument("--pairs", default="", help="semicolon-separated A:B part pairs to test for overlap")
|
|
32
|
+
p.add_argument("--frames", help="START-END; default is the scene range")
|
|
33
|
+
p.add_argument("--contact-mm", type=float, default=6.0, help="height that counts as floor contact")
|
|
34
|
+
p.add_argument("--ground-z", type=float, default=0.0)
|
|
35
|
+
p.add_argument("--json")
|
|
36
|
+
args = p.parse_args(argv)
|
|
37
|
+
|
|
38
|
+
scene = bpy.context.scene
|
|
39
|
+
rig = bpy.data.objects.get(args.rig)
|
|
40
|
+
if rig is None or rig.type != "ARMATURE":
|
|
41
|
+
raise SystemExit(f"--rig: no armature object named {args.rig}")
|
|
42
|
+
f0, f1 = (int(x) for x in args.frames.split("-")) if args.frames else (scene.frame_start, scene.frame_end)
|
|
43
|
+
feet = [s for s in args.feet.split(",") if s]
|
|
44
|
+
pairs = [tuple(pair.split(":")) for pair in args.pairs.split(";") if pair]
|
|
45
|
+
contact = args.contact_mm / 1000.0
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def parse(part):
|
|
49
|
+
name, _, group = part.partition("@")
|
|
50
|
+
ob = bpy.data.objects.get(name)
|
|
51
|
+
if ob is None or ob.type != "MESH":
|
|
52
|
+
raise SystemExit(f"no mesh object named {name}")
|
|
53
|
+
return ob, group
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def select_polys(ob, group):
|
|
57
|
+
me = ob.data
|
|
58
|
+
if not group:
|
|
59
|
+
return [list(poly.vertices) for poly in me.polygons]
|
|
60
|
+
names = {g.index: g.name for g in ob.vertex_groups}
|
|
61
|
+
chosen = []
|
|
62
|
+
for poly in me.polygons:
|
|
63
|
+
acc = {}
|
|
64
|
+
for vi in poly.vertices:
|
|
65
|
+
for g in me.vertices[vi].groups:
|
|
66
|
+
acc[g.group] = acc.get(g.group, 0.0) + g.weight
|
|
67
|
+
if acc and group in names.get(max(acc, key=acc.get), ""):
|
|
68
|
+
chosen.append(list(poly.vertices))
|
|
69
|
+
if not chosen:
|
|
70
|
+
raise SystemExit(f"no polygons of {ob.name} are dominated by a group containing '{group}'")
|
|
71
|
+
return chosen
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
parts = sorted({p for pair in pairs for p in pair} | set(feet))
|
|
75
|
+
POLYS = {part: select_polys(*parse(part)) for part in parts}
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def evaluate():
|
|
79
|
+
dg = bpy.context.evaluated_depsgraph_get()
|
|
80
|
+
verts = {}
|
|
81
|
+
for part in parts:
|
|
82
|
+
ob, _ = parse(part)
|
|
83
|
+
if ob.name in verts:
|
|
84
|
+
continue
|
|
85
|
+
ev = ob.evaluated_get(dg)
|
|
86
|
+
me = ev.to_mesh()
|
|
87
|
+
if len(me.vertices) != len(ob.data.vertices):
|
|
88
|
+
raise SystemExit(f"{ob.name}: modifiers change the vertex count; check_motion needs only deforming modifiers (Armature)")
|
|
89
|
+
verts[ob.name] = [ob.matrix_world @ v.co for v in me.vertices]
|
|
90
|
+
ev.to_mesh_clear()
|
|
91
|
+
return verts
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def overlaps(verts):
|
|
95
|
+
trees = {part: BVHTree.FromPolygons(verts[parse(part)[0].name], POLYS[part]) for part in {p for pair in pairs for p in pair}}
|
|
96
|
+
return {pair: len(trees[pair[0]].overlap(trees[pair[1]])) for pair in pairs}
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
rig.data.pose_position = "REST"
|
|
100
|
+
scene.frame_set(f0)
|
|
101
|
+
baseline = overlaps(evaluate())
|
|
102
|
+
rig.data.pose_position = "POSE"
|
|
103
|
+
|
|
104
|
+
ground, slide, hits = {f: [] for f in feet}, {f: [] for f in feet}, {pair: [] for pair in pairs}
|
|
105
|
+
prev = {}
|
|
106
|
+
for frame in range(f0, f1 + 1):
|
|
107
|
+
scene.frame_set(frame)
|
|
108
|
+
verts = evaluate()
|
|
109
|
+
for pair, n in overlaps(verts).items():
|
|
110
|
+
extra = n - baseline[pair]
|
|
111
|
+
if extra > 0:
|
|
112
|
+
hits[pair].append((frame, extra))
|
|
113
|
+
for foot in feet:
|
|
114
|
+
ob, _ = parse(foot)
|
|
115
|
+
idx = sorted({i for poly in POLYS[foot] for i in poly})
|
|
116
|
+
co = [verts[ob.name][i] for i in idx]
|
|
117
|
+
low = min(c.z for c in co) - args.ground_z
|
|
118
|
+
ground[foot].append((frame, low))
|
|
119
|
+
touching = {i for i, c in zip(idx, co) if c.z - args.ground_z < contact}
|
|
120
|
+
if foot in prev:
|
|
121
|
+
both = touching & prev[foot][1]
|
|
122
|
+
if both:
|
|
123
|
+
pc = prev[foot][0]
|
|
124
|
+
slide[foot].append((frame, max((verts[ob.name][i].xy - pc[i].xy).length for i in both)))
|
|
125
|
+
prev[foot] = (verts[ob.name], touching)
|
|
126
|
+
|
|
127
|
+
report = {"frames": [f0, f1], "ground": {}, "slide": {}, "interpenetration": {}, "rest_baseline_overlaps": {}}
|
|
128
|
+
for foot in feet:
|
|
129
|
+
lows = [z for _, z in ground[foot]]
|
|
130
|
+
report["ground"][foot] = {"min_mm": round(min(lows) * 1000, 1), "contact_frames": sum(z < contact for z in lows)}
|
|
131
|
+
if slide[foot]:
|
|
132
|
+
vals = [v for _, v in slide[foot]]
|
|
133
|
+
worst = max(slide[foot], key=lambda fv: fv[1])
|
|
134
|
+
report["slide"][foot] = {"max_mm_per_frame": round(worst[1] * 1000, 1), "worst_frame": worst[0],
|
|
135
|
+
"mean_mm_per_frame": round(sum(vals) / len(vals) * 1000, 1)}
|
|
136
|
+
for pair in pairs:
|
|
137
|
+
key = f"{pair[0]} x {pair[1]}"
|
|
138
|
+
report["rest_baseline_overlaps"][key] = baseline[pair]
|
|
139
|
+
if hits[pair]:
|
|
140
|
+
report["interpenetration"][key] = {"frames": len(hits[pair]), "max_extra_tris": max(n for _, n in hits[pair]),
|
|
141
|
+
"first_frames": [f for f, _ in hits[pair]][:12]}
|
|
142
|
+
|
|
143
|
+
act = rig.animation_data.action if rig.animation_data else None
|
|
144
|
+
if act:
|
|
145
|
+
a0, a1 = (int(round(v)) for v in act.frame_range)
|
|
146
|
+
|
|
147
|
+
def pose(frame):
|
|
148
|
+
scene.frame_set(frame)
|
|
149
|
+
return {pb.name: (pb.matrix_basis.to_quaternion(), pb.matrix_basis.to_translation()) for pb in rig.pose.bones}
|
|
150
|
+
|
|
151
|
+
pa, pb_ = pose(a0), pose(a1)
|
|
152
|
+
worst = max(pa, key=lambda n: pa[n][0].rotation_difference(pb_[n][0]).angle)
|
|
153
|
+
root = next(b.name for b in rig.data.bones if b.parent is None)
|
|
154
|
+
report["loop_seam"] = {"action": act.name, "action_range": [a0, a1],
|
|
155
|
+
"max_rotation_diff_deg": round(math.degrees(pa[worst][0].rotation_difference(pb_[worst][0]).angle), 3),
|
|
156
|
+
"worst_bone": worst, "root_bone": root,
|
|
157
|
+
"root_delta_bone_space_m": [round(v, 4) for v in (pb_[root][1] - pa[root][1])]}
|
|
158
|
+
|
|
159
|
+
print(json.dumps(report, indent=2))
|
|
160
|
+
if args.json:
|
|
161
|
+
with open(args.json, "w") as f:
|
|
162
|
+
json.dump(report, f, indent=2)
|
package/collection/bundles/blender-3d/skills/blender-mocap-retarget/scripts/export_gltf_clip.py
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"""Export a rigged character to glTF/GLB with exactly one clip per named action.
|
|
2
|
+
|
|
3
|
+
blender -b model.blend --python export_gltf_clip.py -- OUT.glb --rig Armature --actions Walk[,Run] \
|
|
4
|
+
[--collection Character]
|
|
5
|
+
|
|
6
|
+
Why: exported clip time counts from scene frame 0, so an action starting at frame 1 arrives
|
|
7
|
+
offset by a frame. Each action is placed on its own NLA track, named
|
|
8
|
+
after the action, with its strip starting at frame 0, and exported in NLA_TRACKS mode. That gives
|
|
9
|
+
clips named exactly after the actions, starting at clip time 0 with no duplicated frame.
|
|
10
|
+
(ACTIVE_ACTIONS names the clip "Animation"; ACTIONS also exports unrelated actions such as an
|
|
11
|
+
imported source clip.) The NLA edits exist only in this process: the .blend is never saved.
|
|
12
|
+
Without --actions the model exports static. Only the given collection (default: all visible
|
|
13
|
+
objects) is exported, so keep motion-source imports in another collection.
|
|
14
|
+
"""
|
|
15
|
+
import argparse
|
|
16
|
+
import os
|
|
17
|
+
import sys
|
|
18
|
+
|
|
19
|
+
import bpy
|
|
20
|
+
|
|
21
|
+
argv = sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else []
|
|
22
|
+
p = argparse.ArgumentParser()
|
|
23
|
+
p.add_argument("out")
|
|
24
|
+
p.add_argument("--rig")
|
|
25
|
+
p.add_argument("--actions", default="")
|
|
26
|
+
p.add_argument("--collection")
|
|
27
|
+
p.add_argument("--no-yup", action="store_true", help="keep Blender Z-up instead of glTF Y-up")
|
|
28
|
+
args = p.parse_args(argv)
|
|
29
|
+
|
|
30
|
+
if args.collection:
|
|
31
|
+
col = bpy.data.collections.get(args.collection)
|
|
32
|
+
if col is None:
|
|
33
|
+
raise SystemExit(f"no collection named {args.collection}")
|
|
34
|
+
export_objects = list(col.all_objects)
|
|
35
|
+
else:
|
|
36
|
+
export_objects = [o for o in bpy.context.scene.objects if o.visible_get()]
|
|
37
|
+
|
|
38
|
+
bpy.ops.object.select_all(action="DESELECT")
|
|
39
|
+
for ob in export_objects:
|
|
40
|
+
ob.hide_set(False)
|
|
41
|
+
ob.select_set(True)
|
|
42
|
+
|
|
43
|
+
kw = dict(filepath=os.path.abspath(args.out), export_format="GLB" if args.out.lower().endswith(".glb") else "GLTF_SEPARATE",
|
|
44
|
+
use_selection=True, export_apply=False, export_yup=not args.no_yup, export_materials="EXPORT")
|
|
45
|
+
|
|
46
|
+
actions = [a for a in args.actions.split(",") if a]
|
|
47
|
+
if actions:
|
|
48
|
+
rig = bpy.data.objects.get(args.rig or "")
|
|
49
|
+
if rig is None or rig.type != "ARMATURE":
|
|
50
|
+
raise SystemExit("--actions needs --rig with an armature object")
|
|
51
|
+
if rig not in export_objects:
|
|
52
|
+
raise SystemExit(f"rig {rig.name} is not among the exported objects")
|
|
53
|
+
ad = rig.animation_data or rig.animation_data_create()
|
|
54
|
+
for track in list(ad.nla_tracks):
|
|
55
|
+
ad.nla_tracks.remove(track)
|
|
56
|
+
for name in actions:
|
|
57
|
+
act = bpy.data.actions.get(name)
|
|
58
|
+
if act is None:
|
|
59
|
+
raise SystemExit(f"no action named {name}")
|
|
60
|
+
track = ad.nla_tracks.new()
|
|
61
|
+
track.name = name
|
|
62
|
+
track.strips.new(name, 0, act)
|
|
63
|
+
ad.action = None
|
|
64
|
+
kw.update(export_animations=True, export_animation_mode="NLA_TRACKS", export_skins=True,
|
|
65
|
+
export_def_bones=False, export_frame_range=False)
|
|
66
|
+
else:
|
|
67
|
+
kw.update(export_animations=False)
|
|
68
|
+
|
|
69
|
+
os.makedirs(os.path.dirname(os.path.abspath(args.out)), exist_ok=True)
|
|
70
|
+
bpy.ops.export_scene.gltf(**kw)
|
|
71
|
+
print(f"EXPORTED {len(export_objects)} object(s), clips {actions or 'none'} -> {args.out}")
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"""Import a GLB into a throwaway Godot 4 project headlessly and report what the engine sees.
|
|
2
|
+
|
|
3
|
+
python3 godot_verify.py OUT.glb [--godot godot] [--expect-clips Walk] [--keep]
|
|
4
|
+
|
|
5
|
+
Prints mesh and skinned-mesh counts, bone count, animation names with length, track count and
|
|
6
|
+
first/last key time. Exits non-zero when Godot fails, an expected clip is missing, or a clip's
|
|
7
|
+
first key is not at time 0. The project lives in a temporary directory, never in your game.
|
|
8
|
+
"""
|
|
9
|
+
import argparse
|
|
10
|
+
import os
|
|
11
|
+
import shutil
|
|
12
|
+
import subprocess
|
|
13
|
+
import sys
|
|
14
|
+
import tempfile
|
|
15
|
+
|
|
16
|
+
SCRIPT = r'''
|
|
17
|
+
extends SceneTree
|
|
18
|
+
func _init():
|
|
19
|
+
var scene = load("res://asset.glb")
|
|
20
|
+
if scene == null:
|
|
21
|
+
print("RESULT_ERROR cannot load asset.glb")
|
|
22
|
+
quit(1)
|
|
23
|
+
return
|
|
24
|
+
var root_node = scene.instantiate()
|
|
25
|
+
var meshes = root_node.find_children("*", "MeshInstance3D", true, false)
|
|
26
|
+
var skinned = meshes.filter(func(m): return m.skin != null)
|
|
27
|
+
var skels = root_node.find_children("*", "Skeleton3D", true, false)
|
|
28
|
+
print("RESULT_MESHES %d skinned=%d" % [meshes.size(), skinned.size()])
|
|
29
|
+
print("RESULT_BONES %d" % (skels[0].get_bone_count() if skels.size() > 0 else 0))
|
|
30
|
+
for ap in root_node.find_children("*", "AnimationPlayer", true, false):
|
|
31
|
+
for name in ap.get_animation_list():
|
|
32
|
+
var a = ap.get_animation(name)
|
|
33
|
+
var first = 1e9
|
|
34
|
+
var last = 0.0
|
|
35
|
+
for i in a.get_track_count():
|
|
36
|
+
if a.track_get_key_count(i) > 0:
|
|
37
|
+
first = min(first, a.track_get_key_time(i, 0))
|
|
38
|
+
last = max(last, a.track_get_key_time(i, a.track_get_key_count(i) - 1))
|
|
39
|
+
print("RESULT_CLIP %s length=%.4f tracks=%d first_key=%.4f last_key=%.4f" % [name, a.length, a.get_track_count(), first, last])
|
|
40
|
+
quit()
|
|
41
|
+
'''
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def main():
|
|
45
|
+
p = argparse.ArgumentParser()
|
|
46
|
+
p.add_argument("glb")
|
|
47
|
+
p.add_argument("--godot", default=os.environ.get("GODOT", "godot"))
|
|
48
|
+
p.add_argument("--expect-clips", default="")
|
|
49
|
+
p.add_argument("--keep", action="store_true", help="keep the temporary project and print its path")
|
|
50
|
+
args = p.parse_args()
|
|
51
|
+
if shutil.which(args.godot) is None:
|
|
52
|
+
raise SystemExit(f"Godot executable '{args.godot}' not found; pass --godot or set GODOT")
|
|
53
|
+
tmp = tempfile.mkdtemp(prefix="godot-verify-")
|
|
54
|
+
try:
|
|
55
|
+
shutil.copy(args.glb, os.path.join(tmp, "asset.glb"))
|
|
56
|
+
with open(os.path.join(tmp, "project.godot"), "w") as f:
|
|
57
|
+
f.write('config_version=5\n[application]\nconfig/name="verify"\n')
|
|
58
|
+
with open(os.path.join(tmp, "verify.gd"), "w") as f:
|
|
59
|
+
f.write(SCRIPT)
|
|
60
|
+
subprocess.run([args.godot, "--headless", "--import"], cwd=tmp, capture_output=True, text=True, timeout=300)
|
|
61
|
+
run = subprocess.run([args.godot, "--headless", "-s", "verify.gd"], cwd=tmp, capture_output=True, text=True, timeout=300)
|
|
62
|
+
lines = [line for line in run.stdout.splitlines() if line.startswith("RESULT_")]
|
|
63
|
+
for line in lines:
|
|
64
|
+
print(line[len("RESULT_"):])
|
|
65
|
+
problems = [line for line in lines if line.startswith("RESULT_ERROR")]
|
|
66
|
+
if run.returncode != 0 or not lines:
|
|
67
|
+
problems.append(f"godot exited {run.returncode}: {run.stderr.strip()[-400:]}")
|
|
68
|
+
clips = {line.split()[1]: line for line in lines if line.startswith("RESULT_CLIP")}
|
|
69
|
+
for want in filter(None, args.expect_clips.split(",")):
|
|
70
|
+
if want not in clips:
|
|
71
|
+
problems.append(f"expected clip {want} not found (have {sorted(clips)})")
|
|
72
|
+
for name, line in clips.items():
|
|
73
|
+
first = float(line.split("first_key=")[1].split()[0])
|
|
74
|
+
if first > 1e-3:
|
|
75
|
+
problems.append(f"clip {name} first key at {first:.4f}s, not 0")
|
|
76
|
+
for problem in problems:
|
|
77
|
+
print("PROBLEM", problem)
|
|
78
|
+
if args.keep:
|
|
79
|
+
print("project:", tmp)
|
|
80
|
+
sys.exit(1 if problems else 0)
|
|
81
|
+
finally:
|
|
82
|
+
if not args.keep:
|
|
83
|
+
shutil.rmtree(tmp, ignore_errors=True)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
if __name__ == "__main__":
|
|
87
|
+
main()
|