From f01e9aa2acc6f0edd76c534341edcce124c4913f Mon Sep 17 00:00:00 2001 From: syuilo <4439005+syuilo@users.noreply.github.com> Date: Sun, 31 May 2026 16:50:33 +0900 Subject: [PATCH] wip --- .../src/core/WorldRoomMultiplayService.ts | 2 +- .../src/PlayerContainer.ts | 18 +++++++++--------- .../src/avatarPreviewEngine.ts | 2 +- .../src/components/MkWorldAvatarEditDialog.vue | 10 ++++++---- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/packages/backend/src/core/WorldRoomMultiplayService.ts b/packages/backend/src/core/WorldRoomMultiplayService.ts index b89fcab641..35c5967275 100644 --- a/packages/backend/src/core/WorldRoomMultiplayService.ts +++ b/packages/backend/src/core/WorldRoomMultiplayService.ts @@ -130,7 +130,7 @@ export class WorldRoomMultiplayService { username: user.username, avatarUrl: user.avatarUrl, }, - worldAvatar: avatar ?? this.worldAvatarService.defaultAvatar, + avatar: avatar ?? this.worldAvatarService.defaultAvatar, }; } diff --git a/packages/frontend-misskey-world-engine/src/PlayerContainer.ts b/packages/frontend-misskey-world-engine/src/PlayerContainer.ts index 2c89f0a34a..bf47fc68f8 100644 --- a/packages/frontend-misskey-world-engine/src/PlayerContainer.ts +++ b/packages/frontend-misskey-world-engine/src/PlayerContainer.ts @@ -16,7 +16,7 @@ export type PlayerProfile = { username: string; avatarUrl: string; } | null; - worldAvatar: WorldAvatar; + avatar: WorldAvatar; }; export type PlayerState = { @@ -107,8 +107,8 @@ export class PlayerContainer { eyesBlinkTexture.hasAlpha = true; let eyesTex: BABYLON.Texture | null = null; - if (this.profile.worldAvatar.eyes.type in DEFAULT_FACE_PARTS_EYES) { - const eyesTexPath = DEFAULT_FACE_PARTS_EYES[this.profile.worldAvatar.eyes.type]; + if (this.profile.avatar.eyes.type in DEFAULT_FACE_PARTS_EYES) { + const eyesTexPath = DEFAULT_FACE_PARTS_EYES[this.profile.avatar.eyes.type]; if (eyesTexPath) { eyesTex = new BABYLON.Texture(eyesTexPath, this.scene, false, false); eyesTex.hasAlpha = true; @@ -116,8 +116,8 @@ export class PlayerContainer { } let mouthTex: BABYLON.Texture | null = null; - if (this.profile.worldAvatar.mouth.type in DEFAULT_FACE_PARTS_MOUTH) { - const mouthTexPath = DEFAULT_FACE_PARTS_MOUTH[this.profile.worldAvatar.mouth.type]; + if (this.profile.avatar.mouth.type in DEFAULT_FACE_PARTS_MOUTH) { + const mouthTexPath = DEFAULT_FACE_PARTS_MOUTH[this.profile.avatar.mouth.type]; if (mouthTexPath) { mouthTex = new BABYLON.Texture(mouthTexPath, this.scene, false, false); mouthTex.hasAlpha = true; @@ -137,11 +137,11 @@ export class PlayerContainer { // mesh.material = mat; //} if (mesh.name.includes('__BODY__')) { - mesh.material.albedoColor = new BABYLON.Color3(this.profile.worldAvatar.body.color[0], this.profile.worldAvatar.body.color[1], this.profile.worldAvatar.body.color[2]); + mesh.material.albedoColor = new BABYLON.Color3(this.profile.avatar.body.color[0], this.profile.avatar.body.color[1], this.profile.avatar.body.color[2]); } if (mesh.name.includes('__EYES__')) { const mat = new BABYLON.PBRMaterial('', this.scene); - mat.albedoColor = new BABYLON.Color3(this.profile.worldAvatar.eyes.color[0], this.profile.worldAvatar.eyes.color[1], this.profile.worldAvatar.eyes.color[2]); + mat.albedoColor = new BABYLON.Color3(this.profile.avatar.eyes.color[0], this.profile.avatar.eyes.color[1], this.profile.avatar.eyes.color[2]); mat.albedoTexture = eyesTex; mat.roughness = 1; mat.metallic = 0; @@ -172,7 +172,7 @@ export class PlayerContainer { if (mesh.name.includes('__MOUTH__')) { if (mouthTex != null) { const mat = new BABYLON.PBRMaterial('', this.scene); - mat.albedoColor = new BABYLON.Color3(this.profile.worldAvatar.mouth.color[0], this.profile.worldAvatar.mouth.color[1], this.profile.worldAvatar.mouth.color[2]); + mat.albedoColor = new BABYLON.Color3(this.profile.avatar.mouth.color[0], this.profile.avatar.mouth.color[1], this.profile.avatar.mouth.color[2]); mat.albedoTexture = mouthTex; mat.roughness = 1; mat.metallic = 0; @@ -185,7 +185,7 @@ export class PlayerContainer { this.registerMeshes(this.modelRoot.getChildMeshes()); - this.accessoryContainers = await Promise.all(this.profile.worldAvatar.accessories.map(ac => this.loadAccessory({ + this.accessoryContainers = await Promise.all(this.profile.avatar.accessories.map(ac => this.loadAccessory({ type: ac.type, id: ac.id, position: new BABYLON.Vector3(0, cm(20), 0), diff --git a/packages/frontend-misskey-world-engine/src/avatarPreviewEngine.ts b/packages/frontend-misskey-world-engine/src/avatarPreviewEngine.ts index b4d421773e..757c39936e 100644 --- a/packages/frontend-misskey-world-engine/src/avatarPreviewEngine.ts +++ b/packages/frontend-misskey-world-engine/src/avatarPreviewEngine.ts @@ -181,7 +181,7 @@ export class AvatarPreviewEngine extends EngineBase<{ // PlayerPreviewEngine恫 } public async updateAvatar(value: WorldAvatar) { - this.profile.worldAvatar = value; + this.profile.avatar = value; this.clearPlayer(); await this.load(); } diff --git a/packages/frontend/src/components/MkWorldAvatarEditDialog.vue b/packages/frontend/src/components/MkWorldAvatarEditDialog.vue index 3891537bc8..11d6a07a5f 100644 --- a/packages/frontend/src/components/MkWorldAvatarEditDialog.vue +++ b/packages/frontend/src/components/MkWorldAvatarEditDialog.vue @@ -214,10 +214,12 @@ const controller = markRaw(new AvatarPreviewEngineController(avatarPreviewEngine onMounted(async () => { try { await controller.init(canvas.value!, { - name: $i.name ?? $i.username, - username: $i.username, - avatarUrl: $i.avatarUrl, - worldAvatar: deepClone(avatar.value), + user: { + name: $i.name ?? $i.username, + username: $i.username, + avatarUrl: $i.avatarUrl, + }, + avatar: deepClone(avatar.value), }); } catch (err) { console.error(err);