|
| 1 | +# Text Forge Project Structure |
| 2 | + |
| 3 | +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. |
| 4 | + |
| 5 | +## File Structure |
| 6 | + |
| 7 | +Although files can be used in different parts of the project, categorizing them logically can determine their types. |
| 8 | + |
| 9 | +### Project Files |
| 10 | + |
| 11 | +- `action_scripts` - Location for storing Action Scripts and related items |
| 12 | + - `scenes` - Scenes used by action scripts and their scripts |
| 13 | +- `addons` - Godot plugins and any third-party files related to the project |
| 14 | +- `assets` - Icons and fonts |
| 15 | +- `core` - Main editor |
| 16 | + - `autoload` - Contains autoload scripts |
| 17 | + - `classes` - Holds the classes used in the editor |
| 18 | + - `action_script_extension` - Holds special extensions for the action script class |
| 19 | + - `scripts` - Scripts used in the editor are stored here |
| 20 | +- `data` - Information included with the editor at runtime, including themes, panels, translations, etc. |
| 21 | + - `panels` - Keeps panels in separate folders |
| 22 | + - `themes` - Stores default themes |
| 23 | +- `docs` - Holds the project documentation, including this file |
| 24 | + - `img` - Holds the images used in the documentation |
| 25 | +- `reports` - Local folder for test reports |
| 26 | +- `tests` - Unit, automated, and manual tests |
| 27 | + |
| 28 | +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. |
| 29 | + |
| 30 | +### Data Files |
| 31 | + |
| 32 | +- `backups/` - Stores backups along with their dedicated code |
| 33 | +- `extensions/` - Location for storing extensions |
| 34 | +- `logs/` - Stores editor logs |
| 35 | +- `modes/` - Contains installed modes |
| 36 | +- `project_icons/` - Stores cached versions of project icons |
| 37 | +- `shader_cache/` - Stores shader cache |
| 38 | +- `templates/` - Location for storing templates |
| 39 | +- `themes/` - Installed themes |
| 40 | +- `vulkan/` - Stores Vulkan cache |
| 41 | +- `backups.ini` - Maps the main file name and backup time to the backup file |
| 42 | +- `data.cfg` - Stores internal editor information |
| 43 | +- `presets.cfg` - Stores additional editor settings information |
| 44 | +- `recent_files.txt` - Keeps a list of recent files (up to 15 items) |
| 45 | +- `recent_projects.txt` - Keeps a list of recent projects (up to 15 items) |
| 46 | +- `settings.cfg` - Stores the value of settings made by the user |
| 47 | + |
| 48 | +## Editor Structure |
| 49 | + |
| 50 | +Text Forge utilizes the power of Godot's nodes, therefore it has a tree-structured editor. |
| 51 | + |
| 52 | +```text |
| 53 | +root/ <- Root of main window node |
| 54 | + Settings <- Settings and data API |
| 55 | + Signals <- SignalBus API |
| 56 | + TFT <- Translation API |
| 57 | + ExtensionHub <- Global hub for extensions communication |
| 58 | + Global <- Global access point |
| 59 | + Factory <- Node generator |
| 60 | + Extensions <- Extensions API |
| 61 | + BackupCore <- Backup API |
| 62 | + Tests <- Runtime tests handler |
| 63 | + Project <- Project API (Including Project Module) |
| 64 | + NetSuite <- Network API |
| 65 | + U <- Utilities |
| 66 | + Main (Core)/ <- Main editor scene |
| 67 | + Overlays <- Overlay panels, etc. |
| 68 | + EditorContainer/ <- Editor placement manager |
| 69 | + Menus <- Main menus |
| 70 | + FileLabel <- Current file name and path |
| 71 | + PanelManager/ <- Panels management |
| 72 | + LeftTabs <- Left tab buttons |
| 73 | + LeftSplitter/ <- Left tab splitter |
| 74 | + LeftPanels <- Left tab panels |
| 75 | + RightSplitter/ <- Right tab splitter |
| 76 | + BottomSplitter/ <- Bottom tab splitter |
| 77 | + Editor/ <- Editor |
| 78 | + EditorAPI <- Editor API (Including TFM API) |
| 79 | + BottomPanels <- Bottom tab panels |
| 80 | + RightPanels <- Right tab panels |
| 81 | + RightTabs <- Right tab buttons |
| 82 | + BottomTabs <- Bottom tab buttons |
| 83 | + BottomBar <- Bottom [Status] bar |
| 84 | + Scripts <- Action scripts |
| 85 | + Sub-windows <- Sub-windows |
| 86 | +``` |
| 87 | + |
| 88 | +### Settings API |
| 89 | + |
| 90 | +- Access: `Settings` |
| 91 | + |
| 92 | +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: |
| 93 | + |
| 94 | +#### Working with Settings |
| 95 | + |
| 96 | +- `define_preset(section: String, key: String, default: Variant = null)` - Initialize your new setting option |
| 97 | +- `get_default(section: String, key: String)` - Get default value for given setting option |
| 98 | +- `get_setting(section: String, key: String, default: Variant = null)` - Get saved value for given option |
| 99 | +- `get_setting_bool(section: String, key: String, default: Variant = null)` - Safer version of `get_setting()` for boolean options |
| 100 | +- `restore_default(section: String, key: String)` - Resets given option to defined default value |
| 101 | +- `set_setting(section: String, key: String, value: Variant = null)` - Sets given option to a value |
| 102 | + |
| 103 | +!!! Note |
| 104 | + |
| 105 | + 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()`. |
| 106 | + |
| 107 | +#### Working with Data |
| 108 | + |
| 109 | +- `read_data(section: String, key: String, default: Variant = null)` - Get saved data in given key |
| 110 | +- `write_data(section: String, key: String, value: Variant = null)` - Save data in given key |
| 111 | + |
| 112 | +### SignalBus |
| 113 | + |
| 114 | +!!! Note |
| 115 | + |
| 116 | + This part and the following sections will be completed soon. |
0 commit comments