Godot Extension Pack
August 15, 2024

Each page in this multi-part tutorial corresponds to a plugin that can be found in my Godot Extension Pack Repository .

The plugins have been designed to have minimal inter-dependency, so it becomes possible to compile only those that are required for the project. Still, keep an eye on the plugin's description because I do specify if there is any internal dependency.

This extension requires Godot 4.3+ to work. If you are still interested in Godot 3.2+ then check out my Godot Addon Pack which is written in pure GDScript. The addon pack does not work in Godot 4.x though.

For a "reference" list of the functions, properties, signals and so on, check the in editor documentation of the relevant class. Because of the reference that can be consulted directly within Godot editor, I decided to minimize the contents of this tutorial set to be more practical while skipping a "complete list" of what each class provides.

Installation

The process is as simple as copying the binary files into a subdirectory of the Godot project that is meant to utilize the plugins. In other words:

  1. Make sure your project is not open in Godot Editor.
  2. Create a subdirectory in your Godot project, maybe named extensions.
  3. Download the binary files (or compile from sources if so desired)
  4. Unpack the binaries from the .zip file into the directory created in step (2).
  5. Open your project in Godot.

That's it! The additional functionality should appear in Godot.

Limitations/Issues

Bellow I talk about some limitations/known issues, in sub-topics. If possible, offer a work around.

Custom Control Theming

Custom Control theme entries are not automatically populated in the Theme Editor. This happens because I had to work around a limitation in Godot's theme system. While it's possible to easily override each entry through the Inspector, creating a Theme resource to customize the plugin controls will require a little bit of work as it requires prior knowledge of all available theming options.

I have created an editor tool that generates a Theme resource containing all of those custom control theming with the default values. This tool can be accessed by clicking the menu Project -> Tools -> Custom Control Theme Generator. A file dialog will appear asking the name of the resource file. Once set it will be created.

If you prefer to go the "manual route" and set only the relevant styles, follow the steps bellow:

  1. When you edit (double click) a Theme resource it should automatically focus the Theme Editor. On its right side there should be a few controls that allow selecting a Control to be edited. Click on the "+" button to bring the list of existing Controls. Theme Editor - Add Control
  2. Unfortunately the Custom controls are not in the list, as shown in the screenshot bellow. Nevertheless, if you type in the name correctly it will work. Click the Add Type button once the name of the desired Control is in the input box.
  3. Since I have provided icons for each custom Control, one way to know that things are working is that the Type: field will now display the control with its icon in it (as shown in the screenshot bellow). Nevertheless, selecting any of the theme options will not show the elements that can be customized. In the screenshot bellow the StyleBox category is selected. Theme Editor - Empty Style List
  4. Way bellow on that right panel there is a text input that allows you to add a new element to be customized. In the screenshot bellow I have chosen to add the background. After typing the name correctly click the Add button right next to the text input. Theme Editor - Adding Style
  5. The style list will not contain the background entry. You can now create the style as you normally would for any other Control.
Theme Editor - Style Added

As you can see, it's possible albeit a little bit clunky. In this tutorial set you will find the complete list of styling for each provided custom Control. Yet, there is another way to check the list of theming option directly in the editor. Selecting an instance of a widget will populate the Inspector with the available styling in the Theme Overrides category. The most important aspect to keep in mind is that, by default, the editor uses a "capitalize" system that converts a_property_like_this into A Property Like This. If you hover the mouse cursor above the property until the tooltip appears, the actual name will be shown:

Mono/C#

Unfortunately currently there isn't a proper way to generate C# bindings for GDExtensions. Accessing the extensions is not impossible, though. It occurs by using the reflection system, which is basically using call(), set() and get(), which are part of the GodotObject class. Because of this indirect access, extending classes provided by the GDExtension is not possible, at least not directly through C#. Another unfortunate aspect is related to the classes that only contain static functions. Instances of those classes are required.

Now suppose the expandable panel already exists and contains several pages:

// Retrieve the expandable panel
GodotObject expandable = GetNode("ui/expandable_panel");
// Disable page at index 1
expandable.call("disable_page", 1);
// Display page at index 2
expandable.set("current_page", 2);

Just to exemplify, the Quantize offers only static functions. But as mentioned, an instance is required:

GodotObject quantize = ClassDB.Instantiate("Quantize");
// Quantize a float in range [0..1] using 8 bits
int quantized = quantize.call("quantize_unit_float", 0.8, 8);

The extension pack also offers a few singletons. Those can be accessed too, through the Engine:

GodotObject line3d = Engine.GetSingleton("Line3D");
line3d.call("add_line", point0, point1, color);

The Plugins

In the table bellow I list all available plugins, with a brief description of what each one provides. Clicking on the plugin's name should lead to its corresponding page containing detailed information on how to use it.

Plugin NameDescription
Line3D Provides easy easy way to draw lines in 3D
OverlayInfo Easy means to add/remove labels on screen
Quantize Allows (lossy) compression of floating point numbers, as well as easy compression of rotation quaternions
AudioMaster Manages pools audio stream players
AutoInterpolate Automates interpolation calculation of child nodes
RadialImpulse Applies an impulse into all physical bodies that are within its radius
Accordion Create "category buttons" that can toggle visibility of additional content bellow those buttons
ExpandablePanel A widget that attaches itself into one of the four borders of its parent, which can expand or shrink in order to show or hide additional contents
File/Directory Picker Wraps a LineEdit, Button and FileDialog. The LineEdit displays the file/directory selected by the FileDialog that is displayed by clicking the Button
SpinSlider A numerical input box that can also contain a slider and spin button
TabularBox A control that allows displaying and editing data in a tabular layout
Database Offers a (relational) database implemented with Godot's Resource system.

Utility Functions

There is a class which I will not add detailed information, mostly because it provides several general use case (static) functions. For a list of what the class provides refer to the ExtPackUtils class in the in editor documentation.