Skip to content

Conversation

@Astrak
Copy link
Contributor

@Astrak Astrak commented Jun 21, 2016

First contribution here, I hope I got the guidelines #8137

geometry.morphTargets.length > 0 && material.morphTargets;
var useMorphing = ( ( geometry.morphTargets !== undefined && geometry.morphTargets.length > 0 ) ||
( geometry.morphAttributes.position !== undefined && geometry.morphAttributes.position.length > 0 ) )
&& material.morphTargets;
Copy link
Collaborator

Choose a reason for hiding this comment

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

geometry.morphAttributes.position !== undefined

This will throw an error if geometry.morphAttributes is not defined. You can test this on the three.js examples.

An alternate pattern is if ( geometry instanceof THREE.BufferGeometry ). I am not sure which pattern is preferred. /ping @mrdoob

@Astrak
Copy link
Contributor Author

Astrak commented Jun 21, 2016

Oops. Right. Also since material.morphTargets is checked in both cases, same for morphTargets.length > 0, I factorized them in this last commit

@mrdoob
Copy link
Owner

mrdoob commented Jun 24, 2016

Looks good!

@mrdoob mrdoob merged commit 1a984f9 into mrdoob:dev Jun 24, 2016
@mrdoob
Copy link
Owner

mrdoob commented Jun 24, 2016

Thanks!

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