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!
 

Micah_DS

Member
Regarding this request I made a long time ago...
FEATURE REQUEST: Native vertex model import (i.e. importing vertex model data that was saved via buffer_save).
You probably forgot about it or weren't planning on implementing it, which is fine, especially since I realized there is almost zero reason for it anyway.

I say that because I've discovered the option to export as OBJ is actually in Model Creator 5 (MC5 is the program I've made models in up till now), meaning I somehow overlooked this option for literally years... In my defense, it was sort of hidden away under 'Tools', but still, that's a pretty embarrassing oversight on my part.

Anyway, with my newfound power, I tried exporting some OBJs from MC5, which seemed to work fine, but when loading the models in to SMF v1.0.9, I ran into this problem:
############################################################################################
ERROR in
action number 1
of Step Event0
for object oAnimEditSystem:

DoAdd :1: undefined value
at gml_Script_texpack_add_texpack
############################################################################################
gml_Script_texpack_add_texpack (line -1)
gml_Script_modeleditor_press_buttons
gml_Script_press_buttons
gml_Object_oAnimEditSystem_Step_0
Long story short, I found that Blender will open an OBJ that was exported from MC5, and re-exporting to OBJ from Blender then lets me open the model into SMF. It's redundant, but it works. Unfortunately, MC5's OBJ export doesn't save UVs properly or something, so Blender won't load the models properly, meaning models must be fixed in Blender or the UVs will be screwy in SMF. So I had to learn how to do a few things in Blender, like fix UVs, apply the texture, etc. After some work ("work" 95% stressing and learning, 5% doing), I got the textured model into SMF. Nice! ...

Yeah, so I've finally bitten the bullet and I'm putting in the time to learn Blender. :p

- EDIT -
BTW, I'm having a ton of fun messing with SMF right now. This is the first time I've tried to learn SMF for real and I've gotta say that this seems incredibly easy to use. I just test rigged, skinned, and animated parts of a random model, and it was so fast and easy. The result isn't worth showing, however, because the model I used wasn't designed for standard/modern animation. Its vertices weren't separated properly, making it impossible to avoid weighting things like arms and the torso together, and joints weren't really a thing on the model, so... yea, it was a cursed animation.
Anyway, all that means is that I need to make some models designed for animation! Whoop! Oh man, I feel like a kid right now, sorry, I'm just so excited thinking of all the possibilities! :D
 
Last edited:

Kentae

Member
Hey, I have a question.
Is it still possible to add normal mapping to an SMF model?
I checked out the standard shader that comes with the import scripts and found this line:
GML:
vec3 tangent = 2. * in_Colour.rgb - 1.; //This is not used for anything in this particular shader
Is this the tangent I would use to make normal mapping work?
I tried drawing it out in the fragment shader (obviuosly passing it to it first) but the model is just completely black wich makes me think that the tangent is just (0,0,0).
Yes btw, I did click the "generate tangents"- button in the model tool before saving the model and loading it into the project :)
 

TheSnidr

Heavy metal viking dentist
GMC Elder
Huh, I will look into it! Yes, it should still work. I'm on vacation so I can't test until next week.
Thanks for notifying me about it!
 

TheSnidr

Heavy metal viking dentist
GMC Elder
Hey, I have a question.
Is it still possible to add normal mapping to an SMF model?
I checked out the standard shader that comes with the import scripts and found this line:
GML:
vec3 tangent = 2. * in_Colour.rgb - 1.; //This is not used for anything in this particular shader
Is this the tangent I would use to make normal mapping work?
I tried drawing it out in the fragment shader (obviuosly passing it to it first) but the model is just completely black wich makes me think that the tangent is just (0,0,0).
Yes btw, I did click the "generate tangents"- button in the model tool before saving the model and loading it into the project :)
Did you remember to select all the model indices on the right hand side of the Model Tool before generating tangents? It works for me, here I'm drawing the tangents directly:


EDIT: Oh, and also, I've updated the asset on the Marketplace. No big changes, I've only removed some debug code that slowed the demos down *drastically*.
 

Kentae

Member
Did you remember to select all the model indices on the right hand side of the Model Tool before generating tangents? It works for me, here I'm drawing the tangents directly:
Tried that now but still draws completley black :S Tried with both flat and smooth, same result.
Is there any option somewhere to toggle tangent export that I've missed?

EDIT: Ah never mind, found the issue herp di derp. Forgot that I needed to multiply the tangent with the world matrix >.<
 

TheSnidr

Heavy metal viking dentist
GMC Elder
https://im.ge/i/1.L9dm8

https://im.ge/i/L9qZh
Hello, the image above is I have drawn the effect well, but the image below I am copying over to another project and the effect is showing on the surface of another object, I don't understand why, please help me fix it, thanks
Hei!
Excellent use of the particle system! Your problem is that the particles are drawn with depth-writing off so that they don't draw to the depth buffer, and then you draw the level afterwards, which will then be drawn on top.
This is easily fixed by drawing the particles after everything else has drawn.
 

haisupham

