kcoley / gltf2usd

command-line utility for converting glTF 2.0 models to USD
MIT License
263 stars 39 forks source link

USD conversion stoped working #181

Closed ghost closed 4 years ago

ghost commented 4 years ago

This glTF can't get converted:

$ export PYTHONPATH="/usr/local/USD/lib/python" && python /usr/local/gltf2usd/Source/gltf2usd.py -g /var/app/current/tmp/1575031728-28148742/model_with_local_uris.gltf
 -o /var/app/current/tmp/1575031728-28148742/dist.usdz
Traceback (most recent call last):
  File "/usr/local/gltf2usd/Source/gltf2usd.py", line 923, in <module>
    convert_to_usd(os.path.expanduser(args.gltf_file), os.path.abspath(os.path.expanduser(args.usd_file)), args.fps, args.scale, args.arkit, args.verbose, args.use_euler_rotation, args.optimize_textures, args.generate_texture_transform_texture, args.scale_texture)
  File "/usr/local/gltf2usd/Source/gltf2usd.py", line 832, in convert_to_usd
    usd = GLTF2USD(gltf_file=gltf_file, usd_file=temp_usd_file, fps=fps, scale=scale, verbose=verbose, use_euler_rotation=use_euler_rotation, optimize_textures=optimize_textures, generate_texture_transform_texture=generate_texture_transform_texture, scale_texture=scale_texture)
  File "/usr/local/gltf2usd/Source/gltf2usd.py", line 56, in __init__
    self.gltf_loader = GLTF2Loader(gltf_file, optimize_textures, generate_texture_transform_texture)
  File "/usr/local/gltf2usd/Source/_gltf2usd/gltf2loader.py", line 117, in __init__
    self._initialize()
  File "/usr/local/gltf2usd/Source/_gltf2usd/gltf2loader.py", line 125, in _initialize
    self._initialize_meshes()
  File "/usr/local/gltf2usd/Source/_gltf2usd/gltf2loader.py", line 212, in _initialize_meshes
    mesh = Mesh(mesh_entry, i, self)
  File "/usr/local/gltf2usd/Source/_gltf2usd/gltf2/Mesh.py", line 124, in __init__
    primitive = Primitive(primitive_entry, i, self, gltf_loader)
  File "/usr/local/gltf2usd/Source/_gltf2usd/gltf2/Mesh.py", line 67, in __init__
    data = gltf_loader.get_data(accessor, accessor_index)
  File "/usr/local/gltf2usd/Source/_gltf2usd/gltf2loader.py", line 255, in get_data
    bufferview = self.json_data['bufferViews'][accessor['bufferView']]
KeyError: 'bufferView'
ghost commented 4 years ago

It seems this is due to the use of a draco mesh. I'm not sure if this should be fixed on your side. We will for now skip draco compression

kcoley commented 4 years ago

Yeah Draco support would be quite heavy for Python. There is another conversion tool hosted by Google that lists support for Draco meshes https://github.com/google/usd_from_gltf/blob/master/README.md