perf: trim session IPC hot paths and fix clear-effects idle render

Skip full project broadcast on graph/NPC position commits, send session.stateChanged only to consumer windows, and force one Pixi render before stopping the idle ticker so Clear effects actually clears the canvas.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Ivan Fontosh
2026-07-23 12:32:03 +08:00
parent d9fbecf5a7
commit a797162f16
7 changed files with 121 additions and 8 deletions
+5 -5
View File
@@ -54,6 +54,7 @@ import {
closeMaterialsWindow,
closeNpcsEditorWindow,
closeNpcsWindow,
sendToAppWindows,
togglePresentationFullscreen,
waitForEditorWindowReady,
} from './windows/createWindows';
@@ -229,9 +230,8 @@ function emitSessionState(): void {
project,
currentSceneId: project?.currentSceneId ?? null,
};
for (const win of BrowserWindow.getAllWindows()) {
win.webContents.send(ipcChannels.session.stateChanged, { state });
}
// Не шлём полный project в editor/splash — редактор обновляется через invoke-ответы.
sendToAppWindows(ipcChannels.session.stateChanged, { state });
}
/**
@@ -676,8 +676,8 @@ async function main() {
},
);
registerHandler(ipcChannels.project.updateNpcPosition, async ({ npcId, x, y }) => {
// Layout-only: Presentation/Control не читают npc.x/y; UI коммитит локально из ответа invoke.
const project = await projectStore.updateNpcPosition(npcId, x, y);
emitSessionState();
return { project };
});
registerHandler(ipcChannels.project.deleteNpc, async ({ npcId }) => {
@@ -811,8 +811,8 @@ async function main() {
return { project };
});
registerHandler(ipcChannels.project.updateSceneGraphNodePosition, async ({ nodeId, x, y }) => {
// Layout-only: граф сцен живёт в editor (optimistic + invoke); session broadcast не нужен.
const project = await projectStore.updateSceneGraphNodePosition(nodeId, x, y);
emitSessionState();
return { project };
});
registerHandler(ipcChannels.project.addSceneGraphNode, async ({ sceneId, x, y }) => {