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

GLTFLoader: Do not make duplicate morphTargetDictionary entries #13800

Merged
merged 2 commits into from Apr 12, 2018

Conversation

takahirox
Copy link
Collaborator

We need to remove existing morphDictionary entries in case targetNames is defined, not to have duplicate dictionary entry.


for ( var i = 0, il = targetNames.length; i < il; i ++ ) {

dictionary[ targetNames[ i ] ] = i;

}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe just reset mesh.morphTargetDictionary = {}? And because extras.targetNames is already an unofficial property, I think we should be very strict about what it can contain. If the length does not match, ignore the whole thing or even log an error.

if ( Object.keys( dictionary ).length === targetNames.length ) {

  // ...

} else {

  console.warn( 'THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.' );

}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I like that idea because it's easier. Updated. Thanks.

@mrdoob mrdoob added this to the r92 milestone Apr 12, 2018
@mrdoob mrdoob merged commit 3800256 into mrdoob:dev Apr 12, 2018
@mrdoob
Copy link
Owner

mrdoob commented Apr 12, 2018

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.

None yet

3 participants