Editor modules are a way to extend the editor with custom tools

Module types

There are 4 types of modules

These modules are rendered using function pointers/lambdas containing calls to dear imgui


Details panel module creation

EditorModules::addDetailsPanelModule([](Actor*, bool&){ ImGui::Text("Hello, World!"); });

Tools module creation

EditorModules::addToolsModule([](const UVK::CurrentToolType&, bool&){ ImGui::Text("Hello, World!"); });

Top bar module creation

EditorModules::addTopBar([](bool&){ ImGui::Text("Hello, World!"); });

Independent module creation

IndependentModuleData data =
    .bEnabled = true,
    .func = [](const char* name, bool& bShow, bool&)
        ImGui::Begin(name, &bShow);
        ImGui::Text("Hello, World!");
    .name = "Testing module"


You can now create a module, but you need to put that creation code somewhere. There is a designated function for that very purpose in the game instance called onEventInitEditorModules

Details panel

The details panel's module type takes a pointer to an actor. This pointer can be used to check for components.

Independent module

The independent module function takes a name and an enabled boolean. The name is responsible for the name of the window, the enabled boolean is for enabling/disabling the window. Independent modules are listed under the view tab in the title bar and can be enabled/disabled from there.

Tools module

The tools module, takes an enum for the current tools' module type. Due to the fact that the tools' widget contains 3 views

the enum can be used to check if the current active view is one of the three

Useful tools

The engine comes with 2 additional dear imgui libraries

You can learn those 2 libraries and use them in your widgets to display statistics or to have different types of controls

The last argument

You might be wondering what the last bool& argument does. This argument is tied to the Transactions and Undo/Redo API. When having input widgets in dear imgui such as ImGui::InputText, they have their own Undo/Redo system. Instead of disabling their Undo/Redo system and implementing our own, we decided to use their Undo/Redo system and disable ours when interacting with input widgets. This can be done with this bool. Here is a sample of what is recommended:

if (ImGui::InputText(("##Rename" + a.path().string()).c_str(), &renameText) || ImGui::IsItemFocused())
    bReturn = true;

This is extracted from Filesystem.cpp, line 218-219. As you can see, we check if the input function returns true or if the widget is focused. If the check returns true, then we can enable our bool named bReturn and disable interactions with the engine's Undo/Redo API.