File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -453,8 +453,8 @@ Object.assign( ObjectLoader.prototype, {
453453
454454 parseMaterials : function ( json , textures ) {
455455
456+ var cache = { } ; // MultiMaterial
456457 var materials = { } ;
457- var cache = { } ;
458458
459459 if ( json !== undefined ) {
460460
@@ -468,25 +468,24 @@ Object.assign( ObjectLoader.prototype, {
468468 if ( data . type === 'MultiMaterial' ) {
469469
470470 // Deprecated
471+
471472 var array = [ ] ;
472- for ( var j = 0 ; j < data . materials . length ; j ++ ) {
473473
474- if ( cache [ data . materials [ j ] . uuid ] ) {
474+ for ( var j = 0 ; j < data . materials . length ; j ++ ) {
475475
476- array . push ( cache [ data . materials [ j ] . uuid ] ) ;
476+ var material = data . materials [ j ] ;
477477
478- } else {
478+ if ( cache [ material . uuid ] === undefined ) {
479479
480- var mat = loader . parse ( data . materials [ j ] ) ;
481- cache [ data . materials [ j ] . uuid ] = mat ;
482- array . push ( mat ) ;
480+ cache [ material . uuid ] = loader . parse ( material ) ;
483481
484482 }
485483
484+ array . push ( cache [ material . uuid ] ) ;
485+
486486 }
487487
488488 materials [ data . uuid ] = array ;
489- cache [ data . uuid ] = array ;
490489
491490 } else {
492491
You can’t perform that action at this time.
0 commit comments