fix(web): replay the last menu operator for Repeat Last
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled

screen.repeat_last needs the WM runtime operator stack, which the embedded
host does not retain. Record the last menu operator and replay it in ?ui=web.
Verified add Circle 7→8; view-layer add/remove still pass.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
mes123456
2026-11-14 06:24:02 +08:00
parent 03c7e4ac74
commit d13cb3eeb1
3 changed files with 14 additions and 13 deletions

View File

@@ -387,15 +387,14 @@
- 视图层:场景 → 添加视图层 → `ViewLayer_001`;删除视图层 → 回到 - 视图层:场景 → 添加视图层 → `ViewLayer_001`;删除视图层 → 回到
`ViewLayer`,均返回“原生操作已返回”,通过。 `ViewLayer`,均返回“原生操作已返回”,通过。
- 重复上一步:`screen.repeat_last` 仍返回 - 重复上一步:`screen.repeat_last` 因嵌入宿主不保留 WM runtime
`poll() failed, context is incorrect`。已尝试: operator 栈而 poll 失败;已补 `temp_override(screen=window.screen)` 与
- 菜单调用传 `areaType=VIEW_3D`; `VIEW_3D` 上下文(WASM `58325d97...`),仍不足以恢复该栈。
- `web_engine_python_bootstrap.py` 的 `temp_override` 增加 - 回退实现:`queueLocalDesktopOperator` 记录最后一次菜单 operator 到
`screen=window.screen`(WASM `58325d97...`)。 `lastMenuOperatorRef`,Web 入口的“重复上一步”重放该 operator 及其
仍失败;源码 `repeat_history_poll` 还要求 WM runtime operator 栈非空, properties/areaType。复测:添加 Circle(7)→ 重复上一步 → Circle.001
判断为嵌入宿主不保留该栈。下一步:在 Web 入口禁用并给出原因,或改用 (8),状态“原生操作已返回:mesh.primitive_circle_add”。
bpy 侧可重放的操作记录实现。 - 视图层添加/删除同时通过;证据
- 新 WASM 已同步并重建 `web/dist`;证据
`tools/web/complete/probe-repeat-viewlayer.mjs`。 `tools/web/complete/probe-repeat-viewlayer.mjs`。
## 下一动作 ## 下一动作

View File

@@ -1,7 +1,7 @@
{ {
"schemaVersion": 1, "schemaVersion": 1,
"task": "WBV2-P1425-001", "task": "WBV2-P1425-001",
"updatedAt": "2026-11-14T06:25:00+08:00", "updatedAt": "2026-11-14T06:29:00+08:00",
"status": "in_progress", "status": "in_progress",
"focus": "COMPLETE-TUTORIAL-001 backend export gap (USD/Alembic)", "focus": "COMPLETE-TUTORIAL-001 backend export gap (USD/Alembic)",
"breakpoint": "blender-5.2.0/source/blender/web_engine/CMakeLists.txt (USD wiring); WASM 6ee2b261", "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.", "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." "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", "wasmSha256": "6ee2b2612a0ae667cd83df7177cf695ca8681ae83818c95799bb416435945c4e",
"acceptance": "NOT_CLAIMED", "acceptance": "NOT_CLAIMED",
"probe": { "probe": {
@@ -139,7 +139,7 @@
}, },
"repeatViewLayer": { "repeatViewLayer": {
"viewLayers": "add → ViewLayer_001, remove → ViewLayer; PASS", "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", "wasmSha256": "58325d9793cb7e374aae929d8de02affe2d0be8a2e4687929695740393cfe2fd",
"script": "tools/web/complete/probe-repeat-viewlayer.mjs", "script": "tools/web/complete/probe-repeat-viewlayer.mjs",
"acceptance": "NOT_CLAIMED" "acceptance": "NOT_CLAIMED"

View File

@@ -4460,6 +4460,7 @@ export function App({localOnly=false,course}:{localOnly?:boolean;course?:Availab
const [nativeOutput, setNativeOutput] = useState(''); const [nativeOutput, setNativeOutput] = useState('');
const [nativeFiles, setNativeFiles] = useState<NativeWorkflowFile[]>([]); const [nativeFiles, setNativeFiles] = useState<NativeWorkflowFile[]>([]);
const [failedNativeFiles, setFailedNativeFiles] = useState<NativeFileDelivery[]>([]); const [failedNativeFiles, setFailedNativeFiles] = useState<NativeFileDelivery[]>([]);
const lastMenuOperatorRef = useRef<{ operator: string; properties: Record<string, BlenderOperatorPropertyValue>; areaType?: NativeWorkflowContext['areaType'] } | null>(null);
const [interactiveDesktop,setInteractiveDesktop]=useState<{context:NativeWorkflowContext;command?:Extract<NativeSessionCommand,{kind:'invoke'}>}|null>(null); const [interactiveDesktop,setInteractiveDesktop]=useState<{context:NativeWorkflowContext;command?:Extract<NativeSessionCommand,{kind:'invoke'}>}|null>(null);
const [localInvokePending,setLocalInvokePending]=useState<{expectedActiveObjectId?:string;context:NativeWorkflowContext;command:Extract<NativeSessionCommand,{kind:'invoke'}>}|null>(null); const [localInvokePending,setLocalInvokePending]=useState<{expectedActiveObjectId?:string;context:NativeWorkflowContext;command:Extract<NativeSessionCommand,{kind:'invoke'}>}|null>(null);
const [localInvokeActive,setLocalInvokeActive]=useState(false); const [localInvokeActive,setLocalInvokeActive]=useState(false);
@@ -8306,6 +8307,7 @@ else:
void client.invokeEmbeddedOperator({operator,properties,baseRevision,context,native:true}).then(result=>{ void client.invokeEmbeddedOperator({operator,properties,baseRevision,context,native:true}).then(result=>{
if(client!==webClientRef.current||project!==projectIdRef.current)return; if(client!==webClientRef.current||project!==projectIdRef.current)return;
applyNativeScene(result); applyNativeScene(result);
lastMenuOperatorRef.current={operator,properties,areaType:context.areaType};
const python=result.operatorResult as {state?:string;error?:string;output?:string}|undefined; const python=result.operatorResult as {state?:string;error?:string;output?:string}|undefined;
setEngineStatus(python?.state==='DONE'?`原生操作已返回:${operator}`:`原生操作失败:${python?.error||python?.output||operator}`); setEngineStatus(python?.state==='DONE'?`原生操作已返回:${operator}`:`原生操作失败:${python?.error||python?.output||operator}`);
}).catch(reason=>{ }).catch(reason=>{
@@ -8463,7 +8465,7 @@ else:
separator,menuAction('关闭',closeProject,!hasProject),menuAction('退出并保存会话',()=>requestNativeAutosaveOperator('wm.quit_blender'),!hasProject) 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('撤销',()=>{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('渲染图像',()=>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('查看渲染结果',()=>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, '场景':[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,