This commit is contained in:
syuilo 2026-05-26 09:34:55 +09:00
commit dd69662603
3 changed files with 21 additions and 18 deletions

View file

@ -6,7 +6,9 @@
import * as BABYLON from '@babylonjs/core';
import { createPlaneUvMapper } from '../utility.js';
import type { Timer } from '../utility.js';
import type { ModelManager, RoomAttachments } from './utility.js';
import type { ModelManager } from './utility.js';
import type { BooleanOptionSchema, ColorOptionSchema, EnumOptionSchema, ImageOptionSchema, LightOptionSchema, MaterialOptionSchema, NumberOptionSchema, ObjectSchemaDef, OptionsSchema, RangeOptionSchema, SeedOptionSchema, StringOptionSchema } from 'misskey-world/src/room/object.js';
import type { RoomAttachments } from 'misskey-world/src/room/type.js';
export type RoomObjectInstance<Options = any> = {
onInited?: () => void;
@ -44,20 +46,6 @@ type GetConvertedOptionsSchemaValues<T extends OptionsSchema> = {
T[K] extends SeedOptionSchema ? number :
never;
};
export type GetOptionsSchemaUiDef<T extends OptionsSchema> = {
[K in keyof T]:
T[K] extends NumberOptionSchema ? { label: string; } :
T[K] extends BooleanOptionSchema ? { label: string; } :
T[K] extends StringOptionSchema ? { label: string; } :
T[K] extends ColorOptionSchema ? { label: string; } :
T[K] extends MaterialOptionSchema ? { label: string; } :
T[K] extends LightOptionSchema ? { label: string; } :
T[K] extends EnumOptionSchema ? { label: string; enum: Record<T[K]['enum'][number]['value'], { label: string; }>; } :
T[K] extends RangeOptionSchema ? { label: string; } :
T[K] extends ImageOptionSchema ? { label: string; presets: Record<T[K]['presets'][number]['value'], { label: string; }>; } :
T[K] extends SeedOptionSchema ? { label: string; } :
never;
};
export type SnapshotRenderingHelperWrapper = {
updateMesh: (meshes: BABYLON.Mesh[]) => void;

View file

@ -3,7 +3,22 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { GetOptionsSchemaUiDef, ObjectSchemaDef } from './object.js';
import type { BooleanOptionSchema, ColorOptionSchema, EnumOptionSchema, ImageOptionSchema, LightOptionSchema, MaterialOptionSchema, NumberOptionSchema, ObjectSchemaDef, OptionsSchema, RangeOptionSchema, SeedOptionSchema, StringOptionSchema } from 'misskey-world/src/room/object.js';
type GetOptionsSchemaUiDef<T extends OptionsSchema> = {
[K in keyof T]:
T[K] extends NumberOptionSchema ? { label: string; } :
T[K] extends BooleanOptionSchema ? { label: string; } :
T[K] extends StringOptionSchema ? { label: string; } :
T[K] extends ColorOptionSchema ? { label: string; } :
T[K] extends MaterialOptionSchema ? { label: string; } :
T[K] extends LightOptionSchema ? { label: string; } :
T[K] extends EnumOptionSchema ? { label: string; enum: Record<T[K]['enum'][number]['value'], { label: string; }>; } :
T[K] extends RangeOptionSchema ? { label: string; } :
T[K] extends ImageOptionSchema ? { label: string; presets: Record<T[K]['presets'][number]['value'], { label: string; }>; } :
T[K] extends SeedOptionSchema ? { label: string; } :
never;
};
export type ObjectUiDef<Schema extends ObjectSchemaDef = ObjectSchemaDef> = {
name: string;

View file

@ -4,8 +4,8 @@
*/
import { EngineControllerBase } from '../EngineControllerBase.js';
import type { RoomObjectPreviewEngine } from './previewEngine.js';
import type { RoomAttachments } from './utility.js';
import type { RoomObjectPreviewEngine } from 'misskey-world-engine/src/room/previewEngine.js';
import type { RoomAttachments } from 'misskey-world/src/room/type.js';
export type PreviewEngineControllerOptions = {
workerMode?: boolean;