diff --git a/AsyncOutput.py b/AsyncOutput.py index 0cfcd00..1ed5f85 100644 --- a/AsyncOutput.py +++ b/AsyncOutput.py @@ -67,6 +67,8 @@ def onprompt(json_data): PromptServer.instance.on_prompt_handlers.append(onprompt) +# ======================================================== Global Config Node ======================================== + class AsyncOutputGlobalAutoResetNode: def __init__(self): pass @@ -100,6 +102,56 @@ class AsyncOutputGlobalAutoResetNode: @classmethod def IS_CHANGED(s, global_auto_reset, unique_id): return float('nan') +class AsyncOutputGlobalManualResetNode: + def __init__(self): + pass + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "reset_all_memory": ("BOOLEAN", { "default": False }) + }, + "hidden": { + "unique_id": "UNIQUE_ID" + } + } + + OUTPUT_NODE = True + RETURN_TYPES = ("BOOLEAN",) + RETURN_NAMES = ("reset result",) + CATEGORY = f'{MAIN_CATEGORY}/Global/ManualOperation' + FUNCTION = "manual_reset" + + def manual_reset(self, reset_all_memory, unique_id): + global ASYNC_OUTPUT_GLOBAL_AUTO_RESET + + global ASYNC_OUTPUT_STORAGE_DATA + global ASYNC_OUTPUT_COUNTER + global ASYNC_OUTPUT_MULTI_LINE_TEXT_YIELD_ID_DECT + global ASYNC_OUTPUT_REMOTE_CONTROL_DATA + global ASYNC_OUTPUT_REMOTE_CONTROL_TICK_DICT + + ASYNC_OUTPUT_STORAGE_DATA = {} + ASYNC_OUTPUT_COUNTER = {} + ASYNC_OUTPUT_MULTI_LINE_TEXT_YIELD_ID_DECT = {} + ASYNC_OUTPUT_REMOTE_CONTROL_DATA = {} + ASYNC_OUTPUT_REMOTE_CONTROL_TICK_DICT = {} + + print(f'[AsyncOutput]: Current AUTO_RESET on {"`Enabled`" if ASYNC_OUTPUT_GLOBAL_AUTO_RESET == True else "`Disabled`"}') + print(f'[AsyncOutput]: Enabled -> each Run Batch auto Reset | Disabled -> Never Auto Reset, Until ComfyUI process exit') + + if isinstance(reset_all_memory, bool): + ASYNC_OUTPUT_GLOBAL_AUTO_RESET = reset_all_memory + return (ASYNC_OUTPUT_GLOBAL_AUTO_RESET, ) + else: + return (comfy_execution.graph.ExecutionBlocker(None), ) + + @classmethod + def IS_CHANGED(s, reset_all_memory, unique_id): + return float('nan') + +# ============================================================================================================ class AsyncOutputCollectionNode: def __init__(self): diff --git a/__init__.py b/__init__.py index 140df04..bb76ffa 100644 --- a/__init__.py +++ b/__init__.py @@ -17,6 +17,7 @@ NODE_CLASS_MAPPINGS = { "AsyncOutputRemoteCollection": AsyncOutput.AsyncOutputRemoteCollectionNode, "AsyncOutputRemoteTrigger": AsyncOutput.AsyncOutputRemoteTriggerNode, "AsyncOutputGlobalAutoReset": AsyncOutput.AsyncOutputGlobalAutoResetNode, + "AsyncOutputGlobalManualReset": AsyncOutput.AsyncOutputGlobalManualResetNode, } NODE_DISPLAY_NAME_MAPPINGS = { @@ -29,6 +30,7 @@ NODE_DISPLAY_NAME_MAPPINGS = { "AsyncOutputRemoteCollection": "Remote Collect", "AsyncOutputRemoteTrigger": "Remote Trigger", "AsyncOutputGlobalAutoReset": "AsyncOutput[module_config] Global Auto Reset", + "AsyncOutputGlobalManualReset": "AsyncOutput[module_config] Global Memory Reset", } __all__ = [