Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions src/loaders/ObjectLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ Object.assign( ObjectLoader.prototype, {
parseMaterials: function ( json, textures ) {

var materials = {};
var cache = {};

if ( json !== undefined ) {

Expand All @@ -466,21 +467,31 @@ Object.assign( ObjectLoader.prototype, {

if ( data.type === 'MultiMaterial' ) {

// Deprecated

// Deprecated
var array = [];

for ( var j = 0; j < data.materials.length; j ++ ) {

array.push( loader.parse( data.materials[ j ] ) );
if ( cache[ data.materials[ j ].uuid ] ) {

array.push( cache[ data.materials[ j ].uuid ] );

} else {

var mat = loader.parse( data.materials[ j ] );
cache[ data.materials[ j ].uuid ] = mat;
array.push( mat );

}

}

materials[ data.uuid ] = array;
cache[ data.uuid ] = array;
Copy link
Owner

Choose a reason for hiding this comment

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

Is this one needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe not

Copy link
Owner

Choose a reason for hiding this comment

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

Would you like to do another PR removing it? Just to keep the code clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

Copy link
Owner

Choose a reason for hiding this comment

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

Actually, I'll clean it up on my end 👌

Copy link
Owner

Choose a reason for hiding this comment

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

Copy link
Owner

Choose a reason for hiding this comment

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

screen shot 2018-10-31 at 10 39 05 am


} else {

materials[ data.uuid ] = loader.parse( data );
cache[ data.uuid ] = materials[ data.uuid ];
Copy link
Owner

Choose a reason for hiding this comment

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

This one too. Is it really needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is most likely needed.
For cases MultiMaterial = [X, Y], AnotherMaterial = X

Copy link
Owner

Choose a reason for hiding this comment

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

I see...


}

Expand Down