feat(web): studio worlds, camera-view/offscreen environment parity, material and undo coverage
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

Environment lighting:
- ship all eight desktop studiolights/world datasets (WBENV1 float32) and a
  shared loader used by both the main viewport and the offscreen worker
- add the N-panel "studio 环境" selector
- rotate the world background together with the environment
  (backgroundRotation/backgroundIntensity), so camera view and offscreen
  renders match the desktop Mapping-node behaviour

Verification (Chromium, OPFS, NOT_CLAIMED):
- environment lighting + 8 world pixel identity
- camera-view rotation correspondence (camera matrices, 207 samples)
- offscreen vs on-screen background parity after hiding geometry (1305 samples)
- metals case extended with material-field OPFS roundtrip
- material Principled edits and rename undo/redo
- eight studio worlds: pairwise frame differences + luminance rank correlation
- undo history depth capped at 64 steps and undo across OPFS save/reopen

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
mes123456
2026-11-23 09:27:47 +08:00
parent f96654b158
commit 63db6caf1f
325 changed files with 20004 additions and 762 deletions

View File

@@ -0,0 +1,24 @@
{
"triangle_minimal": {
"objects": 1,
"triangles": 1
},
"nested_hierarchy": {
"objects": 2,
"triangles": 3
},
"two_materials": {
"objects": 2,
"triangles": 2,
"materials": 2
},
"millimeter_yup": {
"objects": 1,
"triangles": 12,
"size_m": [
1,
1,
1
]
}
}

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
<asset>
<contributor><author>WebBlender fixtures</author></contributor>
<created>2026-11-21T00:00:00Z</created>
<modified>2026-11-21T00:00:00Z</modified>
<unit meter="0.001" name="millimeter"/>
<up_axis>Y_UP</up_axis>
</asset>
<library_geometries>
<geometry id="Cube" name="Cube">
<mesh>
<source id="Cube-positions">
<float_array id="Cube-positions-array" count="24">0 0 0 1000 0 0 1000 1000 0 0 1000 0 0 0 1000 1000 0 1000 1000 1000 1000 0 1000 1000</float_array>
<technique_common>
<accessor source="#Cube-positions-array" count="8" stride="3">
<param name="X" type="float"/><param name="Y" type="float"/><param name="Z" type="float"/>
</accessor>
</technique_common>
</source>
<vertices id="Cube-vertices">
<input semantic="POSITION" source="#Cube-positions"/>
</vertices>
<triangles count="12">
<input semantic="VERTEX" source="#Cube-vertices" offset="0"/>
<p>0 1 2 0 2 3 4 6 5 4 7 6 0 4 5 0 5 1 1 5 6 1 6 2 2 6 7 2 7 3 3 7 4 3 4 0</p>
</triangles>
</mesh>
</geometry>
</library_geometries>
<library_effects>
</library_effects>
<library_materials>
</library_materials>
<library_visual_scenes>
<visual_scene id="Scene" name="Scene">
<node id="Root" name="Root">
<instance_geometry url="#Cube"></instance_geometry>
</node>
</visual_scene>
</library_visual_scenes>
<scene><instance_visual_scene url="#Scene"/></scene>
</COLLADA>

View File

@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
<asset>
<contributor><author>WebBlender fixtures</author></contributor>
<created>2026-11-21T00:00:00Z</created>
<modified>2026-11-21T00:00:00Z</modified>
<unit meter="1" name="meter"/>
<up_axis>Z_UP</up_axis>
</asset>
<library_geometries>
<geometry id="Marker" name="Marker">
<mesh>
<source id="Marker-positions">
<float_array id="Marker-positions-array" count="9">0 0 0 0.5 0 0 0 0.5 0</float_array>
<technique_common>
<accessor source="#Marker-positions-array" count="3" stride="3">
<param name="X" type="float"/><param name="Y" type="float"/><param name="Z" type="float"/>
</accessor>
</technique_common>
</source>
<vertices id="Marker-vertices">
<input semantic="POSITION" source="#Marker-positions"/>
</vertices>
<triangles count="1">
<input semantic="VERTEX" source="#Marker-vertices" offset="0"/>
<p>0 1 2</p>
</triangles>
</mesh>
</geometry>
<geometry id="Panel" name="Panel">
<mesh>
<source id="Panel-positions">
<float_array id="Panel-positions-array" count="12">0 0 0 1 0 0 1 1 0 0 1 0</float_array>
<technique_common>
<accessor source="#Panel-positions-array" count="4" stride="3">
<param name="X" type="float"/><param name="Y" type="float"/><param name="Z" type="float"/>
</accessor>
</technique_common>
</source>
<vertices id="Panel-vertices">
<input semantic="POSITION" source="#Panel-positions"/>
</vertices>
<triangles count="2">
<input semantic="VERTEX" source="#Panel-vertices" offset="0"/>
<p>0 1 2 0 2 3</p>
</triangles>
</mesh>
</geometry>
</library_geometries>
<library_effects>
</library_effects>
<library_materials>
</library_materials>
<library_visual_scenes>
<visual_scene id="Scene" name="Scene">
<node id="Root" name="Root">
<translate sid="location">0 0 2</translate>
<instance_geometry url="#Marker"></instance_geometry>
<node id="Child" name="Child">
<rotate sid="rotationZ">0 0 1 90</rotate>
<scale sid="scale">2 2 2</scale>
<instance_geometry url="#Panel"></instance_geometry>
</node>
</node>
</visual_scene>
</library_visual_scenes>
<scene><instance_visual_scene url="#Scene"/></scene>
</COLLADA>

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
<asset>
<contributor><author>WebBlender fixtures</author></contributor>
<created>2026-11-21T00:00:00Z</created>
<modified>2026-11-21T00:00:00Z</modified>
<unit meter="1" name="meter"/>
<up_axis>Z_UP</up_axis>
</asset>
<library_geometries>
<geometry id="MinimalTriangle" name="MinimalTriangle">
<mesh>
<source id="MinimalTriangle-positions">
<float_array id="MinimalTriangle-positions-array" count="9">0 0 0 1 0 0 0 2 0</float_array>
<technique_common>
<accessor source="#MinimalTriangle-positions-array" count="3" stride="3">
<param name="X" type="float"/><param name="Y" type="float"/><param name="Z" type="float"/>
</accessor>
</technique_common>
</source>
<vertices id="MinimalTriangle-vertices">
<input semantic="POSITION" source="#MinimalTriangle-positions"/>
</vertices>
<triangles count="1">
<input semantic="VERTEX" source="#MinimalTriangle-vertices" offset="0"/>
<p>0 1 2</p>
</triangles>
</mesh>
</geometry>
</library_geometries>
<library_effects>
</library_effects>
<library_materials>
</library_materials>
<library_visual_scenes>
<visual_scene id="Scene" name="Scene">
<node id="Root" name="Root">
<instance_geometry url="#MinimalTriangle"></instance_geometry>
</node>
</visual_scene>
</library_visual_scenes>
<scene><instance_visual_scene url="#Scene"/></scene>
</COLLADA>

View File

@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
<asset>
<contributor><author>WebBlender fixtures</author></contributor>
<created>2026-11-21T00:00:00Z</created>
<modified>2026-11-21T00:00:00Z</modified>
<unit meter="1" name="meter"/>
<up_axis>Z_UP</up_axis>
</asset>
<library_geometries>
<geometry id="Left" name="Left">
<mesh>
<source id="Left-positions">
<float_array id="Left-positions-array" count="9">-1 0 0 0 0 0 0 1 0</float_array>
<technique_common>
<accessor source="#Left-positions-array" count="3" stride="3">
<param name="X" type="float"/><param name="Y" type="float"/><param name="Z" type="float"/>
</accessor>
</technique_common>
</source>
<vertices id="Left-vertices">
<input semantic="POSITION" source="#Left-positions"/>
</vertices>
<triangles count="1">
<input semantic="VERTEX" source="#Left-vertices" offset="0"/>
<p>0 1 2</p>
</triangles>
</mesh>
</geometry>
<geometry id="Right" name="Right">
<mesh>
<source id="Right-positions">
<float_array id="Right-positions-array" count="9">0 0 0 1 0 0 0 1 0</float_array>
<technique_common>
<accessor source="#Right-positions-array" count="3" stride="3">
<param name="X" type="float"/><param name="Y" type="float"/><param name="Z" type="float"/>
</accessor>
</technique_common>
</source>
<vertices id="Right-vertices">
<input semantic="POSITION" source="#Right-positions"/>
</vertices>
<triangles count="1">
<input semantic="VERTEX" source="#Right-vertices" offset="0"/>
<p>0 1 2</p>
</triangles>
</mesh>
</geometry>
</library_geometries>
<library_effects>
<effect id="FxRed">
<profile_COMMON>
<technique sid="common">
<lambert><diffuse><color>1 0 0 1</color></diffuse></lambert>
</technique>
</profile_COMMON>
</effect>
<effect id="FxGreen">
<profile_COMMON>
<technique sid="common">
<lambert><diffuse><color>0 1 0 1</color></diffuse></lambert>
</technique>
</profile_COMMON>
</effect>
</library_effects>
<library_materials>
<material id="Red" name="Red">
<instance_effect url="#FxRed"/>
</material>
<material id="Green" name="Green">
<instance_effect url="#FxGreen"/>
</material>
</library_materials>
<library_visual_scenes>
<visual_scene id="Scene" name="Scene">
<node id="Root" name="Root">
<instance_geometry url="#Left"><bind_material><technique_common>
<instance_material symbol="MatRed" target="#Red"/>
</technique_common></bind_material></instance_geometry>
<instance_geometry url="#Right"><bind_material><technique_common>
<instance_material symbol="MatGreen" target="#Green"/>
</technique_common></bind_material></instance_geometry>
</node>
</visual_scene>
</library_visual_scenes>
<scene><instance_visual_scene url="#Scene"/></scene>
</COLLADA>

