diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2021-07-15 00:46:35 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2021-07-15 00:46:43 +0200 |
commit | 06568bbfdfbecb489d3263f6df1e7d298642cd61 (patch) | |
tree | 420fd4cf4a5b041f8af3b51b674dc0c3eab1bf6b | |
parent | 499be1fb67bbadb11b54763cf6fe04ac1784877b (diff) |
Misc cleanup of header includes
Was looking for misuse of module headers without checking that the module is
actually enabled and got carried away...
23 files changed, 67 insertions, 89 deletions
diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp index ac4e0db5b7..84860b648d 100644 --- a/core/config/project_settings.cpp +++ b/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() { diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 4d52414748..373692ff47 100644 --- a/editor/editor_node.cpp +++ b/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" diff --git a/editor/plugin_config_dialog.cpp b/editor/plugin_config_dialog.cpp index f55d77d782..cbcc3c9880 100644 --- a/editor/plugin_config_dialog.cpp +++ b/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" diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp index 0f15d4b119..87fbbbcfb8 100644 --- a/editor/rename_dialog.cpp +++ b/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; diff --git a/modules/fbx/data/fbx_material.cpp b/modules/fbx/data/fbx_material.cpp index cf5d70fa5b..fb6c67f7b9 100644 --- a/modules/fbx/data/fbx_material.cpp +++ b/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" diff --git a/modules/fbx/data/import_state.h b/modules/fbx/data/import_state.h index 83bc43faff..9ba60eaacf 100644 --- a/modules/fbx/data/import_state.h +++ b/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" diff --git a/modules/fbx/editor_scene_importer_fbx.h b/modules/fbx/editor_scene_importer_fbx.h index 4bb2c9d21b..4a3b78480b 100644 --- a/modules/fbx/editor_scene_importer_fbx.h +++ b/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" diff --git a/modules/gdscript/editor/gdscript_translation_parser_plugin.h b/modules/gdscript/editor/gdscript_translation_parser_plugin.h index fcf438422a..caa80fc24c 100644 --- a/modules/gdscript/editor/gdscript_translation_parser_plugin.h +++ b/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); diff --git a/modules/gdscript/language_server/gdscript_language_protocol.h b/modules/gdscript/language_server/gdscript_language_protocol.h index 969c38eab6..5a2dd55c46 100644 --- a/modules/gdscript/language_server/gdscript_language_protocol.h +++ b/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 diff --git a/modules/gltf/editor_scene_importer_gltf.cpp b/modules/gltf/editor_scene_importer_gltf.cpp index cef5278f03..eca1c85bf3 100644 --- a/modules/gltf/editor_scene_importer_gltf.cpp +++ b/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; diff --git a/modules/gltf/editor_scene_importer_gltf.h b/modules/gltf/editor_scene_importer_gltf.h index 566d5cfd34..7bc5f594ed 100644 --- a/modules/gltf/editor_scene_importer_gltf.h +++ b/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 { diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index 660c2ab305..71a9b3667f 100644 --- a/modules/gltf/gltf_document.cpp +++ b/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); } diff --git a/modules/gltf/gltf_document.h b/modules/gltf/gltf_document.h index 514373c4f0..3e8ea19045 100644 --- a/modules/gltf/gltf_document.h +++ b/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; diff --git a/modules/gltf/gltf_state.h b/modules/gltf/gltf_state.h index ba6bf8a533..d8209523c5 100644 --- a/modules/gltf/gltf_state.h +++ b/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" diff --git a/modules/mbedtls/tests/test_crypto_mbedtls.cpp b/modules/mbedtls/tests/test_crypto_mbedtls.cpp index 4217497082..8762838883 100644 --- a/modules/mbedtls/tests/test_crypto_mbedtls.cpp +++ b/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" diff --git a/modules/navigation/navigation_mesh_generator.cpp b/modules/navigation/navigation_mesh_generator.cpp index 0d8330c1da..7aeb9e1858 100644 --- a/modules/navigation/navigation_mesh_generator.cpp +++ b/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 diff --git a/modules/text_server_adv/dynamic_font_adv.h b/modules/text_server_adv/dynamic_font_adv.h index 1292966f0c..b3f97bb029 100644 --- a/modules/text_server_adv/dynamic_font_adv.h +++ b/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> diff --git a/modules/text_server_fb/dynamic_font_fb.h b/modules/text_server_fb/dynamic_font_fb.h index b34c8cbed5..82e59fa607 100644 --- a/modules/text_server_fb/dynamic_font_fb.h +++ b/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> diff --git a/modules/webrtc/webrtc_data_channel_gdnative.cpp b/modules/webrtc/webrtc_data_channel_gdnative.cpp index d4cf464c7c..f3009dde2f 100644 --- a/modules/webrtc/webrtc_data_channel_gdnative.cpp +++ b/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" diff --git a/modules/websocket/editor_debugger_server_websocket.h b/modules/websocket/editor_debugger_server_websocket.h index 2f73b98c3d..d9543bb647 100644 --- a/modules/websocket/editor_debugger_server_websocket.h +++ b/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 diff --git a/modules/websocket/remote_debugger_peer_websocket.h b/modules/websocket/remote_debugger_peer_websocket.h index 03c60fb480..590d925dcc 100644 --- a/modules/websocket/remote_debugger_peer_websocket.h +++ b/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 diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index 0b1650076c..92b8b70508 100644 --- a/platform/javascript/os_javascript.cpp +++ b/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 diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp index 1075ae38ce..98925fd7fa 100644 --- a/platform/uwp/export/export.cpp +++ b/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" |