Files
workinf_Blender_Wasm/web/tests/fixtures/create-mesh-editor-input.py
mes123456 f3e21c6b98
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled
chore: checkpoint web Blender migration source, tools and docs
Accumulated uncommitted work: GHOST Web backend, WebGL/GPU web layer,
web workflow engine and protocol, tooling, docs and task records.
Large generated evidence, user-testing archives, build snapshots and
imported test assets remain untracked.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-10 11:18:01 +08:00

26 lines
1.1 KiB
Python

import bpy
import pathlib
root = pathlib.Path(__file__).resolve().parents[3]
bpy.ops.wm.open_mainfile(filepath=str(root / "tests/files/web/basic_scene.blend"))
mesh = bpy.data.objects["BasicCube"].data
# Reverse one face of the closed cube so normal repair has observable work.
vertices = [tuple(vertex.co) for vertex in mesh.vertices]
faces = [tuple(polygon.vertices) for polygon in mesh.polygons]
faces[0] = tuple(reversed(faces[0]))
mesh.clear_geometry()
mesh.from_pydata(vertices, [], faces)
mesh.update()
uv = mesh.uv_layers.active or mesh.uv_layers.new(name="UVMap")
for corner in uv.data:
corner.uv = (0.125, 0.875)
bridge = bpy.data.meshes.new("WebBridgeMesh")
bridge.from_pydata([(-1, -1, 0), (1, -1, 0), (1, 1, 0), (-1, 1, 0),
(-1, -1, 2), (1, -1, 2), (1, 1, 2), (-1, 1, 2)], [],
[(3, 2, 1, 0), (4, 5, 6, 7)])
bridge.update()
obj = bpy.data.objects.new("WebBridgeObject", bridge)
bpy.context.scene.collection.objects.link(obj)
obj.location.x = 4
bpy.ops.wm.save_as_mainfile(filepath=str(root / "tests/files/web/mesh_editor_scene.blend"), check_existing=False)