feat(web): Outliner deletes objects from the keymap and the Data menu
The desktop Outliner binds outliner.delete to X and Del and also carries it in the context/Data menu; the web data menu only offered rename and Remap Users. Both entries now run the existing deleteObject edit for the object row under the cursor or keyboard focus, so the deletion travels through the same native Main transaction as the viewport delete. The headed case [outliner-delete-web] deletes one object with X and one through the Data menu entry, checking the native row set shrinks and the labels disappear; receipt OUTLINER-HEADED-20261130-082221 (NOT_CLAIMED, 9/9). Collection rows still lack Delete Hierarchy, which stays queued. The armature panel regression keeps failing identically at HEAD and is tracked as pre-existing. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -2521,12 +2521,13 @@ const OUTLINER_RESTRICT_POPOVER_LABELS: Record<keyof NativeOutlinerRestrict, str
|
||||
enable: '排除', select: '可选', hide: '隐藏', viewport: '视口',
|
||||
render: '渲染', holdout: '阻隔', indirectOnly: '仅间接',
|
||||
};
|
||||
function Outliner({ snapshot, areaId, onSelect, onToggleVisibility, onRefresh, onSelectAll, onToggleExpand, onTreeSelect, onRemap, onSetDisplayMode, onSetFilter, onSetSyncSelect, onSetRestriction, onSetRestrictColumns, onReparent, onMoveToCollection, onMoveCollection }: {
|
||||
function Outliner({ snapshot, areaId, onSelect, onToggleVisibility, onRefresh, onSelectAll, onToggleExpand, onTreeSelect, onRemap, onSetDisplayMode, onSetFilter, onSetSyncSelect, onSetRestriction, onSetRestrictColumns, onReparent, onMoveToCollection, onMoveCollection, onDeleteObject }: {
|
||||
snapshot: SceneSnapshotIR | null;
|
||||
onSelect: (id: string, additive: boolean, range: boolean) => void;
|
||||
onToggleVisibility: (id: string, visible: boolean) => void;
|
||||
onRefresh?: () => void;
|
||||
onSelectAll?: (operation: 'SELECT' | 'DESELECT' | 'INVERT' | 'TOGGLE') => void;
|
||||
onDeleteObject?: (objectId: string) => void;
|
||||
areaId?: string;
|
||||
onToggleExpand?: (rowId: string, toggleAll: boolean, areaId: string) => void;
|
||||
onTreeSelect?: (rowId: string, extend: boolean, range: boolean, areaId: string, activateData: boolean, activateProperties?: boolean, recursive?: boolean) => void;
|
||||
@@ -2741,7 +2742,7 @@ function Outliner({ snapshot, areaId, onSelect, onToggleVisibility, onRefresh, o
|
||||
{/* Desktop SpaceOutliner display_mode selector (View Layer, Blender File, …). */}
|
||||
{onSetDisplayMode && tree?.displayModes?.length ? <select aria-label="大纲显示模式" value={tree.displayMode ?? ''} onChange={(event) => onSetDisplayMode(event.target.value)}>{tree.displayModes.map(item => <option key={item.id} value={item.id}>{item.label}</option>)}</select> : null}
|
||||
<DesktopMenu label="Data" open={dataMenu} onToggle={() => { setMenuRow(null); setDataMenu(!dataMenu); }}
|
||||
onClose={() => setDataMenu(false)} items={[{label: '重命名 (F2)', disabled: treeRenameBusy || remapBusy || !onRemap || !workspace?.writable || !menuTarget || !renameTarget(menuTarget), reason: '重命名受支持的本地数据块', action: () => { if (menuTarget) beginTreeRename(menuTarget); }}, {label: 'Remap Users',
|
||||
onClose={() => setDataMenu(false)} items={[{label: '重命名 (F2)', disabled: treeRenameBusy || remapBusy || !onRemap || !workspace?.writable || !menuTarget || !renameTarget(menuTarget), reason: '重命名受支持的本地数据块', action: () => { if (menuTarget) beginTreeRename(menuTarget); }}, {label: '删除 (X)', disabled: treeRenameBusy || remapBusy || !onDeleteObject || !menuTarget?.objectId, reason: '删除所选对象(桌面 OUTLINER_OT_delete)', action: () => { if (menuTarget?.objectId) onDeleteObject?.(menuTarget.objectId); }}, {label: 'Remap Users',
|
||||
disabled: remapBusy || treeRenameBusy || !onRemap || !workspace?.writable || !menuTarget?.remapId ||
|
||||
tree?.remapIds?.filter(id => id.id === menuTarget.remapId).length !== 1,
|
||||
reason: 'Remap all local usages of this data-block to another one of the same type', action: openRemap}]} />
|
||||
@@ -2804,6 +2805,11 @@ function Outliner({ snapshot, areaId, onSelect, onToggleVisibility, onRefresh, o
|
||||
const row = rowId ? tree.rows.find((candidate) => candidate.id === rowId) : undefined;
|
||||
if (!row) return;
|
||||
if (event.key === "F2" && !event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey) { event.preventDefault(); event.stopPropagation(); beginTreeRename(row); return; }
|
||||
/* Desktop keymap binds outliner.delete to X and Del; the object row
|
||||
* carries the id the deleteObject edit needs. */
|
||||
if ((event.key === "Delete" || selectKey === "x") && !event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey && row.objectId && onDeleteObject) {
|
||||
event.preventDefault(); event.stopPropagation(); onDeleteObject(row.objectId); return;
|
||||
}
|
||||
if (event.key === "ContextMenu" || (event.shiftKey && event.key === "F10")) { event.preventDefault(); event.stopPropagation(); setMenuRow(row.id); setDataMenu(true); return; }
|
||||
if (event.key === "Enter" || event.key === " ") { event.preventDefault(); event.stopPropagation(); onTreeSelect?.(row.id, event.ctrlKey || event.metaKey, event.shiftKey, nativeArea.id, true, true); return; }
|
||||
if (row.hasChildren && ((event.key === "ArrowRight" && !row.expanded) || (event.key === "ArrowLeft" && row.expanded))) { event.preventDefault(); event.stopPropagation(); onToggleExpand?.(row.id, event.altKey, nativeArea.id); }
|
||||
@@ -10291,7 +10297,8 @@ else:
|
||||
onToggleExpand={toggleOutlinerExpand} onTreeSelect={selectOutlinerRow} onSetDisplayMode={(displayMode) => setOutlinerDisplayMode(displayMode, area.id)} onSetFilter={(filter) => setOutlinerFilter(filter, area.id)} onSetSyncSelect={(sync) => setOutlinerSyncSelect(sync, area.id)} onRemap={(command, feedback) => applyEditCommand(command, undefined, feedback)} onReparent={(ids, parentId, keepTransform) => void applyEditCommand({ type: 'setParents', objectIds: ids, parentId, keepTransform })} onMoveToCollection={(ids, collectionId, keepExistingLinks) => { for (const id of ids) void applyEditCommand({ type: 'moveObjectToCollection', objectId: id, collectionId, keepExistingLinks }); }} onMoveCollection={(collectionId, parentCollectionId) => void applyEditCommand(coreSceneCommands.moveCollection(collectionId, parentCollectionId))}
|
||||
onSelect={(id,additive,range)=>selectObject(id,additive,range,area.id)}
|
||||
onRefresh={()=>refreshOutliner(area.id)} onSelectAll={operation=>selectAllOutliner(operation,area.id)}
|
||||
onToggleVisibility={(id,visible)=>void applyEditCommand({type:'setObjectVisibility',objectId:id,visible})}/>;
|
||||
onToggleVisibility={(id,visible)=>void applyEditCommand({type:'setObjectVisibility',objectId:id,visible})}
|
||||
onDeleteObject={(id)=>void applyEditCommand({type:'deleteObject',objectId:id})}/>;
|
||||
if(area.editor==='VIEW_3D')return <WasmViewportBinding view={area.space?.view} client={webClientRef.current} onSave={async view=>{
|
||||
const client=webClientRef.current;if(!client||!nativeWorkspace)return false;
|
||||
const current=(await client.snapshot()).snapshot;
|
||||
@@ -10468,7 +10475,7 @@ else:
|
||||
case "3D Viewport":
|
||||
return <ViewportPlaceholder key={areaKey} viewportPreferences={{ gizmoSize: webPreferences.viewport.gizmoSize, gizmoSizeNavigate: webPreferences.viewport.gizmoSizeNavigate, miniAxis: webPreferences.viewport.miniAxis, defaultShading: webPreferences.viewport.defaultShading, orbitSensitivity: webPreferences.navigation.orbitSensitivity, zoomSensitivity: webPreferences.navigation.zoomSensitivity, invertZoom: webPreferences.navigation.invertZoom }} showViewName={webPreferences.interface.showViewName} snapshot={snapshot} geometryBuffers={geometryBuffers} nonMeshGeometryBuffers={nonMeshGeometryBuffers} textureAssets={gpuTextureAssets} volumeProject={volumeProject} lodLevels={lodLevels} selectedObjectIds={selectedObjectIds} editMode={uiState.context.mode === "Edit"} meshSelection={meshSelection} greasePencilSelectionRevision={greasePencilSelection?.revision ?? 0} onSelect={selectObject} onBoxSelect={selectObjectsInBox} onElementBoxSelect={selectMeshElementsInBox} onElementSelect={selectMeshElement} onGreasePencilPointSelect={selectGreasePencilPoint} onGreasePencilMarqueeSelect={selectGreasePencilMarquee} onTransform={transformActive} transformSettings={viewportTransformSettings} elementGizmo={elementGizmoFrame} onGizmoDrag={onGizmoDrag}onSetObjectTransform={(objectId, translation, rotationEuler, scale) => void applyEditCommand({ type: "setObjectTransform", objectId, translation, rotationEuler, scale })} onDiagnostic={recordDiagnostic} mode={uiState.context.mode} onMeshEdit={runMeshEdit} onMeshSelectionMode={setMeshSelectionMode} onSelectAllMeshElements={selectAllMeshElements} onAddPrimitive={(primitive) => void applyEditCommand(coreSceneCommands.createPrimitive(primitive))} onFocusSculptProperties={() => focusProperty('[data-testid="sculpt-editor"]')} onVoxelRemesh={(voxelSize) => void invokeNativeOperator('object.voxel_remesh', { voxel_size: voxelSize })} />;
|
||||
case "Outliner":
|
||||
return <Outliner key={`${projectIdRef.current}:${userActionSequenceRef.current}`} snapshot={snapshot} onToggleExpand={toggleOutlinerExpand} onTreeSelect={selectOutlinerRow} onSetDisplayMode={setOutlinerDisplayMode} onSetFilter={setOutlinerFilter} onSetSyncSelect={setOutlinerSyncSelect} onSetRestriction={setOutlinerRestriction} onSetRestrictColumns={setOutlinerRestrictColumns}onRemap={(command, feedback) => applyEditCommand(command, undefined, feedback)} onReparent={(ids, parentId, keepTransform) => void applyEditCommand({ type: 'setParents', objectIds: ids, parentId, keepTransform })} onMoveToCollection={(ids, collectionId, keepExistingLinks) => { for (const id of ids) void applyEditCommand({ type: 'moveObjectToCollection', objectId: id, collectionId, keepExistingLinks }); }} onMoveCollection={(collectionId, parentCollectionId) => void applyEditCommand(coreSceneCommands.moveCollection(collectionId, parentCollectionId))} onSelect={selectObject} onRefresh={refreshOutliner} onSelectAll={selectAllOutliner} onToggleVisibility={(id, visible) => void applyEditCommand({ type: "setObjectVisibility", objectId: id, visible })} />;
|
||||
return <Outliner key={`${projectIdRef.current}:${userActionSequenceRef.current}`} snapshot={snapshot} onToggleExpand={toggleOutlinerExpand} onTreeSelect={selectOutlinerRow} onSetDisplayMode={setOutlinerDisplayMode} onSetFilter={setOutlinerFilter} onSetSyncSelect={setOutlinerSyncSelect} onSetRestriction={setOutlinerRestriction} onSetRestrictColumns={setOutlinerRestrictColumns}onRemap={(command, feedback) => applyEditCommand(command, undefined, feedback)} onReparent={(ids, parentId, keepTransform) => void applyEditCommand({ type: 'setParents', objectIds: ids, parentId, keepTransform })} onMoveToCollection={(ids, collectionId, keepExistingLinks) => { for (const id of ids) void applyEditCommand({ type: 'moveObjectToCollection', objectId: id, collectionId, keepExistingLinks }); }} onMoveCollection={(collectionId, parentCollectionId) => void applyEditCommand(coreSceneCommands.moveCollection(collectionId, parentCollectionId))} onSelect={selectObject} onRefresh={refreshOutliner} onSelectAll={selectAllOutliner} onToggleVisibility={(id, visible) => void applyEditCommand({ type: "setObjectVisibility", objectId: id, visible })} onDeleteObject={(id) => void applyEditCommand({ type: "deleteObject", objectId: id })} />;
|
||||
case "Properties":
|
||||
return <Properties key={mainReplacementEpoch} onSoftBodyCacheOperation={localOnly ? queueSoftBodyCache : undefined} onFluidCacheOperation={localOnly ? (objectId, operation) => queueLocalDesktopOperator("fluid." + operation, {}, true, objectId, "OBJECT") : undefined} pointCacheBusy={headerBusy || Boolean(localInvokePending) || localInvokeActive || nativeModalActive || projectActionLocked} onPointCacheOperation={localOnly ? operation => queueLocalDesktopOperator(operation === "BAKE_ALL" ? "ptcache.bake_all" : "ptcache.free_bake_all", operation === "BAKE_ALL" ? { bake: true } : {}, true) : undefined} selectedEdgeIndices={meshSelection.mode === "EDGE" ? [...meshSelection.indices] : []} nonMeshGeometryBuffers={nonMeshGeometryBuffers} client={webClientRef.current} snapshot={snapshot} uiMode={uiState.context.mode} onSetMode={(mode) => dispatchUI({type:'setMode', mode})} editorWorkflow={editorWorkflow} onExecutePython={executePythonAndApply} objectCameraId={objectCameraId} onObjectCameraChange={setObjectCameraId} onSimulatePhysics={simulatePhysicsRange} physicsSimulationRange={snapshot?.scenes[0]?.renderSettings ? { start: snapshot.scenes[0].renderSettings.frameStart, end: snapshot.scenes[0].renderSettings.frameEnd } : undefined} onImportSequencerMedia={importSequencerMedia} onRestoreSequencerMedia={restoreSequencerMedia} selectedFaceIndices={meshSelection.mode === "FACE" ? [...meshSelection.indices] : []} selectedVertexIndices={meshSelection.mode === "VERT" ? [...meshSelection.indices] : []} greasePencilSelection={greasePencilSelection} onGreasePencilCanvasPointSelect={(point, mode, baseSelectionRevision) => { commitGreasePencilSelection("CANVAS_2D", mode === "ADD" ? "TOGGLE" : mode, [point], baseSelectionRevision, point); }} onCommand={(command) => applyEditCommand(command)} onImportImage={(file) => void importImage(file)} onImportVFont={(file) => void importVFont(file)} onRequestAsset={(assetId) => { const client = webClientRef.current; if (!client) return; void client.requestAsset(assetId).then((asset) => setEngineStatus(`Asset: ${asset.assetId} (${asset.status})`)).catch((error: unknown) => setEngineStatus(recordDiagnostic("ENGINE", "PBR_ASSET_INVALID", error, { assetId }))); }} onAppendLibraryObject={async (source, request) => {
|
||||
const client = webClientRef.current; if (!client) return; const appendProjectId = projectIdRef.current; const isCurrent = () => client === webClientRef.current && appendProjectId === projectIdRef.current;
|
||||
@@ -10635,9 +10642,9 @@ else:
|
||||
{localOnly ? <Area className="spreadsheet-area" editor="Spreadsheet"><WorkspaceEditorSurface editor="Spreadsheet" snapshot={snapshot} engineStatus={engineStatus} onOpen={() => fileInputRef.current?.click()} onSearch={() => dispatchUI({ type: "toggleOperatorSearch", open: true })} /></Area> : workspace === "Geometry Nodes" ? <Area className="spreadsheet-area" editor="Spreadsheet"><SpreadsheetView snapshot={snapshot} geometryBuffers={geometryBuffers} onExecutePython={executePythonAndApply} /></Area> : null}
|
||||
{scriptingMounted.current ? <ScriptingContainer {...(localOnly?{}:{style:{display:scriptingVisible?"contents":"none"}})}><Area className="text-editor-area" editor="Text Editor">
|
||||
<WasmTextEditor key={`${projectIdRef.current}:${textEditorEpoch}`} snapshot={snapshot} onCommand={applyEditCommand} projectBusy={projectActionLocked} canEditDraft={()=>!projectActionMutexRef.current.owner} onDraftChanged={dirty=>{if(dirty)textDraftAreas.current.add('web-tools-text');else textDraftAreas.current.delete('web-tools-text');textDraftDirty.current=textDraftAreas.current.size>0;}} onNativeRun={localOnly?undefined:(name,source)=>void runNativeWorkflow({kind:'PYTHON',context:nativeContext(),python:{source,textName:name,console:false}})} onPythonRun={pythonSession?(name,source)=>pythonSession.run(source,name,false):undefined} pythonBusy={pythonState?.status==='running'||pythonState?.status==='stopping'}/>
|
||||
</Area><Area className="console-area" editor="Python Console">{pythonSession?<WasmPythonConsole session={pythonSession} enabled={Boolean(snapshot)&&!headerPending}/>:<NativeSessionPanel key={projectIdRef.current} client={webClientRef.current} context={nativeContext()} onApplied={applyNativeScene}/>}</Area><Area className="info-area" editor="Info"><WorkspaceEditorSurface editor="Info" snapshot={snapshot} engineStatus={engineStatus} onOpen={() => fileInputRef.current?.click()} onSearch={() => dispatchUI({ type: "toggleOperatorSearch", open: true })} /></Area><Area className="secondary-outliner-area" editor="Outliner"><Outliner key={`${projectIdRef.current}:${userActionSequenceRef.current}`} snapshot={snapshot} onToggleExpand={toggleOutlinerExpand} onTreeSelect={selectOutlinerRow} onSetDisplayMode={setOutlinerDisplayMode} onSetFilter={setOutlinerFilter} onSetSyncSelect={setOutlinerSyncSelect} onSetRestriction={setOutlinerRestriction} onSetRestrictColumns={setOutlinerRestrictColumns}onRemap={(command, feedback) => applyEditCommand(command, undefined, feedback)} onReparent={(ids, parentId, keepTransform) => void applyEditCommand({ type: 'setParents', objectIds: ids, parentId, keepTransform })} onMoveToCollection={(ids, collectionId, keepExistingLinks) => { for (const id of ids) void applyEditCommand({ type: 'moveObjectToCollection', objectId: id, collectionId, keepExistingLinks }); }} onMoveCollection={(collectionId, parentCollectionId) => void applyEditCommand(coreSceneCommands.moveCollection(collectionId, parentCollectionId))} onSelect={selectObject} onRefresh={refreshOutliner} onSelectAll={selectAllOutliner} onToggleVisibility={(id, visible) => void applyEditCommand({ type: "setObjectVisibility", objectId: id, visible })} /></Area></ScriptingContainer> : null}
|
||||
</Area><Area className="console-area" editor="Python Console">{pythonSession?<WasmPythonConsole session={pythonSession} enabled={Boolean(snapshot)&&!headerPending}/>:<NativeSessionPanel key={projectIdRef.current} client={webClientRef.current} context={nativeContext()} onApplied={applyNativeScene}/>}</Area><Area className="info-area" editor="Info"><WorkspaceEditorSurface editor="Info" snapshot={snapshot} engineStatus={engineStatus} onOpen={() => fileInputRef.current?.click()} onSearch={() => dispatchUI({ type: "toggleOperatorSearch", open: true })} /></Area><Area className="secondary-outliner-area" editor="Outliner"><Outliner key={`${projectIdRef.current}:${userActionSequenceRef.current}`} snapshot={snapshot} onToggleExpand={toggleOutlinerExpand} onTreeSelect={selectOutlinerRow} onSetDisplayMode={setOutlinerDisplayMode} onSetFilter={setOutlinerFilter} onSetSyncSelect={setOutlinerSyncSelect} onSetRestriction={setOutlinerRestriction} onSetRestrictColumns={setOutlinerRestrictColumns}onRemap={(command, feedback) => applyEditCommand(command, undefined, feedback)} onReparent={(ids, parentId, keepTransform) => void applyEditCommand({ type: 'setParents', objectIds: ids, parentId, keepTransform })} onMoveToCollection={(ids, collectionId, keepExistingLinks) => { for (const id of ids) void applyEditCommand({ type: 'moveObjectToCollection', objectId: id, collectionId, keepExistingLinks }); }} onMoveCollection={(collectionId, parentCollectionId) => void applyEditCommand(coreSceneCommands.moveCollection(collectionId, parentCollectionId))} onSelect={selectObject} onRefresh={refreshOutliner} onSelectAll={selectAllOutliner} onToggleVisibility={(id, visible) => void applyEditCommand({ type: "setObjectVisibility", objectId: id, visible })} onDeleteObject={(id) => void applyEditCommand({ type: "deleteObject", objectId: id })} /></Area></ScriptingContainer> : null}
|
||||
<Area className="viewport-area" editor="3D Viewport"><ViewportPlaceholder snapshot={preview?.snapshot ?? snapshot} geometryBuffers={preview?.geometryBuffers ?? geometryBuffers} nonMeshGeometryBuffers={preview?.nonMeshGeometryBuffers ?? nonMeshGeometryBuffers} textureAssets={gpuTextureAssets} volumeProject={volumeProject} lodLevels={preview ? null : lodLevels} selectedObjectIds={selectedObjectIds} editMode={uiState.context.mode === "Edit"} meshSelection={meshSelection} greasePencilSelectionRevision={greasePencilSelection?.revision ?? 0} cameraPose={objectCameraId ? objectCameraPose(snapshot, objectCameraId) : undefined} cameraLocked={Boolean(cameraLocks["viewport-area"])} showViewName={webPreferences.interface.showViewName} viewportPreferences={{ gizmoSize: webPreferences.viewport.gizmoSize, gizmoSizeNavigate: webPreferences.viewport.gizmoSizeNavigate, miniAxis: webPreferences.viewport.miniAxis, defaultShading: webPreferences.viewport.defaultShading, orbitSensitivity: webPreferences.navigation.orbitSensitivity, zoomSensitivity: webPreferences.navigation.zoomSensitivity, invertZoom: webPreferences.navigation.invertZoom }} onCameraWrite={handleCameraWrite} onCameraLockChange={(locked)=>setCameraLocks(current=>({...current,"viewport-area":locked}))} onSelect={selectObject} onBoxSelect={selectObjectsInBox} onElementBoxSelect={selectMeshElementsInBox} onElementSelect={selectMeshElement} onGreasePencilPointSelect={selectGreasePencilPoint} onGreasePencilMarqueeSelect={selectGreasePencilMarquee} onTransform={transformActive} transformSettings={viewportTransformSettings} elementGizmo={elementGizmoFrame} onGizmoDrag={onGizmoDrag}onSetObjectTransform={(objectId, translation, rotationEuler, scale) => void applyEditCommand({ type: "setObjectTransform", objectId, translation, rotationEuler, scale })} onDiagnostic={recordDiagnostic} mode={uiState.context.mode} onMeshEdit={runMeshEdit} onMeshSelectionMode={setMeshSelectionMode} onSelectAllMeshElements={selectAllMeshElements} onAddPrimitive={(primitive) => void applyEditCommand(coreSceneCommands.createPrimitive(primitive))} onFocusSculptProperties={() => focusProperty('[data-testid="sculpt-editor"]')} onVoxelRemesh={(voxelSize) => void invokeNativeOperator('object.voxel_remesh', { voxel_size: voxelSize })} /></Area>
|
||||
<Area className="outliner-area" editor="Outliner"><Outliner key={`${projectIdRef.current}:${userActionSequenceRef.current}`} snapshot={snapshot} onToggleExpand={toggleOutlinerExpand} onTreeSelect={selectOutlinerRow} onSetDisplayMode={setOutlinerDisplayMode} onSetFilter={setOutlinerFilter} onSetSyncSelect={setOutlinerSyncSelect} onSetRestriction={setOutlinerRestriction} onSetRestrictColumns={setOutlinerRestrictColumns}onRemap={(command, feedback) => applyEditCommand(command, undefined, feedback)} onReparent={(ids, parentId, keepTransform) => void applyEditCommand({ type: 'setParents', objectIds: ids, parentId, keepTransform })} onMoveToCollection={(ids, collectionId, keepExistingLinks) => { for (const id of ids) void applyEditCommand({ type: 'moveObjectToCollection', objectId: id, collectionId, keepExistingLinks }); }} onMoveCollection={(collectionId, parentCollectionId) => void applyEditCommand(coreSceneCommands.moveCollection(collectionId, parentCollectionId))} onSelect={selectObject} onRefresh={refreshOutliner} onSelectAll={selectAllOutliner} onToggleVisibility={(id, visible) => void applyEditCommand({ type: "setObjectVisibility", objectId: id, visible })} /></Area>
|
||||
<Area className="outliner-area" editor="Outliner"><Outliner key={`${projectIdRef.current}:${userActionSequenceRef.current}`} snapshot={snapshot} onToggleExpand={toggleOutlinerExpand} onTreeSelect={selectOutlinerRow} onSetDisplayMode={setOutlinerDisplayMode} onSetFilter={setOutlinerFilter} onSetSyncSelect={setOutlinerSyncSelect} onSetRestriction={setOutlinerRestriction} onSetRestrictColumns={setOutlinerRestrictColumns}onRemap={(command, feedback) => applyEditCommand(command, undefined, feedback)} onReparent={(ids, parentId, keepTransform) => void applyEditCommand({ type: 'setParents', objectIds: ids, parentId, keepTransform })} onMoveToCollection={(ids, collectionId, keepExistingLinks) => { for (const id of ids) void applyEditCommand({ type: 'moveObjectToCollection', objectId: id, collectionId, keepExistingLinks }); }} onMoveCollection={(collectionId, parentCollectionId) => void applyEditCommand(coreSceneCommands.moveCollection(collectionId, parentCollectionId))} onSelect={selectObject} onRefresh={refreshOutliner} onSelectAll={selectAllOutliner} onToggleVisibility={(id, visible) => void applyEditCommand({ type: "setObjectVisibility", objectId: id, visible })} onDeleteObject={(id) => void applyEditCommand({ type: "deleteObject", objectId: id })} /></Area>
|
||||
<Area className="properties-area" editor="Properties"><Properties key={mainReplacementEpoch} onSoftBodyCacheOperation={localOnly ? queueSoftBodyCache : undefined} onFluidCacheOperation={localOnly ? (objectId, operation) => queueLocalDesktopOperator("fluid." + operation, {}, true, objectId, "OBJECT") : undefined} pointCacheBusy={headerBusy || Boolean(localInvokePending) || localInvokeActive || nativeModalActive || projectActionLocked} onPointCacheOperation={localOnly ? operation => queueLocalDesktopOperator(operation === "BAKE_ALL" ? "ptcache.bake_all" : "ptcache.free_bake_all", operation === "BAKE_ALL" ? { bake: true } : {}, true) : undefined} selectedEdgeIndices={meshSelection.mode === "EDGE" ? [...meshSelection.indices] : []} nonMeshGeometryBuffers={nonMeshGeometryBuffers} client={webClientRef.current} snapshot={snapshot} uiMode={uiState.context.mode} onSetMode={(mode) => dispatchUI({type:'setMode', mode})} editorWorkflow={editorWorkflow} onExecutePython={executePythonAndApply} objectCameraId={objectCameraId} onObjectCameraChange={setObjectCameraId} onSimulatePhysics={simulatePhysicsRange} physicsSimulationRange={snapshot?.scenes[0]?.renderSettings ? { start: snapshot.scenes[0].renderSettings.frameStart, end: snapshot.scenes[0].renderSettings.frameEnd } : undefined} onImportSequencerMedia={importSequencerMedia} onRestoreSequencerMedia={restoreSequencerMedia} selectedFaceIndices={meshSelection.mode === "FACE" ? [...meshSelection.indices] : []} selectedVertexIndices={meshSelection.mode === "VERT" ? [...meshSelection.indices] : []} greasePencilSelection={greasePencilSelection} onGreasePencilCanvasPointSelect={(point, mode, baseSelectionRevision) => { commitGreasePencilSelection("CANVAS_2D", mode === "ADD" ? "TOGGLE" : mode, [point], baseSelectionRevision, point); }} onCommand={(command) => applyEditCommand(command)} onImportImage={(file) => void importImage(file)} onImportVFont={(file) => void importVFont(file)} onRequestAsset={(assetId) => { const client = webClientRef.current; if (!client) return; void client.requestAsset(assetId).then((asset) => setEngineStatus(`Asset: ${asset.assetId} (${asset.status})`)).catch((error: unknown) => setEngineStatus(recordDiagnostic("ENGINE", "PBR_ASSET_INVALID", error, { assetId }))); }} onAppendLibraryObject={async (source, request) => {
|
||||
const client = webClientRef.current; if (!client) return; const appendProjectId = projectIdRef.current; const isCurrent = () => client === webClientRef.current && appendProjectId === projectIdRef.current;
|
||||
try { const result = await client.appendLibraryObject(source, request); if (!isCurrent()) return; const logicalRevision = Math.max(projectRevisionRef.current + 1, result.snapshot.revision); projectRevisionRef.current = logicalRevision; const ownsRevision = () => isCurrent() && projectRevisionRef.current === logicalRevision; setSnapshot(result.snapshot); setSelectedObjectIds(selectionFromSnapshot(result.snapshot)); setGeometryBuffers(result.geometryBuffers); setNonMeshGeometryBuffers(result.nonMeshGeometryBuffers ?? []); setFrame(result.snapshot.frame.current); setPreview(null); setLodLevels(null); setDirtyState(current => { const accepted = acceptMainTransaction(current, logicalRevision); return accepted.ok ? accepted.state : current; });
|
||||
|
||||
Reference in New Issue
Block a user