Read git diff main local and snaptogridnotes.md in this repo for context. Now we're on…
- User
Read
git diff main localand snap_to_grid_notes.md in this repo for context. Now we're onmainbranch. Can you implement this change as a custom node (actually not a node but a frontend plugin) in C:\ComfyUI\custom_nodes , rather than merging in this repo? You may read the source code in C:\ComfyUI\ , C:\ComfyUI_frontend\ , and relevant pip packages in C:\Python312\Lib\site-packages\ (it's the current Python env) to understand how ComfyUI plugin works. - User
C:\ComfyUI\web\ indeed has only empty dirs. If I understand correctly, the plugin should be put in C:\ComfyUI\custom_nodes\ .
- User
You may use C:\ripgrep\rg.exe to search in large repos.
- Assistant
Implemented it as a frontend-only custom node plugin in
C:\ComfyUI\custom_nodes, without changingmaininC:\ComfyUI_frontend.- Added loader at
C:\ComfyUI\custom_nodes\ComfyUI-SnapToGridFix\__init__.py - Added frontend plugin at
C:\ComfyUI\custom_nodes\ComfyUI-SnapToGridFix\web\snap_to_grid_fix.js - The plugin patches runtime behavior to:
- snap node positions after
configure() - ceil-snap node sizes in
setSize()when snap is active - re-snap loaded graphs after workflow configure, including reroutes/groups/subgraph IO
- ceil-snap Vue node CSS size vars while
Always snap to gridis enabled
- snap node positions after
- I sanity-checked it with
python -m py_compileandnode --check
This is a monkey-patch style plugin because the packaged frontend does not expose the exact internals as a stable public API.
Next steps:
- Restart ComfyUI so the custom node/plugin is loaded
- Test with
Always snap to gridenabled by loading a previously misaligned workflow and resizing a few nodes
- Added loader at