Binary file not shown.

View File

@@ -4,8 +4,8 @@ import { pythonReply } from './wasm-console-workflow';
import { finiteLocation } from './console-main-workflow';
import { performNativeAction } from './native-ui-workflow';
import type { WebEngineHistory, WebEngineRequest } from '../../protocol/web-engine';
export async function nativeRequest(page: Page, command: WebEngineRequest['command']) {
const response = await page.evaluate(command => new Promise<any>((resolve, reject) => {
export async function nativeRequest(page: Page, command: WebEngineRequest['command'], timeoutMs = 60000) {
const response = await page.evaluate(({ command, timeoutMs }) => new Promise<any>((resolve, reject) => {
const worker = (window as any).__nativeWorkflowEngine as Worker, requestId = `web-engine-oracle-${crypto.randomUUID()}`;
if (!worker) throw new Error('Native Worker is unavailable');
const listener = ({ data }: MessageEvent) => {
@@ -15,12 +15,12 @@ export async function nativeRequest(page: Page, command: WebEngineRequest['comma
if (file !== undefined && (!(file instanceof ArrayBuffer) || file.byteLength > 64 * 1024 * 1024)) { reject(new Error('Native file readback must be an ArrayBuffer within 64 MiB')); return; }
resolve({ ...data, blendBytes: blend === undefined ? undefined : Array.from(new Uint8Array(blend)), fileBytes: file === undefined ? undefined : Array.from(new Uint8Array(file)) });
};
const timer = setTimeout(() => { worker.removeEventListener('message', listener); reject(new Error('Native readback timed out')); }, 60000); worker.addEventListener('message', listener); worker.postMessage({ requestId, command });
}), command);
const timer = setTimeout(() => { worker.removeEventListener('message', listener); reject(new Error('Native readback timed out')); }, timeoutMs); worker.addEventListener('message', listener); worker.postMessage({ requestId, command });
}), { command, timeoutMs });
expect(response.ok, response.error?.message).toBe(true); return response;
}
export async function queryNativeJSON(page: Page, source: string) {
const response = await nativeRequest(page, { type: 'jsonCommand', cmd: 'pythonExec', params: { source: `exec(${JSON.stringify(source)}, {'__name__': '__wbv2_readback__'})`, filename: 'B2MainReadback.py', console: false } });
export async function queryNativeJSON(page: Page, source: string, timeoutMs = 60000) {
const response = await nativeRequest(page, { type: 'jsonCommand', cmd: 'pythonExec', params: { source: `exec(${JSON.stringify(source)}, {'__name__': '__wbv2_readback__'})`, filename: 'B2MainReadback.py', console: false } }, timeoutMs);
const reply = await pythonReply(page); expect(reply).not.toBeNull(); expect(reply!.requestId).toBe(response.requestId);
expect(reply!.state, reply!.output).toBe('DONE'); expect(reply!.changed).toBe(false); return { revision: reply!.revision, value: JSON.parse(reply!.output) };
}
@@ -100,7 +100,12 @@ export async function focusNativeViewport(page: Page) {
const area = await page.evaluate(() => (window as any).__nativeWorkflowAreas?.find((area: any) => area.editor === 'VIEW_3D' && area.regions.some((region: any) => region.kind === 'MAIN' && region.visible))); expect(area).toBeDefined();
const { x, y, width, height } = area.rect; for (const value of [x, y, width, height]) { expect(typeof value).toBe('number'); expect(Number.isFinite(value)).toBe(true); } expect(width).toBeGreaterThan(0); expect(height).toBeGreaterThan(0);
const bounds = await canvas.boundingBox(); expect(bounds).not.toBeNull(); const point = { x: bounds!.x + (x + width / 2) * bounds!.width, y: bounds!.y + (1 - y - height / 2) * bounds!.height };
await expect(canvas).toHaveAttribute('data-native-input-ready', 'true', { timeout: 15000 });
/* The idle frame pump stops publishing readiness, and republishing requires two consecutive
* acknowledged frames, so keep feeding pointer input until it flips back to ready. */
await expect.poll(async () => {
await page.mouse.move(point.x + Math.random(), point.y);
return canvas.getAttribute('data-native-input-ready');
}, { timeout: 15000 }).toBe('true');
await page.mouse.move(point.x, point.y); await canvas.focus();
await waitNativeModal(page, false); await expect(canvas).toBeFocused(); return { canvas, point };
}