Skip to content

Conversation

@vietnguyen2358
Copy link

@vietnguyen2358 vietnguyen2358 commented Nov 2, 2025

Resolves #7994
Addresses #7992

Changes:

  • Implemented normalization in p5.Shader.modify() to auto-return input objects when return is omitted
  • Skip normalization for void hooks or mismatched return types

Live: https://editor.p5js.org/viet.nguyen2358/sketches/J1H2c-kWN

PR Checklist

Contributors:
@phamjoshua6, @SaKaR22

@welcome
Copy link

welcome bot commented Nov 2, 2025

🎉 Thanks for opening this pull request! For guidance on contributing, check out our contributor guidelines and other resources for contributors!
🤔 Please ensure that your PR links to an issue, which has been approved for work by a maintainer; otherwise, there might already be someone working on it, or still ongoing discussion about implementation. You are welcome to join the discussion in an Issue if you're not sure!
🌸 Once your PR is merged, be sure to add yourself to the list of contributors on the readme page !

Thank You!

Copy link
Collaborator

@perminder-17 perminder-17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, really thanks for working on this. For 1.x versions, your logic works well. Currently we are not adding any features to the 1.x versions (i.e. the main branch), I think you need to open up the PR targeting the dev-2.0 branch as well, and

For this PR if you would still like to continue adding this to main branch, you could probably add visual tests to it instead of unit tests. Do you think that would make sense to you and your team?

Really thanks for working on this.

@vietnguyen2358
Copy link
Author

Thanks so much for the clarification. We'll open a new PR targeting the dev-2.0 branch as suggested. Since dev-2.0 is the current active branch, should my team and I also update the current unit tests to visual tests?

For this current PR, I think we can close it and just focus on the other branch.

@perminder-17
Copy link
Collaborator

Thanks so much for the clarification. We'll open a new PR targeting the dev-2.0 branch as suggested. Since dev-2.0 is the current active branch, should my team and I also update the current unit tests to visual tests?

For this current PR, I think we can close it and just focus on the other branch.

Yes working bothway would be possible.

Like, it would be nice to have changes in both main and dev-2.0 branch. Which means, updating unit tests to visual tests here, and opening up a new PR targeting dev-2.0 branch.

CC: @davepagurek, would u also support changes on the main branch?

@davepagurek
Copy link
Contributor

I think we can 1.x as-is, since we're just doing bugfixes in 1.x at this point.

@davepagurek
Copy link
Contributor

Also in 2.x, hooks are in JavaScript primarily instead of GLSL, so instead of string matching on the source code, we could probably do something where we keep a reference to the inputs object that we pass in as a parameter, and then check the return value, and substitute it with that same inputs object if the return value is undefined.

@vietnguyen2358
Copy link
Author

Sounds good. I will work towards changes in both branches.

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.

[p5.strands] Auto-return input objects if omitted

3 participants