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\", line 116, in execute
    mesh = Mesh(object, scene, self)
  File "C:\Users\xxxxx\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\babylon_js\", 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\", 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\", line 111, in append_range
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