Fix editor regressions and add Blender scene and animated material import

This commit is contained in:
emil28092005
2026-09-12 00:53:20 +03:00
parent 1a0bf725fa
commit 6f497d1977
34 changed files with 1241 additions and 213 deletions
+5 -2
View File
@@ -14,6 +14,9 @@ export function decodeData(uri: string) {
throw Error("Ожидался data URI base64");
return Uint8Array.from(atob(uri.slice(i + 1)), (c) => c.charCodeAt(0));
}
export function engineResource(path: string, base = typeof document === "undefined" ? undefined : document.baseURI) {
return base ? new URL(path.replace(/^\//, ""), base).href : path;
}
export async function readBytes(uri: string) {
if (uri.startsWith("data:")) return decodeData(uri);
const r = await fetch(uri);
@@ -57,8 +60,8 @@ export async function gameArchive(
) {
const { p, files } = await pack(project, read);
files["project.forma.json"] = strToU8(JSON.stringify(p));
files["player.js"] = await read("/engine/player.js");
files["player.css"] = await read("/engine/player.css");
files["player.js"] = await read(engineResource("/engine/player.js"));
files["player.css"] = await read(engineResource("/engine/player.css"));
files["index.html"] = strToU8(
'<!doctype html><html lang="ru"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover"><title>' +
p.name.replace(/[<>&"]/g, "") +