This commit is contained in:
th committed 2026-04-19 22:32:06 +02:00
1 parent fcefd258eb
commit 6b6157d786
23 files changed
+1140 -237

No files matched your search

+7 -7
View File
@@ -32,28 +32,28 @@ export function parseProject(text: string): Scene {
try {
data = JSON.parse(text)
} catch {
throw new ProjectFileError('Datei ist kein gültiges JSON.')
throw new ProjectFileError('File is not valid JSON.')
}
if (!data || typeof data !== 'object') {
throw new ProjectFileError('Datei ist leer oder kein Objekt.')
throw new ProjectFileError('File is empty or not an object.')
}
const obj = data as Record<string, unknown>
if (obj.magic !== MAGIC) {
throw new ProjectFileError('Keine Animatr-Projektdatei (magic fehlt).')
throw new ProjectFileError('Not an Animatr project file (magic missing).')
}
const scene = obj.scene
if (!scene || typeof scene !== 'object') {
throw new ProjectFileError('Projektdatei enthält keine Szene.')
throw new ProjectFileError('Project file has no scene.')
}
const s = scene as Record<string, unknown>
if (!s.canvas || typeof s.canvas !== 'object') {
throw new ProjectFileError('Szenendaten unvollständig: canvas fehlt.')
throw new ProjectFileError('Scene data incomplete: canvas missing.')
}
if (!Array.isArray(s.layers)) {
throw new ProjectFileError('Szenendaten unvollständig: layers fehlt.')
throw new ProjectFileError('Scene data incomplete: layers missing.')
}
if (!Array.isArray(s.assets)) {
throw new ProjectFileError('Szenendaten unvollständig: assets fehlt.')
throw new ProjectFileError('Scene data incomplete: assets missing.')
}
return scene as Scene
}