|
@@ -41,7 +41,7 @@ THREE.OBJLoader2 = function ( manager ) {
|
|
|
this.terminateWorkerOnLoad = true;
|
|
|
};
|
|
|
|
|
|
-THREE.OBJLoader2.OBJLOADER2_VERSION = '2.5.0';
|
|
|
+THREE.OBJLoader2.OBJLOADER2_VERSION = '2.5.1';
|
|
|
|
|
|
THREE.OBJLoader2.prototype = {
|
|
|
|
|
@@ -339,10 +339,9 @@ THREE.OBJLoader2.prototype = {
|
|
|
*/
|
|
|
parse: function ( content ) {
|
|
|
// fast-fail in case of illegal data
|
|
|
- if ( ! THREE.LoaderSupport.Validator.isValid( content ) ) {
|
|
|
+ if ( content === null || content === undefined ) {
|
|
|
|
|
|
- console.warn( 'Provided content is not a valid ArrayBuffer or String.' );
|
|
|
- return this.loaderRootNode;
|
|
|
+ throw 'Provided content is not a valid ArrayBuffer or String. Unable to continue parsing';
|
|
|
|
|
|
}
|
|
|
if ( this.logging.enabled ) console.time( 'OBJLoader2 parse: ' + this.modelName );
|
|
@@ -414,10 +413,9 @@ THREE.OBJLoader2.prototype = {
|
|
|
if ( measureTime && scope.logging.enabled ) console.timeEnd( 'OBJLoader2 parseAsync: ' + scope.modelName );
|
|
|
};
|
|
|
// fast-fail in case of illegal data
|
|
|
- if ( ! THREE.LoaderSupport.Validator.isValid( content ) ) {
|
|
|
+ if ( content === null || content === undefined ) {
|
|
|
|
|
|
- console.warn( 'Provided content is not a valid ArrayBuffer.' );
|
|
|
- scopedOnLoad()
|
|
|
+ throw 'Provided content is not a valid ArrayBuffer or String. Unable to continue parsing';
|
|
|
|
|
|
} else {
|
|
|
|
|
@@ -503,7 +501,7 @@ THREE.OBJLoader2.prototype = {
|
|
|
if ( THREE.MTLLoader === undefined ) console.error( '"THREE.MTLLoader" is not available. "THREE.OBJLoader2" requires it for loading MTL files.' );
|
|
|
if ( THREE.LoaderSupport.Validator.isValid( resource ) && this.logging.enabled ) console.time( 'Loading MTL: ' + resource.name );
|
|
|
|
|
|
- var materials = [];
|
|
|
+ var materials = {};
|
|
|
var scope = this;
|
|
|
var processMaterials = function ( materialCreator ) {
|
|
|
var materialCreatorMaterials = [];
|
|
@@ -1287,9 +1285,13 @@ THREE.OBJLoader2.Parser.prototype = {
|
|
|
|
|
|
var defaultMaterialName = haveVertexColors ? 'defaultVertexColorMaterial' : 'defaultMaterial';
|
|
|
materialOrg = this.materials[ defaultMaterialName ];
|
|
|
- if ( this.logging.enabled ) console.warn( 'object_group "' + meshOutputGroup.objectName + '_' +
|
|
|
- meshOutputGroup.groupName + '" was defined with unresolvable material "' +
|
|
|
- materialNameOrg + '"! Assigning "' + defaultMaterialName + '".' );
|
|
|
+ if ( this.logging.enabled ) {
|
|
|
+
|
|
|
+ console.info( 'object_group "' + meshOutputGroup.objectName + '_' +
|
|
|
+ meshOutputGroup.groupName + '" was defined with unresolvable material "' +
|
|
|
+ materialNameOrg + '"! Assigning "' + defaultMaterialName + '".' );
|
|
|
+
|
|
|
+ }
|
|
|
materialNameOrg = defaultMaterialName;
|
|
|
|
|
|
// if names are identical then there is no need for later manipulation
|