Blender2Babylon exporter - Error: Function.frame expected an int type, not float

In Blender 3.3.1, I took a simple box, added key frames on location for frame 1, moved the box a simple distance up, added key frames for location at frame 20. When I try to export it for .babylon type, I get the following error:

Exporter version: 3.3-beta 1, Blender version: 3.3.1
========= Conversion from Blender to Babylon.js =========
	Scene settings used :
		Inline textures     :  false
		Material Type       :  PBR
		Positions Precision :  4
		Normals Precision   :  3
		UVs Precision       :  3
		Vert Color Precision:  3
		Mat Weight Precision:  2
		Keep Z-up r-handed  :  no
		Texture directory   :  C:\Data\Blender\box\
	Python World class constructor completed
	processing begun of mesh:  Cube
		animation processing begun
========= An error was encountered =========
  File "C:\Users\xxxxx\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\babylon_js\json_exporter.py", line 116, in execute
    mesh = Mesh(object, scene, self)
  File "C:\Users\xxxxx\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\babylon_js\mesh.py", line 49, in __init__
    self.define_animations(bpyMesh, True, True, True)
  File "C:\Users\xxxxx\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\babylon_js\f_curve_animatable.py", line 51, in define_animations
    hasData = rotAnimation.append_range(object, animationRange)
  File "C:\Users\xxxxx\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\babylon_js\animation.py", line 111, in append_range
    bpy.context.scene.frame_set(animationRange.frames_in[idx])
ERROR:  Scene.frame_set(): error with argument 1, "frame" -  Function.frame expected an int type, not float
========= end of processing =========
elapsed time:  0 min, 0.3594 secs

Note: same post reported here: Not able to export animation frames · Issue #61 · BabylonJS/BlenderExporter · GitHub

@JCPalmer will have a look really shortly there I bet.

Thanks a lot @JCPalmer for your amazing support of the Blender exporter :slight_smile:

Ok, Blender now sometimes returns floating point frame numbers. In this case, 1.0, 10.0, & 20.0. Did not go back to see if this was a change by Blender, or just the way things got added always did that.

math.trunc() solved this. The blend exported, and ran in sandbox showing animation, after Auto launch non-skeleton animations was checked in world properties. Will probably have a new zip file by EOD eastern. Will notify / close issue to let you know.

1 Like