feat: scene traps, material legends, and scene editor window

Add trap overlays with session state, material legend editor/panel, and a dedicated scene editor window wired through IPC and project persistence.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Ivan Fontosh
2026-07-24 16:29:43 +08:00
parent d3b1c4660d
commit 02d73ddf81
39 changed files with 2563 additions and 36 deletions
+4 -2
View File
@@ -1,7 +1,7 @@
import React, { useCallback, useEffect, useState } from 'react';
import { createPortal, flushSync } from 'react-dom';
import type { MaterialId, ProjectMaterial } from '../../shared/types';
import type { MaterialId, MaterialLegend, ProjectMaterial } from '../../shared/types';
import { Button, Input } from '../shared/ui/controls';
import { useAssetUrl } from '../shared/useAssetImageUrl';
@@ -81,7 +81,6 @@ export function MaterialEditModal({
onDropPaths: (paths) => {
const picked = pickFirstMaterialImagePath(paths);
if (!picked) return;
// Prefer File blob URL if available from the last drop via entries — handled in onDrop below.
setPreviewFromPathAndUrl(picked, '');
},
filterPaths: filterMaterialImagePaths,
@@ -226,6 +225,7 @@ type MaterialsManagerModalProps = {
onDelete: (materialId: MaterialId) => Promise<void>;
onReorder: (materialIds: MaterialId[]) => Promise<void>;
onRotate: (materialId: MaterialId, rotationDeg: 0 | 90 | 180 | 270) => void;
onLegendChange?: (materialId: MaterialId, legend: MaterialLegend) => Promise<void>;
};
export function MaterialsManagerModal({
@@ -237,6 +237,7 @@ export function MaterialsManagerModal({
onDelete,
onReorder,
onRotate,
onLegendChange,
}: MaterialsManagerModalProps) {
const { t } = useEditorI18n();
const [selectedId, setSelectedId] = useState<MaterialId | null>(null);
@@ -278,6 +279,7 @@ export function MaterialsManagerModal({
onDelete={onDelete}
onReorder={onReorder}
onRotate={onRotate}
onLegendChange={onLegendChange}
/>
</div>
</>,