diff --git a/docs/status/WBV2-P1425-001-web-operator-dispatch.md b/docs/status/WBV2-P1425-001-web-operator-dispatch.md index a8fbc8ff5..7d3ba1f03 100644 --- a/docs/status/WBV2-P1425-001-web-operator-dispatch.md +++ b/docs/status/WBV2-P1425-001-web-operator-dispatch.md @@ -387,15 +387,14 @@ - 视图层:场景 → 添加视图层 → `ViewLayer_001`;删除视图层 → 回到 `ViewLayer`,均返回“原生操作已返回”,通过。 -- 重复上一步:`screen.repeat_last` 仍返回 - `poll() failed, context is incorrect`。已尝试: - - 菜单调用传 `areaType=VIEW_3D`; - - `web_engine_python_bootstrap.py` 的 `temp_override` 增加 - `screen=window.screen`(WASM `58325d97...`)。 - 仍失败;源码 `repeat_history_poll` 还要求 WM runtime operator 栈非空, - 判断为嵌入宿主不保留该栈。下一步:在 Web 入口禁用并给出原因,或改用 - bpy 侧可重放的操作记录实现。 -- 新 WASM 已同步并重建 `web/dist`;证据 +- 重复上一步:`screen.repeat_last` 因嵌入宿主不保留 WM runtime + operator 栈而 poll 失败;已补 `temp_override(screen=window.screen)` 与 + `VIEW_3D` 上下文(WASM `58325d97...`),仍不足以恢复该栈。 +- 回退实现:`queueLocalDesktopOperator` 记录最后一次菜单 operator 到 + `lastMenuOperatorRef`,Web 入口的“重复上一步”重放该 operator 及其 + properties/areaType。复测:添加 Circle(7)→ 重复上一步 → Circle.001 + (8),状态“原生操作已返回:mesh.primitive_circle_add”。 +- 视图层添加/删除同时通过;证据 `tools/web/complete/probe-repeat-viewlayer.mjs`。 ## 下一动作 diff --git a/tests/golden/WBV2-P1425-001/continuation-20261113-web-export.json b/tests/golden/WBV2-P1425-001/continuation-20261113-web-export.json index 54490143f..695bf7a20 100644 --- a/tests/golden/WBV2-P1425-001/continuation-20261113-web-export.json +++ b/tests/golden/WBV2-P1425-001/continuation-20261113-web-export.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "task": "WBV2-P1425-001", - "updatedAt": "2026-11-14T06:25:00+08:00", + "updatedAt": "2026-11-14T06:29:00+08:00", "status": "in_progress", "focus": "COMPLETE-TUTORIAL-001 backend export gap (USD/Alembic)", "breakpoint": "blender-5.2.0/source/blender/web_engine/CMakeLists.txt (USD wiring); WASM 6ee2b261", @@ -29,7 +29,7 @@ "Confirm whether the one-time TfNotice duplicate Python type Coding Error has side effects on second imports.", "Alembic was verified only through the focused worker probe, not the export panel." ], - "nextAction": "Decide repeat_last: disable with reason in web entry or replay via bpy history; continue three-domain cases.", + "nextAction": "Continue three-domain cases; commit/push the repeat fallback with the next batch.", "wasmSha256": "6ee2b2612a0ae667cd83df7177cf695ca8681ae83818c95799bb416435945c4e", "acceptance": "NOT_CLAIMED", "probe": { @@ -139,7 +139,7 @@ }, "repeatViewLayer": { "viewLayers": "add → ViewLayer_001, remove → ViewLayer; PASS", - "repeatLast": "screen.repeat_last poll() failed, context is incorrect; areaType=VIEW_3D and temp_override screen=window.screen did not fix; likely no WM runtime operator stack in the embedded host", + "repeatLast": "screen.repeat_last still poll-fails (no WM runtime operator stack); web fallback replays lastMenuOperatorRef: add Circle 7→8 (Circle.001), status 原生操作已返回:mesh.primitive_circle_add", "wasmSha256": "58325d9793cb7e374aae929d8de02affe2d0be8a2e4687929695740393cfe2fd", "script": "tools/web/complete/probe-repeat-viewlayer.mjs", "acceptance": "NOT_CLAIMED" diff --git a/web/app/src/app/App.tsx b/web/app/src/app/App.tsx index b7474a2ca..6cbf3eeb9 100644 --- a/web/app/src/app/App.tsx +++ b/web/app/src/app/App.tsx @@ -4460,6 +4460,7 @@ export function App({localOnly=false,course}:{localOnly?:boolean;course?:Availab const [nativeOutput, setNativeOutput] = useState(''); const [nativeFiles, setNativeFiles] = useState([]); const [failedNativeFiles, setFailedNativeFiles] = useState([]); + const lastMenuOperatorRef = useRef<{ operator: string; properties: Record; areaType?: NativeWorkflowContext['areaType'] } | null>(null); const [interactiveDesktop,setInteractiveDesktop]=useState<{context:NativeWorkflowContext;command?:Extract}|null>(null); const [localInvokePending,setLocalInvokePending]=useState<{expectedActiveObjectId?:string;context:NativeWorkflowContext;command:Extract}|null>(null); const [localInvokeActive,setLocalInvokeActive]=useState(false); @@ -8306,6 +8307,7 @@ else: void client.invokeEmbeddedOperator({operator,properties,baseRevision,context,native:true}).then(result=>{ if(client!==webClientRef.current||project!==projectIdRef.current)return; applyNativeScene(result); + lastMenuOperatorRef.current={operator,properties,areaType:context.areaType}; const python=result.operatorResult as {state?:string;error?:string;output?:string}|undefined; setEngineStatus(python?.state==='DONE'?`原生操作已返回:${operator}`:`原生操作失败:${python?.error||python?.output||operator}`); }).catch(reason=>{ @@ -8463,7 +8465,7 @@ else: separator,menuAction('关闭',closeProject,!hasProject),menuAction('退出并保存会话',()=>requestNativeAutosaveOperator('wm.quit_blender'),!hasProject) ], '编辑':[menuAction('撤销',()=>{void applyEditCommand({type:'undo'});},!hasProject,'Ctrl Z'),menuAction('重做',()=>{void applyEditCommand({type:'redo'});},!hasProject,'Shift Ctrl Z'),menuAction('撤销历史',()=>{void openHistory();},!hasProject),separator, - menuAction('菜单搜索',()=>dispatchUI({type:'toggleOperatorSearch',open:true}),false,'F3'),menuAction('重命名活动项',showRename,!canRenameObject,'F2'),menuAction('调整上一步操作',()=>openAdjustLastOperation(),!hasProject||(!lastNativeOperator&&(localOnly&&!nativeCanvasReady))),menuAction('重复上一步',()=>queueLocalDesktopOperator('screen.repeat_last',{},false,undefined,undefined,'VIEW_3D'),!hasProject||localOnly&&!nativeCanvasReady),menuAction('重复历史',()=>queueLocalDesktopOperator('screen.repeat_history',{},false,undefined,undefined,'VIEW_3D'),!hasProject||localOnly&&!nativeCanvasReady),separator,menuAction('偏好设置',()=>setPreferencesOpen(true))], + menuAction('菜单搜索',()=>dispatchUI({type:'toggleOperatorSearch',open:true}),false,'F3'),menuAction('重命名活动项',showRename,!canRenameObject,'F2'),menuAction('调整上一步操作',()=>openAdjustLastOperation(),!hasProject||(!lastNativeOperator&&(localOnly&&!nativeCanvasReady))),menuAction('重复上一步',()=>{const last=!localOnly?lastMenuOperatorRef.current:null;if(last){queueLocalDesktopOperator(last.operator,last.properties,false,undefined,undefined,last.areaType);return;}queueLocalDesktopOperator('screen.repeat_last',{},false,undefined,undefined,'VIEW_3D');},!hasProject||localOnly&&!nativeCanvasReady),menuAction('重复历史',()=>queueLocalDesktopOperator('screen.repeat_history',{},false,undefined,undefined,'VIEW_3D'),!hasProject||localOnly&&!nativeCanvasReady),separator,menuAction('偏好设置',()=>setPreferencesOpen(true))], '渲染':[menuAction('渲染图像',()=>renderFromMenu(false),!hasProject,'F12'),menuAction('渲染动画',()=>renderFromMenu(true),!hasProject,'Ctrl F12'),unavailable('渲染音频'),separator, menuAction('查看渲染结果',()=>dispatchUI({type:'switchWorkspace',workspaceId:'Rendering'}),!hasProject),menuAction('查看动画',()=>dispatchUI({type:'switchWorkspace',workspaceId:'Rendering'}),!nativeFiles.some(f=>f.artifact.mime.startsWith('video/')))], '场景':[menuAction('新建场景',()=>queueLocalDesktopOperator('scene.new',{type:'NEW'}),!hasProject||localOnly&&!nativeCanvasReady),menuAction('复制场景设置',()=>queueLocalDesktopOperator('scene.new',{type:'COPY_SETTINGS'}),!hasProject||localOnly&&!nativeCanvasReady),separator,menuAction('删除场景',()=>queueLocalDesktopOperator('scene.delete'),!hasProject||localOnly&&!nativeCanvasReady),separator,