godotengine/godot
Editor architecture
Purpose
The Godot editor is itself a Godot project. It is built out of Control-derived nodes living in a SceneTree, scripted partly in C++ and partly in (a small amount of) GDScript, and only compiled into the binary when tools=yes (which is on by default for target=editor). This page covers how the editor is organized, how plugins extend it, and how it talks to the running game.
Directory layout (high-level)
editor/
├── editor_node.{cpp,h} Singleton orchestrating the editor (~377 KB cpp, ~38 KB h — the largest file in the repo)
├── editor_data.{cpp,h} Per-project state: open scenes, tab order, plugin list
├── editor_interface.{cpp,h} Public interface plugins use to inspect/manipulate the editor
├── editor_main_screen.{cpp,h} Manager for the four "main screen" buttons (2D, 3D, Script, AssetLib)
├── editor_log.{cpp,h} Editor-side log dock with stack traces
├── editor_undo_redo_manager.{cpp,h} Multi-history undo/redo (per scene + global)
├── docks/ Dockable panels (FileSystem, Inspector, Scene Tree, Import, History, Signals, Groups)
├── plugins/ EditorPlugin system + every editor plugin
├── inspector/ Inspector + property editors
├── file_system/ Editor file system, asset scanner, import metadata
├── import/ Import bus (textures, audio, models, fonts, scenes)
├── export/ Export presets, export dialog, exporter base class
├── scene/ Editor-side scene management helpers
├── script/ ScriptEditor + per-language plugins
├── shader/ Shader editor
├── settings/ EditorSettings + EditorPaths + project settings dialog
├── themes/ Default editor theme builder + icons handling
├── debugger/ Editor-side remote debugger (console, profiler, monitor, video memory)
├── translations/ Editor + class reference translations (Weblate output)
├── doc/ Editor docstring loader (parses doc/classes XMLs)
├── icons/ Icons (~9000 SVG icons baked into a `EditorThemeManager` cache)
├── project_manager/ The project manager (the binary's other primary mode)
├── project_upgrade/ Tools for upgrading projects across breaking versions
├── run/ "Play" infrastructure — launching the running scene + remote debug bridge
├── version_control/ Editor-side VCS plugin host
└── editor_builders.py SCons hooks (string concatenation, certificates, code-completion data)EditorNode
EditorNode (editor/editor_node.cpp, ~377 KB) is the editor's god-object. It:
- Builds the editor UI (top toolbar, main screen switcher, side docks, bottom panel, status bar).
- Manages the list of open scenes, current scene, scene history, and unsaved-state tracking.
- Coordinates undo/redo via
EditorUndoRedoManager. - Hosts the singleton list (
EditorPlugininstances, exporters, importers, conversions). - Owns
EditorData(per-project state) andEditorInterface(the public API plugins use). - Provides progress bars, error dialogs, and the global "Open scene…" / "Save" pipeline.
- Acts as the bridge to the running game:
EditorRun(editor/run/) launches the game and connects to itsRemoteDebugger.
Plugin system
EditorPlugin (editor/plugins/editor_plugin.cpp) is the extension point. A plugin can:
- Add a custom main screen (button next to "2D", "3D", "Script", "AssetLib").
- Add a custom dock or bottom panel.
- Add toolbar buttons or context menu items.
- Register an importer (
EditorImportPlugin), exporter (EditorExportPlugin), converter (EditorResourceConversionPlugin), inspector plugin (EditorInspectorPlugin), node 3D gizmo (EditorNode3DGizmoPlugin), translation parser (EditorTranslationParserPlugin), or scene importer. - Hook into selection changes, scene save events, run/stop events.
Built-in plugins under editor/plugins/ include the 2D editor, the 3D editor, the script editor, the shader editor, the asset library, the animation player editor, the curve editor, the gradient editor, the texture region editor, theme editor, tile map editor, the visual shader editor, and many more — over 100 source files.
User-authored editor plugins are written in GDScript, C#, or GDExtension and registered via the plugin config dialog (editor/plugins/plugin_config_dialog.cpp).
Docks
The editor exposes the docking system through EditorDockManager (editor/docks/editor_dock_manager.cpp). Built-in docks:
| Dock | File | Role |
|---|---|---|
| FileSystem | docks/filesystem_dock.cpp (~172 KB) |
Project file tree + previews |
| Scene Tree | docks/scene_tree_dock.cpp (~182 KB) |
Edit the open scene's node tree |
| Inspector | docks/inspector_dock.cpp |
Edit properties of the selected node/resource |
| Import | docks/import_dock.cpp |
Per-asset import settings |
| History | docks/history_dock.cpp |
Undo/redo history visualization |
| Groups | docks/groups_dock.cpp |
Manage groups membership |
| Signals | docks/signals_dock.cpp |
Connect/disconnect signals on the selected node |
Docks can be reordered, torn off into floating windows, hidden, or grouped into tabs. The editor remembers per-user dock layouts in editor_layout.cfg.
Inspector
The inspector (editor/inspector/) builds property editors from PropertyInfo. For each property of the selected Object:
- Look up the
PropertyHint(PROPERTY_HINT_RANGE,PROPERTY_HINT_ENUM,PROPERTY_HINT_RESOURCE_TYPE, …). - Find an
EditorPropertysubclass that handles that (type, hint) pair. - Bind it to live
Object::set/Object::get, with undo entries written toEditorUndoRedoManager. - Plugins can register
EditorInspectorPlugins to inject custom rows or replace built-in ones (e.g., the script editor's "Tool" toggle, the shader editor's "Convert to ShaderInclude" button).
Importers
editor/import/ plus per-format files implement the import bus. When a non-engine asset (e.g., .png, .gltf, .wav) is dropped into the project, the editor:
- Picks an
ResourceImportersubclass based on file extension and configuration. - Reads import options (per-file from
<asset>.import, defaulting to project-level defaults). - Runs the importer to produce a binary
.res/.scn/.ctexcache under.godot/imported/. - Updates
<asset>.importwith the metadata.
Built-in importers cover textures (multiple compressors per platform), audio (MP3/Vorbis/WAV), 3D scenes (glTF, FBX-via-glTF), fonts, BMFont, BitFont, OBJ, CSV translations, and shader includes.
Exporters
editor/export/ contains the cross-platform exporter scaffolding plus per-platform exporters under platform/<os>/export/. Exporting a project:
- Resolves which export preset is active (
export_presets.cfg). - Walks the project tree, applying include/exclude filters and feature-tag filters.
- Encodes resources into a PCK (or splits across multiple PCKs).
- Combines the platform's pre-built export template binary with the PCK.
- Optionally signs the binary (codesign on macOS, signtool on Windows, jarsigner on Android, codesigning on iOS via Xcode).
EditorExportPlatform is the abstract per-platform exporter; EditorExportPreset holds a single configured target; EditorExportPlugin is the user-extension hook (used by GDExtension authors to bundle native libs into the export).
Project Manager
editor/project_manager/ is the entry point when the editor is launched without a project path. It manages the list of recent projects, the "Create new project" dialog, the asset library tab, and project upgrade prompts.
When the user opens a project, it execs the same binary again with a --path argument so the editor starts cleanly.
Editor settings vs project settings
Two parallel configs exist:
- Project settings (
project.godot): everything that ships with the project. Per-feature overrides supported. Loaded at engine startup. - Editor settings (
editor_settings.tresunder the user's data dir): per-user editor preferences (theme, font size, code completion behaviour, shortcut overrides). Lives underEditorPaths::get_settings_dir().
EditorSettings (editor/settings/editor_settings.cpp) loads, exposes, and persists the editor settings; editor/settings/project_settings_editor.cpp is the editor-only UI for project settings.
Remote debug + run
editor/run/ orchestrates "Play":
EditorRunconstructs the command-line for the game binary (the same engine, but invoked with the project path).EditorDebuggerNode(editor/debugger/) opens a TCP listener and waits for the launched game to connect.- The game's
EngineDebuggerconnects back; thereafter, the game streams stack traces on errors, profiler samples, scene-tree snapshots, and live-edit ops. - The editor's debugger panels (
editor/debugger/script_editor_debugger.cpp) render the stream.
Key abstractions
| Abstraction | File | Role |
|---|---|---|
EditorNode |
editor/editor_node.cpp |
Editor singleton |
EditorPlugin |
editor/plugins/editor_plugin.cpp |
Extension point |
EditorInterface |
editor/editor_interface.cpp |
API plugins use to manipulate the editor |
EditorData |
editor/editor_data.cpp |
Per-project editor state |
EditorUndoRedoManager |
editor/editor_undo_redo_manager.cpp |
Multi-context undo |
EditorSettings |
editor/settings/editor_settings.cpp |
Per-user editor preferences |
EditorDockManager |
editor/docks/editor_dock_manager.cpp |
Dock layout |
EditorImportPlugin / ResourceImporter |
editor/import/ |
Asset import |
EditorExportPlatform |
editor/export/editor_export_platform.cpp |
Per-platform exporters |
ScriptEditor |
editor/script/script_editor.cpp |
Multi-language script editor |
EditorThemeManager |
editor/themes/editor_theme_manager.cpp |
Editor theme + icon caching |
Integration points
- The editor depends on every other layer of the engine (scene, modules, servers).
- The 2D and 3D editors render their viewports through
RenderingServerlike any other game viewport — the gizmos and grids are just additionalMeshInstance3D/Sprite2Dnodes inside the editor's scene. - Scripting integration: GDScript and C# both register
EditorPlugin-style hooks (e.g., the GDScript debugger's class browser, the Mono build & sync system). - Class reference: the editor parses
doc/classes/*.xmlon startup so the inspector + script editor can show inline help.
Entry points for modification
- Adding an editor feature → write an
EditorPluginsubclass and register from a module'sregister_module_types. - Replacing the default theme → see
editor/themes/editor_theme_manager.cppand the SVG icons undereditor/icons/. - Adding an importer → subclass
ResourceImporterand callResourceFormatImporter::get_singleton()->add_importer(my_importer)fromregister_module_types(an editor-only path). - Editor remote debugging extensions → extend
EngineDebuggeron the runtime side andEditorDebuggerSessionon the editor side; they share a message protocol overMarshalls.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.