Three.js, Uncaught TypeError: Unable to read the 'type' property from undefined

I am trying to load a json file in html using the three.js command, but I encountered the following error:

> Uncaught TypeError: Cannot read property 'type' of undefined
THREE.ObjectLoader.parseObject @ three.js:13066
THREE.ObjectLoader.parse @ three.js:12706
(anonymous function) @ three.js:12677
(anonymous function) @ three.js:11761

I used the three.js (71) plugin for Blender (2.75a) to export from FBX to json.

I tried switching from ObjectLoader to JSONLoader, but I get a similar error, except that I cannot read the length of the property instead. Any idea?

I am using an example from https://github.com/master-atul/blender3js/dis/index.html

Here is a link to the json file I came across: http://we.tl/8a3rxgpqr5

The following is a snippet of json download code:

var characterGenerator = function () {
  var init = function () {
    var defer = q.defer();
    var mesh = null;
    var loader = new THREE.ObjectLoader();

    loader.load("assets/test_igor.json", function (geometry, materials) {
      for (var i = 0; i < materials.length; i++) {
        var m = materials[i];
        m.skinning = true;
      }
      mesh = new THREE.SkinnedMesh(geometry, new THREE.MeshFaceMaterial(materials));
      //mesh.rotation.y = 90;
      mesh.animator = function (animeName) {
        var selected = _.find(geometry.animations, {'name': animeName});
        var animation = new THREE.Animation(mesh, selected);
        animation.play();
      };
      defer.resolve(mesh);
    });
    return defer.promise;
  };

  return {
    init: init
  }
}();
+4

Source: https://habr.com/ru/post/1621146/


All Articles