Why it matters
export_preset_unreal_gltf is sold as the Unreal centimeter preset. It multiplies each mesh's scale by 100 and applies it, but never scales object locations. A single object at the origin exports correctly. Any real scene with more than one object comes out with centimeter-sized geometry laid out at meter spacing: objects overlap or collapse together in Unreal.
Readers copy this snippet as-is, and the engine-export-presets skill points at it.
Evidence
snippets/export_preset_unreal.py:30-36 (HEAD 54e7f71):
def export_preset_unreal_gltf(filepath, selected_only=True, draco=False):
apply_selected_mesh_transforms()
for obj in list(bpy.context.selected_objects):
if obj.type != "MESH":
continue
obj.scale = (obj.scale[0] * 100.0, obj.scale[1] * 100.0, obj.scale[2] * 100.0)
apply_selected_mesh_transforms() # transform_apply(location=False, ...)
obj.location is never touched, so the distance between objects stays in meters while mesh extents grow 100x.
Reproduced headless on .scratch/5.2/blender-5.2.1-windows-x64/blender.exe (reports Blender 5.2.1 LTS): three cubes placed 3 m apart, selected, then export_preset_unreal_gltf(...) was called:
PROBE2 inter-object distance 3.000 -> 3.000; cube width 4.000 -> 400.000
Mesh extents grew ×100, spacing stayed ×1.
Suggested approach
Pick one:
- Scale
obj.location by 100 alongside obj.scale. Parented objects need care: only scale roots, or use matrix_world.
- Parent the selection under a temporary root empty, scale the root 100x, apply, then unparent.
Also check whether the existing examples/ export-preset smoke only uses a single object at the origin, which would explain why CI never saw this.
Done when
Why it matters
export_preset_unreal_gltfis sold as the Unreal centimeter preset. It multiplies each mesh's scale by 100 and applies it, but never scales object locations. A single object at the origin exports correctly. Any real scene with more than one object comes out with centimeter-sized geometry laid out at meter spacing: objects overlap or collapse together in Unreal.Readers copy this snippet as-is, and the
engine-export-presetsskill points at it.Evidence
snippets/export_preset_unreal.py:30-36(HEAD54e7f71):obj.locationis never touched, so the distance between objects stays in meters while mesh extents grow 100x.Reproduced headless on
.scratch/5.2/blender-5.2.1-windows-x64/blender.exe(reportsBlender 5.2.1 LTS): three cubes placed 3 m apart, selected, thenexport_preset_unreal_gltf(...)was called:Mesh extents grew ×100, spacing stayed ×1.
Suggested approach
Pick one:
obj.locationby 100 alongsideobj.scale. Parented objects need care: only scale roots, or usematrix_world.Also check whether the existing
examples/export-preset smoke only uses a single object at the origin, which would explain why CI never saw this.Done when