1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-20 22:15:28 +02:00
This commit is contained in:
syuilo
2026-02-27 21:57:43 +09:00
parent 3e7166bd2c
commit 5910ec68e3
15 changed files with 37 additions and 5 deletions

View File

@@ -884,8 +884,16 @@ export class RoomEngine {
},
findMaterial: (keyword) => {
for (const m of root.getChildMeshes()) {
if (m.material != null && m.material.name.includes(keyword)) {
if (m.material == null) continue;
if (m.material.name.includes(keyword)) {
return m.material as BABYLON.PBRMaterial;
} else if ((m.material as BABYLON.MultiMaterial).subMaterials != null) {
for (const sm of (m.material as BABYLON.MultiMaterial).subMaterials) {
if (sm == null) continue;
if (sm.name.includes(keyword)) {
return sm as BABYLON.PBRMaterial;
}
}
}
}
throw new Error(`Material with keyword "${keyword}" not found for object ${args.type} (${args.id})`);