Skip to content

Let a duplicated node's pins reset to the original's default [patch] - #518

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/476-duplicate-seeds-default
Sep 29, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/476-duplicate-seeds-default

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #476

What was wrong

NodeEditorEngine.DuplicateNodes gave each copied pin a new id and wrote the original's current value to it, but never seeded a default for it in PinValueStore. PinValueStore.Reset only works on a pin that has a seeded default, so ResetPinValue returned false and did nothing on every pin of a duplicated node. Copies of factory-bound nodes had the same problem, and undo/redo kept it because CaptureNode recorded HasDefault = false.

Change

  • Before a copied pin's value is written, the original's seeded default (from pinValues.TryGetDefault) is seeded onto the copy.
  • Seeding also sets the value. If the original holds null over a non-null default, the copy's value is put back to null so the seed doesn't replace it.
  • The DuplicateNodes remarks now say that a copied pin resets to the original's default.

Tests

  • DuplicateNode_CopiedPinResetsToTheOriginalsDefault is the issue's repro on a spec-created node. The copy arrives with 42, the reset returns true and gives 5, and the original is unchanged.
  • DuplicateNode_CarriesANullValueOverANonNullDefault: a null on the original is still null on the copy, and a reset gives the default back.
  • ResetPinValue_OnACopyOfABoundNode_PutsTheOriginalsDefaultBack covers a factory-bound TunableNode: the copy resets to 128 and the original's instance keeps 200.

With the NodeEditorEngine.cs change reverted, all three new tests fail on the ResetPinValue assertion. With the change in place, all 269 tests in ImGui.NodeEditor.Tests pass on net10.0.

🤖 Generated with Claude Code

https://claude.ai/code/session_018AK9FUHZoZnfAL1aQuEtAR


Generated by Claude Code

…opies

DuplicateNodes wrote each copy's value but never seeded its default, so
ResetPinValue returned false on every pin of a duplicated node. Copy the
original's seeded default across first, and keep a null value the original
holds rather than letting the seed stand in for it.

Fixes #476

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018AK9FUHZoZnfAL1aQuEtAR
@sonarqubecloud

Copy link
Copy Markdown

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.

ResetPinValue returns false and does nothing on any pin of a duplicated node

2 participants