Add-on: Export Blender Cubes to Lua table

Happy New Year 2026, Defold community! :pine_decoration::sunrise:

I’ve created a simple workflow to bridge the gap between Blender and Defold for level blockouts. It consists of a Blender add-on and a Defold Editor Script.

:hammer_and_wrench: What it does

  1. Blender Add-on: Exports selected Cube objects into a Lua table (name, pos, rot, scale). :package:

  2. Defold Editor Script: Reads that Lua table and automatically generates GameObjects with matching .collision (static box) components right in the editor! :high_voltage:

:wrench: Design Choice: No Automatic Axis Conversion

For this tool, I decided not to include automatic axis conversion (e.g., swapping Y and Z). The script exports the raw coordinates exactly as they are in Blender. I believe this keeps the tool simple and transparent, allowing you to handle the mapping in your own script according to your project’s needs.

:warning: A few things to note

  • Axis Convention: Blender is Z-up and Defold is Y-up. Please handle the height mapping or rotation on the Defold side.

  • Cube Size: Blender’s default cube is 2.0 units. Set it to 1.0 unit to match Defold’s visual scale perfectly. :straight_ruler:

:artist_palette: Credits

The demo assets used in the example are by Kenney (https://kenney.nl/).


I hope this helps your workflow in the new year!

Happy Defolding! :rocket:

9 Likes

Oh, great! And a nice example of Editor Scripts usage! :heart_eyes:

3 Likes