Reputation: 25934
Have you come across this erro: "uncaught syntaxError unexpected token"
When loading a model exported from Blender 2.63a with the three exporter addon?
From this code copied from three.js github example
var loader = new THREE.JSONLoader();
loader.load( {"buffalo.js", function(geo){createModel(geo)}});
Thanks Regards Chris
Upvotes: 1
Views: 1248
Reputation: 31
Check whether the model has a material. Search in buffalo.s
for the string: "material" : ,
. If you find that string, your model has no material assigned - bad syntax error appears! Go to blender, assign material, and export again to buffalo.js
.
Not working:
...
"objects" :
{
"Monkey" : {
"geometry" : "geo_Monkey",
"groups" : [ ],
"material" : ,
"position" : [ -0.150241, 5.41906, 2.96394 ],
"rotation" : [ 0.874236, 0.0220203, -3.11527 ],
"quaternion": [ 0.00726118, 0.0155444, -0.423137, -0.905903 ],
"scale" : [ 2.9257, 2.86503, 2.68207 ],
"visible" : true,
"castShadow" : false,
"receiveShadow" : false,
"doubleSided" : false
},
...
},
...
Working:
...
"objects" :
{
"Monkey" : {
"geometry" : "geo_Monkey",
"groups" : [ ],
"material" : "Material",
"position" : [ -0.150241, 5.41906, 2.96394 ],
"rotation" : [ 0.874236, 0.0220203, -3.11527 ],
"quaternion": [ 0.00726118, 0.0155444, -0.423137, -0.905903 ],
"scale" : [ 2.9257, 2.86503, 2.68207 ],
"visible" : true,
"castShadow" : false,
"receiveShadow" : false,
"doubleSided" : false
},
...
},
...
Upvotes: 3
Reputation: 25934
I got this working by leaving out the JSON signature of the load function. Like this:
loader = new THREE.JSONLoader();
loader.load( 'buffalo.js',function( geo )
{
....
Hope this helps Regards
Upvotes: 1