Gltf-blender-io: simple scene with animation causes exporter to crash

Created on 7 Nov 2018  路  18Comments  路  Source: KhronosGroup/glTF-Blender-IO

Here is the blender scene (v2.79)
untitled.zip

And this is the error that the latest TOT produces:

`INFO: Starting glTF 2.0 export
Traceback (most recent call last):
File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_gltf2__init__.py", line 370, in execute
return gltf2_blender_export.save(self, context, export_settings)
File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_export.py", line 62, in save
scenes, animations = gltf2_blender_gather.gather_gltf2(export_settings)
File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather.py", line 32, in gather_gltf2
animations += __gather_animations(blender_scene, export_settings)
File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather.py", line 60, in __gather_animations
animations += gltf2_blender_gather_animations.gather_animations(blender_object, export_settings)
File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_animations.py", line 39, in gather_animations
animation = __gather_animation(blender_action, blender_object, export_settings)
File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_animations.py", line 54, in __gather_animation
channels=__gather_channels(blender_action, blender_object, export_settings),
File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_animations.py", line 84, in __gather_channels
return gltf2_blender_gather_animation_channels.gather_animation_channels(blender_action, blender_object, export_settings)
File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 50, in wrapper_cached
result = func(args)
File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_animation_channels.py", line 31, in gather_animation_channels
channel = __gather_animation_channel(channel_group, blender_object, export_settings)
File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_animation_channels.py", line 48, in __gather_animation_channel
sampler=__gather_sampler(channels, blender_object, export_settings),
File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_animation_channels.py", line 81, in __gather_sampler
export_settings
File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 50, in wrapper_cached
result = func(
args)
File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_animation_samplers.py", line 36, in gather_animation_sampler
input=__gather_input(channels, blender_object, export_settings),
File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_animation_samplers.py", line 61, in __gather_input
keyframes = __gather_keyframes(channels, export_settings)
File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 50, in wrapper_cached
result = func(*args)
File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_animation_samplers.py", line 294, in __gather_keyframes
for c in channels
File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_animation_samplers.py", line 294, in
for c in channels
IndexError: list index out of range

location: :-1`

Cheers and thanks for a great tool!

bug exporter

All 18 comments

I reproduced it on a simplier file:

  • On default Cube, frame 1, insert keyframe on location X, Y and Z
  • On default Cube, frame 10, insert keyframe on location Z only
    --> Try to export

Same error with shift animation on 2 differents keyframes. See file in attachment
untitled.blend.zip

the problem leading to a crash in the exporter is fixed, but there still seems to be a problem with the .gltf of the original file by @aguaviva.

the animation should now work as expected in the .gltf.
@aguaviva you might need to move some keyframes into the playback range and/or extend it

It doesn't crash anymore but the animation is incorrect. You can repro that by importing the model again. Also the materials colors seem to be gone.

Material colors are currently not supported by the exporter. It is trivial to implement if you really need it though.

I can see what is wrong after importing it, but the exported .gltf seems to animate as specified in blender. So I suppose it's an import issue.

54 is the material factor issue

@UX3D-becher my gltf visualizer animates the scene in the same exact way blender does after importing it. And so far it has been working with all the models I have tested it with.

which one do you use?

A visualizer that is not public yet :)

material factors are now exported with 0e80d7c37d7faa28cfd4f35c429280de9a54b75f

Thanks! As for this being an issue of the importer, I am not so sure TBH. What other test could you use to determine what is causing the issue?

I think the best action would be to wait for a response from Julien. He might be able to tell us what could trigger the wrongful behaviour.
Currently neither the validation nor Babylon or three.js notice a problem.

by validating, you mean that the animations display properly on other visualizers? then you've got a point there

I meant using the validator https://github.com/KhronosGroup/glTF-Validator
Of course if there is something strange with the exported gltf we should fix the exporter. Otherwise there may be an ambiguity in the spec, which could also explain the differing behaviour.

I just inspected the binary buffers using VisualStudio and I noticed where the shrinking rectangle is coming from. If you look at the time line, when the time is 0, that gives us an index of 0, and in the table on the left hand side with the scales that means a (0,0,0), if the time is 1.6 that gives us the next value in the scales table, which is (1,1,1), and hence for intermediate values it makes the thing shink and grow

image

On the other hand this viewer displays the right results, however a box that should be spinning is still

Hello,
I didn't implement import of CUBICSPLINE interpolation yet. That's why the animation is weird.

I will close this ticket, because original export bug is now fixed, and open a new one for enhancement about animation import

you are absolutely right, I forgot about the interpolation method, I was using linear instead of cubic! Thanks for the help!

Was this page helpful?
0 / 5 - 0 ratings