Skip to content

v0.26: Run-time generated C++ API

Compare
Choose a tag to compare
@github-actions github-actions released this 25 Oct 17:55
· 208 commits to main since this release
5383d75

A new run-time generated C++ API is made available to Docker- and CMake-based projects. The API is auto-generated on first save, and contains all loaded classes including extra modules and GDextensions. This adds auto-complete to your external editor as well, which greatly increases productiveness.

Since it's a run-time generated API it will automatically follow Godot versions forward.

	JSON j = ClassDB::instantiate<JSON>("JSON");
	j.parse(
	R"({
		"pi": 3.141,
		"happy": true,
		"name": "Niels Nielsen",
		"nothing": null,
		"answer": {
			"everything": 42
		},
		"list": [1, 0, 2],
		"object": {
			"currency": "USD",
			"value": 42.99
		}
	})");
	print(j.get_data());

Even the Sandbox class can be auto-completed in your favorite editor, as it is a loaded extension:

extern "C" Variant test_sandbox_pass(Sandbox s) {
	Sandbox s2 = s.FromBuffer(PackedArray<uint8_t>((const uint8_t *)binary_data, binary_data_size));
	return s2;
}

In the future we may add better support for static functions in classes and also try to add inline documentation to classes, properties and methods.

A new load<Class> resource loading helper has been added:

Node2D scene = load<PackedScene>("res://scenes/mod/mod.tscn").instantiate();

You can iterate nodes by group:

    for (Node node : get_tree().get_nodes_in_group("Coins")) {
    }

Other changes include preventing access to restrictions while in an active VM call, even indirectly.

What's Changed

Full Changelog: v0.25...v0.26