SMF - 3D skeletal animation - Now with a custom Blender exporter!

RetroBatter

Member
I'm trying to save an smf model through smf_model_save, but the function shows an error if I try to save a model that doesn't have a rig:
GML:
Variable <unknown_object>.nodeList(100251, -2147483648) not set before reading it.
 at gml_Script_smf_model_save (line 946) -        nodeList = rig.nodeList;
 

TheSnidr

Heavy metal viking dentist
GMC Elder
When you go to load a smf file sometimes it crashes in the model editor. Something to do with the rig itself. I tried the axe and it crashed.

as a request, can you make a 7th demo for collisions with the hammer/axe, it would really help out with game generation.
and Can you bring that Zelda demo back but in the way the dwarf is? Not saying the camera follows but in the way the movement is now. Plus I would like a controller support for your demos. My XBox Contoller works on it using
var hInput = gamepad_axis_value(0, 0.5 < gp_axislh < -0.5)
on the 4th Demo for movement but its always diagonal. At least it works. :)
I'm trying to save an smf model through smf_model_save, but the function shows an error if I try to save a model that doesn't have a rig:
GML:
Variable <unknown_object>.nodeList(100251, -2147483648) not set before reading it.
at gml_Script_smf_model_save (line 946) -        nodeList = rig.nodeList;
Thank you so much for these error reports! I've fixed them both:
I'm going to play around with controllers, gonna see what I can do! Finally got myself an actual controller, been a keyboard-mouse guy until now.
I won't bring back the Zelda demo, I'd prefer to only use assets that are either free, or that I've made myself!
Besides, the Zelda demo used the ColMesh scripts that were previously included in the SMF system, but have been taken out and made into their own system. A big update to the ColMesh system is coming relatively soon!

Hello!
I got v095 somewhat running on GMS14
- couldn't get buffer->surface transfer to work [smf_model_load.gml], I think it's busted in 14 (v1.4.9999 Steam), so I'm getting textures from .png
- outline shader is glitchy [sh_smf_vertex_outline.shader]
- character control is wonky in Demo 6
- I don't know math for transformation matrices so I just punched in some constants for Demo 6 shadowmap [smf_shadowmap_create.gml, smf_shadowmap_set_view.gml]
Would be great if somebody could fix it up or port a newer version
Original v095 GMS2 source https://forum.yoyogames.com/index.php?threads/smf-3d-skeletal-animation.19806/post-279300
Thanks in advance if somebody does that and either way thanks so much TheSnidr for this!
Whoa, you ported the whole thing? :O That's dedication!
 
what I meant was not use the Zelda character but use some other toon like your dwarf instead.
Oh this is a random comment you might find funny: AVG the Antivirus keeps tagging your program for being a malicious program, but every time it goes to AVG it gets flagged "not a threat" from the staff on the other end. I think the staff is sick of it by now. :)
 
Last edited:

RetroBatter

Member
How would I use the collision scripts on a .smf model? I know how to do it with an .obj model, but I'm confused on adding a colmesh to an smf model.
 
Whoa, you ported the whole thing? :O That's dedication!
Thanks! To be honest I used a conversion program and then just had to change some things to get it running

I've got outline shader working now and added some functions for shadow maps so they kinda almost work.
I can make them work with a hack.
Also found a hack that makes collisions not glitch on movement. Somersault on Jump3 still bugs out but that's the only thing as far as I can tell.
So there are 3 hacks now (yeah, so almost Bethesda or CDPR territory): in [zeldaclone_init] and [oDemo6Player.Step] and texture loading from sprites in [smf_model_load]
This is as far as I go probably. I don't know anything about 3d models or shaders and I'm pretty happy with how it is now. Still would be great if somebody could properly fix those things.
SMFv95.jpg
 
Last edited:

Yal

🐧 *penguin noises*
GMC Elder
Two minor issues with the latest version:

  • The debug text in the bottom-left corner overlaps some of the buttons, I don't think that's intentional. (I can't really tell if it's debug text that never was intended for mortal end-users' eyes or a part of the interface, it's too informative :p)
    1611644975936.png
  • The "lock node" button is apparently great if you want a node to stay ion place, according to the tooltip.

...aaaaaaaaand also a big one: trying to load a rig from an existing model crashes because of a function being renamed or out of scope? (I did this with a completely unrigged model).

___________________________________________
############################################################################################
ERROR in
action number 1
of Step Event0
for object oAnimEditSystem:

Variable <unknown_object>.rig_create(102210, -2147483648) not set before reading it.
at gml_Script_smf_read_rig_from_buffer
############################################################################################
gml_Script_smf_read_rig_from_buffer (line -1)
gml_Script_rigeditor_press_buttons
gml_Script_press_buttons
gml_Object_oAnimEditSystem_Step_0


I was going to do a regression test with 0.9.7 since I happened to have it lying around in a dusty corner of my hard drive, but turns out the SMF rig loading was a completely new feature, so no luck with that x3 The user-friendliness of the interface has improved miles since 0.9.7, though!

Reusing animations between different models is pretty high on my wishlist, but since one could just copy the Animations / SampleStrips / AnimationMap in-game after loading a model I suppose there's no need to support this in the modelling tool.
 
Last edited:

TheSnidr

Heavy metal viking dentist
GMC Elder
Thank you for the bug report! I will fix it as soon as I am able! :D

EDIT:
Here's a hotfix, importing a rig from a different SMF model should work now:
 
Last edited:
  • Like
Reactions: Yal

Yal

