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 "editor/debugger/debug_adapter/debug_adapter_server.h"
34#include "editor/editor_command_palette.h"
35#include "editor/editor_feature_profile.h"
36#include "editor/editor_file_system.h"
37#include "editor/editor_interface.h"
38#include "editor/editor_node.h"
39#include "editor/editor_paths.h"
40#include "editor/editor_resource_picker.h"
41#include "editor/editor_resource_preview.h"
42#include "editor/editor_script.h"
43#include "editor/editor_settings.h"
44#include "editor/editor_string_names.h"
45#include "editor/editor_translation_parser.h"
46#include "editor/editor_undo_redo_manager.h"
47#include "editor/export/editor_export_platform.h"
48#include "editor/export/editor_export_platform_pc.h"
49#include "editor/export/editor_export_plugin.h"
50#include "editor/filesystem_dock.h"
51#include "editor/gui/editor_file_dialog.h"
52#include "editor/gui/editor_spin_slider.h"
53#include "editor/import/editor_import_plugin.h"
54#include "editor/import/resource_importer_bitmask.h"
55#include "editor/import/resource_importer_bmfont.h"
56#include "editor/import/resource_importer_csv_translation.h"
57#include "editor/import/resource_importer_dynamic_font.h"
58#include "editor/import/resource_importer_image.h"
59#include "editor/import/resource_importer_imagefont.h"
60#include "editor/import/resource_importer_layered_texture.h"
61#include "editor/import/resource_importer_obj.h"
62#include "editor/import/resource_importer_scene.h"
63#include "editor/import/resource_importer_shader_file.h"
64#include "editor/import/resource_importer_texture.h"
65#include "editor/import/resource_importer_texture_atlas.h"
66#include "editor/import/resource_importer_wav.h"
67#include "editor/plugins/animation_tree_editor_plugin.h"
68#include "editor/plugins/audio_stream_editor_plugin.h"
69#include "editor/plugins/audio_stream_randomizer_editor_plugin.h"
70#include "editor/plugins/bit_map_editor_plugin.h"
71#include "editor/plugins/bone_map_editor_plugin.h"
72#include "editor/plugins/camera_3d_editor_plugin.h"
73#include "editor/plugins/cast_2d_editor_plugin.h"
74#include "editor/plugins/collision_polygon_2d_editor_plugin.h"
75#include "editor/plugins/collision_shape_2d_editor_plugin.h"
76#include "editor/plugins/control_editor_plugin.h"
77#include "editor/plugins/cpu_particles_2d_editor_plugin.h"
78#include "editor/plugins/cpu_particles_3d_editor_plugin.h"
79#include "editor/plugins/curve_editor_plugin.h"
80#include "editor/plugins/editor_debugger_plugin.h"
81#include "editor/plugins/editor_resource_tooltip_plugins.h"
82#include "editor/plugins/font_config_plugin.h"
83#include "editor/plugins/gpu_particles_2d_editor_plugin.h"
84#include "editor/plugins/gpu_particles_3d_editor_plugin.h"
85#include "editor/plugins/gpu_particles_collision_sdf_editor_plugin.h"
86#include "editor/plugins/gradient_editor_plugin.h"
87#include "editor/plugins/gradient_texture_2d_editor_plugin.h"
88#include "editor/plugins/input_event_editor_plugin.h"
89#include "editor/plugins/light_occluder_2d_editor_plugin.h"
90#include "editor/plugins/lightmap_gi_editor_plugin.h"
91#include "editor/plugins/line_2d_editor_plugin.h"
92#include "editor/plugins/material_editor_plugin.h"
93#include "editor/plugins/mesh_editor_plugin.h"
94#include "editor/plugins/mesh_instance_3d_editor_plugin.h"
95#include "editor/plugins/mesh_library_editor_plugin.h"
96#include "editor/plugins/multimesh_editor_plugin.h"
97#include "editor/plugins/navigation_link_2d_editor_plugin.h"
98#include "editor/plugins/navigation_obstacle_2d_editor_plugin.h"
99#include "editor/plugins/navigation_obstacle_3d_editor_plugin.h"
100#include "editor/plugins/navigation_polygon_editor_plugin.h"
101#include "editor/plugins/node_3d_editor_gizmos.h"
102#include "editor/plugins/occluder_instance_3d_editor_plugin.h"
103#include "editor/plugins/packed_scene_editor_plugin.h"
104#include "editor/plugins/path_2d_editor_plugin.h"
105#include "editor/plugins/path_3d_editor_plugin.h"
106#include "editor/plugins/physical_bone_3d_editor_plugin.h"
107#include "editor/plugins/polygon_2d_editor_plugin.h"
108#include "editor/plugins/polygon_3d_editor_plugin.h"
109#include "editor/plugins/resource_preloader_editor_plugin.h"
110#include "editor/plugins/script_editor_plugin.h"
111#include "editor/plugins/shader_editor_plugin.h"
112#include "editor/plugins/shader_file_editor_plugin.h"
113#include "editor/plugins/skeleton_2d_editor_plugin.h"
114#include "editor/plugins/skeleton_3d_editor_plugin.h"
115#include "editor/plugins/skeleton_ik_3d_editor_plugin.h"
116#include "editor/plugins/sprite_2d_editor_plugin.h"
117#include "editor/plugins/sprite_frames_editor_plugin.h"
118#include "editor/plugins/style_box_editor_plugin.h"
119#include "editor/plugins/sub_viewport_preview_editor_plugin.h"
120#include "editor/plugins/texture_3d_editor_plugin.h"
121#include "editor/plugins/texture_editor_plugin.h"
122#include "editor/plugins/texture_layered_editor_plugin.h"
123#include "editor/plugins/texture_region_editor_plugin.h"
124#include "editor/plugins/theme_editor_plugin.h"
125#include "editor/plugins/tiles/tiles_editor_plugin.h"
126#include "editor/plugins/version_control_editor_plugin.h"
127#include "editor/plugins/visual_shader_editor_plugin.h"
128#include "editor/plugins/voxel_gi_editor_plugin.h"
129#include "editor/register_exporters.h"
130
131void register_editor_types() {
132 OS::get_singleton()->benchmark_begin_measure("register_editor_types");
133
134 ResourceLoader::set_timestamp_on_load(true);
135 ResourceSaver::set_timestamp_on_save(true);
136
137 EditorStringNames::create();
138
139 GDREGISTER_CLASS(EditorPaths);
140 GDREGISTER_CLASS(EditorPlugin);
141 GDREGISTER_CLASS(EditorTranslationParserPlugin);
142 GDREGISTER_CLASS(EditorImportPlugin);
143 GDREGISTER_CLASS(EditorScript);
144 GDREGISTER_CLASS(EditorSelection);
145 GDREGISTER_CLASS(EditorFileDialog);
146 GDREGISTER_CLASS(EditorSettings);
147 GDREGISTER_CLASS(EditorNode3DGizmo);
148 GDREGISTER_CLASS(EditorNode3DGizmoPlugin);
149 GDREGISTER_ABSTRACT_CLASS(EditorResourcePreview);
150 GDREGISTER_CLASS(EditorResourcePreviewGenerator);
151 GDREGISTER_CLASS(EditorResourceTooltipPlugin);
152 GDREGISTER_ABSTRACT_CLASS(EditorFileSystem);
153 GDREGISTER_CLASS(EditorFileSystemDirectory);
154 GDREGISTER_CLASS(EditorVCSInterface);
155 GDREGISTER_ABSTRACT_CLASS(ScriptEditor);
156 GDREGISTER_ABSTRACT_CLASS(ScriptEditorBase);
157 GDREGISTER_CLASS(EditorSyntaxHighlighter);
158 GDREGISTER_ABSTRACT_CLASS(EditorInterface);
159 GDREGISTER_CLASS(EditorExportPlugin);
160 GDREGISTER_ABSTRACT_CLASS(EditorExportPlatform);
161 GDREGISTER_ABSTRACT_CLASS(EditorExportPlatformPC);
162
163 register_exporter_types();
164
165 GDREGISTER_CLASS(EditorResourceConversionPlugin);
166 GDREGISTER_CLASS(EditorSceneFormatImporter);
167 GDREGISTER_CLASS(EditorScenePostImportPlugin);
168 GDREGISTER_CLASS(EditorInspector);
169 GDREGISTER_CLASS(EditorInspectorPlugin);
170 GDREGISTER_CLASS(EditorProperty);
171 GDREGISTER_CLASS(ScriptCreateDialog);
172 GDREGISTER_CLASS(EditorFeatureProfile);
173 GDREGISTER_CLASS(EditorSpinSlider);
174 GDREGISTER_CLASS(EditorResourcePicker);
175 GDREGISTER_CLASS(EditorScriptPicker);
176 GDREGISTER_ABSTRACT_CLASS(EditorUndoRedoManager);
177
178 GDREGISTER_ABSTRACT_CLASS(FileSystemDock);
179 GDREGISTER_VIRTUAL_CLASS(EditorFileSystemImportFormatSupportQuery);
180
181 GDREGISTER_CLASS(EditorScenePostImport);
182 GDREGISTER_CLASS(EditorCommandPalette);
183 GDREGISTER_CLASS(EditorDebuggerPlugin);
184 GDREGISTER_ABSTRACT_CLASS(EditorDebuggerSession);
185
186 // Required to document import options in the class reference.
187 GDREGISTER_CLASS(ResourceImporterBitMap);
188 GDREGISTER_CLASS(ResourceImporterBMFont);
189 GDREGISTER_CLASS(ResourceImporterCSVTranslation);
190 GDREGISTER_CLASS(ResourceImporterDynamicFont);
191 GDREGISTER_CLASS(ResourceImporterImage);
192 GDREGISTER_CLASS(ResourceImporterImageFont);
193 GDREGISTER_CLASS(ResourceImporterLayeredTexture);
194 GDREGISTER_CLASS(ResourceImporterOBJ);
195 GDREGISTER_CLASS(ResourceImporterScene);
196 GDREGISTER_CLASS(ResourceImporterShaderFile);
197 GDREGISTER_CLASS(ResourceImporterTexture);
198 GDREGISTER_CLASS(ResourceImporterTextureAtlas);
199 GDREGISTER_CLASS(ResourceImporterWAV);
200
201 // This list is alphabetized, and plugins that depend on Node2D are in their own section below.
202 EditorPlugins::add_by_type<AnimationTreeEditorPlugin>();
203 EditorPlugins::add_by_type<AudioStreamEditorPlugin>();
204 EditorPlugins::add_by_type<AudioStreamRandomizerEditorPlugin>();
205 EditorPlugins::add_by_type<BitMapEditorPlugin>();
206 EditorPlugins::add_by_type<BoneMapEditorPlugin>();
207 EditorPlugins::add_by_type<Camera3DEditorPlugin>();
208 EditorPlugins::add_by_type<ControlEditorPlugin>();
209 EditorPlugins::add_by_type<CPUParticles3DEditorPlugin>();
210 EditorPlugins::add_by_type<CurveEditorPlugin>();
211 EditorPlugins::add_by_type<DebugAdapterServer>();
212 EditorPlugins::add_by_type<FontEditorPlugin>();
213 EditorPlugins::add_by_type<GPUParticles3DEditorPlugin>();
214 EditorPlugins::add_by_type<GPUParticlesCollisionSDF3DEditorPlugin>();
215 EditorPlugins::add_by_type<GradientEditorPlugin>();
216 EditorPlugins::add_by_type<GradientTexture2DEditorPlugin>();
217 EditorPlugins::add_by_type<InputEventEditorPlugin>();
218 EditorPlugins::add_by_type<LightmapGIEditorPlugin>();
219 EditorPlugins::add_by_type<MaterialEditorPlugin>();
220 EditorPlugins::add_by_type<MeshEditorPlugin>();
221 EditorPlugins::add_by_type<MeshInstance3DEditorPlugin>();
222 EditorPlugins::add_by_type<MeshLibraryEditorPlugin>();
223 EditorPlugins::add_by_type<MultiMeshEditorPlugin>();
224 EditorPlugins::add_by_type<NavigationObstacle3DEditorPlugin>();
225 EditorPlugins::add_by_type<OccluderInstance3DEditorPlugin>();
226 EditorPlugins::add_by_type<PackedSceneEditorPlugin>();
227 EditorPlugins::add_by_type<Path3DEditorPlugin>();
228 EditorPlugins::add_by_type<PhysicalBone3DEditorPlugin>();
229 EditorPlugins::add_by_type<Polygon3DEditorPlugin>();
230 EditorPlugins::add_by_type<ResourcePreloaderEditorPlugin>();
231 EditorPlugins::add_by_type<ShaderEditorPlugin>();
232 EditorPlugins::add_by_type<ShaderFileEditorPlugin>();
233 EditorPlugins::add_by_type<Skeleton3DEditorPlugin>();
234 EditorPlugins::add_by_type<SkeletonIK3DEditorPlugin>();
235 EditorPlugins::add_by_type<SpriteFramesEditorPlugin>();
236 EditorPlugins::add_by_type<StyleBoxEditorPlugin>();
237 EditorPlugins::add_by_type<SubViewportPreviewEditorPlugin>();
238 EditorPlugins::add_by_type<Texture3DEditorPlugin>();
239 EditorPlugins::add_by_type<TextureEditorPlugin>();
240 EditorPlugins::add_by_type<TextureLayeredEditorPlugin>();
241 EditorPlugins::add_by_type<TextureRegionEditorPlugin>();
242 EditorPlugins::add_by_type<ThemeEditorPlugin>();
243 EditorPlugins::add_by_type<VoxelGIEditorPlugin>();
244
245 // 2D
246 EditorPlugins::add_by_type<CollisionPolygon2DEditorPlugin>();
247 EditorPlugins::add_by_type<CollisionShape2DEditorPlugin>();
248 EditorPlugins::add_by_type<CPUParticles2DEditorPlugin>();
249 EditorPlugins::add_by_type<GPUParticles2DEditorPlugin>();
250 EditorPlugins::add_by_type<LightOccluder2DEditorPlugin>();
251 EditorPlugins::add_by_type<Line2DEditorPlugin>();
252 EditorPlugins::add_by_type<NavigationLink2DEditorPlugin>();
253 EditorPlugins::add_by_type<NavigationObstacle2DEditorPlugin>();
254 EditorPlugins::add_by_type<NavigationPolygonEditorPlugin>();
255 EditorPlugins::add_by_type<Path2DEditorPlugin>();
256 EditorPlugins::add_by_type<Polygon2DEditorPlugin>();
257 EditorPlugins::add_by_type<Cast2DEditorPlugin>();
258 EditorPlugins::add_by_type<Skeleton2DEditorPlugin>();
259 EditorPlugins::add_by_type<Sprite2DEditorPlugin>();
260 EditorPlugins::add_by_type<TileMapEditorPlugin>();
261 EditorPlugins::add_by_type<TileSetEditorPlugin>();
262
263 // For correct doc generation.
264 GLOBAL_DEF("editor/run/main_run_args", "");
265
266 GLOBAL_DEF(PropertyInfo(Variant::STRING, "editor/script/templates_search_path", PROPERTY_HINT_DIR), "res://script_templates");
267
268 GLOBAL_DEF("editor/naming/default_signal_callback_name", "_on_{node_name}_{signal_name}");
269 GLOBAL_DEF("editor/naming/default_signal_callback_to_self_name", "_on_{signal_name}");
270 GLOBAL_DEF(PropertyInfo(Variant::INT, "editor/naming/scene_name_casing", PROPERTY_HINT_ENUM, "Auto,PascalCase,snake_case"), EditorNode::SCENE_NAME_CASING_SNAKE_CASE);
271
272 GLOBAL_DEF("editor/import/reimport_missing_imported_files", true);
273 GLOBAL_DEF("editor/import/use_multiple_threads", true);
274
275 GLOBAL_DEF("editor/export/convert_text_resources_to_binary", true);
276
277 GLOBAL_DEF("editor/version_control/plugin_name", "");
278 GLOBAL_DEF("editor/version_control/autoload_on_startup", false);
279
280 EditorInterface::create();
281 Engine::get_singleton()->add_singleton(Engine::Singleton("EditorInterface", EditorInterface::get_singleton()));
282
283 OS::get_singleton()->benchmark_end_measure("register_editor_types");
284}
285
286void unregister_editor_types() {
287 OS::get_singleton()->benchmark_begin_measure("unregister_editor_types");
288
289 EditorNode::cleanup();
290 EditorInterface::free();
291
292 if (EditorPaths::get_singleton()) {
293 EditorPaths::free();
294 }
295 EditorStringNames::free();
296
297 OS::get_singleton()->benchmark_end_measure("unregister_editor_types");
298}
299