pissang / claygl

A WebGL graphic library for building scalable Web3D applications
http://claygl.xyz/
BSD 2-Clause "Simplified" License
2.81k stars 302 forks source link

TypeError: 'int' object is not iterable #34

Open nickkraakman opened 6 years ago

nickkraakman commented 6 years ago

Hi, just updated to the latest fbx2gltf.py (thanks again!), but my test FBX file now returns TypeError: 'int' object is not iterable. Here is the stack trace:

$ python fbx2gltf.py /tests/test.FBX
Traceback (most recent call last):
  File "fbx2gltf.py", line 1474, in <module>
    args.binary
  File "fbx2gltf.py", line 1329, in Convert
    lSceneIdx = ConvertScene(lScene, poseTime)
  File "fbx2gltf.py", line 904, in ConvertScene
    lNodeIdx = ConvertSceneNode(pScene, lRoot.GetChild(i), pPoseTime)
  File "fbx2gltf.py", line 889, in ConvertSceneNode
    lChildNodeIdx = ConvertSceneNode(pScene, pNode.GetChild(i), pPoseTime)
  File "fbx2gltf.py", line 854, in ConvertSceneNode
    lGLTFMesh['primitives'] += ConvertMesh(pScene, lNodeAttribute, pNode, lGLTFSkin, lClusters)
  File "fbx2gltf.py", line 639, in ConvertMesh
    lTmpIndex, lScaleU, lScaleV, lTranslationU, lTranslationV = ConvertToPBRMaterial(lMaterial)
TypeError: 'int' object is not iterable

This same FBX file worked with the previous version of fbx2gltf.py, and this FBX file can be opened with the official FBX Review tool. I tried different FBX files, and those did convert correctly and without errors.

Any idea what the problem could be?

pissang commented 6 years ago

Hi @nickkraakman , thanks for the bug report. Same issue with https://github.com/pissang/claygl/issues/31 . Just fixed in the commit https://github.com/pissang/claygl/commit/9ff18618d8d2c70d1801b4f858ba244d6a2d80b2 and works in my viewer now:)

screen shot 2018-01-04 at 11 21 22 pm

nickkraakman commented 6 years ago

Hi @pissang, that was quick! Perfect, thanks so much :-)

One more thing we ran into: now that GLB export is included, we can allow our users to upload FBX and OBJ files, which are then converted to GLB, which is great. However, it would also be amazing to allow them to upload glTF files (a .gltf + .bin file, or a .gltf + .bin + textures folder, either zipped or as multiple files in a folder) to convert to GLB, since GLB is what we want to use in the end.

Something like this, but then in Python of course :-)

I checked your code, and most functionality for this is already included in fbx2gltf.py, but it still requires some rewriting of course. Is this a feature you might consider adding?

pissang commented 6 years ago

It's a bit complex since I need to parse the glTF again in the script. Will take a look at it later this month. And perhaps I should change the name fbx2gltf ;)

nickkraakman commented 6 years ago

Haha, good point ;-)