Skip to content

Fix incorrect flattening behavior for hidden nodes#3759

Open
JustJ01 wants to merge 4 commits intoGraphiteEditor:masterfrom
JustJ01:fix-hidden-node-flattening
Open

Fix incorrect flattening behavior for hidden nodes#3759
JustJ01 wants to merge 4 commits intoGraphiteEditor:masterfrom
JustJ01:fix-hidden-node-flattening

Conversation

@JustJ01
Copy link

@JustJ01 JustJ01 commented Feb 13, 2026

Problem (Issue #3629)

When a node like Instance Position or Pointer Position is hidden, the flattening logic incorrectly replaces it with a default () value.

This causes:

  • Type mismatches in downstream nodes (Ex ConvertNode<DVec2>)
  • Graph evaluation failures
  • Panics such as:
    • Cannot construct default value for hidden node
    • entered unreachable code: tried to resolve not flattened node

Before:

Expected Behavior

Hiding a node should:

  • Preserve its output type
  • Forward a compatible input when possible
  • Never inject () unless the node’s real output type is ()

Solution

Screen.Recording.2026-02-14.021205.mp4

Updated flatten_with_fns handling for Visible::Value(output_type).

New behavior:

  1. If a compatible input exists

    • Replace the node with an identity node
    • Forward that input directly
    • Preserve type integrity
  2. If no compatible input exists

    • Generate a default value using:
      TaggedValue::from_type(&output_type)
    • Insert a correctly typed constant node
  3. Prevent incorrect () propagation

    • The logic no longer defaults to () unless the node’s actual output type is unit.

Result

  • Hiding Instance Position no longer crashes.
  • ConvertNode<DVec2> no longer receives ().

@JustJ01 JustJ01 marked this pull request as ready for review February 14, 2026 16:18
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.

1 participant