Getting a type error on trying to export armature with animations
See original GitHub issueDescribe 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:
- Go to File -> Export -> gltf 2.0
- Click on Export gltf 2.0
- 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:
- Created 2 years ago
- Comments:8 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok, that explains it.
The frame variable is indeed a float (it ultimately comes from
fcurve.range
), whilescene.frame_set
is documented to take an integer.If I run
C.scene.frame_set(1.0)
in my Blender (Python 3.9) I getSo 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.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