Threejs Blender 导出器以错误的格式导出 [英] Threejs blender exporter exports in wrong format
问题描述
我正在尝试借助提供的 搅拌机出口商.解析 json 文件时出现错误:
I'm trying to export a blender model to threejs json with the help of the provided blender exporter. On parsing the json file I get an error:
Uncaught TypeError: Cannot read property 'length' of undefined
json 文件如下所示(省略顶点和面):
The json file looks as following (ommiting vertices and faces):
{
"textures": [],
"metadata": {
"version": 4.3,
"sourceFile": "UV-World.blend",
"type": "Object",
"generator": "io_three"
},
"images": [],
"materials": [],
"object": {
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],
"children": [{
"type": "Mesh",
"name": "Kugel",
"uuid": "5051D840-9982-4F9A-8CFF-36303B38E091",
"position": [0.0,0.0,0.0],
"rotation": [-1.5707964897155762,0.0,0.0],
"scale": [1.0,0.9999999403953552,0.9999999403953552],
"visible": true,
"castShadow": true,
"receiveShadow": true,
"geometry": "DEAE2CE2-9824-4F91-BE4C-1C80BEDC566A"
}],
"type": "Scene",
"uuid": "8C543616-2AB0-4D1D-B76D-549E32A0E468"
},
"geometries": [{
"type": "Geometry",
"data": {
"name": "KugelGeometry",
"metadata": {
"version": 3,
"faces": 512,
"vertices": 482,
"generator": "io_three"
},
"vertices": [...],
"faces": [...]
},
"uuid": "DEAE2CE2-9824-4F91-BE4C-1C80BEDC566A"
}]
}
这似乎不是threejs期望的格式 原来如此.如果我手动将json更改为以下三个js会按预期解析并显示模型.
This seems to be not in the format that threejs expects it to be. If I manually change the json to be the following threejs parses and displays the model as expected.
{
"scale": 1,
"vertices": [...],
"faces": [...]
}
向/从 obj 导出和导入按预期工作.
Exporting and importing to/from obj works as expected.
因为我找不到任何人也有这个问题,我猜这是一个使用错误.我是 Blender 的新手,所以也许我在那里做错了什么?我正在使用刚刚从存储库克隆的 Blender 2.73a 和 Threejs.
As I could not find anyone also having this problem, I guess it's a usage error. I'm new to blender, so maybe I did something wrong there? I'm using Blender 2.73a and threejs just cloned from the repository.
推荐答案
我怀疑您正在使用 JSONLoader
.尝试改用 ObjectLoader
.
I suspect you are using JSONLoader
. Try using ObjectLoader
instead.
这篇关于Threejs Blender 导出器以错误的格式导出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!