35 Commits

Author SHA1 Message Date
Dariusz L
7a5ecb3919 Fix matting model check and frontend flow
Added proper backend validation for both config.json and model.safetensors to confirm model availability. Updated frontend logic to use /matting/check-model response, preventing unnecessary download notifications.
2025-09-04 23:10:22 +02:00
Dariusz L
06d94f6a63 Improve mask loading logic on node connection
Updated mask loading to immediately use available data from connected nodes and preserve existing masks if none is provided. Backend mask data is only fetched after workflow execution, ensuring no stale data is loaded during connection.
2025-08-09 02:33:28 +02:00
Dariusz L
285ad035b2 Improve batch images and mask handling
Fixed batch image processing to prevent duplicates and layer deletion while ensuring proper mask loading from input_mask. Images are now added as new layers without removing existing ones, and masks are always checked from backend regardless of image state.
2025-08-09 00:49:58 +02:00
Dariusz L
afdac52144 Added mask and image input 2025-08-08 22:23:15 +02:00
Dariusz L
38973b4698 Rename CanvasNode to LayerForgeNode
Replaced all instances of CanvasNode with LayerForgeNode to prevent naming conflicts with the ComfyUI-YCanvas node.
2025-08-04 01:49:37 +02:00
Dariusz L
674879b497 Increase WebSocket max message size
Sets the max_msg_size parameter to 32MB for the WebSocketResponse in handle_canvas_websocket to support larger messages.
2025-07-21 21:52:21 +02:00
Dariusz L
5419acad27 Refactor auto-refresh toggle to node widget property
Replaces the local auto-refresh toggle with a node widget property 'auto_refresh_after_generation' in both JS and TS Canvas classes. Updates Python CanvasNode to include this property in the required config and removes 'hidden' from 'trigger' and 'node_id'. This change centralizes auto-refresh state in the node widget for better consistency and UI integration.
2025-07-21 20:31:46 +02:00
Dariusz L
4e55bb25bc Improve matting error handling and user feedback
Adds specific handling for JSONDecodeError during model loading in Python, returning a clear error message if the model config is corrupted. Updates the JS/TS frontends to show a custom error dialog with details and copy-to-clipboard functionality instead of a simple alert, and ensures spinner removal is safe. This improves user experience and troubleshooting for matting model errors.
2025-07-04 07:31:33 +02:00
Dariusz L
aa31a347d1 Add configurable log level for Python and JS modules
Introduced LOG_LEVEL configuration in both Python and JavaScript to control logging verbosity. Updated logger initialization in canvas_node.py and LoggerUtils.js to use the new LOG_LEVEL from config files.
2025-07-03 13:15:33 +02:00
Dariusz L
2ab406ebfd Improve error handling in BiRefNetMatting model loading
Refines exception handling in the load_model method to provide more informative error messages and re-raise exceptions for upstream handling. Removes boolean return values in favor of exception-based flow, and updates execute to rely on exceptions for error detection.
2025-07-03 12:04:28 +02:00
Dariusz L
3419061b6c Add support for importing multiple latest images
Introduces a new backend route and method to fetch all images created since a given timestamp, and updates the frontend to import all new images as layers on auto-refresh. This improves workflow by allowing multiple images generated in a single execution to be imported at once, rather than only the most recent image.
2025-07-03 01:54:50 +02:00
Dariusz L
195e25437a Improve matting error handling and user feedback
Adds checks for missing 'transformers' dependency and network errors in the matting endpoint, returning clear error messages for common failure cases. Updates the frontend to display more informative alerts to users when matting fails, including details from server responses.
2025-07-02 10:36:22 +02:00
Dariusz L
562b0db042 Initial commit
Project scaffolding and initial file setup.
2025-07-01 17:02:15 +02:00
Dariusz L
4376a21147 Add 'fit on add' option for image placement
Introduces a 'fit_on_add' boolean option to control whether images are fit to the canvas when added or pasted. Updates image addition and paste logic in Canvas, CanvasLayers, and CanvasView to support new placement modes ('fit', 'center', 'mouse', 'default').
2025-06-28 19:48:57 +02:00
Dariusz L
2033ab168a Set default log level to NONE and remove logger docs
Changed the default log level for both Python and JavaScript module loggers from DEBUG to NONE to disable logging by default. Removed the README_LOGGER.md documentation file, and updated README.md to remove a reference to seamless integration.
2025-06-28 08:38:08 +02:00
Dariusz L
940f027b40 Increase logging level to DEBUG and enhance MaskTool callbacks
Set logging level to DEBUG in both Python and JavaScript loggers for improved debugging. Updated MaskTool to accept an onStateChange callback and trigger it after mask state changes, allowing Canvas to respond to mask updates.
2025-06-28 07:28:58 +02:00
Dariusz L
0078faf1fd Set default log level to NONE and improve logger checks
Changed the default log level to LogLevel.NONE in both Python and JavaScript logger utilities. Updated LayerForgeLogger to fully disable logging when the effective level is NONE, ensuring no logs are emitted for disabled modules.
2025-06-28 06:11:12 +02:00
Dariusz L
4c569a0130 Remove optional input_image and input_mask parameters
Eliminates the 'optional' input_image and input_mask parameters from the CanvasNode class and its process_canvas_image method. Fallback logic for these parameters is also removed, simplifying the code and relying solely on WebSocket cache for image and mask data.
2025-06-28 02:49:07 +02:00
Dariusz L
f8f7583c1c Remove cache and output switch options from CanvasNode
Eliminated the 'cache_enabled' and 'output_switch' parameters and related logic from CanvasNode. This simplifies the node's configuration and processing flow by removing unused or redundant options.
2025-06-28 01:55:51 +02:00
Dariusz L
d8ebbeea1e Refactor logger setup and path handling
Moved sys.path modification from canvas_node.py to __init__.py for better package management. Improved logger formatting for colored output and enhanced file logging configuration with error handling for log directory creation. Added python/__init__.py to make the 'python' directory a package.
2025-06-28 01:26:33 +02:00
Dariusz L
b40d645a79 Refactor canvas and mask handling for clarity and maintainability
Removed redundant comments and streamlined logic across canvas-related modules, including mask positioning, garbage collection, and WebSocket communication. Improved code readability and maintainability by eliminating unnecessary explanations and clarifying intent in both Python and JavaScript files. No functional changes were made; this is a cleanup and refactor for better developer experience.
2025-06-27 06:17:24 +02:00
Dariusz L
711722eb9f Revert "Refactor logging and formatting"
This reverts commit 83ce890ef4.
2025-06-27 05:50:47 +02:00
Dariusz L
83ce890ef4 Refactor logging and formatting
Improved code readability
2025-06-27 05:32:11 +02:00
Dariusz L
be4fae2964 Add WebSocket-based RAM output for CanvasNode
Introduces a WebSocket-based mechanism for CanvasNode to send and receive canvas image and mask data in RAM, enabling fast, diskless data transfer between frontend and backend. Adds a new WebSocketManager utility, updates CanvasIO to support RAM output mode, and modifies CanvasView to send canvas data via WebSocket before prompt execution. The backend (canvas_node.py) is updated to handle WebSocket data storage and retrieval, with improved locking and cleanup logic. This change improves workflow speed and reliability by avoiding unnecessary disk I/O and ensuring up-to-date canvas data is available during node execution.
2025-06-27 05:28:13 +02:00
Dariusz L
38ad476719 Improve canvas save logic and add detailed debug logging
Enhanced the canvas save mechanism to ensure unique file names per node, prevent concurrent saves and executions, and handle missing files more robustly. Switched all logger levels to DEBUG for detailed tracing. Added fallback logic for file naming, improved error handling, and ensured that empty canvases are not saved. These changes improve reliability and traceability of canvas operations, especially in multi-node scenarios.
2025-06-25 23:21:50 +02:00
Dariusz L
e3040c3aed Add logging system 2025-06-25 20:44:25 +02:00
Dariusz L
1e58747b76 Add concurrency locks and detailed logging to canvas processing
Introduces concurrency locks in Python and JavaScript to prevent simultaneous processing and saving operations in canvas-related workflows. Adds extensive logging throughout the canvas image processing, saving, and matting routines to aid debugging and trace execution flow. Also improves error handling and state management in both backend and frontend code.
2025-06-25 20:00:58 +02:00
Dariusz L
6b44bd9239 Refactor JS code for consistent formatting and style
Standardized spacing and object literal formatting across multiple JS files for improved readability and consistency. No functional changes were made. Minor Python formatting adjustment for line length in canvas_node.py.
2025-06-25 05:51:47 +02:00
Dariusz L
acdd12b65e Add mask drawing tool and improve mask handling
Introduces a new MaskTool for interactive mask drawing with adjustable brush size, strength, and softness. Updates Canvas.js to integrate mask editing, rendering, and saving, including support for saving images with and without masks. Enhances the UI in Canvas_view.js with mask controls and a dialog for canvas resizing. Updates canvas_node.py to load images without masks for processing. These changes improve user control over mask creation and management in the canvas workflow.
2025-06-25 02:47:40 +02:00
Dariusz L
41bd1761c4 Changed naeme 2025-06-21 04:10:43 +02:00
Dariusz L
2ccc784745 Added Outpainting Logic 2025-06-20 19:04:49 +02:00
tanglup
0461953c6c Update canvas_node.py 2024-11-24 12:47:43 +08:00
tanglup
af0a32a4f9 Update canvas_node.py 2024-11-24 10:34:20 +08:00
tanglup
872814b676 Update canvas_node.py 2024-11-20 18:21:25 +08:00
tanglup
413bc4985c Add files via upload 2024-11-19 15:38:08 +00:00