🐧 *penguin noises*
GMC Elder
Please tell me how to make a character transparent. Alpha = 0.5. Thanks
If you just set alpha to 0.5 before drawing a 3D model, you will see triangles on the other side of the character (or worse, things that are behind the character get culled out because of depth testing even though you should see them). I think the easiest way is to
  1. set projection/shader etc
  2. change the drawing target to a screen-sized surface
  3. draw the character model
  4. set drawing mode to "only affect alpha channel, subtract"
  5. draw the environment (so you remove anything that's in front of the character since we erase now)
  6. reset the drawing target
  7. draw the surface to the screen on the GUI layer later, with draw_surface_ext so you can set alpaca to 0.5
3D and transparency doesn't mix well, a lot of games use dithered textures these days
 

haisupham

Member
If you just set alpha to 0.5 before drawing a 3D model, you will see triangles on the other side of the character (or worse, things that are behind the character get culled out because of depth testing even though you should see them). I think the easiest way is to
  1. set projection/shader etc
  2. change the drawing target to a screen-sized surface
  3. draw the character model
  4. set drawing mode to "only affect alpha channel, subtract"
  5. draw the environment (so you remove anything that's in front of the character since we erase now)
  6. reset the drawing target
  7. draw the surface to the screen on the GUI layer later, with draw_surface_ext so you can set alpaca to 0.5
3D and transparency doesn't mix well, a lot of games use dithered textures these days
Thanks for answering.
If there is more detail, it would be good
 

duran can

Member
which version works with html5? It gives me a lot of error too @TheSnidr
GML:
akten3d.js?FQWZB=2143337320:5053 The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu
GameMaker_Init @ akten3d.js?FQWZB=2143337320:5053
akten3d.js?FQWZB=2143337320:1834 Entering main loop...
akten3d.js?FQWZB=2143337320:1834 Error: undefined
--------------------------------------------------------------------
    function _3b3(gml_Script_smf_instance, [instance], [undefined])
    function _xk(gml_Script_smf_instance, [instance], [undefined])
    function _sa([instance], [unknown], [undefined])
    function _b3([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function __C2(4, [unknown])
    function _FH3()
    function _eH3(4543.847)

akten3d.js?FQWZB=2143337320:1834 Unhandled Exception - Uncaught TypeError: Cannot read property '_ra' of undefined in file undefined at line undefined
akten3d.js?FQWZB=2143337320:1109 Uncaught TypeError: Cannot read property '_ra' of undefined
    at _lC3._xk (akten3d.js?FQWZB=2143337320:1109)
    at _sa (akten3d.js?FQWZB=2143337320:4906)
    at _Sk2._b3 [as _02] (akten3d.js?FQWZB=2143337320:1579)
    at _Sk2._TD (akten3d.js?FQWZB=2143337320:4548)
    at _J91._TD (akten3d.js?FQWZB=2143337320:4381)
    at __C2 (akten3d.js?FQWZB=2143337320:5065)
    at _FH3 (akten3d.js?FQWZB=2143337320:5067)
    at _eH3 (akten3d.js?FQWZB=2143337320:5057)
akten3d.js?FQWZB=2143337320:1834 Entering main loop...
akten3d.js?FQWZB=2143337320:1834 Error: undefined
--------------------------------------------------------------------
    function _3b3(gml_Script_smf_instance, [instance], [undefined])
    function _xk(gml_Script_smf_instance, [instance], [undefined])
    function _sa([instance], [unknown], [undefined])
    function _b3([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function __C2(4, [unknown])
    function _FH3()
    function _eH3(4552.188)

akten3d.js?FQWZB=2143337320:1834 Unhandled Exception - Uncaught TypeError: Cannot read property '_ra' of undefined in file undefined at line undefined
akten3d.js?FQWZB=2143337320:1109 Uncaught TypeError: Cannot read property '_ra' of undefined
    at _lC3._xk (akten3d.js?FQWZB=2143337320:1109)
    at _sa (akten3d.js?FQWZB=2143337320:4906)
    at _Sk2._b3 [as _02] (akten3d.js?FQWZB=2143337320:1579)
    at _Sk2._TD (akten3d.js?FQWZB=2143337320:4548)
    at _J91._TD (akten3d.js?FQWZB=2143337320:4381)
    at __C2 (akten3d.js?FQWZB=2143337320:5065)
    at _FH3 (akten3d.js?FQWZB=2143337320:5067)
    at _eH3 (akten3d.js?FQWZB=2143337320:5057)
akten3d.js?FQWZB=2143337320:1834 Entering main loop...
akten3d.js?FQWZB=2143337320:1834 Error: undefined
--------------------------------------------------------------------
    function _3b3(gml_Script_smf_instance, [instance], [undefined])
    function _xk(gml_Script_smf_instance, [instance], [undefined])
    function _sa([instance], [unknown], [undefined])
    function _b3([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function __C2(4, [unknown])
    function _FH3()
    function _eH3(4560.499)

akten3d.js?FQWZB=2143337320:1834 Unhandled Exception - Uncaught TypeError: Cannot read property '_ra' of undefined in file undefined at line undefined
akten3d.js?FQWZB=2143337320:1109 Uncaught TypeError: Cannot read property '_ra' of undefined
    at _lC3._xk (akten3d.js?FQWZB=2143337320:1109)
    at _sa (akten3d.js?FQWZB=2143337320:4906)
    at _Sk2._b3 [as _02] (akten3d.js?FQWZB=2143337320:1579)
    at _Sk2._TD (akten3d.js?FQWZB=2143337320:4548)
    at _J91._TD (akten3d.js?FQWZB=2143337320:4381)
    at __C2 (akten3d.js?FQWZB=2143337320:5065)
    at _FH3 (akten3d.js?FQWZB=2143337320:5067)
    at _eH3 (akten3d.js?FQWZB=2143337320:5057)
akten3d.js?FQWZB=2143337320:1834 Entering main loop...
akten3d.js?FQWZB=2143337320:1834 Error: undefined
--------------------------------------------------------------------
    function _3b3(gml_Script_smf_instance, [instance], [undefined])
    function _xk(gml_Script_smf_instance, [instance], [undefined])
    function _sa([instance], [unknown], [undefined])
    function _b3([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function __C2(4, [unknown])
    function _FH3()
    function _eH3(4568.905)

akten3d.js?FQWZB=2143337320:1834 Unhandled Exception - Uncaught TypeError: Cannot read property '_ra' of undefined in file undefined at line undefined
akten3d.js?FQWZB=2143337320:1109 Uncaught TypeError: Cannot read property '_ra' of undefined
    at _lC3._xk (akten3d.js?FQWZB=2143337320:1109)
    at _sa (akten3d.js?FQWZB=2143337320:4906)
    at _Sk2._b3 [as _02] (akten3d.js?FQWZB=2143337320:1579)
    at _Sk2._TD (akten3d.js?FQWZB=2143337320:4548)
    at _J91._TD (akten3d.js?FQWZB=2143337320:4381)
    at __C2 (akten3d.js?FQWZB=2143337320:5065)
    at _FH3 (akten3d.js?FQWZB=2143337320:5067)
    at _eH3 (akten3d.js?FQWZB=2143337320:5057)
akten3d.js?FQWZB=2143337320:1834 Entering main loop...
akten3d.js?FQWZB=2143337320:1834 Error: undefined
--------------------------------------------------------------------
    function _3b3(gml_Script_smf_instance, [instance], [undefined])
    function _xk(gml_Script_smf_instance, [instance], [undefined])
    function _sa([instance], [unknown], [undefined])
    function _b3([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function __C2(4, [unknown])
    function _FH3()
    function _eH3(4577.502)

akten3d.js?FQWZB=2143337320:1834 Unhandled Exception - Uncaught TypeError: Cannot read property '_ra' of undefined in file undefined at line undefined
akten3d.js?FQWZB=2143337320:1109 Uncaught TypeError: Cannot read property '_ra' of undefined
    at _lC3._xk (akten3d.js?FQWZB=2143337320:1109)
    at _sa (akten3d.js?FQWZB=2143337320:4906)
    at _Sk2._b3 [as _02] (akten3d.js?FQWZB=2143337320:1579)
    at _Sk2._TD (akten3d.js?FQWZB=2143337320:4548)
    at _J91._TD (akten3d.js?FQWZB=2143337320:4381)
    at __C2 (akten3d.js?FQWZB=2143337320:5065)
    at _FH3 (akten3d.js?FQWZB=2143337320:5067)
    at _eH3 (akten3d.js?FQWZB=2143337320:5057)
akten3d.js?FQWZB=2143337320:1834 Entering main loop...
akten3d.js?FQWZB=2143337320:1834 Error: undefined
--------------------------------------------------------------------
    function _3b3(gml_Script_smf_instance, [instance], [undefined])
    function _xk(gml_Script_smf_instance, [instance], [undefined])
    function _sa([instance], [unknown], [undefined])
    function _b3([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function __C2(4, [unknown])
    function _FH3()
    function _eH3(4585.572)

akten3d.js?FQWZB=2143337320:1834 Unhandled Exception - Uncaught TypeError: Cannot read property '_ra' of undefined in file undefined at line undefined
akten3d.js?FQWZB=2143337320:1109 Uncaught TypeError: Cannot read property '_ra' of undefined
    at _lC3._xk (akten3d.js?FQWZB=2143337320:1109)
    at _sa (akten3d.js?FQWZB=2143337320:4906)
    at _Sk2._b3 [as _02] (akten3d.js?FQWZB=2143337320:1579)
    at _Sk2._TD (akten3d.js?FQWZB=2143337320:4548)
    at _J91._TD (akten3d.js?FQWZB=2143337320:4381)
    at __C2 (akten3d.js?FQWZB=2143337320:5065)
    at _FH3 (akten3d.js?FQWZB=2143337320:5067)
    at _eH3 (akten3d.js?FQWZB=2143337320:5057)
akten3d.js?FQWZB=2143337320:1834 Entering main loop...
akten3d.js?FQWZB=2143337320:1834 Error: undefined
--------------------------------------------------------------------
    function _3b3(gml_Script_smf_instance, [instance], [undefined])
    function _xk(gml_Script_smf_instance, [instance], [undefined])
    function _sa([instance], [unknown], [undefined])
    function _b3([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function __C2(4, [unknown])
    function _FH3()
    function _eH3(4594.335)

akten3d.js?FQWZB=2143337320:1834 Unhandled Exception - Uncaught TypeError: Cannot read property '_ra' of undefined in file undefined at line undefined
akten3d.js?FQWZB=2143337320:1109 Uncaught TypeError: Cannot read property '_ra' of undefined
    at _lC3._xk (akten3d.js?FQWZB=2143337320:1109)
    at _sa (akten3d.js?FQWZB=2143337320:4906)
    at _Sk2._b3 [as _02] (akten3d.js?FQWZB=2143337320:1579)
    at _Sk2._TD (akten3d.js?FQWZB=2143337320:4548)
    at _J91._TD (akten3d.js?FQWZB=2143337320:4381)
    at __C2 (akten3d.js?FQWZB=2143337320:5065)
    at _FH3 (akten3d.js?FQWZB=2143337320:5067)
    at _eH3 (akten3d.js?FQWZB=2143337320:5057)
akten3d.js?FQWZB=2143337320:1834 Entering main loop...
akten3d.js?FQWZB=2143337320:1834 Error: undefined
--------------------------------------------------------------------
    function _3b3(gml_Script_smf_instance, [instance], [undefined])
    function _xk(gml_Script_smf_instance, [instance], [undefined])
    function _sa([instance], [unknown], [undefined])
    function _b3([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function __C2(4, [unknown])
    function _FH3()
    function _eH3(4602.486)

akten3d.js?FQWZB=2143337320:1834 Unhandled Exception - Uncaught TypeError: Cannot read property '_ra' of undefined in file undefined at line undefined
akten3d.js?FQWZB=2143337320:1109 Uncaught TypeError: Cannot read property '_ra' of undefined
    at _lC3._xk (akten3d.js?FQWZB=2143337320:1109)
    at _sa (akten3d.js?FQWZB=2143337320:4906)
    at _Sk2._b3 [as _02] (akten3d.js?FQWZB=2143337320:1579)
    at _Sk2._TD (akten3d.js?FQWZB=2143337320:4548)
    at _J91._TD (akten3d.js?FQWZB=2143337320:4381)
    at __C2 (akten3d.js?FQWZB=2143337320:5065)
    at _FH3 (akten3d.js?FQWZB=2143337320:5067)
    at _eH3 (akten3d.js?FQWZB=2143337320:5057)
akten3d.js?FQWZB=2143337320:1834 Entering main loop...
akten3d.js?FQWZB=2143337320:1834 Error: undefined
--------------------------------------------------------------------
    function _3b3(gml_Script_smf_instance, [instance], [undefined])
    function _xk(gml_Script_smf_instance, [instance], [undefined])
    function _sa([instance], [unknown], [undefined])
    function _b3([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function __C2(4, [unknown])
    function _FH3()
    function _eH3(4610.742)

akten3d.js?FQWZB=2143337320:1834 Unhandled Exception - Uncaught TypeError: Cannot read property '_ra' of undefined in file undefined at line undefined
akten3d.js?FQWZB=2143337320:1109 Uncaught TypeError: Cannot read property '_ra' of undefined
    at _lC3._xk (akten3d.js?FQWZB=2143337320:1109)
    at _sa (akten3d.js?FQWZB=2143337320:4906)
    at _Sk2._b3 [as _02] (akten3d.js?FQWZB=2143337320:1579)
    at _Sk2._TD (akten3d.js?FQWZB=2143337320:4548)
    at _J91._TD (akten3d.js?FQWZB=2143337320:4381)
    at __C2 (akten3d.js?FQWZB=2143337320:5065)
    at _FH3 (akten3d.js?FQWZB=2143337320:5067)
    at _eH3 (akten3d.js?FQWZB=2143337320:5057)
akten3d.js?FQWZB=2143337320:1834 Entering main loop...
akten3d.js?FQWZB=2143337320:1834 Error: undefined
--------------------------------------------------------------------
    function _3b3(gml_Script_smf_instance, [instance], [undefined])
    function _xk(gml_Script_smf_instance, [instance], [undefined])
    function _sa([instance], [unknown], [undefined])
    function _b3([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function __C2(4, [unknown])
    function _FH3()
    function _eH3(4619.153)

akten3d.js?FQWZB=2143337320:1834 Unhandled Exception - Uncaught TypeError: Cannot read property '_ra' of undefined in file undefined at line undefined
akten3d.js?FQWZB=2143337320:1109 Uncaught TypeError: Cannot read property '_ra' of undefined
    at _lC3._xk (akten3d.js?FQWZB=2143337320:1109)
    at _sa (akten3d.js?FQWZB=2143337320:4906)
    at _Sk2._b3 [as _02] (akten3d.js?FQWZB=2143337320:1579)
    at _Sk2._TD (akten3d.js?FQWZB=2143337320:4548)
    at _J91._TD (akten3d.js?FQWZB=2143337320:4381)
    at __C2 (akten3d.js?FQWZB=2143337320:5065)
    at _FH3 (akten3d.js?FQWZB=2143337320:5067)
    at _eH3 (akten3d.js?FQWZB=2143337320:5057)
akten3d.js?FQWZB=2143337320:1834 Entering main loop...
akten3d.js?FQWZB=2143337320:1834 Error: undefined
--------------------------------------------------------------------
    function _3b3(gml_Script_smf_instance, [instance], [undefined])
    function _xk(gml_Script_smf_instance, [instance], [undefined])
    function _sa([instance], [unknown], [undefined])
    function _b3([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function __C2(4, [unknown])
    function _FH3()
    function _eH3(4627.212)

akten3d.js?FQWZB=2143337320:1834 Unhandled Exception - Uncaught TypeError: Cannot read property '_ra' of undefined in file undefined at line undefined
akten3d.js?FQWZB=2143337320:1109 Uncaught TypeError: Cannot read property '_ra' of undefined
    at _lC3._xk (akten3d.js?FQWZB=2143337320:1109)
    at _sa (akten3d.js?FQWZB=2143337320:4906)
    at _Sk2._b3 [as _02] (akten3d.js?FQWZB=2143337320:1579)
    at _Sk2._TD (akten3d.js?FQWZB=2143337320:4548)
    at _J91._TD (akten3d.js?FQWZB=2143337320:4381)
    at __C2 (akten3d.js?FQWZB=2143337320:5065)
    at _FH3 (akten3d.js?FQWZB=2143337320:5067)
    at _eH3 (akten3d.js?FQWZB=2143337320:5057)
akten3d.js?FQWZB=2143337320:1834 Entering main loop...
akten3d.js?FQWZB=2143337320:1834 Error: undefined
--------------------------------------------------------------------
    function _3b3(gml_Script_smf_instance, [instance], [undefined])
    function _xk(gml_Script_smf_instance, [instance], [undefined])
    function _sa([instance], [unknown], [undefined])
    function _b3([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function __C2(4, [unknown])
    function _FH3()
    function _eH3(4635.459)

akten3d.js?FQWZB=2143337320:1834 Unhandled Exception - Uncaught TypeError: Cannot read property '_ra' of undefined in file undefined at line undefined
akten3d.js?FQWZB=2143337320:1109 Uncaught TypeError: Cannot read property '_ra' of undefined
    at _lC3._xk (akten3d.js?FQWZB=2143337320:1109)
    at _sa (akten3d.js?FQWZB=2143337320:4906)
    at _Sk2._b3 [as _02] (akten3d.js?FQWZB=2143337320:1579)
    at _Sk2._TD (akten3d.js?FQWZB=2143337320:4548)
    at _J91._TD (akten3d.js?FQWZB=2143337320:4381)
    at __C2 (akten3d.js?FQWZB=2143337320:5065)
    at _FH3 (akten3d.js?FQWZB=2143337320:5067)
    at _eH3 (akten3d.js?FQWZB=2143337320:5057)
akten3d.js?FQWZB=2143337320:1834 Entering main loop...
akten3d.js?FQWZB=2143337320:1834 Error: undefined
--------------------------------------------------------------------
    function _3b3(gml_Script_smf_instance, [instance], [undefined])
    function _xk(gml_Script_smf_instance, [instance], [undefined])
    function _sa([instance], [unknown], [undefined])
    function _b3([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function __C2(4, [unknown])
    function _FH3()
    function _eH3(4643.794)

akten3d.js?FQWZB=2143337320:1834 Unhandled Exception - Uncaught TypeError: Cannot read property '_ra' of undefined in file undefined at line undefined
akten3d.js?FQWZB=2143337320:1109 Uncaught TypeError: Cannot read property '_ra' of undefined
    at _lC3._xk (akten3d.js?FQWZB=2143337320:1109)
    at _sa (akten3d.js?FQWZB=2143337320:4906)
    at _Sk2._b3 [as _02] (akten3d.js?FQWZB=2143337320:1579)
    at _Sk2._TD (akten3d.js?FQWZB=2143337320:4548)
    at _J91._TD (akten3d.js?FQWZB=2143337320:4381)
    at __C2 (akten3d.js?FQWZB=2143337320:5065)
    at _FH3 (akten3d.js?FQWZB=2143337320:5067)
    at _eH3 (akten3d.js?FQWZB=2143337320:5057)
akten3d.js?FQWZB=2143337320:1834 Entering main loop...
akten3d.js?FQWZB=2143337320:1834 Error: undefined
--------------------------------------------------------------------
    function _3b3(gml_Script_smf_instance, [instance], [undefined])
    function _xk(gml_Script_smf_instance, [instance], [undefined])
    function _sa([instance], [unknown], [undefined])
    function _b3([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function __C2(4, [unknown])
    function _FH3()
    function _eH3(4652.129)

akten3d.js?FQWZB=2143337320:1834 Unhandled Exception - Uncaught TypeError: Cannot read property '_ra' of undefined in file undefined at line undefined
akten3d.js?FQWZB=2143337320:1109 Uncaught TypeError: Cannot read property '_ra' of undefined
    at _lC3._xk (akten3d.js?FQWZB=2143337320:1109)
    at _sa (akten3d.js?FQWZB=2143337320:4906)
    at _Sk2._b3 [as _02] (akten3d.js?FQWZB=2143337320:1579)
    at _Sk2._TD (akten3d.js?FQWZB=2143337320:4548)
    at _J91._TD (akten3d.js?FQWZB=2143337320:4381)
    at __C2 (akten3d.js?FQWZB=2143337320:5065)
    at _FH3 (akten3d.js?FQWZB=2143337320:5067)
    at _eH3 (akten3d.js?FQWZB=2143337320:5057)
akten3d.js?FQWZB=2143337320:1834 Entering main loop...
akten3d.js?FQWZB=2143337320:1834 Error: undefined
--------------------------------------------------------------------
    function _3b3(gml_Script_smf_instance, [instance], [undefined])
    function _xk(gml_Script_smf_instance, [instance], [undefined])
    function _sa([instance], [unknown], [undefined])
    function _b3([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function __C2(4, [unknown])
    function _FH3()
    function _eH3(4660.449)

akten3d.js?FQWZB=2143337320:1834 Unhandled Exception - Uncaught TypeError: Cannot read property '_ra' of undefined in file undefined at line undefined
akten3d.js?FQWZB=2143337320:1109 Uncaught TypeError: Cannot read property '_ra' of undefined
    at _lC3._xk (akten3d.js?FQWZB=2143337320:1109)
    at _sa (akten3d.js?FQWZB=2143337320:4906)
    at _Sk2._b3 [as _02] (akten3d.js?FQWZB=2143337320:1579)
    at _Sk2._TD (akten3d.js?FQWZB=2143337320:4548)
    at _J91._TD (akten3d.js?FQWZB=2143337320:4381)
    at __C2 (akten3d.js?FQWZB=2143337320:5065)
    at _FH3 (akten3d.js?FQWZB=2143337320:5067)
    at _eH3 (akten3d.js?FQWZB=2143337320:5057)
akten3d.js?FQWZB=2143337320:1834 Entering main loop...
akten3d.js?FQWZB=2143337320:1834 Error: undefined
--------------------------------------------------------------------
    function _3b3(gml_Script_smf_instance, [instance], [undefined])
    function _xk(gml_Script_smf_instance, [instance], [undefined])
    function _sa([instance], [unknown], [undefined])
    function _b3([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function __C2(4, [unknown])
    function _FH3()
    function _eH3(4668.8)

akten3d.js?FQWZB=2143337320:1834 Unhandled Exception - Uncaught TypeError: Cannot read property '_ra' of undefined in file undefined at line undefined
akten3d.js?FQWZB=2143337320:1109 Uncaught TypeError: Cannot read property '_ra' of undefined
    at _lC3._xk (akten3d.js?FQWZB=2143337320:1109)
    at _sa (akten3d.js?FQWZB=2143337320:4906)
    at _Sk2._b3 [as _02] (akten3d.js?FQWZB=2143337320:1579)
    at _Sk2._TD (akten3d.js?FQWZB=2143337320:4548)
    at _J91._TD (akten3d.js?FQWZB=2143337320:4381)
    at __C2 (akten3d.js?FQWZB=2143337320:5065)
    at _FH3 (akten3d.js?FQWZB=2143337320:5067)
    at _eH3 (akten3d.js?FQWZB=2143337320:5057)
akten3d.js?FQWZB=2143337320:1834 Entering main loop...
akten3d.js?FQWZB=2143337320:1834 Error: undefined
--------------------------------------------------------------------
    function _3b3(gml_Script_smf_instance, [instance], [undefined])
    function _xk(gml_Script_smf_instance, [instance], [undefined])
    function _sa([instance], [unknown], [undefined])
    function _b3([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function __C2(4, [unknown])
    function _FH3()
    function _eH3(4677.13)

akten3d.js?FQWZB=2143337320:1834 Unhandled Exception - Uncaught TypeError: Cannot read property '_ra' of undefined in file undefined at line undefined
akten3d.js?FQWZB=2143337320:1109 Uncaught TypeError: Cannot read property '_ra' of undefined
    at _lC3._xk (akten3d.js?FQWZB=2143337320:1109)
    at _sa (akten3d.js?FQWZB=2143337320:4906)
    at _Sk2._b3 [as _02] (akten3d.js?FQWZB=2143337320:1579)
    at _Sk2._TD (akten3d.js?FQWZB=2143337320:4548)
    at _J91._TD (akten3d.js?FQWZB=2143337320:4381)
    at __C2 (akten3d.js?FQWZB=2143337320:5065)
    at _FH3 (akten3d.js?FQWZB=2143337320:5067)
    at _eH3 (akten3d.js?FQWZB=2143337320:5057)
akten3d.js?FQWZB=2143337320:1834 Entering main loop...
akten3d.js?FQWZB=2143337320:1834 Error: undefined
--------------------------------------------------------------------
    function _3b3(gml_Script_smf_instance, [instance], [undefined])
    function _xk(gml_Script_smf_instance, [instance], [undefined])
    function _sa([instance], [unknown], [undefined])
    function _b3([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function __C2(4, [unknown])
    function _FH3()
    function _eH3(4685.439)

akten3d.js?FQWZB=2143337320:1834 Unhandled Exception - Uncaught TypeError: Cannot read property '_ra' of undefined in file undefined at line undefined
akten3d.js?FQWZB=2143337320:1109 Uncaught TypeError: Cannot read property '_ra' of undefined
    at _lC3._xk (akten3d.js?FQWZB=2143337320:1109)
    at _sa (akten3d.js?FQWZB=2143337320:4906)
    at _Sk2._b3 [as _02] (akten3d.js?FQWZB=2143337320:1579)
    at _Sk2._TD (akten3d.js?FQWZB=2143337320:4548)
    at _J91._TD (akten3d.js?FQWZB=2143337320:4381)
    at __C2 (akten3d.js?FQWZB=2143337320:5065)
    at _FH3 (akten3d.js?FQWZB=2143337320:5067)
    at _eH3 (akten3d.js?FQWZB=2143337320:5057)
akten3d.js?FQWZB=2143337320:1834 Entering main loop...
akten3d.js?FQWZB=2143337320:1834 Error: undefined
--------------------------------------------------------------------
    function _3b3(gml_Script_smf_instance, [instance], [undefined])
    function _xk(gml_Script_smf_instance, [instance], [undefined])
    function _sa([instance], [unknown], [undefined])
    function _b3([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function __C2(4, [unknown])
    function _FH3()
    function _eH3(4693.83)

akten3d.js?FQWZB=2143337320:1834 Unhandled Exception - Uncaught TypeError: Cannot read property '_ra' of undefined in file undefined at line undefined
akten3d.js?FQWZB=2143337320:1109 Uncaught TypeError: Cannot read property '_ra' of undefined
    at _lC3._xk (akten3d.js?FQWZB=2143337320:1109)
    at _sa (akten3d.js?FQWZB=2143337320:4906)
    at _Sk2._b3 [as _02] (akten3d.js?FQWZB=2143337320:1579)
    at _Sk2._TD (akten3d.js?FQWZB=2143337320:4548)
    at _J91._TD (akten3d.js?FQWZB=2143337320:4381)
    at __C2 (akten3d.js?FQWZB=2143337320:5065)
    at _FH3 (akten3d.js?FQWZB=2143337320:5067)
    at _eH3 (akten3d.js?FQWZB=2143337320:5057)
akten3d.js?FQWZB=2143337320:1834 Entering main loop...
akten3d.js?FQWZB=2143337320:1834 Error: undefined
--------------------------------------------------------------------
    function _3b3(gml_Script_smf_instance, [instance], [undefined])
    function _xk(gml_Script_smf_instance, [instance], [undefined])
    function _sa([instance], [unknown], [undefined])
    function _b3([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function __C2(4, [unknown])
    function _FH3()
    function _eH3(4702.123)

akten3d.js?FQWZB=2143337320:1834 Unhandled Exception - Uncaught TypeError: Cannot read property '_ra' of undefined in file undefined at line undefined
akten3d.js?FQWZB=2143337320:1109 Uncaught TypeError: Cannot read property '_ra' of undefined
    at _lC3._xk (akten3d.js?FQWZB=2143337320:1109)
    at _sa (akten3d.js?FQWZB=2143337320:4906)
    at _Sk2._b3 [as _02] (akten3d.js?FQWZB=2143337320:1579)
    at _Sk2._TD (akten3d.js?FQWZB=2143337320:4548)
    at _J91._TD (akten3d.js?FQWZB=2143337320:4381)
    at __C2 (akten3d.js?FQWZB=2143337320:5065)
    at _FH3 (akten3d.js?FQWZB=2143337320:5067)
    at _eH3 (akten3d.js?FQWZB=2143337320:5057)
akten3d.js?FQWZB=2143337320:1834 Entering main loop...
akten3d.js?FQWZB=2143337320:1834 Error: undefined
--------------------------------------------------------------------
    function _3b3(gml_Script_smf_instance, [instance], [undefined])
    function _xk(gml_Script_smf_instance, [instance], [undefined])
    function _sa([instance], [unknown], [undefined])
    function _b3([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function __C2(4, [unknown])
    function _FH3()
    function _eH3(4710.423)

akten3d.js?FQWZB=2143337320:1834 Unhandled Exception - Uncaught TypeError: Cannot read property '_ra' of undefined in file undefined at line undefined
akten3d.js?FQWZB=2143337320:1109 Uncaught TypeError: Cannot read property '_ra' of undefined
    at _lC3._xk (akten3d.js?FQWZB=2143337320:1109)
    at _sa (akten3d.js?FQWZB=2143337320:4906)
    at _Sk2._b3 [as _02] (akten3d.js?FQWZB=2143337320:1579)
    at _Sk2._TD (akten3d.js?FQWZB=2143337320:4548)
    at _J91._TD (akten3d.js?FQWZB=2143337320:4381)
    at __C2 (akten3d.js?FQWZB=2143337320:5065)
    at _FH3 (akten3d.js?FQWZB=2143337320:5067)
    at _eH3 (akten3d.js?FQWZB=2143337320:5057)
akten3d.js?FQWZB=2143337320:1834 Entering main loop...
akten3d.js?FQWZB=2143337320:1834 Error: undefined
--------------------------------------------------------------------
    function _3b3(gml_Script_smf_instance, [instance], [undefined])
    function _xk(gml_Script_smf_instance, [instance], [undefined])
    function _sa([instance], [unknown], [undefined])
    function _b3([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function __C2(4, [unknown])
    function _FH3()
    function _eH3(4718.768)

akten3d.js?FQWZB=2143337320:1834 Unhandled Exception - Uncaught TypeError: Cannot read property '_ra' of undefined in file undefined at line undefined
akten3d.js?FQWZB=2143337320:1109 Uncaught TypeError: Cannot read property '_ra' of undefined
    at _lC3._xk (akten3d.js?FQWZB=2143337320:1109)
    at _sa (akten3d.js?FQWZB=2143337320:4906)
    at _Sk2._b3 [as _02] (akten3d.js?FQWZB=2143337320:1579)
    at _Sk2._TD (akten3d.js?FQWZB=2143337320:4548)
    at _J91._TD (akten3d.js?FQWZB=2143337320:4381)
    at __C2 (akten3d.js?FQWZB=2143337320:5065)
    at _FH3 (akten3d.js?FQWZB=2143337320:5067)
    at _eH3 (akten3d.js?FQWZB=2143337320:5057)
akten3d.js?FQWZB=2143337320:1834 Entering main loop...
akten3d.js?FQWZB=2143337320:1834 Error: undefined
--------------------------------------------------------------------
    function _3b3(gml_Script_smf_instance, [instance], [undefined])
    function _xk(gml_Script_smf_instance, [instance], [undefined])
    function _sa([instance], [unknown], [undefined])
    function _b3([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function __C2(4, [unknown])
    function _FH3()
    function _eH3(4727.108)

akten3d.js?FQWZB=2143337320:1834 Unhandled Exception - Uncaught TypeError: Cannot read property '_ra' of undefined in file undefined at line undefined
akten3d.js?FQWZB=2143337320:1109 Uncaught TypeError: Cannot read property '_ra' of undefined
    at _lC3._xk (akten3d.js?FQWZB=2143337320:1109)
    at _sa (akten3d.js?FQWZB=2143337320:4906)
    at _Sk2._b3 [as _02] (akten3d.js?FQWZB=2143337320:1579)
    at _Sk2._TD (akten3d.js?FQWZB=2143337320:4548)
    at _J91._TD (akten3d.js?FQWZB=2143337320:4381)
    at __C2 (akten3d.js?FQWZB=2143337320:5065)
    at _FH3 (akten3d.js?FQWZB=2143337320:5067)
    at _eH3 (akten3d.js?FQWZB=2143337320:5057)
akten3d.js?FQWZB=2143337320:1834 Entering main loop...
akten3d.js?FQWZB=2143337320:1834 Error: undefined
--------------------------------------------------------------------
    function _3b3(gml_Script_smf_instance, [instance], [undefined])
    function _xk(gml_Script_smf_instance, [instance], [undefined])
    function _sa([instance], [unknown], [undefined])
    function _b3([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function __C2(4, [unknown])
    function _FH3()
    function _eH3(4735.475)

akten3d.js?FQWZB=2143337320:1834 Unhandled Exception - Uncaught TypeError: Cannot read property '_ra' of undefined in file undefined at line undefined
akten3d.js?FQWZB=2143337320:1109 Uncaught TypeError: Cannot read property '_ra' of undefined
    at _lC3._xk (akten3d.js?FQWZB=2143337320:1109)
    at _sa (akten3d.js?FQWZB=2143337320:4906)
    at _Sk2._b3 [as _02] (akten3d.js?FQWZB=2143337320:1579)
    at _Sk2._TD (akten3d.js?FQWZB=2143337320:4548)
    at _J91._TD (akten3d.js?FQWZB=2143337320:4381)
    at __C2 (akten3d.js?FQWZB=2143337320:5065)
    at _FH3 (akten3d.js?FQWZB=2143337320:5067)
    at _eH3 (akten3d.js?FQWZB=2143337320:5057)
akten3d.js?FQWZB=2143337320:1834 Entering main loop...
akten3d.js?FQWZB=2143337320:1834 Error: undefined
--------------------------------------------------------------------
    function _3b3(gml_Script_smf_instance, [instance], [undefined])
    function _xk(gml_Script_smf_instance, [instance], [undefined])
    function _sa([instance], [unknown], [undefined])
    function _b3([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function __C2(4, [unknown])
    function _FH3()
    function _eH3(4743.733)

akten3d.js?FQWZB=2143337320:1834 Unhandled Exception - Uncaught TypeError: Cannot read property '_ra' of undefined in file undefined at line undefined
akten3d.js?FQWZB=2143337320:1109 Uncaught TypeError: Cannot read property '_ra' of undefined
    at _lC3._xk (akten3d.js?FQWZB=2143337320:1109)
    at _sa (akten3d.js?FQWZB=2143337320:4906)
    at _Sk2._b3 [as _02] (akten3d.js?FQWZB=2143337320:1579)
    at _Sk2._TD (akten3d.js?FQWZB=2143337320:4548)
    at _J91._TD (akten3d.js?FQWZB=2143337320:4381)
    at __C2 (akten3d.js?FQWZB=2143337320:5065)
    at _FH3 (akten3d.js?FQWZB=2143337320:5067)
    at _eH3 (akten3d.js?FQWZB=2143337320:5057)
akten3d.js?FQWZB=2143337320:1834 Entering main loop...
akten3d.js?FQWZB=2143337320:1834 Error: undefined
--------------------------------------------------------------------
    function _3b3(gml_Script_smf_instance, [instance], [undefined])
    function _xk(gml_Script_smf_instance, [instance], [undefined])
    function _sa([instance], [unknown], [undefined])
    function _b3([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function __C2(4, [unknown])
    function _FH3()
    function _eH3(4752.126)

akten3d.js?FQWZB=2143337320:1834 Unhandled Exception - Uncaught TypeError: Cannot read property '_ra' of undefined in file undefined at line undefined
akten3d.js?FQWZB=2143337320:1109 Uncaught TypeError: Cannot read property '_ra' of undefined
    at _lC3._xk (akten3d.js?FQWZB=2143337320:1109)
    at _sa (akten3d.js?FQWZB=2143337320:4906)
    at _Sk2._b3 [as _02] (akten3d.js?FQWZB=2143337320:1579)
    at _Sk2._TD (akten3d.js?FQWZB=2143337320:4548)
    at _J91._TD (akten3d.js?FQWZB=2143337320:4381)
    at __C2 (akten3d.js?FQWZB=2143337320:5065)
    at _FH3 (akten3d.js?FQWZB=2143337320:5067)
    at _eH3 (akten3d.js?FQWZB=2143337320:5057)
akten3d.js?FQWZB=2143337320:1834 Entering main loop...
akten3d.js?FQWZB=2143337320:1834 Error: undefined
 

Yal

🐧 *penguin noises*
GMC Elder
I've been playing around a lot of more with SMF and I found some more issues! :D

First of all (this is a feature request and not a bug), I'd really like to see an option (in the animation segment) for rotating and moving the entire rig (i.e. all bones) around... I find myself finding a perfect pose but having the character partway through the ground / hovering a bit above the ground a lot, and there's no way to just align them properly without moving every node separately (and thus breaking that perfect pose).
Moving is the big thing for me personally, but I can imagine rotating the entire rig around a point makes certain animations (e.g. dodgerolls) a lot easier to key out. With moving in place, rotating around the model origin probably is enough (since you can just translate it back to align properly) but computing the center and rotating around that probably is more user-friendly?

And now for the three two actual bugs!
Trying to reuse a texture you've already loaded (i.e. when the model consists of several Blender objects that share the same texture mapping) crashes the editor:
tbloadcrash.gif
(tried capturing everything in a small window so I could upload the GIF directly, sorry for the error message being a bit unclear)
The error contents are:
___________________________________________
############################################################################################
ERROR in
action number 1
of Step Event0
for object oAnimEditSystem:

Variable <unknown_object>._smf_get_array_index(102252, -2147483648) not set before reading it.
at gml_Script_press_scroll_menu
############################################################################################
gml_Script_press_scroll_menu (line -1)
gml_Object_oAnimEditSystem_Step_0





There's a small issue where changing bone length/position in the rigging phase will detatch any child nodes in the animations, and the animations will be a bit weird until you select those bones in a keyframe (making them snap back to their parent properly), but this feels like a "what did you expect" thing where the user is at fault and not an editor issue


Finally I can't seem to get the weight-drawing view (vertices are pointed out properly but the colored weights aren't shown, it's not possible to select bones in painting mode, and a bone selected in rigging mode will get unselected when changing to drawing mode)
Okay, nvm, I re-read the manual and realized I missed the "click the node at the tip of the bone" bit, so it was user error all along on this one. Sorry for being stupid UwU
 

TheSnidr

Heavy metal viking dentist
GMC Elder
which version works with html5? It gives me a lot of error too @TheSnidr
The current version should work with HTML5, though it only works if you load the models asynchronously! That means no more smf_model_load, you gotta do buffer_load_async, and once the buffer's loaded you can read the SMF model from it with smf_model_load_from_buffer.
I'll do some testing later just to make sure it still works in HTML5.

@Yal
Thanks for the bug report! I believe I've fixed the texture selection issue, here's a new version:
Download SMF v0.9.a
As for moving and rotating the whole rig, that should indeed be possible if you grab the root node. In this gif I've "locked" the feet in place so that they stay where theya re, but the rest of the rig follows when I move the root node:
 

Bart

WiseBart
The first version of the Blender to SMF exporter is now in a usable state!
I'd like to greatly thank @TheSnidr for his help explaining the format, with the maths behind this and with all the debugging.

This exporter exports models from Blender to the new SMF format (version 10).
It can pack image textures into the file and export a single rig/armature, complete with either a single animation or multiple animations, linked through NLA tracks.
Installing the add-on

The add-on can be installed directly from the downloaded zip file under Edit > Preferences > Add-ons. After enabling it by ticking the checkbox it can be used from Blender's File > Export menu.

Exporting models and animations

To export a model or animation, select all objects in the scene that you want to export. The exporter considers mesh objects (the geometry) and a single armature (with animations or not) for export.

The export options
  • Export Textures - This includes texture images in the SMF file. These should be linked either directly or indirectly through a shader node to a shader's Material Output node.
  • Export NLA Tracks - Looks for all actions linked to the rig/armature via Blender's NLA instead of exporting the current armature action.
  • Export Type - Keyframes exports the actual keyframes of the animation, Samples "samples" the animation (also see the Subdivisions option)
  • Sample Frame Multiplier - This is the default value to be used for SMF's Sample Frame Multiplier.
  • Subdivisions - When export type is Samples, the animation will be chopped up into this number of pieces. The total number of keyframes then becomes (subdivisions+1).
To further detail the export options that can be used I put together a quick How To Use guide though this is still a bit incomplete at the moment and needs some more work.

There are a couple of things to keep in mind when exporting animated models to SMF format:
  • Texture dimensions should be a power of two to display correctly. A warning will be shown in Blender if this is not the case.
  • Armatures/rigs should always have a root bone for child bones/nodes to connect to. This will act as the root node for SMF which is needed since Blender itself has no notion of nodes, it only knows bones. The tail of the root bone in Blender acts as the root node in SMF.
  • Models that aren't parented to the rig are parented to the root node.
  • The actions in Blender are the animations. Exported animations have the length of the action rather than the length of the scene.

Voilà. That is, in very short, an overview on how to use the add-on.

Feel free to let me know if you encounter any bugs or errors or if there are other things that come to mind.
 

Amon

Member
The first version of the Blender to SMF exporter is now in a usable state!
I'd like to greatly thank @TheSnidr for his help explaining the format, with the maths behind this and with all the debugging.

This exporter exports models from Blender to the new SMF format (version 10).
It can pack image textures into the file and export a single rig/armature, complete with either a single animation or multiple animations, linked through NLA tracks.
Installing the add-on

The add-on can be installed directly from the downloaded zip file under Edit > Preferences > Add-ons. After enabling it by ticking the checkbox it can be used from Blender's File > Export menu.

Exporting models and animations

To export a model or animation, select all objects in the scene that you want to export. The exporter considers mesh objects (the geometry) and a single armature (with animations or not) for export.

The export options
  • Export Textures - This includes texture images in the SMF file. These should be linked either directly or indirectly through a shader node to a shader's Material Output node.
  • Export NLA Tracks - Looks for all actions linked to the rig/armature via Blender's NLA instead of exporting the current armature action.
  • Export Type - Keyframes exports the actual keyframes of the animation, Samples "samples" the animation (also see the Subdivisions option)
  • Sample Frame Multiplier - This is the default value to be used for SMF's Sample Frame Multiplier.
  • Subdivisions - When export type is Samples, the animation will be chopped up into this number of pieces. The total number of keyframes then becomes (subdivisions+1).
To further detail the export options that can be used I put together a quick How To Use guide though this is still a bit incomplete at the moment and needs some more work.

There are a couple of things to keep in mind when exporting animated models to SMF format:
  • Texture dimensions should be a power of two to display correctly. A warning will be shown in Blender if this is not the case.
  • Armatures/rigs should always have a root bone for child bones/nodes to connect to. This will act as the root node for SMF which is needed since Blender itself has no notion of nodes, it only knows bones. The tail of the root bone in Blender acts as the root node in SMF.
  • Models that aren't parented to the rig are parented to the root node.
  • The actions in Blender are the animations. Exported animations have the length of the action rather than the length of the scene.

Voilà. That is, in very short, an overview on how to use the add-on.

Feel free to let me know if you encounter any bugs or errors or if there are other things that come to mind.
This is awesome. Thank you.
 

Kentae

Member
The first version of the Blender to SMF exporter is now in a usable state!
I'd like to greatly thank @TheSnidr for his help explaining the format, with the maths behind this and with all the debugging.

This exporter exports models from Blender to the new SMF format (version 10).
It can pack image textures into the file and export a single rig/armature, complete with either a single animation or multiple animations, linked through NLA tracks.
Installing the add-on

The add-on can be installed directly from the downloaded zip file under Edit > Preferences > Add-ons. After enabling it by ticking the checkbox it can be used from Blender's File > Export menu.

Exporting models and animations

To export a model or animation, select all objects in the scene that you want to export. The exporter considers mesh objects (the geometry) and a single armature (with animations or not) for export.

The export options
  • Export Textures - This includes texture images in the SMF file. These should be linked either directly or indirectly through a shader node to a shader's Material Output node.
  • Export NLA Tracks - Looks for all actions linked to the rig/armature via Blender's NLA instead of exporting the current armature action.
  • Export Type - Keyframes exports the actual keyframes of the animation, Samples "samples" the animation (also see the Subdivisions option)
  • Sample Frame Multiplier - This is the default value to be used for SMF's Sample Frame Multiplier.
  • Subdivisions - When export type is Samples, the animation will be chopped up into this number of pieces. The total number of keyframes then becomes (subdivisions+1).
To further detail the export options that can be used I put together a quick How To Use guide though this is still a bit incomplete at the moment and needs some more work.

There are a couple of things to keep in mind when exporting animated models to SMF format:
  • Texture dimensions should be a power of two to display correctly. A warning will be shown in Blender if this is not the case.
  • Armatures/rigs should always have a root bone for child bones/nodes to connect to. This will act as the root node for SMF which is needed since Blender itself has no notion of nodes, it only knows bones. The tail of the root bone in Blender acts as the root node in SMF.
  • Models that aren't parented to the rig are parented to the root node.
  • The actions in Blender are the animations. Exported animations have the length of the action rather than the length of the scene.
Voilà. That is, in very short, an overview on how to use the add-on.

Feel free to let me know if you encounter any bugs or errors or if there are other things that come to mind.
That is awesome! Are any bone constraints supported? IKs and such? :)
 

Bart

WiseBart
Yeah, there's currently no support in the exporter for SMF's IK system, @Kentae. You can of course animate a model in Blender using IK constraints, etc. and export the result of that. Though that simply plays the created animation instead of actually doing real-time IK.
 

Kentae

Member
The IK used by SMF is still only my own two-joint algorithm! It's not as fancy as Blender's IK.
Hehe ok ^^

Yeah, there's currently no support in the exporter for SMF's IK system, @Kentae. You can of course animate a model in Blender using IK constraints, etc. and export the result of that. Though that simply plays the created animation instead of actually doing real-time IK.
That's really all I want. I should porbably have been more clear :p I don't need the constraints to be a part of the calculations in the game but I would like to be able to use them in blender and see the result of their usage in game :)
 

Kentae

Member
@Bart Hey, I'm currently trying out the SMF exporter for blender but I'm having some trouble when loading it in to my game maker project. I followed TheSnidr's documentation to try and implement it but I get an error that says there are no bones in my rig. Am I exporting it wrong?

EDIT:
Just realized that when I have both the model and the rig selected in blender when I try to export I get an error
GML:
Traceback (most recent call last):
  File "C:\Users\kenta\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\blender-to-smf\__init__.py", line 108, in execute
    return export_smf(self, self.filepath, context, self.export_textures, self.export_nla_tracks, self.export_type, self.mult, self.subdivisions)
  File "C:\Users\kenta\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\blender-to-smf\smf.py", line 264, in export_smf
    w = group.weight/s*255
ZeroDivisionError: float division by zero

location: <unknown location>:-1
 
Last edited:

Kentae

Member
Ah, right. I see what that is. That should be handled properly.
Going to fix that one for the next update!
Nice! ^^ I really want this to work... cuz it seems like the animation system I currently use isn't supported any more xD
 

TheSnidr

Heavy metal viking dentist
GMC Elder
is it posible to draw an outline on the 3d model using the default shader?
Not out of the box, but there are several ways of drawing outlines!
The easiest, albeit least precise, is to draw your model twice, first the normal way, and then draw it black with inverted culling and scaled slightly larger. This will only be *perfect* for spherical shapes, and will look less good the more your shape deviates from a sphere.
Another solution is to make a shader for extruding vertices. Same procedure, draw your model with the default shader first, then invert the culling and draw the model again with a custom shader that extrudes vertices along their normals. This requires that all normals are continuous, ie. the normals are the same for all vertices at the same position, otherwise you'll get visible seams.

I can help with the latter, but try to give it a go yourself first!
 
Not out of the box, but there are several ways of drawing outlines!
The easiest, albeit least precise, is to draw your model twice, first the normal way, and then draw it black with inverted culling and scaled slightly larger. This will only be *perfect* for spherical shapes, and will look less good the more your shape deviates from a sphere.
Another solution is to make a shader for extruding vertices. Same procedure, draw your model with the default shader first, then invert the culling and draw the model again with a custom shader that extrudes vertices along their normals. This requires that all normals are continuous, ie. the normals are the same for all vertices at the same position, otherwise you'll get visible seams.

I can help with the latter, but try to give it a go yourself first!
I did a small modification to the sh_smf_static shader... I'm very new to shaders but i'm getting close to what i want to achieve. I'm doing your suggestion (drawing the model twice)

 

abeldev

Member
Hey there! This looks like an amazing tool and I'm really keen to play around with it. I believe the dropbox link on the first page is broken however - just a heads up! :)
 

TheSnidr

Heavy metal viking dentist
GMC Elder
Hey there! This looks like an amazing tool and I'm really keen to play around with it. I believe the dropbox link on the first page is broken however - just a heads up! :)
Thanks for the heads up, and sorry about that! The link is now back up.
 

RetroBatter

Member
I'm not sure if this is a memory leak or if I'm using smf_model_destroy wrong, but each time I load a model and destroy it memory is still being taken up/gradually increasing.

for example:
Code:
repeat(20)
{
    show_debug_message("create");
    model = smf_model_load("Powerline.smf");
    show_debug_message("destroy");
    smf_model_destroy(model, true);
}
in this example code the debugger shows the memory increasing by a lot, even though the model is being destroyed. I'm trying to create a script that preloads and frees model when they're needed/unneeded. Am I just misunderstanding something?
 

TheSnidr

Heavy metal viking dentist
GMC Elder
I'm not sure if this is a memory leak or if I'm using smf_model_destroy wrong, but each time I load a model and destroy it memory is still being taken up/gradually increasing.

for example:
Code:
repeat(20)
{
    show_debug_message("create");
    model = smf_model_load("Powerline.smf");
    show_debug_message("destroy");
    smf_model_destroy(model, true);
}
in this example code the debugger shows the memory increasing by a lot, even though the model is being destroyed. I'm trying to create a script that preloads and frees model when they're needed/unneeded. Am I just misunderstanding something?
Looks like a bug with buffer_decompress.
Even just doing this will make memory usage explode:
Code:
var loadBuff = buffer_load("Powerline.smf");
var decompressedBuff = buffer_decompress(loadBuff);
if (decompressedBuff >= 0)
{
    buffer_delete(decompressedBuff );
}
buffer_delete(loadBuff);
You can safely comment out the buffer decompress part of smf_model_load, models exported from the model tool are not compressed.

EDIT: I have now reported the bug to YoYo, will put the link to the bug report here once it's ready.
 
Last edited:

RetroBatter

Member
Looks like a bug with buffer_decompress.
Even just doing this will make memory usage explode:
Code:
var loadBuff = buffer_load("Powerline.smf");
var decompressedBuff = buffer_decompress(loadBuff);
if (decompressedBuff >= 0)
{
    buffer_delete(decompressedBuff );
}
buffer_delete(loadBuff);
You can safely comment out the buffer decompress part of smf_model_load, models exported from the model tool are not compressed.
I see! Thanks for the help!
 
Top