瀏覽代碼

Add error for invalid skinIndices or skinWeights import data lengths. Fixes #4421

Peter Ehrlich 11 年之前
父節點
當前提交
1dadcc8838
共有 1 個文件被更改,包括 8 次插入0 次删除
  1. 8 0
      src/loaders/JSONLoader.js

+ 8 - 0
src/loaders/JSONLoader.js

@@ -452,6 +452,14 @@ THREE.JSONLoader.prototype.parse = function ( json, texturePath ) {
 		}
 
 		geometry.bones = json.bones;
+
+    if ( (geometry.bones.length > 0) && (
+      (geometry.skinWeights.length != geometry.skinIndices.length) ||
+      (geometry.skinWeights.length != geometry.vertices.length) ) ) {
+        console.warn('When skinning, number of vertices (' + geometry.vertices.length + '), skinIndices (' +
+          geometry.skinIndices.length + '), and skinWeights (' + geometry.skinWeights.length + ') should match.');
+    }
+
 		// could change this to json.animations[0] or remove completely
 		geometry.animation = json.animation;
 		geometry.animations = json.animations;