Browse Source

ensure that "THREE.CLASSNAME:" prefixes all warnings and errors. Redirect two console.log warnings to THREE.warning for improved robustness.

Ben Houston 10 years ago
parent
commit
ad068a8757

+ 1 - 1
src/core/BufferGeometry.js

@@ -476,7 +476,7 @@ THREE.BufferGeometry.prototype = {
 			 this.attributes.normal === undefined ||
 			 this.attributes.normal === undefined ||
 			 this.attributes.uv === undefined ) {
 			 this.attributes.uv === undefined ) {
 
 
-			THREE.warning( 'Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()' );
+			THREE.warning( 'THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()' );
 			return;
 			return;
 
 
 		}
 		}

+ 1 - 1
src/extras/FontUtils.js

@@ -333,7 +333,7 @@ THREE.FontUtils.generateShapes = function ( text, parameters ) {
 				//throw ( "Warning, unable to triangulate polygon!" );
 				//throw ( "Warning, unable to triangulate polygon!" );
 				//return null;
 				//return null;
 				// Sometimes warning is fine, especially polygons are triangulated in reverse.
 				// Sometimes warning is fine, especially polygons are triangulated in reverse.
-				console.log( 'Warning, unable to triangulate polygon!' );
+				THREE.warning( 'THREE.FontUtils: Warning, unable to triangulate polygon! in Triangulate.process()' );
 
 
 				if ( indices ) return vertIndices;
 				if ( indices ) return vertIndices;
 				return result;
 				return result;

+ 1 - 1
src/extras/core/Curve.js

@@ -43,7 +43,7 @@ THREE.Curve = function () {
 
 
 THREE.Curve.prototype.getPoint = function ( t ) {
 THREE.Curve.prototype.getPoint = function ( t ) {
 
 
-	THREE.warning( "Warning, THREE.Curve.getPoint() not implemented!" );
+	THREE.warning( "THREE.Curve: Warning, getPoint() not implemented!" );
 	return null;
 	return null;
 
 
 };
 };

+ 1 - 1
src/extras/core/Shape.js

@@ -462,7 +462,7 @@ THREE.Shape.Utils = {
 
 
 			if ( allPointsMap[ key ] !== undefined ) {
 			if ( allPointsMap[ key ] !== undefined ) {
 
 
-				console.log( "Duplicate point", key );
+				THREE.warning( "THREE.Shape: Duplicate point", key );
 
 
 			}
 			}
 
 

+ 1 - 1
src/extras/geometries/ExtrudeGeometry.js

@@ -174,7 +174,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
 
 
 	function scalePt2 ( pt, vec, size ) {
 	function scalePt2 ( pt, vec, size ) {
 
 
-		if ( ! vec ) THREE.error( "vec does not exist" );
+		if ( ! vec ) THREE.error( "THREE.ExtrudeGeometry: vec does not exist" );
 
 
 		return vec.clone().multiplyScalar( size ).add( pt );
 		return vec.clone().multiplyScalar( size ).add( pt );
 
 

+ 1 - 1
src/extras/objects/MorphBlendMesh.js

@@ -221,7 +221,7 @@ THREE.MorphBlendMesh.prototype.playAnimation = function ( name ) {
 
 
 	} else {
 	} else {
 
 
-		THREE.warning( "animation[" + name + "] undefined" );
+		THREE.warning( "THREE.MorphBlendMesh: animation[" + name + "] undefined in .playAnimation()" );
 
 
 	}
 	}
 
 

+ 1 - 1
src/loaders/JSONLoader.js

@@ -454,7 +454,7 @@ THREE.JSONLoader.prototype.parse = function ( json, texturePath ) {
 
 
 		if ( geometry.bones && geometry.bones.length > 0 && ( geometry.skinWeights.length !== geometry.skinIndices.length || geometry.skinIndices.length !== geometry.vertices.length ) ) {
 		if ( geometry.bones && geometry.bones.length > 0 && ( geometry.skinWeights.length !== geometry.skinIndices.length || geometry.skinIndices.length !== geometry.vertices.length ) ) {
 
 
-				THREE.warning( 'When skinning, number of vertices (' + geometry.vertices.length + '), skinIndices (' +
+				THREE.warning( 'THREE.JSONLoader: When skinning, number of vertices (' + geometry.vertices.length + '), skinIndices (' +
 					geometry.skinIndices.length + '), and skinWeights (' + geometry.skinWeights.length + ') should match.' );
 					geometry.skinIndices.length + '), and skinWeights (' + geometry.skinWeights.length + ') should match.' );
 
 
 		}
 		}

+ 1 - 1
src/math/Matrix4.js

@@ -634,7 +634,7 @@ THREE.Matrix4.prototype = {
 
 
 		if ( det == 0 ) {
 		if ( det == 0 ) {
 
 
-			var msg = "Matrix4.getInverse(): can't invert matrix, determinant is 0";
+			var msg = "THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";
 
 
 			if ( throwOnInvertible || false ) {
 			if ( throwOnInvertible || false ) {
 
 

+ 1 - 1
src/objects/MorphAnimMesh.js

@@ -109,7 +109,7 @@ THREE.MorphAnimMesh.prototype.playAnimation = function ( label, fps ) {
 
 
 	} else {
 	} else {
 
 
-		THREE.warning( 'animation[' + label + '] undefined' );
+		THREE.warning( 'THREE.MorphAnimMesh: animation[' + label + '] undefined in .playAnimation()' );
 
 
 	}
 	}
 
 

+ 3 - 3
src/renderers/WebGLRenderer.js

@@ -218,7 +218,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	} catch ( error ) {
 	} catch ( error ) {
 
 
-		THREE.error( error );
+		THREE.error( 'THREE.WebGLRenderer: ' + error );
 
 
 	}
 	}
 
 
@@ -5744,7 +5744,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 					} else {
 					} else {
 
 
-						THREE.warning( "Attempt to load unsupported compressed texture format" );
+						THREE.warning( "THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()" );
 
 
 					}
 					}
 
 
@@ -5908,7 +5908,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 								} else {
 								} else {
 
 
-									THREE.warning( "Attempt to load unsupported compressed texture format" );
+									THREE.warning( "THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()" );
 
 
 								}
 								}
 
 

+ 1 - 1
src/renderers/webgl/plugins/ShadowMapPlugin.js

@@ -183,7 +183,7 @@ THREE.ShadowMapPlugin = function ( _renderer, _lights, _webglObjects, _webglObje
 
 
 				} else {
 				} else {
 
 
-					THREE.error( "Unsupported light type for shadow" );
+					THREE.error( "THREE.ShadowMapPlugin: Unsupported light type for shadow", light );
 					continue;
 					continue;
 
 
 				}
 				}