diff --git a/javascript/sdppp-custom.js b/javascript/sdppp-custom.js index 07e8fb6..827a5c2 100644 --- a/javascript/sdppp-custom.js +++ b/javascript/sdppp-custom.js @@ -250,18 +250,36 @@ export default function (sdppp) { } }); + sdppp.widgetable.add("ShowText|pysssss", { + formatter: (node) => { + return { + title: getTitle(node), + widgets: [{ + value: node.widgets[1]?.value || '', + outputType: "string" + }] + } + } + }) + sdppp.widgetable.add('__DEFAULT__', { formatter: (node) => { return { id: node.id, title: getTitle(node), - widgets: node.widgets.map((widget) => ({ - name: widget.label || widget.name, - outputType: widget.type || "string", - value: widget.value, - options: widget.options, - uiWeight: widget.uiWeight || 12 - })) + widgets: node.widgets.map((widget) => { + const ret = { + outputType: widget.type || "string", + value: widget.value, + options: widget.options, + uiWeight: widget.uiWeight || 12 + } + if (node.widgets.length != 1) { + ret.name = widget.label || widget.name; + } + + return ret; + }) }; } }) diff --git a/sdppp_python/comfy/nodes.py b/sdppp_python/comfy/nodes.py index 06df5d2..675fa3c 100644 --- a/sdppp_python/comfy/nodes.py +++ b/sdppp_python/comfy/nodes.py @@ -427,45 +427,45 @@ def define_comfyui_nodes(sdpppServer): return (output_mask, ) - class SendTextToLayerNode: - RETURN_TYPES = ("DOCUMENT",) - OUTPUT_NODE = True - FUNCTION = "action" - CATEGORY = "SD-PPP" + # class SendTextToLayerNode: + # RETURN_TYPES = ("DOCUMENT",) + # OUTPUT_NODE = True + # FUNCTION = "action" + # CATEGORY = "SD-PPP" - @classmethod - def IS_CHANGED(self, **kwargs): - return np.random.rand() + # @classmethod + # def IS_CHANGED(self, **kwargs): + # return np.random.rand() - @classmethod - def INPUT_TYPES(cls): - return { - "required": { - "text": ('STRING', {"sdppp_type": "STRING"}), - "layer": ('LAYER', {"default": None, "sdppp_type": "LAYER"}), - }, - "optional": SDPPPOptional({}, { - "sdppp": ("STRING", {"default": ""}) - }), - "hidden": { - "unique_id": "UNIQUE_ID", - "prompt": "PROMPT", - } - } + # @classmethod + # def INPUT_TYPES(cls): + # return { + # "required": { + # "text": ('STRING', {"sdppp_type": "STRING"}), + # "layer": ('LAYER', {"default": None, "sdppp_type": "LAYER"}), + # }, + # "optional": SDPPPOptional({}, { + # "sdppp": ("STRING", {"default": ""}) + # }), + # "hidden": { + # "unique_id": "UNIQUE_ID", + # "prompt": "PROMPT", + # } + # } - def action(self, text, layer, **kwargs): - sdpppServer.has_ps_instance(throw_error=True) + # def action(self, text, layer, **kwargs): + # sdpppServer.has_ps_instance(throw_error=True) - document = layer['document'] + # document = layer['document'] - call_async_func_in_server_thread(ProtocolPhotoshop.send_text( - instance_id=document['instance_id'], - document_identify=document['identify'], - text=text, - layer_identify=layer['layer_identify'], - ), True) + # call_async_func_in_server_thread(ProtocolPhotoshop.send_text( + # instance_id=document['instance_id'], + # document_identify=document['identify'], + # text=text, + # layer_identify=layer['layer_identify'], + # ), True) - return (document, ) + # return (document, ) class GetTextFromLayerNode: RETURN_TYPES = ("STRING",) diff --git a/typescripts/_build/esbuild.ts b/typescripts/_build/esbuild.ts index 12c83f2..2bd6c4f 100644 --- a/typescripts/_build/esbuild.ts +++ b/typescripts/_build/esbuild.ts @@ -13,6 +13,7 @@ import WebSocket, { WebSocketServer } from 'ws'; import { join } from 'path'; import { typescriptSrcRoot } from './lib.ts'; import { globSync } from 'glob'; + let wss: WebSocketServer | null = null; let clients = new Set(); if (process.env.NODE_ENV === 'development') { @@ -105,6 +106,26 @@ async function main() { notifyClients(result); } + // Add stdin listener for Enter key press + if (process.env.NODE_ENV === 'development') { + process.stdin.setRawMode(true); + process.stdin.resume(); + process.stdin.setEncoding('utf8'); + console.log('Press Enter to trigger client notification, or Ctrl+C to exit'); + + process.stdin.on('data', (data) => { + const key = data.toString(); + if (key === '\r' || key === '\n') { + console.log('Enter pressed, notifying clients...'); + notifyClients({ errors: [], warnings: [] }); + } + // Ctrl+C handling + if (key === '\u0003') { + process.exit(); + } + }); + } + if (isWatchMode) { console.log('Watch mode enabled. Watching for changes...'); for (const { context } of contexts) { diff --git a/typescripts/modules/comfy/src/popup/tsx/WorkflowEditWeb.tsx b/typescripts/modules/comfy/src/popup/tsx/WorkflowEditWeb.tsx index c15f2f4..a3f91a6 100644 --- a/typescripts/modules/comfy/src/popup/tsx/WorkflowEditWeb.tsx +++ b/typescripts/modules/comfy/src/popup/tsx/WorkflowEditWeb.tsx @@ -241,7 +241,7 @@ export class WorkflowEditWrap extends React.Component<{ ) return true - } else if (widget.outputType === 'string' || widget.outputType === 'customtext') { + } else if (widget.outputType === 'string' || widget.outputType === 'customtext' || widget.outputType === 'text') { context.result.push( { } pageStore.setWidgetTableValue(getWidgetTableValue(app.graph)); }) +api.addEventListener("executed", () => { + pageStore.setWidgetTableValue(getWidgetTableValue(app.graph)); +}) let lastActiveWorkflowID: number = 0;