Topic: Bug in smgr.getMeshFromFileIO ?

Incbin "cone.b3d"
Incbin "cube.b3d"
Incbin "cylinder.b3d"
Incbin "pyramid.b3d"
Incbin "sphere.b3d"
Incbin "plane.b3d"

Function CreatePlane:ianimatedmeshscenenode()
Local mtmp:ireadfile=device.getfilesystem().creatememoryreadfile(IncbinPtr("plane.b3d"),IncbinLen("plane.b3d"),"Plane.b3d",False)
Local mtmpb:ianimatedmeshscenenode=smgr.addanimatedmeshscenenode(smgr.getMeshFromFileIO(mtmp))
mtmpb.setmaterialflag(emf_lighting,False)
mtmp.drop()
Return mtmpb
End Function

Function CreateCone:ianimatedmeshscenenode()
Local mtmp:ireadfile=device.getfilesystem().creatememoryreadfile(IncbinPtr("cone.b3d"),IncbinLen("cone.b3d"),"Cone.b3d",False)
Local mtmpb:ianimatedmeshscenenode=smgr.addanimatedmeshscenenode(smgr.getMeshFromFileIO(mtmp))
mtmpb.setmaterialflag(emf_lighting,False)
mtmp.drop()
Return mtmpb
End Function

Function CreateCube:ianimatedmeshscenenode()
Local mtmp:ireadfile=device.getfilesystem().creatememoryreadfile(IncbinPtr("cube.b3d"),IncbinLen("cube.b3d"),"Cube.b3d",False)
Local mtmpb:ianimatedmeshscenenode=smgr.addanimatedmeshscenenode(smgr.getMeshFromFileIO(mtmp))
mtmpb.setmaterialflag(emf_lighting,False)
mtmp.drop()
Return mtmpb
End Function

Function CreateCylinder:ianimatedmeshscenenode()
Local mtmp:ireadfile=device.getfilesystem().creatememoryreadfile(IncbinPtr("cylinder.b3d"),IncbinLen("cylinder.b3d"),"Cylinder.b3d",False)
Local mtmpb:ianimatedmeshscenenode=smgr.addanimatedmeshscenenode(smgr.getMeshFromFileIO(mtmp))
mtmpb.setmaterialflag(emf_lighting,False)
mtmp.drop()
Return mtmpb
End Function

Function CreatePyramid:ianimatedmeshscenenode()
Local mtmp:ireadfile=device.getfilesystem().creatememoryreadfile(IncbinPtr("pyramid.b3d"),IncbinLen("pyramid.b3d"),"Pyramid.b3d",False)
Local mtmpb:ianimatedmeshscenenode=smgr.addanimatedmeshscenenode(smgr.getMeshFromFileIO(mtmp))
mtmpb.setmaterialflag(emf_lighting,False)
mtmp.drop()
Return mtmpb
End Function

Function CreateSphere:ianimatedmeshscenenode()
Local mtmp:ireadfile=device.getfilesystem().creatememoryreadfile(IncbinPtr("sphere.b3d"),IncbinLen("sphere.b3d"),"Sphere.b3d",False)
Local mtmpb:ianimatedmeshscenenode=smgr.addanimatedmeshscenenode(smgr.getMeshFromFileIO(mtmp))
mtmpb.setmaterialflag(emf_lighting,False)
mtmp.drop()
Return mtmpb
End Function

Re: Bug in smgr.getMeshFromFileIO ?

greetings porcus!  its been a while i hope all is well smile  thank you very much for the detailed bug report and especially the compilable code.  it really helps when troubleshooting issues.  you were correct in there was an issue with the getMeshFromFileIO method.  whenever a C++ object is wrapped, by the Irrlicht mod i must be sure to say whether it needs dropped or not.  essentially, any method that starts with "create" i must be sure to tell the wrapping BMAX type to decrement the internal reference counter when dropped.  anything that starts with "add" or "get" i must tell it to not decrement the counter.  in this instance i incorrectly told it to decrement when it should not, causing the exception.  a new version of the mod has been uploaded with the appropriate fix.  you may download it by visiting the v1.6 announcements forum entry.