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

Tests: Add BufferAttribute.toJSON() unit test #21225

Merged
merged 1 commit into from
Feb 8, 2021

Conversation

takahirox
Copy link
Collaborator

Description

This PR adds BufferAttribute.toJSON() unit test.

I realized that .name and .usage are not serialized. Is it intentional because .name is optional and (if I'm right) isn't used in core, and appropriate .usage should depend on app, not data?

This contribution is made in a hospital.

@Mugen87
Copy link
Collaborator

Mugen87 commented Feb 8, 2021

Since name is actually deserialized in BufferGeometryLoader, I'm a bit surprised that it is missing in toJSON().

if ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;

I guess it would be more consistent to honor name, usage and updateRange in toJSON(). And correctly restore them.

@mrdoob mrdoob added this to the r126 milestone Feb 8, 2021
@mrdoob mrdoob merged commit 8b18854 into mrdoob:dev Feb 8, 2021
@mrdoob
Copy link
Owner

mrdoob commented Feb 8, 2021

Thanks!

@takahirox takahirox deleted the BufferAttributeToJSONTest branch February 8, 2021 22:08
@takahirox
Copy link
Collaborator Author

I guess it would be more consistent to honor name, usage and updateRange in toJSON(). And correctly restore them.

OK, I'll work on it. I didn't look into deserialization side.

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.

3 participants