提交 5922b735 编写于 作者: D Don McCurdy

JSM: Fix more replacements in strings, and error in GLTFLoader.

上级 8da957ed
......@@ -405,7 +405,7 @@ GLTFExporter.prototype = {
} catch ( error ) {
console.warn( 'GLTFExporter: userData of \'' + object.name + '\' ' +
console.warn( 'THREE.GLTFExporter: userData of \'' + object.name + '\' ' +
'won\'t be serialized because of JSON.stringify error - ' + error.message );
}
......@@ -656,7 +656,7 @@ GLTFExporter.prototype = {
} else {
throw new Error( 'GLTFExporter: Unsupported bufferAttribute component type.' );
throw new Error( 'THREE.GLTFExporter: Unsupported bufferAttribute component type.' );
}
......@@ -967,7 +967,7 @@ GLTFExporter.prototype = {
} else {
console.warn( 'GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.' );
console.warn( 'THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.' );
}
......@@ -1017,7 +1017,7 @@ GLTFExporter.prototype = {
if ( material.normalScale.x !== material.normalScale.y ) {
console.warn( 'GLTFExporter: Normal scale components are different, ignoring Y and exporting X.' );
console.warn( 'THREE.GLTFExporter: Normal scale components are different, ignoring Y and exporting X.' );
}
......@@ -1174,7 +1174,7 @@ GLTFExporter.prototype = {
if ( originalNormal !== undefined && ! isNormalizedNormalAttribute( originalNormal ) ) {
console.warn( 'GLTFExporter: Creating normalized normal attribute from the non-normalized one.' );
console.warn( 'THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one.' );
geometry.addAttribute( 'normal', createNormalizedNormalAttribute( originalNormal ) );
......@@ -1333,7 +1333,7 @@ GLTFExporter.prototype = {
if ( ! forceIndices && geometry.index === null && isMultiMaterial ) {
// temporal workaround.
console.warn( 'GLTFExporter: Creating index for non-indexed multi-material mesh.' );
console.warn( 'THREE.GLTFExporter: Creating index for non-indexed multi-material mesh.' );
forceIndices = true;
}
......@@ -1524,7 +1524,7 @@ GLTFExporter.prototype = {
if ( ! trackNode || ! trackProperty ) {
console.warn( 'GLTFExporter: Could not export animation track "%s".', track.name );
console.warn( 'THREE.GLTFExporter: Could not export animation track "%s".', track.name );
return null;
}
......@@ -1667,7 +1667,7 @@ GLTFExporter.prototype = {
if ( light.decay !== undefined && light.decay !== 2 ) {
console.warn( 'GLTFExporter: Light decay may be lost. glTF is physically-based, '
console.warn( 'THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, '
+ 'and expects light.decay=2.' );
}
......@@ -1678,7 +1678,7 @@ GLTFExporter.prototype = {
|| light.target.position.y !== 0
|| light.target.position.z !== - 1 ) ) {
console.warn( 'GLTFExporter: Light direction may be lost. For best results, '
console.warn( 'THREE.GLTFExporter: Light direction may be lost. For best results, '
+ 'make light.target a child of the light with position 0,0,-1.' );
}
......@@ -1777,7 +1777,7 @@ GLTFExporter.prototype = {
} else if ( object.isLight ) {
console.warn( 'GLTFExporter: Only directional, point, and spot lights are supported.' );
console.warn( 'THREE.GLTFExporter: Only directional, point, and spot lights are supported.' );
return null;
}
......@@ -2163,11 +2163,11 @@ GLTFExporter.Utils = {
// This should never happen, because glTF morph target animations
// affect all targets already.
throw new Error( 'GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.' );
throw new Error( 'THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.' );
}
console.warn( 'GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead.' );
console.warn( 'THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead.' );
sourceTrack = sourceTrack.clone();
sourceTrack.setInterpolation( InterpolateLinear );
......@@ -2179,7 +2179,7 @@ GLTFExporter.Utils = {
if ( targetIndex === undefined ) {
throw new Error( 'GLTFExporter: Morph target name not found: ' + sourceTrackBinding.propertyIndex );
throw new Error( 'THREE.GLTFExporter: Morph target name not found: ' + sourceTrackBinding.propertyIndex );
}
......
......@@ -99,7 +99,7 @@ var MMDExporter = function () {
if ( skin.isSkinnedMesh !== true ) {
console.warn( 'MMDExporter: parseVpd() requires SkinnedMesh instance.' );
console.warn( 'THREE.MMDExporter: parseVpd() requires SkinnedMesh instance.' );
return null;
}
......
......@@ -164,7 +164,7 @@ OBJExporter.prototype = {
} else {
console.warn( 'OBJExporter.parseMesh(): geometry type unsupported', geometry );
console.warn( 'THREE.OBJExporter.parseMesh(): geometry type unsupported', geometry );
}
......@@ -240,7 +240,7 @@ OBJExporter.prototype = {
} else {
console.warn( 'OBJExporter.parseLine(): geometry type unsupported', geometry );
console.warn( 'THREE.OBJExporter.parseLine(): geometry type unsupported', geometry );
}
......
......@@ -28,7 +28,7 @@ PLYExporter.prototype = {
if ( onDone && typeof onDone === 'object' ) {
console.warn( 'PLYExporter: The options parameter is now the third argument to the "parse" function. See the documentation for the new API.' );
console.warn( 'THREE.PLYExporter: The options parameter is now the third argument to the "parse" function. See the documentation for the new API.' );
options = onDone;
onDone = undefined;
......
......@@ -44,7 +44,7 @@ import {
Loader,
LoaderUtils,
Material,
Math,
Math as _Math,
Matrix3,
Matrix4,
Mesh,
......@@ -2793,7 +2793,7 @@ var GLTFLoader = ( function () {
if ( cameraDef.type === 'perspective' ) {
camera = new PerspectiveCamera( Math.radToDeg( params.yfov ), params.aspectRatio || 1, params.znear || 1, params.zfar || 2e6 );
camera = new PerspectiveCamera( _Math.radToDeg( params.yfov ), params.aspectRatio || 1, params.znear || 1, params.zfar || 2e6 );
} else if ( cameraDef.type === 'orthographic' ) {
......
......@@ -82,12 +82,13 @@ function convert( path, ignoreList ) {
// constants
contents = contents.replace( /THREE\.([a-zA-Z0-9]+)/g, function ( match, p1 ) {
contents = contents.replace( /(\'?)THREE\.([a-zA-Z0-9]+)/g, function ( match, p1, p2 ) {
if ( ignoreList.includes( p1 ) ) return match;
if ( p1 === className ) return p1;
if ( ignoreList.includes( p2 ) ) return match;
if ( p1 === '\'' ) return match; // Inside a string
if ( p2 === className ) return p2;
if ( p1 === 'Math' || p1 === '_Math' ) {
if ( p2 === 'Math' || p2 === '_Math' ) {
dependencies[ '_Math' ] = true;
......@@ -95,11 +96,11 @@ function convert( path, ignoreList ) {
}
dependencies[ p1 ] = true;
dependencies[ p2 ] = true;
// console.log( match, p1 );
// console.log( match, p2 );
return `${p1}`;
return `${p2}`;
} );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册