Member
Hei!
Excellent use of the particle system! Your problem is that the particles are drawn with depth-writing off so that they don't draw to the depth buffer, and then you draw the level afterwards, which will then be drawn on top.
This is easily fixed by drawing the particles after everything else has drawn.
I fixed it, thank you very much and am making 3D games with GMS, I admire you for such useful ways . What I've been trying to learn from you over the past few years.
 

haisupham

Member
I was using the function : levelColmesh.save(file). I am in need of a function such as : Forward one coordinate --> levelColmesh.Forward_save(file,a,b,c)
That is, the new data will translate to a new coordinate for the collision: x(new) = x(old) + a ; y(new) = y(old) + b; z(new) = z(old) + c ;
the collision will be translated by one coordinate (a,b,c) . I am not knowledgeable enough to do this, please help me, because while running the game I want to move the level to another place and there is a collision . Thanks
 

j123

Member
Thanks for making this! If I use this in a commercial project for console/PC/Mac, what credits need to be placed in the credits of the project?
 

z_bill

Member
this tool absolutely owns! I can put 3d anims in my game! I used it in this game: Unholy Eyeballs

Thanks a ton for this!

....buuut I'm still really dense. Can anyone tell me *the code* for telling it to use a sprite in my GMS project as the texture instead of having the texture embedded in the SMF file? I looked thru the documentation and browsed this thread but couldn't find it (btw I'm using the "new method" as per the docs, not sure if that matters) Thanks!
 

TheSnidr

Heavy metal viking dentist
GMC Elder
this tool absolutely owns! I can put 3d anims in my game! I used it in this game: Unholy Eyeballs

Thanks a ton for this!

....buuut I'm still really dense. Can anyone tell me *the code* for telling it to use a sprite in my GMS project as the texture instead of having the texture embedded in the SMF file? I looked thru the documentation and browsed this thread but couldn't find it (btw I'm using the "new method" as per the docs, not sure if that matters) Thanks!
Awesome!
You can define the textures of an SMF model by setting model.texPack! This is an array that stores sprite indices, so you can do this to set all submodels to the same texture:
model.texPack = [sprTexture];
Or if you'd like to specify the textures for each submodel, you add one index for each submodel like this:
model.texPack = [tex1, tex2, tex3];

I'm considering revamping the texture system, but for now, this is the way to do it!
 

z_bill

Member
Awesome!
You can define the textures of an SMF model by setting model.texPack! This is an array that stores sprite indices, so you can do this to set all submodels to the same texture:
model.texPack = [sprTexture];
Or if you'd like to specify the textures for each submodel, you add one index for each submodel like this:
model.texPack = [tex1, tex2, tex3];

I'm considering revamping the texture system, but for now, this is the way to do it!
Yes! Thank you so much!

I had to consult back to the demo and rearrange how I was doing stuff but figured it out!

I'm blown away by the functionality of the rigging and animation program. I keep on finding new stuff it can do!

Similar to previous question: Is there a way to have a model have different textures without setting up a different model (well, same model/anims/etc, but with a diff texture)? This is for alternating character faces, colors, and so forth for enemies. I tried some stuff and only seem to be able to alter the texture for the models globally, not down to each instance of the model. Is it possible? I may just be screwing up something simple with the syntax.
 

TheSnidr

Heavy metal viking dentist
GMC Elder
Thank you! I appreciate your kind words ^.^

You could set the model's array in the enemy's draw event so that each updates the texpack just before drawing the model.
I see how this solution is not optimal, so again, the texture system needs some work done :p
 

z_bill

Member
that would totally work! Thanks.

(I'm sorta glad, however, that this time the functionality is not in instead of me just failing to understand something haha)
 

haisupham

Member
I tried writing shaders for animated characters , But when building them on android device it has some bugs and degraded quality :
 
G

Guest User

Guest
Thank you so much for your development!

And next quastion is:
___________________________________________
############################################################################################
ERROR in
action number 1
of Step Event0
for object oAnimEditSystem:

Push :: Execution Error - Variable Index [19] out of range [19] - -7.keyframe(101224,19)
at gml_Script_anon_smf_anim_gml_GlobalScript_smf_anim_10222_smf_anim_gml_GlobalScript_smf_anim
############################################################################################
gml_Script_anon_smf_anim_gml_GlobalScript_smf_anim_10222_smf_anim_gml_GlobalScript_smf_anim (line -1)
gml_Script_anon_smf_anim_gml_GlobalScript_smf_anim_11444_smf_anim_gml_GlobalScript_smf_anim
gml_Script_smf_model_save
gml_Script_press_buttons
gml_Object_oAnimEditSystem_Step_0


what's wrong with the 19 rig?
I created 20 rigs then 21 and deleted 19, after that it turned out to be saved. Otherwise, it crashed out of the program.

This was such a glitch with the latest version, I have not tried it for 1.4. Can you tell me what to do with the lighting? Where can I find a well-optimized system with the ability to make many light sources (positional and spotlight) and have shadows on the models with the ability to adjust the radius and color?
And so that if the sun is done, that is enough for a map with a size of 8192 by 8192 pixels. What I found loads the graphics card very heavily.
 
Last edited by a moderator:
Top