Simplify tool mode handling and improve material disposal in viewport-host

This commit is contained in:
2026-03-31 03:10:48 +02:00
parent f2682b0d9b
commit 1db5f63b51
2 changed files with 9 additions and 7 deletions

View File

@@ -95,10 +95,7 @@ export class EditorStore {
return;
}
if (this.toolMode !== "play") {
this.previousEditingToolMode = this.toolMode;
}
this.previousEditingToolMode = this.toolMode;
this.toolMode = "play";
this.emit();
}

View File

@@ -16,9 +16,7 @@ import {
MeshStandardMaterial,
PerspectiveCamera,
Raycaster,
RepeatWrapping,
Scene,
SRGBColorSpace,
Vector2,
Vector3,
WebGLRenderer
@@ -314,7 +312,14 @@ export class ViewportHost {
for (const mesh of renderObjects.meshes) {
mesh.geometry.dispose();
mesh.material.dispose();
if (Array.isArray(mesh.material)) {
for (const material of mesh.material) {
material.dispose();
}
} else {
mesh.material.dispose();
}
}
}