Add RelationshipChangeLog model and enhance character loading logic
This commit is contained in:
@@ -82,6 +82,13 @@ export default {
|
||||
const base = getApiBaseURL();
|
||||
const prefix = base ? `${base}${MODELS_API_PATH}` : MODELS_API_PATH;
|
||||
return `${prefix}/${this.actualGender}_${this.ageGroup}.glb`;
|
||||
},
|
||||
exactAgeModelPath() {
|
||||
// Pfad für genaues Alter (z.B. female_1y.glb für Alter 1)
|
||||
const age = this.actualAge;
|
||||
const base = getApiBaseURL();
|
||||
const prefix = base ? `${base}${MODELS_API_PATH}` : MODELS_API_PATH;
|
||||
return `${prefix}/${this.actualGender}_${age}y.glb`;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -207,15 +214,32 @@ export default {
|
||||
|
||||
const base = getApiBaseURL();
|
||||
const prefix = base ? `${base}${MODELS_API_PATH}` : MODELS_API_PATH;
|
||||
const modelPath = this.modelPath;
|
||||
|
||||
// Fallback-Hierarchie:
|
||||
// 1. Zuerst versuchen, Modell für genaues Alter zu laden (z.B. female_1y.glb)
|
||||
// 2. Falls nicht vorhanden, Altersbereich verwenden (z.B. female_toddler.glb)
|
||||
// 3. Falls auch nicht vorhanden, Basis-Modell verwenden (z.B. female.glb)
|
||||
const exactAgePath = this.exactAgeModelPath;
|
||||
const ageGroupPath = this.modelPath;
|
||||
const fallbackPath = `${prefix}/${this.actualGender}.glb`;
|
||||
|
||||
let gltf;
|
||||
try {
|
||||
gltf = await loader.loadAsync(modelPath);
|
||||
} catch (error) {
|
||||
console.warn(`Could not load ${modelPath}, trying fallback model`);
|
||||
gltf = await loader.loadAsync(fallbackPath);
|
||||
// Versuche zuerst genaues Alter
|
||||
try {
|
||||
gltf = await loader.loadAsync(exactAgePath);
|
||||
console.log(`Loaded exact age model: ${exactAgePath}`);
|
||||
} catch (exactAgeError) {
|
||||
// Falls genaues Alter nicht existiert, versuche Altersbereich
|
||||
try {
|
||||
gltf = await loader.loadAsync(ageGroupPath);
|
||||
console.log(`Loaded age group model: ${ageGroupPath}`);
|
||||
} catch (ageGroupError) {
|
||||
// Falls Altersbereich nicht existiert, verwende Basis-Modell
|
||||
console.warn(`Could not load ${ageGroupPath}, trying fallback model`);
|
||||
gltf = await loader.loadAsync(fallbackPath);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
dracoLoader.dispose();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user