Skip to content

Fix assignments to properties of inputs in branches in p5.strands#8397

Merged
davepagurek merged 2 commits intodev-2.0from
fix/assign-inputs-branching
Jan 10, 2026
Merged

Fix assignments to properties of inputs in branches in p5.strands#8397
davepagurek merged 2 commits intodev-2.0from
fix/assign-inputs-branching

Conversation

@davepagurek
Copy link
Contributor

Resolves #8396

Changes:

  • Previously, we would call .copy() on any object modified in any way in a branch. If you assign to color.rgb, we want to do color.copy(). That made sense because that's a sizzle assignment. But it broke if you assigned to inputs.color, it would do inputs.copy(), which doesn't work because inputs is a struct.
  • Now, we copy the outermost property accessed object that is not a swizzle. So that's color in color.rgb, inputs.color in inputs.color, and inputs.color in inputs.color.rgb.

Live: https://editor.p5js.org/davepagurek/sketches/vOrLgKr0R

PR Checklist

@davepagurek davepagurek merged commit b4f23ee into dev-2.0 Jan 10, 2026
5 checks passed
@davepagurek davepagurek deleted the fix/assign-inputs-branching branch January 10, 2026 15:13
@ksen0 ksen0 added this to the 2.2 milestone Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Completed

Development

Successfully merging this pull request may close these issues.

2 participants