No description
  • Odin 91.2%
  • Twig 5.1%
  • Python 2.9%
  • Makefile 0.7%
Find a file
2025-12-01 16:18:43 -07:00
bin add working bin directory for compiled tools 2024-02-26 16:28:54 -07:00
bindgen Merge branch 'dresswithpockets:main' into updates-for-Godot-4.5-#16 2025-10-28 04:17:43 -07:00
examples Update examples/hello-gdextension/example.gd 2025-11-30 22:16:42 -07:00
gdext odin changes for Godot 4.5 2025-10-16 15:22:46 -07:00
godin add license notices to source and update copyright year 2025-03-19 12:21:07 -07:00
godot Update Variant.odin 2025-10-16 15:24:19 -07:00
godot-cpp@e83fd0904c updates for Godot 4.5 2025-10-16 15:13:26 -07:00
libgd add license notices to source and update copyright year 2025-03-19 12:21:07 -07:00
templates Fix gdext/gdextension import path inconsistency 2025-07-16 17:13:18 -03:00
temple@42bdffe98c update temple 2025-02-24 16:02:59 -07:00
.gitattributes add exr and png to lfs 2025-03-03 22:43:43 -07:00
.gitignore move gdext/bind into libgd/classdb 2025-03-14 16:39:26 -07:00
.gitmodules updates for Godot 4.5 2025-10-16 15:13:26 -07:00
build_godin.sh add build_godin.sh 2023-08-28 15:17:12 -07:00
build_hello-gdextension.sh Revert "update makefile" 2025-11-30 22:16:42 -07:00
classdb_gen.py add license notices to source and update copyright year 2025-03-19 12:21:07 -07:00
godin_test.bat add test godin script 2023-08-28 13:17:51 -07:00
interface_procs.py add license notices to source and update copyright year 2025-03-19 12:21:07 -07:00
LICENSE add apache license 2023-04-27 04:42:31 -07:00
Makefile Revert "update makefile" 2025-11-30 22:16:42 -07:00
odinfmt.json update ols and odinfmt configurations to latest versions 2024-02-15 14:05:37 -07:00
ols.json update ols.json to use REAL_PRECISION 2025-03-14 09:55:46 -07:00
readme.md Fix gdext/gdextension import path inconsistency 2025-07-16 17:13:18 -03:00
todo update TODO 2025-03-03 14:14:58 -07:00

Godot Toolkit for Odin

Warning

This toolkit is a Work In Progress!

If you are using parts of it, beware of sudden major changes to the API, structure, and features.

This currently targets Godot v4.4. The base interface is backwards compatible with v4.3 and v4.2, and may even work with v4.1, but it will not work with v4.0. For a version which works with v4.0 use the dev-4.0-2024-02 release.

Checkout releases for each Godot version here: https://github.com/dresswithpockets/odin-godot/releases - Some are more stable than others.

Base GDExtension Bindings

The bindings to the C Interface are in gdextension. Check out hello-gdextension for example usage of these bindings.

Generating Complete Bindings

Clone & generate bindings

git clone --recurse-submodules -j8 https://github.com/dresswithpockets/odin-godot
cd odin-godot
make bindings

Bindings for all enums, classes, utility functions, singletons, and native structs will be generated in core, editor, and variant.

Note

make bindings expects odin on path, all submodules updated, and odin-godot (this repo) is the working directory.

Alternatively, you may build and run bindgen yourself:

# temple is the templating engine used by bindgen, temple_cli is temple's preprocessor.
odin build temple/cli/ -o:speed -out:bin/temple_cli.exe

# temple_cli will recursively search all odin files in the specified directory for
# usages of `compiled` and `compiled_inline`, then it will generate Odin code with
# the built templates in templates.odin, in the specified directory. in this case,
# its searching in the bindgen directory, and outputs to bindgen/templates.odin, with
# the `bindgen` package name.
./bin/temple_cli.exe bindgen bindgen bindgen

# bindgen is the tool which uses the temple templates to generate the entire
# GDExtension binding
odin build bindgen/ -o:speed -out:bin/bindgen.exe

# bindgen requires a path to a json file which describes the GDExtension API.
# One is available in godot-cpp.
./bin/bindgen.exe godot-cpp/gdextension/extension_api.json

Creating a GDExtension

See the example game for a working usage of these bindings.

Then, follow the instructions for using the extension module.

Godin

Godin is a preprocessor which generates most of the boilerplate for Extension Classes, Methods, Enums, Properties, Signals, Groups, and Subgroups.

Warning

Godin is suuuuper work in progress!

Godin doesn't produce correct gdextension useage in its current state, and may not even run in some cases.

For example, the following Odin code will produce all of the boilerplate for an extension class "Player" that extends "Node2D".

package test

//+class Player extends Node2D
Player :: struct {
    health: i64,
}

To build Godin:

# while in the odin-godot directory
./build_godin.sh

Run godin help for usage details, including documentation about the Godin preprocessor syntax.