|
|
|
|
@@ -3374,11 +3374,13 @@ function NumberDraftInput({ value, step, label, disabled, onCommit }: { value: n
|
|
|
|
|
onKeyDown={(event) => { if (event.key === "Enter") { event.preventDefault(); setDraft(null); } }} />;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function Properties({ selectedEdgeIndices, nonMeshGeometryBuffers, client, snapshot, editorWorkflow, selectedFaceIndices, selectedVertexIndices, greasePencilSelection, onGreasePencilCanvasPointSelect, onCommand, onExecutePython, objectCameraId, onObjectCameraChange, onPointCacheOperation, onSoftBodyCacheOperation, onFluidCacheOperation, onSimulatePhysics, physicsSimulationRange, onImportSequencerMedia, onRestoreSequencerMedia, pointCacheBusy, onImportImage, onImportVFont, onRequestAsset, onAppendLibraryObject, onAssetLibraryCommand, onQueryRenderCapability, onApplyDecimate, onPreviewDecimate, onApplyDecimateSelected, onGenerateLOD, onSetModifierEnabled, onApplyModifier, onModifierOperator, onCollectionInstance, previewActive, onCancelPreview, simplifyReport, cacheLevels, activeMaterialSlot, onActiveMaterialSlotChange }: {
|
|
|
|
|
function Properties({ selectedEdgeIndices, nonMeshGeometryBuffers, client, snapshot, uiMode, onSetMode, editorWorkflow, selectedFaceIndices, selectedVertexIndices, greasePencilSelection, onGreasePencilCanvasPointSelect, onCommand, onExecutePython, objectCameraId, onObjectCameraChange, onPointCacheOperation, onSoftBodyCacheOperation, onFluidCacheOperation, onSimulatePhysics, physicsSimulationRange, onImportSequencerMedia, onRestoreSequencerMedia, pointCacheBusy, onImportImage, onImportVFont, onRequestAsset, onAppendLibraryObject, onAssetLibraryCommand, onQueryRenderCapability, onApplyDecimate, onPreviewDecimate, onApplyDecimateSelected, onGenerateLOD, onSetModifierEnabled, onApplyModifier, onModifierOperator, onCollectionInstance, previewActive, onCancelPreview, simplifyReport, cacheLevels, activeMaterialSlot, onActiveMaterialSlotChange }: {
|
|
|
|
|
selectedEdgeIndices: number[];
|
|
|
|
|
nonMeshGeometryBuffers: NonMeshGeometryChunk[];
|
|
|
|
|
client: WebEngineClient | null;
|
|
|
|
|
snapshot: SceneSnapshotIR | null;
|
|
|
|
|
uiMode: string;
|
|
|
|
|
onSetMode: (mode: 'Object' | 'Edit' | 'Pose') => void;
|
|
|
|
|
editorWorkflow: EditorWorkflowIR | null;
|
|
|
|
|
selectedFaceIndices: number[];
|
|
|
|
|
selectedVertexIndices: number[];
|
|
|
|
|
@@ -4417,6 +4419,10 @@ function Properties({ selectedEdgeIndices, nonMeshGeometryBuffers, client, snaps
|
|
|
|
|
if (!armature) return null;
|
|
|
|
|
const activeArmatureBone = armature.bones.find((bone) => bone.name === activeArmatureBoneName) ?? armature.bones[0];
|
|
|
|
|
const constraintTarget = snapshot?.nodes.some((node) => node.id === poseConstraintTargetId && node.id !== activeNode.id) ? poseConstraintTargetId : "";
|
|
|
|
|
/* Desktop splits armature editing by mode: rest bones in Edit mode, pose
|
|
|
|
|
* channels in Pose mode, and a read-only summary in Object mode. */
|
|
|
|
|
const isEditMode = uiMode === "Edit";
|
|
|
|
|
const isPoseMode = uiMode === "Pose";
|
|
|
|
|
const commandBones = armature.bones.map((bone) => ({
|
|
|
|
|
name: bone.name,
|
|
|
|
|
parentName: armature.bones.find((candidate) => candidate.id === bone.parentId)?.name ?? null,
|
|
|
|
|
@@ -4425,12 +4431,13 @@ function Properties({ selectedEdgeIndices, nonMeshGeometryBuffers, client, snaps
|
|
|
|
|
roll: bone.roll ?? 0,
|
|
|
|
|
connected: bone.connected ?? false,
|
|
|
|
|
}));
|
|
|
|
|
return <div className="property-section" data-testid="armature-authoring-workbench">
|
|
|
|
|
return <div className="property-section" data-testid="armature-authoring-workbench" data-armature-mode={uiMode}>
|
|
|
|
|
<h3>Armature</h3>
|
|
|
|
|
<label>Bone <select aria-label="Active armature bone" value={activeArmatureBone?.name ?? ""} disabled={!activeArmatureBone} onChange={(event) => setActiveArmatureBoneName(event.target.value)}>{armature.bones.map((bone) => <option key={bone.id} value={bone.name}>{bone.name}</option>)}</select></label>
|
|
|
|
|
<label>Constraint target <select aria-label="Pose constraint target" value={constraintTarget} onChange={(event) => setPoseConstraintTargetId(event.target.value)}><option value="">None</option>{snapshot?.nodes.filter((node) => node.id !== activeNode.id).map((node) => <option key={node.id} value={node.id}>{node.name}</option>)}</select></label>
|
|
|
|
|
{isEditMode ? <label>Constraint target <select aria-label="Pose constraint target" value={constraintTarget} onChange={(event) => setPoseConstraintTargetId(event.target.value)}><option value="">None</option>{snapshot?.nodes.filter((node) => node.id !== activeNode.id).map((node) => <option key={node.id} value={node.id}>{node.name}</option>)}</select></label> : null}
|
|
|
|
|
<output>{armature.bones.length} bones</output>
|
|
|
|
|
<div className="property-actions" data-testid="armature-edit-operations">
|
|
|
|
|
{!isEditMode && !isPoseMode ? <div className="property-actions" data-testid="armature-mode-actions"><output>物体模式:骨骼与姿态只读。</output><button type="button" onClick={() => onSetMode("Edit")}>进入编辑模式</button><button type="button" onClick={() => onSetMode("Pose")}>进入姿态模式</button></div> : null}
|
|
|
|
|
{isEditMode ? <div className="property-actions" data-testid="armature-edit-operations">
|
|
|
|
|
<button type="button" onClick={() => onCommand({ type: "setBoneSymmetry", objectId: activeNode.id, enabled: true })}>Enable X Mirror</button>
|
|
|
|
|
<button type="button" onClick={() => onCommand({ type: "setBoneSymmetry", objectId: activeNode.id, enabled: false })}>Disable X Mirror</button>
|
|
|
|
|
{activeArmatureBone ? <>
|
|
|
|
|
@@ -4440,8 +4447,8 @@ function Properties({ selectedEdgeIndices, nonMeshGeometryBuffers, client, snaps
|
|
|
|
|
<button type="button" onClick={() => onCommand({ type: "setPoseConstraint", objectId: activeNode.id, boneName: activeArmatureBone.name, constraintName: "Web Copy Rotation", constraintType: "COPY_ROTATION", targetObjectId: constraintTarget || null, influence: 1, enabled: true })}>Add Pose Constraint</button>
|
|
|
|
|
<button type="button" onClick={() => onCommand({ type: "setPoseConstraint", objectId: activeNode.id, boneName: activeArmatureBone.name, constraintName: "Web Copy Rotation", constraintType: null })}>Remove Pose Constraint</button>
|
|
|
|
|
</> : null}
|
|
|
|
|
</div>
|
|
|
|
|
<form className="property-grid" onSubmit={(event) => {
|
|
|
|
|
</div> : null}
|
|
|
|
|
{isEditMode ? <form className="property-grid" onSubmit={(event) => {
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
const data = new FormData(event.currentTarget);
|
|
|
|
|
const name = String(data.get("newBoneName") ?? "").trim();
|
|
|
|
|
@@ -4463,12 +4470,12 @@ function Properties({ selectedEdgeIndices, nonMeshGeometryBuffers, client, snaps
|
|
|
|
|
<label>Roll <input name="newRoll" type="number" step="0.01" defaultValue={0} /></label>
|
|
|
|
|
<label>Connected <input name="newConnected" type="checkbox" /></label>
|
|
|
|
|
<div className="property-actions"><button type="submit">Add Bone</button></div>
|
|
|
|
|
</form>
|
|
|
|
|
</form> : null}
|
|
|
|
|
{armature.bones.map((bone) => {
|
|
|
|
|
const currentParent = armature.bones.find((candidate) => candidate.id === bone.parentId)?.name ?? "";
|
|
|
|
|
return <div className="property-subsection" key={bone.id} data-resource-id={bone.id}>
|
|
|
|
|
<h4>{bone.name}</h4>
|
|
|
|
|
<form className="property-grid" onSubmit={(event) => {
|
|
|
|
|
{isEditMode ? <form className="property-grid" onSubmit={(event) => {
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
const data = new FormData(event.currentTarget);
|
|
|
|
|
const number = (field: string) => Number(data.get(field));
|
|
|
|
|
@@ -4489,8 +4496,8 @@ function Properties({ selectedEdgeIndices, nonMeshGeometryBuffers, client, snaps
|
|
|
|
|
<label>Roll <input name="roll" type="number" step="any" defaultValue={bone.roll ?? 0} /></label>
|
|
|
|
|
<label>Connected <input name="connected" type="checkbox" defaultChecked={bone.connected ?? false} /></label>
|
|
|
|
|
<div className="property-actions"><button type="submit">Apply Rest Pose</button><button type="button" onClick={() => onCommand({ type: "armatureEditOperations", objectId: activeNode.id, operations: [{ operation: "DELETE", boneName: bone.name }] })}>Remove Bone</button></div>
|
|
|
|
|
</form>
|
|
|
|
|
{(() => {
|
|
|
|
|
</form> : null}
|
|
|
|
|
{isPoseMode ? (() => {
|
|
|
|
|
/* Pose channels read back from the snapshot and rotate in degrees
|
|
|
|
|
* like the desktop pose panel; the engine stores radians. The key
|
|
|
|
|
* remounts the uncontrolled fields when the pose changes. */
|
|
|
|
|
@@ -4512,7 +4519,7 @@ function Properties({ selectedEdgeIndices, nonMeshGeometryBuffers, client, snaps
|
|
|
|
|
{(["X", "Y", "Z"] as const).map((axis, index) => <label key={`scale-${axis}`}>Scale {axis} <input name={`scale${axis}`} type="number" step="any" defaultValue={Number((poseScale[index] ?? 1).toFixed(4))} /></label>)}
|
|
|
|
|
<div className="property-actions"><button type="submit">Apply Pose</button></div>
|
|
|
|
|
</form>;
|
|
|
|
|
})()}
|
|
|
|
|
})() : null}
|
|
|
|
|
</div>;
|
|
|
|
|
})}
|
|
|
|
|
</div>;
|
|
|
|
|
@@ -9873,7 +9880,8 @@ else:
|
|
|
|
|
if(event.isComposing||target?.closest('input,textarea,select,[contenteditable=true],[role=dialog],[role=menu]')||headerBusy||headerDialog||robotToolOpen||interactiveDesktop)return;
|
|
|
|
|
if(event.key==='F1'&&event.shiftKey&&!event.ctrlKey&&!event.metaKey&&!event.altKey&&hasProject){event.preventDefault();event.stopImmediatePropagation();focusProperty('[data-testid="library-append-workbench"]');}
|
|
|
|
|
else if(event.key==='F12'){event.preventDefault();event.stopImmediatePropagation();renderFromMenu(event.ctrlKey);}
|
|
|
|
|
else if(event.key==='Tab'&&target?.matches('canvas.viewport-canvas')&&canEdit){event.preventDefault();event.stopImmediatePropagation();dispatchUI({type:'setMode',mode:uiState.context.mode==='Edit'?'Object':'Edit'});}
|
|
|
|
|
else if(event.key==='Tab'&&event.ctrlKey&&target?.matches('canvas.viewport-canvas')&&activeHeaderNode?.type==='ARMATURE'){event.preventDefault();event.stopImmediatePropagation();dispatchUI({type:'setMode',mode:uiState.context.mode==='Pose'?'Object':'Pose'});}
|
|
|
|
|
else if(event.key==='Tab'&&!event.ctrlKey&&!event.metaKey&&target?.matches('canvas.viewport-canvas')&&canEdit){event.preventDefault();event.stopImmediatePropagation();dispatchUI({type:'setMode',mode:uiState.context.mode==='Edit'?'Object':'Edit'});}
|
|
|
|
|
else if(target?.matches('canvas.viewport-canvas')&&event.key.toLowerCase()==='a'&&!event.ctrlKey&&!event.metaKey){event.preventDefault();event.stopImmediatePropagation();selectHeader(event.altKey?'none':'all');}
|
|
|
|
|
else if(target?.matches('canvas.viewport-canvas')&&(event.ctrlKey||event.metaKey)&&event.key.toLowerCase()==='i'){event.preventDefault();event.stopImmediatePropagation();selectHeader('invert');}
|
|
|
|
|
};
|
|
|
|
|
@@ -10193,7 +10201,7 @@ else:
|
|
|
|
|
case "Outliner":
|
|
|
|
|
return <Outliner key={`${projectIdRef.current}:${userActionSequenceRef.current}`} snapshot={snapshot} onToggleExpand={toggleOutlinerExpand} onTreeSelect={selectOutlinerRow} 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 })} />;
|
|
|
|
|
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} 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) => {
|
|
|
|
|
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;
|
|
|
|
|
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; });
|
|
|
|
|
void invalidateCachedLODs(appendProjectId, result.snapshot.revision); try { await persistRecoveryCheckpoint(client, appendProjectId, logicalRevision); } catch (error) { if (ownsRevision()) setStorageStatus(recordDiagnostic("STORAGE", "OPERATION_LOG_FAILED", error, { command: "appendLibraryObject", recovery: "checkpoint" })); } if (!ownsRevision()) return;
|
|
|
|
|
@@ -10361,7 +10369,7 @@ else:
|
|
|
|
|
</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} 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 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} 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="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} 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) => {
|
|
|
|
|
<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; });
|
|
|
|
|
void invalidateCachedLODs(appendProjectId, result.snapshot.revision); try { await persistRecoveryCheckpoint(client, appendProjectId, logicalRevision); } catch (error) { if (ownsRevision()) setStorageStatus(recordDiagnostic("STORAGE", "OPERATION_LOG_FAILED", error, { command: "appendLibraryObject", recovery: "checkpoint" })); } if (!ownsRevision()) return;
|
|
|
|
|
|