From a8f9df9747de7b492a06c3a5cda2f17765fd1cc6 Mon Sep 17 00:00:00 2001 From: zombieyang Date: Thu, 1 May 2025 23:26:16 +0800 Subject: [PATCH] switch workflow bugfix --- sdppp_python/comfy/nodes.py | 2 +- typescripts/modules/comfy/src/widgettable-entry.mts | 4 +++- typescripts/src/common/zh-cn.mts | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sdppp_python/comfy/nodes.py b/sdppp_python/comfy/nodes.py index 2e1ab81..54a22bc 100644 --- a/sdppp_python/comfy/nodes.py +++ b/sdppp_python/comfy/nodes.py @@ -232,7 +232,7 @@ def define_comfyui_nodes(sdpppServer): def IS_CHANGED(self, **kwargs): sdppp_arg = kwargs['sdppp'] document_arg = kwargs['document'] - if kwargs['layer_or_group'] == '### The Canvas ###' or kwargs['layer_or_group'] == '### 整个画布 ###': + if kwargs['layer_or_group'] == '### The Canvas ###' or kwargs['layer_or_group'] == '### 整个画布 ###' or kwargs['layer_or_group'] == '### Selected Layer ###' or kwargs['layer_or_group'] == '### 所选图层 ###': return sdppp_is_changed(sdpppServer, sdppp_arg, document_arg, 'historyStateID') return sdppp_is_changed(sdpppServer, sdppp_arg, document_arg) diff --git a/typescripts/modules/comfy/src/widgettable-entry.mts b/typescripts/modules/comfy/src/widgettable-entry.mts index b1ad112..eb5c391 100644 --- a/typescripts/modules/comfy/src/widgettable-entry.mts +++ b/typescripts/modules/comfy/src/widgettable-entry.mts @@ -4,9 +4,10 @@ import { makeWidgetTableStructure, getWidgetTableValue } from "./graph-to-form.m import { WidgetTableStructure } from "../../../src/types/sdppp"; -api.addEventListener("graphChanged", () => { +api.addEventListener("graphChanged", (event: { detail: any }) => { const workflowManager = app.workflowManager || app.extensionManager.workflow const activeWorkflow = workflowManager.activeWorkflow; + if (event.detail.id !== activeWorkflow.activeState.id) return const originalWTStructure = pageStore.data.widgetTableStructure; const newWTStructure = makeWidgetTableStructure(app.graph, activeWorkflow); if (isStructureDiff(newWTStructure, originalWTStructure)) { @@ -45,6 +46,7 @@ function checkGraphUpdate() { pageStore.setWidgetTableValue(wtValue); // rgthree may have some delay setTimeout(() => { + if (activeWorkflow !== workflowManager.activeWorkflow) return const newWTStructure = makeWidgetTableStructure(app.graph, activeWorkflow); const newWTValue = getWidgetTableValue(app.graph); if (isStructureDiff(newWTStructure, wtStructure)) { diff --git a/typescripts/src/common/zh-cn.mts b/typescripts/src/common/zh-cn.mts index 90b6ae2..c129d58 100644 --- a/typescripts/src/common/zh-cn.mts +++ b/typescripts/src/common/zh-cn.mts @@ -69,7 +69,9 @@ export default { 'bounds [optional]': '范围[可选]', 'boundary': '范围', 'Boundary': '范围', + 'canvas_boundary': '画布范围', 'canvas_bound': '画布范围', + 'layer_boundary': '图层范围', 'layer_bound': '图层范围', "Photoshop Disconnected!" : "Photoshop 未连接!", 'rgb_out': 'RGB输出',