瀏覽代碼

Merge pull request #50468 from akien-mga/cleanup-header-includes

Misc cleanup of header includes
Rémi Verschelde 4 年之前
父節點
當前提交
f79958a30e

+ 1 - 3
core/config/project_settings.cpp

@@ -30,7 +30,7 @@
 
 #include "project_settings.h"
 
-#include "core/core_bind.h"
+#include "core/core_bind.h" // For Compression enum.
 #include "core/core_string_names.h"
 #include "core/input/input_map.h"
 #include "core/io/dir_access.h"
@@ -42,8 +42,6 @@
 #include "core/os/os.h"
 #include "core/variant/variant_parser.h"
 
-#include <zlib.h>
-
 ProjectSettings *ProjectSettings::singleton = nullptr;
 
 ProjectSettings *ProjectSettings::get_singleton() {

+ 0 - 1
editor/editor_node.cpp

@@ -31,7 +31,6 @@
 #include "editor_node.h"
 
 #include "core/config/project_settings.h"
-#include "core/core_bind.h"
 #include "core/extension/native_extension_manager.h"
 #include "core/input/input.h"
 #include "core/io/config_file.h"

+ 1 - 0
editor/plugin_config_dialog.cpp

@@ -29,6 +29,7 @@
 /*************************************************************************/
 
 #include "plugin_config_dialog.h"
+
 #include "core/io/config_file.h"
 #include "core/io/dir_access.h"
 #include "editor/editor_node.h"

+ 7 - 1
editor/rename_dialog.cpp

@@ -35,12 +35,18 @@
 #include "editor_scale.h"
 #include "editor_settings.h"
 #include "editor_themes.h"
-#include "modules/regex/regex.h"
 #include "plugins/script_editor_plugin.h"
 #include "scene/gui/control.h"
 #include "scene/gui/label.h"
 #include "scene/gui/tab_container.h"
 
+#include "modules/modules_enabled.gen.h"
+#ifdef MODULE_REGEX_ENABLED
+#include "modules/regex/regex.h"
+#else
+#error "Can't build editor rename dialog without RegEx module."
+#endif
+
 RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_undo_redo) {
 	scene_tree_editor = p_scene_tree_editor;
 	undo_redo = p_undo_redo;

+ 4 - 0
modules/fbx/data/fbx_material.cpp

@@ -29,6 +29,10 @@
 /*************************************************************************/
 
 #include "fbx_material.h"
+
+// FIXME: Shouldn't depend on core_bind.h! Use DirAccessRef like the rest of
+// the engine instead of _Directory.
+#include "core/core_bind.h"
 #include "scene/resources/material.h"
 #include "scene/resources/texture.h"
 #include "tools/validation_tools.h"

+ 0 - 1
modules/fbx/data/import_state.h

@@ -37,7 +37,6 @@
 
 #include "pivot_transform.h"
 
-#include "core/core_bind.h"
 #include "core/io/resource_importer.h"
 #include "core/templates/vector.h"
 #include "editor/import/resource_importer_scene.h"

+ 0 - 1
modules/fbx/editor_scene_importer_fbx.h

@@ -36,7 +36,6 @@
 #include "data/import_state.h"
 #include "tools/import_utils.h"
 
-#include "core/core_bind.h"
 #include "core/io/resource_importer.h"
 #include "core/string/ustring.h"
 #include "core/templates/local_vector.h"

+ 0 - 1
modules/gdscript/editor/gdscript_translation_parser_plugin.h

@@ -34,7 +34,6 @@
 #include "core/templates/set.h"
 #include "editor/editor_translation_parser.h"
 #include "modules/gdscript/gdscript_parser.h"
-#include "modules/regex/regex.h"
 
 class GDScriptEditorTranslationParserPlugin : public EditorTranslationParserPlugin {
 	GDCLASS(GDScriptEditorTranslationParserPlugin, EditorTranslationParserPlugin);

+ 9 - 3
modules/gdscript/language_server/gdscript_language_protocol.h

@@ -28,8 +28,8 @@
 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
 /*************************************************************************/
 
-#ifndef GDSCRIPT_PROTOCAL_SERVER_H
-#define GDSCRIPT_PROTOCAL_SERVER_H
+#ifndef GDSCRIPT_LANGUAGE_PROTOCOL_H
+#define GDSCRIPT_LANGUAGE_PROTOCOL_H
 
 #include "core/io/stream_peer.h"
 #include "core/io/stream_peer_tcp.h"
@@ -37,7 +37,13 @@
 #include "gdscript_text_document.h"
 #include "gdscript_workspace.h"
 #include "lsp.hpp"
+
+#include "modules/modules_enabled.gen.h"
+#ifdef MODULE_JSONRPC_ENABLED
 #include "modules/jsonrpc/jsonrpc.h"
+#else
+#error "Can't build GDScript LSP without JSONRPC module."
+#endif
 
 #define LSP_MAX_BUFFER_SIZE 4194304
 #define LSP_MAX_CLIENTS 8
@@ -108,4 +114,4 @@ public:
 	GDScriptLanguageProtocol();
 };
 
-#endif
+#endif // GDSCRIPT_LANGUAGE_PROTOCOL_H

+ 7 - 15
modules/gltf/editor_scene_importer_gltf.cpp

@@ -28,22 +28,14 @@
 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
 /*************************************************************************/
 
-#include "core/crypto/crypto_core.h"
-#include "core/io/file_access.h"
-#include "core/math/disjoint_set.h"
-#include "core/math/math_defs.h"
-#include "core/os/os.h"
-#include "editor/import/resource_importer_scene.h"
-#include "modules/gltf/gltf_state.h"
-#include "modules/regex/regex.h"
-#include "scene/3d/bone_attachment_3d.h"
-#include "scene/3d/camera_3d.h"
-#include "scene/3d/mesh_instance_3d.h"
-#include "scene/animation/animation_player.h"
-#include "scene/resources/packed_scene.h"
-#include "scene/resources/surface_tool.h"
+#include "editor_scene_importer_gltf.h"
+
+#include "gltf_document.h"
+#include "gltf_state.h"
 
-#include "modules/gltf/editor_scene_importer_gltf.h"
+#include "scene/3d/node_3d.h"
+#include "scene/animation/animation_player.h"
+#include "scene/resources/animation.h"
 
 uint32_t EditorSceneImporterGLTF::get_import_flags() const {
 	return ImportFlags::IMPORT_SCENE | ImportFlags::IMPORT_ANIMATION;

+ 3 - 18
modules/gltf/editor_scene_importer_gltf.h

@@ -31,28 +31,13 @@
 #ifndef EDITOR_SCENE_IMPORTER_GLTF_H
 #define EDITOR_SCENE_IMPORTER_GLTF_H
 
-#include "core/config/project_settings.h"
-#include "core/object/object.h"
-#include "core/templates/vector.h"
+#include "gltf_state.h"
+
 #include "editor/import/resource_importer_scene.h"
-#include "modules/csg/csg_shape.h"
-#include "modules/gridmap/grid_map.h"
-#include "scene/3d/mesh_instance_3d.h"
-#include "scene/3d/multimesh_instance_3d.h"
-#include "scene/3d/node_3d.h"
-#include "scene/3d/skeleton_3d.h"
-#include "scene/animation/animation_player.h"
-#include "scene/gui/check_box.h"
 #include "scene/main/node.h"
 #include "scene/resources/packed_scene.h"
-#include "scene/resources/surface_tool.h"
-
-#include "gltf_document.h"
-#include "gltf_state.h"
 
-class AnimationPlayer;
-class BoneAttachment;
-class EditorSceneImporterMeshNode3D;
+class Animation;
 
 #ifdef TOOLS_ENABLED
 class EditorSceneImporterGLTF : public EditorSceneImporter {

+ 17 - 24
modules/gltf/gltf_document.cpp

@@ -29,9 +29,7 @@
 /*************************************************************************/
 
 #include "gltf_document.h"
-#include "core/error/error_list.h"
-#include "core/error/error_macros.h"
-#include "core/variant/variant.h"
+
 #include "gltf_accessor.h"
 #include "gltf_animation.h"
 #include "gltf_camera.h"
@@ -44,35 +42,33 @@
 #include "gltf_state.h"
 #include "gltf_texture.h"
 
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "core/core_bind.h"
 #include "core/crypto/crypto_core.h"
+#include "core/io/dir_access.h"
 #include "core/io/file_access.h"
 #include "core/io/json.h"
 #include "core/math/disjoint_set.h"
 #include "core/variant/typed_array.h"
+#include "core/variant/variant.h"
 #include "core/version.h"
 #include "core/version_hash.gen.h"
 #include "drivers/png/png_driver_common.h"
 #include "editor/import/resource_importer_scene.h"
+#include "scene/2d/node_2d.h"
+#include "scene/3d/camera_3d.h"
+#include "scene/3d/multimesh_instance_3d.h"
+#include "scene/animation/animation_player.h"
+#include "scene/resources/surface_tool.h"
+
+#include "modules/modules_enabled.gen.h"
 #ifdef MODULE_CSG_ENABLED
 #include "modules/csg/csg_shape.h"
 #endif // MODULE_CSG_ENABLED
 #ifdef MODULE_GRIDMAP_ENABLED
 #include "modules/gridmap/grid_map.h"
 #endif // MODULE_GRIDMAP_ENABLED
-#include "scene/2d/node_2d.h"
-#include "scene/3d/bone_attachment_3d.h"
-#include "scene/3d/camera_3d.h"
-#include "scene/3d/mesh_instance_3d.h"
-#include "scene/3d/multimesh_instance_3d.h"
-#include "scene/3d/node_3d.h"
-#include "scene/3d/skeleton_3d.h"
-#include "scene/animation/animation_player.h"
-#include "scene/main/node.h"
-#include "scene/resources/surface_tool.h"
+
+#include <stdio.h>
+#include <stdlib.h>
 #include <limits>
 
 Error GLTFDocument::serialize(Ref<GLTFState> state, Node *p_root, const String &p_path) {
@@ -2873,16 +2869,13 @@ Error GLTFDocument::_serialize_images(Ref<GLTFState> state, const String &p_path
 				name = itos(i);
 			}
 			name = _gen_unique_name(state, name);
-			name = name.pad_zeros(3);
-			Ref<_Directory> dir;
-			dir.instantiate();
+			name = name.pad_zeros(3) + ".png";
 			String texture_dir = "textures";
 			String new_texture_dir = p_path.get_base_dir() + "/" + texture_dir;
-			dir->open(p_path.get_base_dir());
-			if (!dir->dir_exists(new_texture_dir)) {
-				dir->make_dir(new_texture_dir);
+			DirAccessRef da = DirAccess::open(p_path.get_base_dir());
+			if (!da->dir_exists(new_texture_dir)) {
+				da->make_dir(new_texture_dir);
 			}
-			name = name + ".png";
 			image->save_png(new_texture_dir.plus_file(name));
 			d["uri"] = texture_dir.plus_file(name);
 		}

+ 4 - 4
modules/gltf/gltf_document.h

@@ -31,11 +31,9 @@
 #ifndef GLTF_DOCUMENT_H
 #define GLTF_DOCUMENT_H
 
-#include "editor/import/resource_importer_scene.h"
-#include "editor/import/scene_importer_mesh_node_3d.h"
 #include "gltf_animation.h"
-#include "modules/modules_enabled.gen.h"
-#include "scene/2d/node_2d.h"
+
+#include "editor/import/scene_importer_mesh_node_3d.h"
 #include "scene/3d/bone_attachment_3d.h"
 #include "scene/3d/light_3d.h"
 #include "scene/3d/mesh_instance_3d.h"
@@ -45,6 +43,8 @@
 #include "scene/resources/material.h"
 #include "scene/resources/texture.h"
 
+#include "modules/modules_enabled.gen.h"
+
 class GLTFState;
 class GLTFSkin;
 class GLTFNode;

+ 3 - 3
modules/gltf/gltf_state.h

@@ -31,9 +31,6 @@
 #ifndef GLTF_STATE_H
 #define GLTF_STATE_H
 
-#include "core/io/resource.h"
-#include "core/templates/vector.h"
-#include "editor_scene_importer_gltf.h"
 #include "gltf_accessor.h"
 #include "gltf_animation.h"
 #include "gltf_buffer_view.h"
@@ -45,6 +42,9 @@
 #include "gltf_skeleton.h"
 #include "gltf_skin.h"
 #include "gltf_texture.h"
+
+#include "core/io/resource.h"
+#include "core/templates/vector.h"
 #include "scene/animation/animation_player.h"
 #include "scene/resources/texture.h"
 

+ 1 - 1
modules/mbedtls/tests/test_crypto_mbedtls.cpp

@@ -28,7 +28,7 @@
 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
 /*************************************************************************/
 
-#include "modules/mbedtls/tests/test_crypto_mbedtls.h"
+#include "test_crypto_mbedtls.h"
 
 #include "modules/mbedtls/crypto_mbedtls.h"
 #include "tests/test_macros.h"

+ 1 - 1
modules/navigation/navigation_mesh_generator.cpp

@@ -47,12 +47,12 @@
 #include "scene/resources/sphere_shape_3d.h"
 #include "scene/resources/world_margin_shape_3d.h"
 
-#include "modules/modules_enabled.gen.h"
 #ifdef TOOLS_ENABLED
 #include "editor/editor_node.h"
 #include "editor/editor_settings.h"
 #endif
 
+#include "modules/modules_enabled.gen.h"
 #ifdef MODULE_CSG_ENABLED
 #include "modules/csg/csg_shape.h"
 #endif

+ 0 - 1
modules/text_server_adv/dynamic_font_adv.h

@@ -34,7 +34,6 @@
 #include "font_adv.h"
 
 #include "modules/modules_enabled.gen.h"
-
 #ifdef MODULE_FREETYPE_ENABLED
 
 #include <ft2build.h>

+ 0 - 1
modules/text_server_fb/dynamic_font_fb.h

@@ -34,7 +34,6 @@
 #include "font_fb.h"
 
 #include "modules/modules_enabled.gen.h"
-
 #ifdef MODULE_FREETYPE_ENABLED
 
 #include <ft2build.h>

+ 1 - 0
modules/webrtc/webrtc_data_channel_gdnative.cpp

@@ -31,6 +31,7 @@
 #ifdef WEBRTC_GDNATIVE_ENABLED
 
 #include "webrtc_data_channel_gdnative.h"
+
 #include "core/io/resource_loader.h"
 #include "modules/gdnative/nativescript/nativescript.h"
 

+ 4 - 5
modules/websocket/editor_debugger_server_websocket.h

@@ -28,12 +28,11 @@
 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
 /*************************************************************************/
 
-#ifndef SCRIPT_EDITOR_DEBUGGER_WEBSOCKET_H
-#define SCRIPT_EDITOR_DEBUGGER_WEBSOCKET_H
-
-#include "modules/websocket/websocket_server.h"
+#ifndef EDITOR_DEBUGGER_SERVER_WEBSOCKET_H
+#define EDITOR_DEBUGGER_SERVER_WEBSOCKET_H
 
 #include "editor/debugger/editor_debugger_server.h"
+#include "modules/websocket/websocket_server.h"
 
 class EditorDebuggerServerWebSocket : public EditorDebuggerServer {
 	GDCLASS(EditorDebuggerServerWebSocket, EditorDebuggerServer);
@@ -59,4 +58,4 @@ public:
 	~EditorDebuggerServerWebSocket();
 };
 
-#endif // SCRIPT_EDITOR_DEBUGGER_WEBSOCKET_H
+#endif // EDITOR_DEBUGGER_SERVER_WEBSOCKET_H

+ 3 - 3
modules/websocket/remote_debugger_peer_websocket.h

@@ -28,8 +28,8 @@
 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
 /*************************************************************************/
 
-#ifndef SCRIPT_DEBUGGER_WEBSOCKET_H
-#define SCRIPT_DEBUGGER_WEBSOCKET_H
+#ifndef REMOTE_DEBUGGER_PEER_WEBSOCKET_H
+#define REMOTE_DEBUGGER_PEER_WEBSOCKET_H
 
 #ifdef JAVASCRIPT_ENABLED
 #include "modules/websocket/emws_client.h"
@@ -62,4 +62,4 @@ public:
 	RemoteDebuggerPeerWebSocket(Ref<WebSocketPeer> p_peer = Ref<WebSocketPeer>());
 };
 
-#endif // SCRIPT_DEBUGGER_WEBSOCKET_H
+#endif // REMOTE_DEBUGGER_PEER_WEBSOCKET_H

+ 1 - 1
platform/javascript/os_javascript.cpp

@@ -35,9 +35,9 @@
 #include "drivers/unix/dir_access_unix.h"
 #include "drivers/unix/file_access_unix.h"
 #include "main/main.h"
-#include "modules/modules_enabled.gen.h"
 #include "platform/javascript/display_server_javascript.h"
 
+#include "modules/modules_enabled.gen.h"
 #ifdef MODULE_WEBSOCKET_ENABLED
 #include "modules/websocket/remote_debugger_peer_websocket.h"
 #endif

+ 0 - 1
platform/uwp/export/export.cpp

@@ -31,7 +31,6 @@
 #include "export.h"
 
 #include "core/config/project_settings.h"
-#include "core/core_bind.h"
 #include "core/crypto/crypto_core.h"
 #include "core/io/dir_access.h"
 #include "core/io/file_access.h"