File size: 8,060 Bytes
a84fca7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Scripts

```
scripts/
  pipeline/     the build steps, run in order
  probes/       format readers — each parses BVH or binary FBX on its own
```

Pure Python 3 with no dependencies; step 5 additionally downloads from the Hugging Face Hub.
Everything in `probes/` is importable on its own, and `pipeline/` puts those probes to work.

Nothing in here re-exports a file. `animation/` is built by selecting and renaming, so a clip is a
hardlink of one in `Truebone_Z-OO/` — a round trip through an editor would rebuild the rest pose from
the first frame of the take and move the root bones. Sixteen clips are no longer hardlinks,
because three probes repaired them by editing the binary node tree in place: the four `Cat` clips
and all twelve `KingCobra` clips. Each writes a temporary file and renames it, so the source keeps
its own inode and its bytes.

## pipeline/

```bash
cd scripts
python3 pipeline/build_dataset.py         # 1. index the download -> ../clips.csv
python3 pipeline/normalize.py             # 2. name every clip    -> ../clips.csv
python3 pipeline/build_animation.py       # 3. one file per motion-> ../animation/
python3 pipeline/build_metadata.py        # 4. measure animation/ -> ../animation.csv, ../species.csv
python3 pipeline/build_prompts.py         # 5. attach captions    -> ../animation_prompts.json
```

Step 5 is optional and stands apart from the rest: it is the only step that pulls from a third
party, and what it pulls is CC-BY-NC-4.0.

Each step reads what the one before it wrote, and each can be re-run on its own.

| script | purpose |
|---|---|
| `build_dataset.py` | Walks `../Truebone_Z-OO/`, probes every BVH and FBX, writes `clips.csv`, and hardlinks the indexed files and their textures into `../Truebone_Z-OO/`. Files that fail to parse land in `excluded.csv`. |
| `normalize.py` | Names every source FBX that carries motion `<Species>-<Action>.fbx` and fills the `normalized_name` column in `clips.csv`. Creates no files. Holds the naming rules — species aliases, compound words, canonical casing, Mixamo-style actions. |
| `build_animation.py` | Builds `../animation/`: drops each group's combined `ALL` file and its `TPOSE` rest pose, removes the clips the source exported twice, hardlinks the rest. A file carrying more than one take is reported, never rewritten. |
| `build_prompts.py` | Downloads the [T2M4LVO](https://huggingface.co/datasets/1Konny/t2m4lvo-truebones-zoo) captions and attaches them to `../animation/` through `clips.csv`, writing `../animation_prompts.json` — one `short`/`original` sentence per clip, in the Mixamo file's shape. `--full` adds all four lengths, seven phrasings and the alternative object labels. Resolves each caption to the phrasing that names the species — the source lists seven object labels alphabetically, so index 0 is usually the most generic one, not the animal. |
| `build_metadata.py` | Measures `../animation/` into `animation.csv`, `species.csv`, `animation_frames.json` and `animation_bones.json`, and maps every row of `clips.csv` onto the clip that carries its motion (`animation_file`, `status`). |

## probes/

Each reads the file format itself and runs standalone from the command line.

| script | purpose |
|---|---|
| `bvh_probe.py` | BVH `HIERARCHY` and `MOTION` headers: joints, end sites, tree depth, frames, frame time, fps, duration, root, joint names. Stops before the motion rows. |
| `fbx_probe.py` | Binary FBX node tree: version, joints, keyframes, fps and duration measured off the key times, the topmost animated joint, joint names. |
| `fbx_takes.py` | Enumerates a file's `AnimationStack` objects and each one's time span — the only way to tell a single clip from a combined timeline. |
| `fbx_stacks.py` | Which of those stacks actually carry animation. Four files pair the real motion with an empty `Take 001` left by a C4D export; counting stacks calls them two-take, following the connections shows one action and one empty shell. |
| `fbx_motion.py` | Whether a clip moves at all: decodes the curves and reports the widest value range. Used to keep T-poses and model-only exports out of the clip set. |
| `fbx_fingerprint.py` | Per-curve value ranges — a cheap first pass for spotting repeated motions. |
| `fbx_curves.py` | Decodes curve values and compares two clips frame by frame, to confirm what the range test only suggests. |
| `fbx_rig.py` | Bone-length fingerprint, for checking that a species' clips share one skeleton. |
| `fbx_anomaly.py` | Flags sudden jumps in a curve — first-frame pops, gimbal reparameterizations, broken frames. |
| `fbx_check.py` | Structural integrity: header, node tree, truncation. |
| `fbx_embed_texture.py` | Grafts an embedded texture into an FBX that only references one externally. Parses the node tree, inserts one `Video/Content` node copied verbatim from a donor of the same species, and re-serializes with recomputed offsets — every node record holds an absolute end offset, so an insertion shifts everything after it. Gated on a byte-identical no-edit round trip, and writes through a temporary file so hardlinked sources are left alone. Used once, for the four `Cat` clips. |
| `fbx_graft_mesh.py` | Grafts a mesh and its skin from a donor FBX into one exported without geometry. Moves `Geometry::Mesh`, `Model::Mesh`, `Deformer::Skin`, its `Cluster`s and `Pose::BindPose` across on fresh uids, re-points every connection that referenced the donor's bones, materials or textures at the target's own by name, and drops the target's orphan deformers. Also collapses a `Texture → LayeredTexture → Material` chain to the direct connection importers look for. `--bind` decides whose bind pose — whose rest pose, as an importer shows it — the repaired clip ends up with: `donor` (the default) adopts the donor's, which is what keeps a species' clips sharing one rest pose; `self` keeps the target's own and re-poses the grafted mesh to match; a path takes a third file's. Same round-trip gate and same temporary-file write as `fbx_embed_texture.py`. `--inspect` reports what geometry and skin any file holds. Used once, for `KingCobra-Walk.fbx`. |
| `fbx_strip_variant.py` | Keeps one colourway of a mesh that ships several stacked on top of each other. Drops the other materials' polygons, renumbers the surviving vertices and follows them through every array that indexes them — normals and colours per vertex, UV indices per polygon vertex, the material array per polygon, and each skin cluster's indices and weights — then removes the materials, textures and embedded images nothing references any more. Where one image exists as two `Video` objects and the pixels hang off the slot being removed, they are moved onto the surviving one first. The material is named rather than indexed, because the two KingCobra export batches connect the same materials in opposite orders. `--list` shows what variants a file carries. Used once, for the twelve `KingCobra` clips. |
| `fbx_align_material.py` | Gives a clip's materials the same settings its siblings use. Matches materials by name and moves only the values inside `Properties70`, keeping each file's own property type strings, shading model and textures; a property the reference lacks is removed, one only the reference has is added. `--diff` reports what differs without writing. Used once, for `KingCobra-Walk.fbx`, whose `ReflectionFactor` made Blender import it at `Metallic` 0.0 while every other clip in the library imports at 1.0. |

```bash
python3 probes/fbx_probe.py       ../animation/Cat-Walk.fbx
python3 probes/fbx_graft_mesh.py  --inspect ../animation/*.fbx
python3 probes/fbx_takes.py       ../Truebone_Z-OO/Lynx/LynxALL.fbx
python3 probes/bvh_probe.py       ../Truebone_Z-OO/Cat/CAT_Walk.bvh
python3 probes/fbx_curves.py      ../animation/Crab-Attack_1.fbx ../animation/Crab-Attack_3.fbx
```

The two header probes skip the motion payload, so indexing the whole 2.8 GB library takes about
twenty seconds. The curve-level tools decompress the payload and are correspondingly slower.