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

Use material-utils where possible #5920

Merged
merged 1 commit into from
Feb 2, 2023
Merged

Use material-utils where possible #5920

merged 1 commit into from
Feb 2, 2023

Conversation

takahirox
Copy link
Contributor

There some codes in src like

if (object.material) {
  if (Array.isArray(object.material)) {
    object.material.forEach(material => func(material));
  } else {
    func(object.material);
  }
}

utils/material-utils has forEachMaterial helper function that does the above. Other files can just import and use it.

Copy link
Contributor

@netpro2k netpro2k left a comment

Choose a reason for hiding this comment

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

LGTM.

Related. I suspect as we convert to typescript we will find more spots where we are assuming material is a single object but can be an array.

@takahirox
Copy link
Contributor Author

Related. I suspect as we convert to typescript we will find more spots where we are assuming material is a single object but can be an array.

Perhaps right. Let's digging into in another PR (at some point).

@takahirox takahirox merged commit f446dda into master Feb 2, 2023
@takahirox takahirox deleted the UseMaterialUtils branch February 2, 2023 22:48
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

2 participants