Introduzione allo sviluppo dell'editor
In questa pagina, imparerai:
Le scelte progettuali alla base dell'editor Godot.
Come lavorare efficientemente sul codice C++ dell'editor Godot.
This guide is aimed at current or future engine contributors. To create editor plugins in GDScript, see Creare estenzioni instead.
Vedi anche
If you are new to Godot, we recommended you to read La filosofia progettuale di Godot before continuing. Since the Godot editor is a Godot project written in C++, much of the engine's philosophy applies to the editor.
Scelte tecniche
The Godot editor is drawn using Godot's renderer and UI system. It does not rely on a toolkit such as GTK or Qt. This is similar in spirit to software like Blender. While using toolkits makes it easier to achieve a "native" appearance, they are also quite heavy and their licensing is not compatible with Godot's.
The editor is fully written in C++. It can't contain any GDScript or C# code.
Struttura delle cartelle
The editor's code is fully self-contained in the editor/ folder of the Godot source repository.
Some editor functionality is also implemented via modules. Some of these are only enabled in editor builds to decrease the binary size of export templates. See the modules/ folder in the Godot source repository.
Some important files in the editor are:
editor/editor_node.cpp: File di inizializzazione principale dell'editor. Effettivamente la "scena principale" dell'editor.
editor/project_manager.cpp: File di inizializzazione principale del Gestore dei progetti. Effettivamente la "scena principale" del Gestore dei progetti.
editor/plugins/canvas_item_editor_plugin.cpp: The 2D editor viewport and related functionality (toolbar at the top, editing modes, overlaid helpers/panels, …).
editor/plugins/node_3d_editor_plugin.cpp: La viewport dell'editor 3D e le relative funzionalità (barra degli strumenti in alto, modalità di modifica, pannelli sovrapposti, …).
editor/plugins/node_3d_editor_gizmos.cpp: Where the 3D editor gizmos are defined and drawn. This file doesn't have a 2D counterpart as 2D gizmos are drawn by the nodes themselves.
Editor dependencies in scene/ files
When working on an editor feature, you may have to modify files in
Godot's GUI nodes, which you can find in the scene/ folder.
One rule to keep in mind is that you must not introduce new dependencies to
editor/ includes in other folders such as scene/. This applies even if
you use #ifdef TOOLS_ENABLED.
To make the codebase easier to follow and more self-contained, the allowed dependency order is:
editor/->scene/->servers/->core/
This means that files in editor/ can depend on includes from scene/,
servers/, and core/. But, for example, while scene/ can depend on includes
from servers/ and core/, it cannot depend on includes from editor/.
Attualmente, ci sono alcune dipendenze da editor/ incluse nei file scene/, ma sono in fase di rimozione.
Consigli di sviluppo
Per iterare rapidamente sull'editor, consigliamo di impostare un progetto di prova e aprirlo dalla riga di comando dopo aver compilato l'editor. In questo modo, non si dovrà passare attraverso il Gestore dei progetti ogni volta che Godot viene avviato.