question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting a type error on trying to export armature with animations

See original GitHub issue

Describe the bug I am creating an FPS and using some arms I found with a model of a crossbow I made. The arms themselves will export just fine, and my crossbow does as well. However, once they are posed and I’ve put frames into an animation/action, I can’t export it.

To Reproduce Steps to reproduce the behavior:

  1. Go to File -> Export -> gltf 2.0
  2. Click on Export gltf 2.0
  3. See error

Expected behavior The file exports successfully as a .glb.

Screenshots

Python: Traceback (most recent call last):
  File "/usr/share/blender/2.93/scripts/addons/io_scene_gltf2/__init__.py", line 626, in execute
    return gltf2_blender_export.save(context, export_settings)
  File "/usr/share/blender/2.93/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_export.py", line 46, in save
    json, buffer = __export(export_settings)
  File "/usr/share/blender/2.93/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_export.py", line 63, in __export
    __gather_gltf(exporter, export_settings)
  File "/usr/share/blender/2.93/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_export.py", line 75, in __gather_gltf
    active_scene_idx, scenes, animations = gltf2_blender_gather.gather_gltf2(export_settings)
  File "/usr/share/blender/2.93/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather.py", line 39, in gather_gltf2
    animations += __gather_animations(blender_scene, export_settings)
  File "/usr/share/blender/2.93/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather.py", line 83, in __gather_animations
    animations_, merged_tracks = gltf2_blender_gather_animations.gather_animations(_blender_object, merged_tracks, len(animations), export_settings)
  File "/usr/share/blender/2.93/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py", line 76, in gather_animations
    animation = __gather_animation(blender_action, blender_object, export_settings)
  File "/usr/share/blender/2.93/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py", line 114, in __gather_animation
    channels=__gather_channels(blender_action, blender_object, export_settings),
  File "/usr/share/blender/2.93/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py", line 149, in __gather_channels
    return gltf2_blender_gather_animation_channels.gather_animation_channels(
  File "/usr/share/blender/2.93/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 65, in wrapper_cached
    result = func(*args)
  File "/usr/share/blender/2.93/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py", line 74, in gather_animation_channels
    channel = __gather_animation_channel(
  File "/usr/share/blender/2.93/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py", line 202, in __gather_animation_channel
    sampler=__gather_sampler(channels, blender_object, export_settings, bake_bone, bake_channel, bake_range_start, bake_range_end, action_name, driver_obj),
  File "/usr/share/blender/2.93/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py", line 254, in __gather_sampler
    return gltf2_blender_gather_animation_samplers.gather_animation_sampler(
  File "/usr/share/blender/2.93/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 65, in wrapper_cached
    result = func(*args)
  File "/usr/share/blender/2.93/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_samplers.py", line 67, in gather_animation_sampler
    input=__gather_input(channels, blender_object_if_armature, non_keyed_values,
  File "/usr/share/blender/2.93/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 65, in wrapper_cached
    result = func(*args)
  File "/usr/share/blender/2.93/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_samplers.py", line 235, in __gather_input
    keyframes = gltf2_blender_gather_animation_sampler_keyframes.gather_keyframes(blender_object_if_armature,
  File "/usr/share/blender/2.93/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 65, in wrapper_cached
    result = func(*args)
  File "/usr/share/blender/2.93/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py", line 231, in gather_keyframes
    mat = get_bone_matrix(
  File "/usr/share/blender/2.93/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 90, in wrapper_bonecache
    result = func(*args)
  File "/usr/share/blender/2.93/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py", line 159, in get_bone_matrix
    bpy.context.scene.frame_set(frame)
TypeError: Scene.frame_set(): error with argument 1, "frame" -  Function.frame expected an int type, not float

location: <unknown location>:-1

.blend file/ .gltf https://1.filedit.ch/1/VlLYnIJHjXzUJNoXXIkN.blend

Version

  • OS: Void Linux
  • Blender Version: 2.93.5

Additional context Is it possible I have an outdated version of this addon? Version shows as 1.6.16. This is more than likely me not realizing something with an animation lol, but I can’t seem to find a solution 😕

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
scurestcommented, Nov 17, 2021

Ok, that explains it.

The frame variable is indeed a float (it ultimately comes from fcurve.range), while scene.frame_set is documented to take an integer.

If I run C.scene.frame_set(1.0) in my Blender (Python 3.9) I get

<blender_console>:1: DeprecationWarning: an integer is required (got type float).
Implicit conversion to integers using __int__ is deprecated,
and may be removed in a future version of Python.

So I’m guessing this has actually been removed in 3.10.

Since some distros are ahead of the curve on their Python version, this should hopefully be fixed soon (before 3.0) to avoid a repeat of #1295. The quickest fix is just to replace it with frame_set(int(frame)) since the deprecation warning indicates that is what the current code is actually doing.

0reactions
chongmacommented, Nov 30, 2021

I had the same problem on Fedora 35 with default version of blender 2.93.5 with python 3.10. i changed to flatpak version 2.93.6 and everything works now

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error when trying to export mesh/armature FBX file to Unity
I have been trying to move a blend file with three animations from Blender to Unity. First I tried exporting the file from...
Read more >
Problem with Blender's .FBX export using the Armatures name ...
Blender puts a "|" when I export with the .FBX 7.4 method. This makes Unity tell me to go ... FBX and get...
Read more >
When trying to export a USD file with animation enabled I get ...
When trying to export a USD file with animation enabled I get a weird error. How can I solve it to be able...
Read more >
Show chat replay - YouTube
Blender(2.8/2.9):THE FUNDAMENTALS of Exporting Rigged characters to Unreal, Unity, or ANY GameEngine.
Read more >
Export animations the RIGHT way in Blender! - YouTube
Blender Output Settings Explained Step-by-Step! This beginner tutorial for Blender animation output settings will cover exporting your ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found