KhronosGroup / glTF-Blender-IO

Blender glTF 2.0 importer and exporter
https://docs.blender.org/manual/en/latest/addons/import_export/scene_gltf2.html
Apache License 2.0
1.5k stars 319 forks source link

Animation drivers not baked in Scene mode unless at least one keyframe is set #2414

Open The0Dev opened 5 days ago

The0Dev commented 5 days ago

Describe the bug Animations driven by drivers are not baked in the Scene animation mode unless at least one keyframe is set on any object.

To Reproduce Steps to reproduce the behavior:

  1. Open the attached .blend file.
  2. Export the scene to the glTF format using the Scene animation mode (toggle Animation Pointer).
  3. Import the exported file back into Blender.
  4. Observe the result: the material animation is missing.
  5. Set at least one keyframe on the Plane or its material (or on some other object) and repeat steps 2 to 4: animation is there

Expected behavior Animations should be baked and exported correctly, even if no keyframes were set.

Screenshots animation_example

.blend file/ .gltf (mandatory) material_texture_anim.zip

Additional context

Using Scene option, animations will be exported as you can see them in viewport. You can choose to export a single glTF animation, or each object separately.

In this case, I think drivers should be baked even if nothing was animated with regular keyframes.

Version

julienduroure commented 4 days ago

Confirmed.

We currently have a check that avoid to bake the scene if there is no animation in it. Here: https://github.com/KhronosGroup/glTF-Blender-IO/blob/0b885358ab6a0fe7fe1a089affe568fe377ca745/addons/io_scene_gltf2/blender/exp/animation/scene_animation.py#L30

This check is a little too strict, as drivers are not detected, so we skip the entire scene bake.