Files
Comfyui-Workflow-Snapshot-M…/snapshot_node.py
Ethanfel 3877c5838c Add SaveSnapshot node with visual separation and rolling limit
Introduce a SaveSnapshot custom node that triggers snapshot captures
via WebSocket. Node-triggered snapshots are visually distinct in the
sidebar (purple left border + "Node" badge) and managed with their
own independent rolling limit (maxNodeSnapshots setting), separate
from auto/manual snapshot pruning. Node snapshots skip hash-dedup
so repeated queue runs always capture.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 21:22:53 +01:00

40 lines
824 B
Python

from server import PromptServer
class _AnyType(str):
def __ne__(self, other):
return False
ANY_TYPE = _AnyType("*")
class SaveSnapshot:
CATEGORY = "Snapshot Manager"
FUNCTION = "execute"
RETURN_TYPES = (ANY_TYPE,)
OUTPUT_NODE = True
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"value": (ANY_TYPE, {}),
"label": ("STRING", {"default": "Node Trigger"}),
}
}
@classmethod
def VALIDATE_INPUTS(cls, input_types):
return True
@classmethod
def IS_CHANGED(cls, *args, **kwargs):
return float("NaN")
def execute(self, value, label):
PromptServer.instance.send_sync(
"snapshot-manager-capture", {"label": label}
)
return (value,)