Skip to content

Commit 3ce6b1c

Browse files
TMHSDigitalclaude
andcommitted
docs(examples): unapplied-scale-gltf README states the contract, who hits it, and 5.1 re-verification
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: TMHSDigital <154358121+TMHSDigital@users.noreply.github.com>
1 parent c7e5f63 commit 3ce6b1c

1 file changed

Lines changed: 55 additions & 10 deletions

File tree

‎examples/unapplied-scale-gltf/README.md‎

Lines changed: 55 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,67 @@ node has no scale) and neighbor of
77
[`prop-origin-transform`](../prop-origin-transform/) (bake to `(1,1,1)`
88
in Blender).
99

10-
**Why this pathology:** `export_apply` RNA is "Apply modifiers … to mesh
11-
objects". AI code treats it as "apply object transforms". Unapplied
12-
scale lands on the glTF node, Y-up permuted; POSITION stays local.
10+
## The contract
11+
12+
`bpy.ops.export_scene.gltf(export_apply=True)` applies **modifiers**, not
13+
object transforms. Its RNA description, identical on 4.5.11, 5.1.2 and
14+
5.2.1, reads:
15+
16+
> Apply modifiers (excluding Armatures) to mesh objects -WARNING: prevents
17+
> exporting shape keys
18+
19+
An object whose `Object.scale` was never applied therefore exports with
20+
that scale on the glTF **node** (`nodes[i].scale`), permuted to Y-up, and
21+
with its **POSITION** accessor still holding the unscaled local
22+
coordinates. `export_apply` has no effect on either: exporting the same
23+
object with `export_apply=False` writes the identical node scale and
24+
POSITION range.
25+
26+
**Who hits this:** a pipeline that sets `export_apply=True` believing it
27+
bakes transforms, then ships a prop whose root carries a non-uniform
28+
scale. In the engine the mesh looks the right size, but any child
29+
rotated under that node skews, physics colliders sized from the mesh
30+
bounds come out at the local size, and a script reading the node's
31+
scale gets `(2, 0.5, 1)` instead of `(1, 1, 1)`. The fix is to apply
32+
scale in Blender before export (`bpy.ops.object.transform_apply(scale=True)`,
33+
or the data-API bake in `prop-origin-transform`), not an exporter flag.
34+
35+
## What the check asserts
1336

1437
**Pre-assertion (pathology exists):** `obj.scale == (2, 1, 0.5)`
1538
(non-uniform) **and** local verts at ±1 on every axis. `--identity`
16-
exits 3.
39+
leaves the scale at `(1, 1, 1)` and exits 3.
40+
41+
**Handling (second axis):** read back from the written `.gltf` and its
42+
`.bin`, not from Blender state:
43+
44+
- `nodes[0].scale == [2, 0.5, 1]` — Blender `(sx, sy, sz)` becomes glTF
45+
`(sx, sz, sy)` under the Y-up conversion `(x, y, z) → (x, z, −y)`.
46+
- POSITION min/max is ±1 on every axis — the local cube, unscaled.
47+
- POSITION count is 8 either way, so a vertex count alone cannot tell
48+
applied from unapplied. The node scale and the POSITION range are the
49+
witnesses.
50+
51+
`--bake` applies the scale to the mesh data after the pre-assertion.
52+
The node then has no `scale` key and POSITION spans x ±2, y ±0.5, z ±1,
53+
so the check exits 4.
54+
55+
## Versions
56+
57+
Re-verified on Blender 4.5.11 LTS, 5.1.2 and 5.2.1 LTS: the RNA
58+
description, the node scale, the POSITION range and both falsifier exits
59+
are the same on all three. Not a version split.
1760

18-
**Handling (second axis):** with `export_apply=True`, node.scale is
19-
`(2, 0.5, 1)` (`(sx, sz, sy)` from `(x,y,z)→(x,z,−y)`) and POSITION
20-
bbox stays ±1. Vert count is 8 either way. `--bake` after the
21-
pre-assert exits 4 (node.scale missing, POSITION x ±2).
61+
No gallery still. A stretched box looks like modeled non-uniform size;
62+
the defect is unapplied versus baked, which only the file shows.
2263

23-
Same on 4.5 LTS and 5.2 LTS. Not a version split.
64+
## API reference
2465

25-
No gallery still. A stretched box looks like modeled non-uniform size.
66+
- [`bpy.ops.export_scene.gltf`](https://docs.blender.org/api/current/bpy.ops.export_scene.html#bpy.ops.export_scene.gltf)
67+
([4.5 LTS](https://docs.blender.org/api/4.5/bpy.ops.export_scene.html#bpy.ops.export_scene.gltf))
68+
— `export_apply`, `export_yup`
69+
- [`Object.scale`](https://docs.blender.org/api/current/bpy.types.Object.html#bpy.types.Object.scale)
70+
- [glTF 2.0 node transforms](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#transformations)
2671

2772
## Run
2873

0 commit comments

Comments
 (0)