Skip to content

Enable INT node inputs and fix live preview sync for MaskRectArea nodes#1168

Merged
ltdrdata merged 1 commit intoltdrdata:Mainfrom
andreszs:fix-mask-rect-area-nodes
Dec 30, 2025
Merged

Enable INT node inputs and fix live preview sync for MaskRectArea nodes#1168
ltdrdata merged 1 commit intoltdrdata:Mainfrom
andreszs:fix-mask-rect-area-nodes

Conversation

@andreszs
Copy link
Contributor

Overview

This PR improves both MaskRectArea and MaskRectAreaAdvanced nodes by allowing them to accept values from connected INT nodes, while preserving backward compatibility with existing workflows.

It also fixes several UI and preview issues that prevented the canvas from updating correctly when values were driven by links.

Fixes #1126

Key changes

1. Typed INT inputs support (backend)

  • Both MaskRectArea and MaskRectAreaAdvanced now declare proper INT inputs in INPUT_TYPES.
  • This allows parameters such as x, y, width, height, and blur_radius to be driven directly by other nodes.
  • Existing workflows that relied on node properties remain supported via fallback logic using extra_pnginfo.

2. Live preview correctly updates when inputs are linked (frontend)

  • The canvas preview now updates immediately when values come from linked INT nodes.
  • This is achieved by synchronizing linked input values into node.properties during canvas rendering, avoiding reliance on widget callbacks or execution timing.
  • This directly resolves the behavior reported in issue Mask Rect Area node can not link input params #1126.

3. Node height and layout fix (frontend)

  • The node height calculation was corrected to use the actual widget layout (last_y) instead of input/output counts.
  • Nodes can now both grow and shrink correctly when resized or when widget content changes.
  • This removes excessive empty space below the widgets and canvas.

4. Widget duplication prevention

  • Frontend logic now detects when widgets are already created by Python and avoids recreating them in JavaScript.
  • This prevents duplicated widgets and keeps the node UI consistent.

5. Comment cleanup

  • Remaining comments in Spanish were translated to English for consistency and maintainability.

Backward compatibility

  • Existing workflows continue to work without modification.
  • Default behavior and mask output remain unchanged unless inputs are explicitly linked.

Motivation

These changes make the nodes composable with the rest of the graph (especially math and control nodes), improve the reliability of the preview, and fix UI inconsistencies without introducing breaking changes.

## Overview

This PR improves both MaskRectArea and MaskRectAreaAdvanced nodes by allowing them to accept values from connected INT nodes, while preserving backward compatibility with existing workflows.

It also fixes several UI and preview issues that prevented the canvas from updating correctly when values were driven by links.

Fixes ltdrdata#1126

## Key changes

### 1. Typed INT inputs support (backend)

- Both MaskRectArea and MaskRectAreaAdvanced now declare proper INT inputs in INPUT_TYPES.
- This allows parameters such as x, y, width, height, and blur_radius to be driven directly by other nodes.
- Existing workflows that relied on node properties remain supported via fallback logic using extra_pnginfo.

### 2. Live preview correctly updates when inputs are linked (frontend)

- The canvas preview now updates immediately when values come from linked INT nodes.
- This is achieved by synchronizing linked input values into node.properties during canvas rendering, avoiding reliance on widget callbacks or execution timing.
- This directly resolves the behavior reported in issue ltdrdata#1126.

### 3. Node height and layout fix (frontend)

- The node height calculation was corrected to use the actual widget layout (last_y) instead of input/output counts.
- Nodes can now both grow and shrink correctly when resized or when widget content changes.
- This removes excessive empty space below the widgets and canvas.

### 4. Widget duplication prevention

- Frontend logic now detects when widgets are already created by Python and avoids recreating them in JavaScript.
- This prevents duplicated widgets and keeps the node UI consistent.

### 5. Comment cleanup

- Remaining comments in Spanish were translated to English for consistency and maintainability.

## Backward compatibility

- Existing workflows continue to work without modification.
- Default behavior and mask output remain unchanged unless inputs are explicitly linked.

## Motivation

These changes make the nodes composable with the rest of the graph (especially math and control nodes), improve the reliability of the preview, and fix UI inconsistencies without introducing breaking changes.
@andreszs
Copy link
Contributor Author

andreszs commented Dec 26, 2025

Screenshot

image

@ltdrdata ltdrdata merged commit 4c864fa into ltdrdata:Main Dec 30, 2025
@andreszs andreszs deleted the fix-mask-rect-area-nodes branch January 2, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mask Rect Area node can not link input params

2 participants