Skip to content

majidfida/AutoResetInt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AutoResetInt – ComfyUI Custom Node

A drop‑in replacement for the PrimitiveInt node that automatically resets its value to 0 after a batch finishes.

✨ Features

  • Works exactly like INT (PrimitiveInt) – has the built‑in control_after_generate dropdown (increment / decrement / randomize).
  • Auto‑reset after batch completion – value returns to 0 the moment the entire queue finishes (Auto mode) or after a configurable countdown (Manual mode).
  • Reset on interruption – when you click Stop or cancel a batch, the counter instantly resets to 0, even mid‑generation.
  • Visual status badge – a coloured badge on the node confirms each reset.
  • Hands‑free operation – set it once, pair with auto_prompt_schedule (or any counter‑driven node), and forget about it.

📦 Installation

  1. Open your ComfyUI custom_nodes folder (e.g. ComfyUI/custom_nodes/).
  2. Clone this repository:
    git clone https://github.com/majidfida/comfyui_auto_reset_int.git
  3. Restart ComfyUI.

The node will appear in the utils category as Auto Reset Int 🔄.

🧪 Requirements

  • ComfyUI 0.20.1 or newer (tested with 0.20.1, frontend v1.43.17).
  • No additional Python packages – the node is pure Python + JavaScript.

⚙️ Usage

Basic setup (automatic reset)

  1. Add the Auto Reset Int 🔄 node to your workflow.
  2. Connect its INT output to the counter input of another node (e.g. auto_prompt_schedule’s frame index).
  3. Leave the control_after_generate dropdown on Increment (it’s the default).
  4. Queue your batch of images as usual – press Run and enter the number of images you need.
  5. After the last image finishes, the counter automatically resets to 0 – you don’t touch anything.

Manual reset with a timer

  • Set reset_mode to Manual.
  • Adjust reset_delay_seconds to the desired countdown (3 seconds by default).
  • After the queue empties, the node will display a countdown badge and then reset.

Stopping mid‑batch

  • If you click Stop while a batch is running, the counter instantly resets to 0, and a yellow badge confirms it.### Defaults
Widget Default Purpose
value 0 The counter value. Incremented/decremented by the dropdown.
control_after_generate Increment Tell ComfyUI to automatically add 1 after each generation.
reset_mode Auto Auto = instant reset when queue empties; Manual = wait reset_delay_seconds.
reset_delay_seconds 3 Only used in Manual mode. How many seconds to wait before reset.

🔧 Under the hood

  • Python (node.py) simply passes the current integer through – all mutation is handled by ComfyUI’s native control_after_generate machinery.
  • JavaScript (js/auto_reset_int.js) listens to execution_success and execution_interrupted events. It checks the queue state and resets the widget’s value to 0 directly in the frontend. A small badge is drawn on the node to confirm the action.

📁 Repository structure

comfyui_auto_reset_int/
├── __init__.py          # ComfyUI registration
├── node.py              # Node logic
├── js/
│   └── auto_reset_int.js
└── README.md

🤝 Contributing

Pull requests are welcome. If you encounter a bug or have a feature request, please open an issue.

📝 License

MIT – do whatever you want with it, just keep the license file.

About

A drop‑in replacement for the `PrimitiveInt` node that automatically resets its value to 0 after a batch finishes – no more manual resets after overnight renders.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors