Debian Codegraph @

editor/register_editor_types.cpp

raw symbols SCIP
1 /**************************************************************************/
2 /* register_editor_types.cpp */
3 /**************************************************************************/
4 /* This file is part of: */
5 /* GODOT ENGINE */
6 /* https://godotengine.org */
7 /**************************************************************************/
8 /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9 /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10 /* */
11 /* Permission is hereby granted, free of charge, to any person obtaining */
12 /* a copy of this software and associated documentation files (the */
13 /* "Software"), to deal in the Software without restriction, including */
14 /* without limitation the rights to use, copy, modify, merge, publish, */
15 /* distribute, sublicense, and/or sell copies of the Software, and to */
16 /* permit persons to whom the Software is furnished to do so, subject to */
17 /* the following conditions: */
18 /* */
19 /* The above copyright notice and this permission notice shall be */
20 /* included in all copies or substantial portions of the Software. */
21 /* */
22 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29 /**************************************************************************/
30
31 #include "register_editor_types.h"
32
33 #include "core/object/script_language.h"
34 #include "editor/animation/animation_tree_editor_plugin.h"
35 #include "editor/audio/audio_stream_editor_plugin.h"
36 #include "editor/audio/audio_stream_randomizer_editor_plugin.h"
37 #include "editor/debugger/debug_adapter/debug_adapter_server.h"
38 #include "editor/debugger/editor_debugger_plugin.h"
39 #include "editor/docks/filesystem_dock.h"
40 #include "editor/editor_interface.h"
41 #include "editor/editor_node.h"
42 #include "editor/editor_string_names.h"
43 #include "editor/editor_undo_redo_manager.h"
44 #include "editor/export/editor_export_platform.h"
45 #include "editor/export/editor_export_platform_apple_embedded.h"
46 #include "editor/export/editor_export_platform_extension.h"
47 #include "editor/export/editor_export_platform_pc.h"
48 #include "editor/export/editor_export_plugin.h"
49 #include "editor/export/register_exporters.h"
50 #include "editor/file_system/editor_file_system.h"
51 #include "editor/file_system/editor_paths.h"
52 #include "editor/gui/editor_file_dialog.h"
53 #include "editor/gui/editor_spin_slider.h"
54 #include "editor/gui/editor_toaster.h"
55 #include "editor/import/3d/resource_importer_obj.h"
56 #include "editor/import/3d/resource_importer_scene.h"
57 #include "editor/import/editor_import_plugin.h"
58 #include "editor/import/resource_importer_bitmask.h"
59 #include "editor/import/resource_importer_bmfont.h"
60 #include "editor/import/resource_importer_csv_translation.h"
61 #include "editor/import/resource_importer_dynamic_font.h"
62 #include "editor/import/resource_importer_image.h"
63 #include "editor/import/resource_importer_imagefont.h"
64 #include "editor/import/resource_importer_layered_texture.h"
65 #include "editor/import/resource_importer_shader_file.h"
66 #include "editor/import/resource_importer_svg.h"
67 #include "editor/import/resource_importer_texture.h"
68 #include "editor/import/resource_importer_texture_atlas.h"
69 #include "editor/import/resource_importer_wav.h"
70 #include "editor/inspector/editor_context_menu_plugin.h"
71 #include "editor/inspector/editor_resource_picker.h"
72 #include "editor/inspector/editor_resource_preview.h"
73 #include "editor/inspector/editor_resource_tooltip_plugins.h"
74 #include "editor/inspector/input_event_editor_plugin.h"
75 #include "editor/inspector/sub_viewport_preview_editor_plugin.h"
76 #include "editor/inspector/tool_button_editor_plugin.h"
77 #include "editor/scene/2d/camera_2d_editor_plugin.h"
78 #include "editor/scene/2d/light_occluder_2d_editor_plugin.h"
79 #include "editor/scene/2d/line_2d_editor_plugin.h"
80 #include "editor/scene/2d/particles_2d_editor_plugin.h"
81 #include "editor/scene/2d/path_2d_editor_plugin.h"
82 #include "editor/scene/2d/physics/cast_2d_editor_plugin.h"
83 #include "editor/scene/2d/physics/collision_polygon_2d_editor_plugin.h"
84 #include "editor/scene/2d/physics/collision_shape_2d_editor_plugin.h"
85 #include "editor/scene/2d/polygon_2d_editor_plugin.h"
86 #include "editor/scene/2d/skeleton_2d_editor_plugin.h"
87 #include "editor/scene/2d/sprite_2d_editor_plugin.h"
88 #include "editor/scene/2d/tiles/tiles_editor_plugin.h"
89 #include "editor/scene/3d/bone_map_editor_plugin.h"
90 #include "editor/scene/3d/camera_3d_editor_plugin.h"
91 #include "editor/scene/3d/gpu_particles_collision_sdf_editor_plugin.h"
92 #include "editor/scene/3d/lightmap_gi_editor_plugin.h"
93 #include "editor/scene/3d/mesh_editor_plugin.h"
94 #include "editor/scene/3d/mesh_instance_3d_editor_plugin.h"
95 #include "editor/scene/3d/mesh_library_editor_plugin.h"
96 #include "editor/scene/3d/multimesh_editor_plugin.h"
97 #include "editor/scene/3d/node_3d_editor_gizmos.h"
98 #include "editor/scene/3d/occluder_instance_3d_editor_plugin.h"
99 #include "editor/scene/3d/particles_3d_editor_plugin.h"
100 #include "editor/scene/3d/path_3d_editor_plugin.h"
101 #include "editor/scene/3d/physics/physical_bone_3d_editor_plugin.h"
102 #include "editor/scene/3d/polygon_3d_editor_plugin.h"
103 #include "editor/scene/3d/skeleton_3d_editor_plugin.h"
104 #include "editor/scene/3d/voxel_gi_editor_plugin.h"
105 #include "editor/scene/curve_editor_plugin.h"
106 #include "editor/scene/gradient_editor_plugin.h"
107 #include "editor/scene/gui/control_editor_plugin.h"
108 #include "editor/scene/gui/font_config_plugin.h"
109 #include "editor/scene/gui/margin_container_editor_plugin.h"
110 #include "editor/scene/gui/style_box_editor_plugin.h"
111 #include "editor/scene/gui/theme_editor_plugin.h"
112 #include "editor/scene/material_editor_plugin.h"
113 #include "editor/scene/packed_scene_editor_plugin.h"
114 #include "editor/scene/resource_preloader_editor_plugin.h"
115 #include "editor/scene/sprite_frames_editor_plugin.h"
116 #include "editor/scene/texture/bit_map_editor_plugin.h"
117 #include "editor/scene/texture/gradient_texture_2d_editor_plugin.h"
118 #include "editor/scene/texture/texture_3d_editor_plugin.h"
119 #include "editor/scene/texture/texture_editor_plugin.h"
120 #include "editor/scene/texture/texture_layered_editor_plugin.h"
121 #include "editor/scene/texture/texture_region_editor_plugin.h"
122 #include "editor/script/editor_script.h"
123 #include "editor/script/editor_script_plugin.h"
124 #include "editor/script/script_editor_plugin.h"
125 #include "editor/settings/editor_command_palette.h"
126 #include "editor/settings/editor_feature_profile.h"
127 #include "editor/settings/editor_settings.h"
128 #include "editor/shader/shader_editor_plugin.h"
129 #include "editor/shader/shader_file_editor_plugin.h"
130 #include "editor/translations/editor_translation_parser.h"
131 #include "editor/version_control/editor_vcs_interface.h"
132 #ifndef DISABLE_DEPRECATED
133 #include "editor/scene/2d/parallax_background_editor_plugin.h"
134 #include "editor/scene/3d/skeleton_ik_3d_editor_plugin.h"
135 #endif
136
137 void register_editor_types() {
138 OS::get_singleton()->benchmark_begin_measure("Editor", "Register Types");
139
140 ResourceLoader::set_timestamp_on_load(true);
141 ResourceSaver::set_timestamp_on_save(true);
142
143 EditorStringNames::create();
144
145 GDREGISTER_CLASS(EditorPaths);
146 GDREGISTER_CLASS(EditorPlugin);
147 GDREGISTER_CLASS(EditorTranslationParserPlugin);
148 GDREGISTER_CLASS(EditorImportPlugin);
149 GDREGISTER_CLASS(EditorScript);
150 GDREGISTER_CLASS(EditorDock);
151 GDREGISTER_CLASS(EditorSelection);
152 GDREGISTER_CLASS(EditorFileDialog);
153 GDREGISTER_CLASS(EditorSettings);
154 GDREGISTER_ABSTRACT_CLASS(EditorToaster);
155 GDREGISTER_CLASS(EditorNode3DGizmo);
156 GDREGISTER_CLASS(EditorNode3DGizmoPlugin);
157 GDREGISTER_ABSTRACT_CLASS(EditorResourcePreview);
158 GDREGISTER_CLASS(EditorResourcePreviewGenerator);
159 GDREGISTER_CLASS(EditorResourceTooltipPlugin);
160 GDREGISTER_ABSTRACT_CLASS(EditorFileSystem);
161 GDREGISTER_CLASS(EditorFileSystemDirectory);
162 GDREGISTER_CLASS(EditorVCSInterface);
163 GDREGISTER_ABSTRACT_CLASS(ScriptEditor);
164 GDREGISTER_ABSTRACT_CLASS(ScriptEditorBase);
165 GDREGISTER_CLASS(EditorSyntaxHighlighter);
166 GDREGISTER_ABSTRACT_CLASS(EditorInterface);
167 GDREGISTER_CLASS(EditorExportPlugin);
168 GDREGISTER_ABSTRACT_CLASS(EditorExportPlatform);
169 GDREGISTER_ABSTRACT_CLASS(EditorExportPlatformPC);
170 GDREGISTER_ABSTRACT_CLASS(EditorExportPlatformAppleEmbedded);
171 GDREGISTER_CLASS(EditorExportPlatformExtension);
172 GDREGISTER_ABSTRACT_CLASS(EditorExportPreset);
173
174 register_exporter_types();
175
176 GDREGISTER_CLASS(EditorResourceConversionPlugin);
177 GDREGISTER_CLASS(EditorSceneFormatImporter);
178 GDREGISTER_CLASS(EditorScenePostImportPlugin);
179 GDREGISTER_CLASS(EditorInspector);
180 GDREGISTER_CLASS(EditorInspectorPlugin);
181 GDREGISTER_CLASS(EditorProperty);
182 GDREGISTER_CLASS(ScriptCreateDialog);
183 GDREGISTER_CLASS(EditorFeatureProfile);
184 GDREGISTER_CLASS(EditorSpinSlider);
185 GDREGISTER_CLASS(EditorResourcePicker);
186 GDREGISTER_CLASS(EditorScriptPicker);
187 GDREGISTER_ABSTRACT_CLASS(EditorUndoRedoManager);
188 GDREGISTER_CLASS(EditorContextMenuPlugin);
189
190 GDREGISTER_ABSTRACT_CLASS(FileSystemDock);
191 GDREGISTER_VIRTUAL_CLASS(EditorFileSystemImportFormatSupportQuery);
192
193 GDREGISTER_CLASS(EditorScenePostImport);
194 GDREGISTER_CLASS(EditorCommandPalette);
195 GDREGISTER_CLASS(EditorDebuggerPlugin);
196 GDREGISTER_ABSTRACT_CLASS(EditorDebuggerSession);
197
198 // Required to document import options in the class reference.
199 GDREGISTER_CLASS(ResourceImporterBitMap);
200 GDREGISTER_CLASS(ResourceImporterBMFont);
201 GDREGISTER_CLASS(ResourceImporterCSVTranslation);
202 GDREGISTER_CLASS(ResourceImporterDynamicFont);
203 GDREGISTER_CLASS(ResourceImporterImage);
204 GDREGISTER_CLASS(ResourceImporterImageFont);
205 GDREGISTER_CLASS(ResourceImporterSVG);
206 GDREGISTER_CLASS(ResourceImporterLayeredTexture);
207 GDREGISTER_CLASS(ResourceImporterOBJ);
208 GDREGISTER_CLASS(ResourceImporterScene);
209 GDREGISTER_CLASS(ResourceImporterShaderFile);
210 GDREGISTER_CLASS(ResourceImporterTexture);
211 GDREGISTER_CLASS(ResourceImporterTextureAtlas);
212 GDREGISTER_CLASS(ResourceImporterWAV);
213
214 // This list is alphabetized, and plugins that depend on Node2D are in their own section below.
215 EditorPlugins::add_by_type<AnimationTreeEditorPlugin>();
216 EditorPlugins::add_by_type<AudioStreamEditorPlugin>();
217 EditorPlugins::add_by_type<AudioStreamRandomizerEditorPlugin>();
218 EditorPlugins::add_by_type<BitMapEditorPlugin>();
219 EditorPlugins::add_by_type<BoneMapEditorPlugin>();
220 EditorPlugins::add_by_type<Camera3DEditorPlugin>();
221 EditorPlugins::add_by_type<ControlEditorPlugin>();
222 EditorPlugins::add_by_type<CPUParticles3DEditorPlugin>();
223 EditorPlugins::add_by_type<CurveEditorPlugin>();
224 if (!Engine::get_singleton()->is_recovery_mode_hint()) {
225 EditorPlugins::add_by_type<DebugAdapterServer>();
226 }
227 EditorPlugins::add_by_type<EditorScriptPlugin>();
228 EditorPlugins::add_by_type<FontEditorPlugin>();
229 EditorPlugins::add_by_type<GPUParticles3DEditorPlugin>();
230 EditorPlugins::add_by_type<GPUParticlesCollisionSDF3DEditorPlugin>();
231 EditorPlugins::add_by_type<GradientEditorPlugin>();
232 EditorPlugins::add_by_type<GradientTexture2DEditorPlugin>();
233 EditorPlugins::add_by_type<InputEventEditorPlugin>();
234 EditorPlugins::add_by_type<LightmapGIEditorPlugin>();
235 EditorPlugins::add_by_type<MarginContainerEditorPlugin>();
236 EditorPlugins::add_by_type<MaterialEditorPlugin>();
237 EditorPlugins::add_by_type<MeshEditorPlugin>();
238 EditorPlugins::add_by_type<MeshInstance3DEditorPlugin>();
239 EditorPlugins::add_by_type<MeshLibraryEditorPlugin>();
240 EditorPlugins::add_by_type<MultiMeshEditorPlugin>();
241 EditorPlugins::add_by_type<OccluderInstance3DEditorPlugin>();
242 EditorPlugins::add_by_type<PackedSceneEditorPlugin>();
243 EditorPlugins::add_by_type<Path3DEditorPlugin>();
244 EditorPlugins::add_by_type<PhysicalBone3DEditorPlugin>();
245 EditorPlugins::add_by_type<Polygon3DEditorPlugin>();
246 EditorPlugins::add_by_type<ResourcePreloaderEditorPlugin>();
247 EditorPlugins::add_by_type<ShaderEditorPlugin>();
248 EditorPlugins::add_by_type<ShaderFileEditorPlugin>();
249 EditorPlugins::add_by_type<Skeleton3DEditorPlugin>();
250 EditorPlugins::add_by_type<SpriteFramesEditorPlugin>();
251 EditorPlugins::add_by_type<StyleBoxEditorPlugin>();
252 EditorPlugins::add_by_type<SubViewportPreviewEditorPlugin>();
253 EditorPlugins::add_by_type<Texture3DEditorPlugin>();
254 EditorPlugins::add_by_type<TextureEditorPlugin>();
255 EditorPlugins::add_by_type<TextureLayeredEditorPlugin>();
256 EditorPlugins::add_by_type<TextureRegionEditorPlugin>();
257 EditorPlugins::add_by_type<ThemeEditorPlugin>();
258 EditorPlugins::add_by_type<ToolButtonEditorPlugin>();
259 EditorPlugins::add_by_type<VoxelGIEditorPlugin>();
260 #ifndef DISABLE_DEPRECATED
261 EditorPlugins::add_by_type<SkeletonIK3DEditorPlugin>();
262 #endif
263
264 // 2D
265 EditorPlugins::add_by_type<Camera2DEditorPlugin>();
266 EditorPlugins::add_by_type<CollisionPolygon2DEditorPlugin>();
267 EditorPlugins::add_by_type<CollisionShape2DEditorPlugin>();
268 EditorPlugins::add_by_type<CPUParticles2DEditorPlugin>();
269 EditorPlugins::add_by_type<GPUParticles2DEditorPlugin>();
270 EditorPlugins::add_by_type<LightOccluder2DEditorPlugin>();
271 EditorPlugins::add_by_type<Line2DEditorPlugin>();
272 EditorPlugins::add_by_type<Path2DEditorPlugin>();
273 EditorPlugins::add_by_type<Polygon2DEditorPlugin>();
274 EditorPlugins::add_by_type<Cast2DEditorPlugin>();
275 EditorPlugins::add_by_type<Skeleton2DEditorPlugin>();
276 EditorPlugins::add_by_type<Sprite2DEditorPlugin>();
277 EditorPlugins::add_by_type<TileSetEditorPlugin>();
278 EditorPlugins::add_by_type<TileMapEditorPlugin>();
279 #ifndef DISABLE_DEPRECATED
280 EditorPlugins::add_by_type<ParallaxBackgroundEditorPlugin>();
281 #endif
282
283 // For correct doc generation.
284 GLOBAL_DEF(PropertyInfo(Variant::STRING, "editor/run/main_run_args", PROPERTY_HINT_NONE, "monospace"), "");
285
286 GLOBAL_DEF(PropertyInfo(Variant::STRING, "editor/script/templates_search_path", PROPERTY_HINT_DIR), "res://script_templates");
287
288 GLOBAL_DEF("editor/naming/default_signal_callback_name", "_on_{node_name}_{signal_name}");
289 GLOBAL_DEF("editor/naming/default_signal_callback_to_self_name", "_on_{signal_name}");
290 GLOBAL_DEF(PropertyInfo(Variant::INT, "editor/naming/scene_name_casing", PROPERTY_HINT_ENUM, "Auto,PascalCase,snake_case,kebab-case,camelCase"), EditorNode::SCENE_NAME_CASING_SNAKE_CASE);
291 GLOBAL_DEF(PropertyInfo(Variant::INT, "editor/naming/script_name_casing", PROPERTY_HINT_ENUM, "Auto,PascalCase,snake_case,kebab-case,camelCase"), ScriptLanguage::SCRIPT_NAME_CASING_AUTO);
292
293 GLOBAL_DEF("editor/import/reimport_missing_imported_files", true);
294 GLOBAL_DEF("editor/import/use_multiple_threads", true);
295
296 GLOBAL_DEF(PropertyInfo(Variant::INT, "editor/import/atlas_max_width", PROPERTY_HINT_RANGE, "128,8192,1,or_greater"), 2048);
297
298 GLOBAL_DEF("editor/export/convert_text_resources_to_binary", true);
299
300 GLOBAL_DEF("editor/version_control/plugin_name", "");
301 GLOBAL_DEF("editor/version_control/autoload_on_startup", false);
302
303 EditorInterface::create();
304 Engine::Singleton ei_singleton = Engine::Singleton("EditorInterface", EditorInterface::get_singleton());
305 ei_singleton.editor_only = true;
306 Engine::get_singleton()->add_singleton(ei_singleton);
307
308 if (RenderingServer::get_singleton()) {
309 // RenderingServer needs to exist for this to succeed.
310 Texture3DEditor::init_shaders();
311 TextureLayeredEditor::init_shaders();
312 TexturePreview::init_shaders();
313 }
314
315 // Required as GDExtensions can register docs at init time way before this
316 // class is actually instantiated.
317 EditorHelp::init_gdext_pointers();
318
319 OS::get_singleton()->benchmark_end_measure("Editor", "Register Types");
320 }
321
322 void unregister_editor_types() {
323 OS::get_singleton()->benchmark_begin_measure("Editor", "Unregister Types");
324
325 Texture3DEditor::finish_shaders();
326 TextureLayeredEditor::finish_shaders();
327 TexturePreview::finish_shaders();
328
329 EditorNode::cleanup();
330 EditorInterface::free();
331
332 if (EditorPaths::get_singleton()) {
333 EditorPaths::free();
334 }
335 EditorStringNames::free();
336
337 OS::get_singleton()->benchmark_end_measure("Editor", "Unregister Types");
338 }