This commit is contained in:
syuilo 2026-06-15 18:51:26 +09:00
commit 3fd8becdc5
4 changed files with 19 additions and 19 deletions

View file

@ -40,7 +40,7 @@ import type { RoomAttachments, RoomState } from 'misskey-world/src/room/type.js'
import type { RawOptions } from 'misskey-world/src/mono.js';
const BAKE_TRANSFORM = false; // 実験的
const IGNORE_FUNITURES: string[] = ['aquarium']; // for debug
const IGNORE_FURNITURES: string[] = ['aquarium']; // for debug
const IN_WEB_WORKER = typeof window === 'undefined';
function enableFurnitureCollision(meshes: BABYLON.Mesh[]) {
@ -377,7 +377,7 @@ export class RoomEngine extends EngineBase<{
public async init() {
await this.loadEnv();
const furnitures = this.roomState.installedFurnitures.filter(o => !IGNORE_FUNITURES.includes(o.type));
const furnitures = this.roomState.installedFurnitures.filter(o => !IGNORE_FURNITURES.includes(o.type));
let loadedCount = 0;
if (this.roomState.worldScale !== WORLD_SCALE) {

View file

@ -121,7 +121,7 @@ import { kakejiku } from './furnitures/kakejiku.js';
import { herbarium } from './furnitures/herbarium.js';
import type { FurnitureDef } from './furniture.js';
export const FUNITURE_DEFS = [
export const FURNITURE_DEFS = [
a4Case,
aircon,
allInOnePc,
@ -239,7 +239,7 @@ export const FUNITURE_DEFS = [
] as FurnitureDef[];
export function getFurnitureDef(type: string): FurnitureDef {
const def = FUNITURE_DEFS.find(x => x.id === type) as FurnitureDef | undefined;
const def = FURNITURE_DEFS.find(x => x.id === type) as FurnitureDef | undefined;
if (def == null) {
throw new Error(`Unrecognized furniture type: ${type}`);
}

View file

@ -60,9 +60,9 @@ SPDX-License-Identifier: AGPL-3.0-only
<div v-show="showPreview" :class="$style.previewContainer" @click="selectedId = null">
<div :class="$style.preview" @click.stop>
<MkButton :class="$style.unselectButton" small rounded iconOnly @click="selectedId = null"><i class="ti ti-x"></i></MkButton>
<MkButton v-if="selectedFunitureSchema != null && Object.keys(selectedFunitureSchema.options.schema).length > 0" :class="$style.customizeButton" small rounded iconOnly @click="showFurnitureOptions = !showFurnitureOptions"><i class="ti ti-tool"></i></MkButton>
<MkButton v-if="selectedFurnitureSchema != null && Object.keys(selectedFurnitureSchema.options.schema).length > 0" :class="$style.customizeButton" small rounded iconOnly @click="showFurnitureOptions = !showFurnitureOptions"><i class="ti ti-tool"></i></MkButton>
<div :class="[$style.previewMain, { [$style.optionsOpened]: selectedFunitureSchema != null && selectedInstanceId != null && showFurnitureOptions }]">
<div :class="[$style.previewMain, { [$style.optionsOpened]: selectedFurnitureSchema != null && selectedInstanceId != null && showFurnitureOptions }]">
<canvas ref="canvas" :class="$style.canvas"></canvas>
<MkButton :class="$style.addButton" small rounded primary @click="ok"><i class="ti ti-plus"></i></MkButton>
</div>
@ -73,12 +73,12 @@ SPDX-License-Identifier: AGPL-3.0-only
:enterFromClass="prefer.s.animation ? $style.transition_options_enterFrom : ''"
:leaveToClass="prefer.s.animation ? $style.transition_options_leaveTo : ''"
>
<div v-if="selectedFunitureSchema != null && selectedInstanceId != null && showFurnitureOptions" :class="$style.customize">
<div v-if="selectedFurnitureSchema != null && selectedInstanceId != null && showFurnitureOptions" :class="$style.customize">
<MkWorldMonoOptionsForm
:uiDef="FURNITURE_UI_DEFS[selectedFunitureSchema.id]"
:uiDef="FURNITURE_UI_DEFS[selectedFurnitureSchema.id]"
:addFileAttachment="addFileAttachment"
:schema="selectedFunitureSchema.options.schema"
:options="selectedFunitureOptionsState"
:schema="selectedFurnitureSchema.options.schema"
:options="selectedFurnitureOptionsState"
@update="(k, v) => updateFurnitureOption(k, v)"
/>
</div>
@ -139,8 +139,8 @@ const canvas = useTemplateRef('canvas');
const selectedId = ref<string | null>(null);
const showPreview = ref(false);
const selectedInstanceId = ref<string | null>(null);
const selectedFunitureOptionsState = ref<RawOptions | null>(null);
const selectedFunitureSchema = computed(() => selectedId.value == null ? null : FURNITURE_SCHEMA_DEFS[selectedId.value]);
const selectedFurnitureOptionsState = ref<RawOptions | null>(null);
const selectedFurnitureSchema = computed(() => selectedId.value == null ? null : FURNITURE_SCHEMA_DEFS[selectedId.value]);
const showFurnitureOptions = ref(false);
const searchKeyword = ref('');
const searchResult = ref<FurnitureSchemaDef<any>[]>([]);
@ -222,14 +222,14 @@ watch(selectedId, (newId) => {
controller.clearFurniture();
controller.pauseRender();
selectedInstanceId.value = null;
selectedFunitureOptionsState.value = null;
selectedFurnitureOptionsState.value = null;
} else {
const closeWaiting = os.waiting();
nextTick(() => {
try {
withTimeout(controller.loadFurniture(newId), 10000).then(res => {
selectedInstanceId.value = res.id;
selectedFunitureOptionsState.value = deepClone(res.options);
selectedFurnitureOptionsState.value = deepClone(res.options);
controller.resumeRender();
closeWaiting();
showPreview.value = true;
@ -250,7 +250,7 @@ watch(selectedId, (newId) => {
const updateFurnitureOption = throttle(100, (k: string, v: any) => {
controller.updateFurnitureOption(k, deepClone(v), attachments);
selectedFunitureOptionsState.value![k] = v;
selectedFurnitureOptionsState.value![k] = v;
});
function ok() {
@ -264,7 +264,7 @@ function ok() {
emit('ok', {
id: selectedId.value,
options: deepClone(selectedFunitureOptionsState.value!),
options: deepClone(selectedFurnitureOptionsState.value!),
attachments: deepClone(attachments),
});

View file

@ -84,7 +84,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<button v-if="controller.grabbing.value" class="_button" :class="$style.floatingButton" @click="controller.changeGrabbingDistance(-10)"><i class="ti ti-arrows-minimize"></i></button>
<button v-if="!controller.grabbing.value && controller.selected.value != null" v-tooltip.noDelay="i18n.ts._miRoom.duplicate" class="_button" :class="$style.floatingButton" @click="duplicateSelectedFurniture"><i class="ti ti-copy"></i></button>
<button v-if="!controller.grabbing.value && controller.selected.value != null" v-tooltip.noDelay="i18n.ts._miRoom.uninstallFurniture" class="_button" :class="$style.floatingButton" style="color: var(--MI_THEME-error)" @click="removeSelectedFuniture"><i class="ti ti-trash"></i></button>
<button v-if="!controller.grabbing.value && controller.selected.value != null" v-tooltip.noDelay="i18n.ts._miRoom.uninstallFurniture" class="_button" :class="$style.floatingButton" style="color: var(--MI_THEME-error)" @click="removeSelectedFurniture"><i class="ti ti-trash"></i></button>
</template>
<template v-else>
<MkButton v-if="controller.isSitting.value" @click="controller.standUp()">{{ i18n.ts._miWorld.standUp }} (Q)</MkButton>
@ -536,8 +536,8 @@ function duplicateSelectedFurniture() {
canvas.value!.focus();
}
function removeSelectedFuniture() {
controller.removeSelectedFuniture();
function removeSelectedFurniture() {
controller.removeSelectedFurniture();
canvas.value!.focus();
}