Text Forge Project Structure
If you are an editor developer, or even want to create a powerful and useful plugin, understanding and having an overview of the project structure will be very helpful for you. In this guide, we will examine the different parts of the editor.
File Structure
Although files can be used in different parts of the project, categorizing them logically can determine their types.
Project Files
action_scripts- Location for storing Action Scripts and related itemsscenes- Scenes used by action scripts and their scriptsaddons- Godot plugins and any third-party files related to the projectassets- Icons and fontscore- Main editorautoload- Contains autoload scriptsclasses- Holds the classes used in the editoraction_script_extension- Holds special extensions for the action script class
main.gd- Script of the main scene (classCore)main.gdshader- Shader applied by the UI filter overlaymain.tscn- Main editor scenepanels- Panels of the editor, each panel in its own folderscripts- Scripts used in the editor are stored heretranslations- Translation files of the editordata- Information included with the editor at runtime, such as themes and default modesdefault_modes.tfmode- Packaged default modesmain_ui.ini- Main menu configurationshortcuts.tres- Default shortcut mapthemes- Stores default themesdocs- Holds the project documentation, including this fileimg- Holds the images used in the documentationreports- Local folder for test reportstests- Unit, automated, and manual tests
These files are stored in the project's source repository (except for reports/), and the action_scripts/ and data/ folders are also located next to the installation file.
Data Files
backups/- Stores backups along with their dedicated codeextensions/- Location for storing extensionslogs/- Stores editor logsmodes/- Contains installed modesproject_icons/- Stores cached versions of project iconsshader_cache/- Stores shader cachetemplates/- Location for storing templatesthemes/- Installed themesvulkan/- Stores Vulkan cachebackups.ini- Maps the main file name and backup time to the backup filedata.cfg- Stores internal editor informationpresets.cfg- Stores additional editor settings informationrecent_files.txt- Keeps a list of recent files (up to 15 items)recent_projects.txt- Keeps a list of recent projects (up to 15 items)settings.cfg- Stores the value of settings made by the usersession.cfg- Stores the documents of the last session, with their caret and scroll position
Editor Structure
Text Forge utilizes the power of Godot's nodes, therefore it has a tree-structured editor.
root/ <- Root of main window node
Signals <- SignalBus API
Global <- Global access point
Documents <- Open documents manager
Tests <- Runtime tests handler
Settings <- Settings and data API
Notif <- Notification manager
Factory <- Node generator
ExtensionHub <- Global hub for extensions communication
Extensions <- Extensions API
U <- Utilities
NetSuite <- Network API
BackupCore <- Backup API
Project <- Project API (Including Project Module)
Main (Core)/ <- Main editor scene
UIFilter <- UI filter layer
OverlayShader <- Shader overlay using main.gdshader
Overlays <- Overlay panels, etc.
Replace popup <- Replace popup for template completion
Background <- Background panel
Margin <- Main layout container
Sections <- Main sections container
MenuBar <- Main menus
PanelManager/ <- Panels management
LeftTab <- Left tab buttons
LeftSpliter/ <- Left tab splitter
LeftPanel <- Left tab panels
RightSpliter/ <- Right tab splitter
BottomSpliter/ <- Bottom tab splitter
Editor/ <- Editor
API <- Editor API (Including TFM API)
BottomPanel <- Bottom tab panels
RightPanel <- Right tab panels
RightTab <- Right tab buttons
BottomTab <- Bottom tab buttons
BottomBar <- Bottom [Status] bar
Scripts <- Action scripts
About <- About window
Settings API
- Access:
Settings
This API allows you to utilize the settings and data capabilities of the editor and integrate your desired configurations. Settings are characteristics that can be customized by the user, while data is information that you need to store. To this end, two categories of functions are available to you in this API:
Working with Settings
define_preset(section: String, key: String, default: Variant = null)- Initialize your new setting optionget_default(section: String, key: String)- Get default value for given setting optionget_setting(section: String, key: String, default: Variant = null)- Get saved value for given optionrestore_default(section: String, key: String)- Resets given option to defined default valueset_setting(section: String, key: String, value: Variant = null, force_silent := false)- Sets given option to a valueflush() -> Error- Saves data, presets, and settings to their files
Note
For get_setting() function, you can use section and key parameters and leave default null to let API use defined default value in define_preset().
Working with Data
read_data(section: String, key: String, default = null)- Get saved data in given keywrite_data(section: String, key: String, value = null, force_flush := false)- Save data in given key
SignalBus
Note
This part and the following sections will be completed soon.