Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NodeMaterial: Fix '_listeners' warning #25003

Merged
merged 1 commit into from
Nov 22, 2022
Merged

Conversation

sunag
Copy link
Collaborator

@sunag sunag commented Nov 22, 2022

/cc @LeviPesin

This contribution is funded by Google

@sunag sunag added this to the r147 milestone Nov 22, 2022

nodeMaterial[ key ] = material[ key ]; // currently this is needed only for material.alphaTest
const nodeMaterial = new materialLib[ type ]();
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure about this... new materialLib[ type ]( material ) internally uses Material.setValues( material ), which copies values not only by simply assigning, but also via .copy(), but also produces a warning if there is not a key in new material (NodeMaterial).
Maybe we can add an option to that function to disable warnings? /cc @mrdoob @Mugen87

Copy link
Contributor

Choose a reason for hiding this comment

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

Or maybe we can add _listeners as an exception in Material.setValues.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm... The point is that .fromMaterial() can be used outside of WebGPURenderer, but for WebGPURenderer is good not copy/clone to not add unnecessary duplicity in memory.

@Mugen87 Mugen87 merged commit 5da9a70 into mrdoob:dev Nov 22, 2022
@sunag sunag deleted the dev-nodematerials branch November 22, 2022 17:32
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.

None yet

3 participants