diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e844970322..f7a61457ad 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -50,11 +50,15 @@ repos: stages: [manual] # Not automatically triggered, invoked via `pre-commit run --hook-stage manual clang-tidy` - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.7.3 + rev: v0.8.4 hooks: - id: ruff args: [--fix] + files: (\.py|SConstruct|SCsub)$ + types_or: [text] - id: ruff-format + files: (\.py|SConstruct|SCsub)$ + types_or: [text] - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.13.0 @@ -204,7 +208,7 @@ repos: language: python entry: python misc/scripts/header_guards.py files: \.(h|hpp|hh|hxx)$ - exclude: ^.*/(thread|platform_config|platform_gl)\.h$ + exclude: ^.*/(dummy|thread|platform_config|platform_gl)\.h$ - id: file-format name: file-format diff --git a/core/input/input_map.cpp b/core/input/input_map.cpp index 4448594e25..9f6e76b10c 100644 --- a/core/input/input_map.cpp +++ b/core/input/input_map.cpp @@ -160,7 +160,7 @@ List InputMap::get_actions() const { } List>::Element *InputMap::_find_event(Action &p_action, const Ref &p_event, bool p_exact_match, bool *r_pressed, float *r_strength, float *r_raw_strength, int *r_event_index) const { - ERR_FAIL_COND_V(!p_event.is_valid(), nullptr); + ERR_FAIL_COND_V(p_event.is_null(), nullptr); int i = 0; for (List>::Element *E = p_action.inputs.front(); E; E = E->next()) { diff --git a/core/io/image.cpp b/core/io/image.cpp index 2eb57e982f..fa7911cace 100644 --- a/core/io/image.cpp +++ b/core/io/image.cpp @@ -3994,7 +3994,7 @@ Error Image::load_svg_from_buffer(const Vector &p_array, float scale) { ERR_FAIL_COND_V(buffer_size == 0, ERR_INVALID_PARAMETER); Ref image = _svg_scalable_mem_loader_func(p_array.ptr(), buffer_size, scale); - ERR_FAIL_COND_V(!image.is_valid(), ERR_PARSE_ERROR); + ERR_FAIL_COND_V(image.is_null(), ERR_PARSE_ERROR); copy_internals_from(image); @@ -4061,7 +4061,7 @@ Error Image::_load_from_buffer(const Vector &p_array, ImageMemLoadFunc const uint8_t *r = p_array.ptr(); Ref image = p_loader(r, buffer_size); - ERR_FAIL_COND_V(!image.is_valid(), ERR_PARSE_ERROR); + ERR_FAIL_COND_V(image.is_null(), ERR_PARSE_ERROR); copy_internals_from(image); diff --git a/core/io/packet_peer_udp.cpp b/core/io/packet_peer_udp.cpp index db23bc070c..a9ca2683a6 100644 --- a/core/io/packet_peer_udp.cpp +++ b/core/io/packet_peer_udp.cpp @@ -49,7 +49,7 @@ void PacketPeerUDP::set_broadcast_enabled(bool p_enabled) { Error PacketPeerUDP::join_multicast_group(IPAddress p_multi_address, const String &p_if_name) { ERR_FAIL_COND_V(udp_server, ERR_LOCKED); - ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE); + ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE); ERR_FAIL_COND_V(!p_multi_address.is_valid(), ERR_INVALID_PARAMETER); if (!_sock->is_open()) { @@ -64,7 +64,7 @@ Error PacketPeerUDP::join_multicast_group(IPAddress p_multi_address, const Strin Error PacketPeerUDP::leave_multicast_group(IPAddress p_multi_address, const String &p_if_name) { ERR_FAIL_COND_V(udp_server, ERR_LOCKED); - ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE); + ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE); ERR_FAIL_COND_V(!_sock->is_open(), ERR_UNCONFIGURED); return _sock->leave_multicast_group(p_multi_address, p_if_name); } @@ -139,7 +139,7 @@ Error PacketPeerUDP::get_packet(const uint8_t **r_buffer, int &r_buffer_size) { } Error PacketPeerUDP::put_packet(const uint8_t *p_buffer, int p_buffer_size) { - ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE); + ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE); ERR_FAIL_COND_V(!peer_addr.is_valid(), ERR_UNCONFIGURED); Error err; @@ -180,7 +180,7 @@ int PacketPeerUDP::get_max_packet_size() const { } Error PacketPeerUDP::bind(int p_port, const IPAddress &p_bind_address, int p_recv_buffer_size) { - ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE); + ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE); ERR_FAIL_COND_V(_sock->is_open(), ERR_ALREADY_IN_USE); ERR_FAIL_COND_V(!p_bind_address.is_valid() && !p_bind_address.is_wildcard(), ERR_INVALID_PARAMETER); ERR_FAIL_COND_V_MSG(p_port < 0 || p_port > 65535, ERR_INVALID_PARAMETER, "The local port number must be between 0 and 65535 (inclusive)."); @@ -229,7 +229,7 @@ void PacketPeerUDP::disconnect_shared_socket() { Error PacketPeerUDP::connect_to_host(const IPAddress &p_host, int p_port) { ERR_FAIL_COND_V(udp_server, ERR_LOCKED); - ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE); + ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE); ERR_FAIL_COND_V(!p_host.is_valid(), ERR_INVALID_PARAMETER); ERR_FAIL_COND_V_MSG(p_port < 1 || p_port > 65535, ERR_INVALID_PARAMETER, "The remote port number must be between 1 and 65535 (inclusive)."); @@ -280,12 +280,12 @@ void PacketPeerUDP::close() { } Error PacketPeerUDP::wait() { - ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE); + ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE); return _sock->poll(NetSocket::POLL_TYPE_IN, -1); } Error PacketPeerUDP::_poll() { - ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE); + ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE); if (!_sock->is_open()) { return FAILED; diff --git a/core/io/plist.cpp b/core/io/plist.cpp index 8434c7e17b..1e83b9e758 100644 --- a/core/io/plist.cpp +++ b/core/io/plist.cpp @@ -713,7 +713,7 @@ bool PList::load_string(const String &p_string, String &r_err_out) { stack.push_back(dict); } else { // Add root node. - if (!root.is_null()) { + if (root.is_valid()) { r_err_out = "Root node already set."; return false; } @@ -745,7 +745,7 @@ bool PList::load_string(const String &p_string, String &r_err_out) { stack.push_back(arr); } else { // Add root node. - if (!root.is_null()) { + if (root.is_valid()) { r_err_out = "Root node already set."; return false; } diff --git a/core/io/remote_filesystem_client.cpp b/core/io/remote_filesystem_client.cpp index 432c7ce0b0..ed309e1b01 100644 --- a/core/io/remote_filesystem_client.cpp +++ b/core/io/remote_filesystem_client.cpp @@ -46,7 +46,7 @@ Vector RemoteFilesystemClient::_load_cache_file() { Ref fa = FileAccess::open(cache_path.path_join(FILES_CACHE_FILE), FileAccess::READ); - if (!fa.is_valid()) { + if (fa.is_null()) { return Vector(); // No cache, return empty } diff --git a/core/io/resource.cpp b/core/io/resource.cpp index 825d0ee9c7..f3411c92bc 100644 --- a/core/io/resource.cpp +++ b/core/io/resource.cpp @@ -233,7 +233,7 @@ void Resource::reload_from_file() { Ref s = ResourceLoader::load(ResourceLoader::path_remap(path), get_class(), ResourceFormatLoader::CACHE_MODE_IGNORE); - if (!s.is_valid()) { + if (s.is_null()) { return; } @@ -653,7 +653,7 @@ Ref ResourceCache::get_ref(const String &p_path) { ref = Ref(*res); } - if (res && !ref.is_valid()) { + if (res && ref.is_null()) { // This resource is in the process of being deleted, ignore its existence (*res)->path_cache = String(); resources.erase(p_path); @@ -672,7 +672,7 @@ void ResourceCache::get_cached_resources(List> *p_resources) { for (KeyValue &E : resources) { Ref ref = Ref(E.value); - if (!ref.is_valid()) { + if (ref.is_null()) { // This resource is in the process of being deleted, ignore its existence E.value->path_cache = String(); to_remove.push_back(E.key); diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 6e357bf526..045a8acbb6 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -699,7 +699,7 @@ Error ResourceLoaderBinary::load() { external_resources.write[i].path = path; //remap happens here, not on load because on load it can actually be used for filesystem dock resource remap external_resources.write[i].load_token = ResourceLoader::_load_start(path, external_resources[i].type, use_sub_threads ? ResourceLoader::LOAD_THREAD_DISTRIBUTE : ResourceLoader::LOAD_THREAD_FROM_CURRENT, cache_mode_for_external); - if (!external_resources[i].load_token.is_valid()) { + if (external_resources[i].load_token.is_null()) { if (!ResourceLoader::get_abort_on_missing_resources()) { ResourceLoader::notify_dependency_error(local_path, path, external_resources[i].type); } else { @@ -1389,7 +1389,7 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, cons ERR_FAIL_COND_V(err != ERR_FILE_EOF, ERR_FILE_CORRUPT); Ref res = loader.get_resource(); - ERR_FAIL_COND_V(!res.is_valid(), ERR_FILE_CORRUPT); + ERR_FAIL_COND_V(res.is_null(), ERR_FILE_CORRUPT); return ResourceFormatSaverBinary::singleton->save(res, p_path); } diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index 22fe2b5b5d..43fafc4306 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -527,7 +527,7 @@ Ref ResourceLoader::load(const String &p_path, const String &p_type_hi thread_mode = LOAD_THREAD_SPAWN_SINGLE; } Ref load_token = _load_start(p_path, p_type_hint, thread_mode, p_cache_mode); - if (!load_token.is_valid()) { + if (load_token.is_null()) { if (r_error) { *r_error = FAILED; } @@ -947,7 +947,7 @@ Ref ResourceLoader::ensure_resource_ref_override_for_outer_load(const Object *obj = ClassDB::instantiate(p_res_type); ERR_FAIL_NULL_V(obj, Ref()); Ref res(obj); - if (!res.is_valid()) { + if (res.is_null()) { memdelete(obj); ERR_FAIL_V(Ref()); } diff --git a/core/io/stream_peer_tcp.cpp b/core/io/stream_peer_tcp.cpp index 8e002f98f7..346a35432d 100644 --- a/core/io/stream_peer_tcp.cpp +++ b/core/io/stream_peer_tcp.cpp @@ -91,7 +91,7 @@ void StreamPeerTCP::accept_socket(Ref p_sock, IPAddress p_host, uint1 } Error StreamPeerTCP::bind(int p_port, const IPAddress &p_host) { - ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE); + ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE); ERR_FAIL_COND_V(_sock->is_open(), ERR_ALREADY_IN_USE); ERR_FAIL_COND_V_MSG(p_port < 0 || p_port > 65535, ERR_INVALID_PARAMETER, "The local port number must be between 0 and 65535 (inclusive)."); @@ -108,7 +108,7 @@ Error StreamPeerTCP::bind(int p_port, const IPAddress &p_host) { } Error StreamPeerTCP::connect_to_host(const IPAddress &p_host, int p_port) { - ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE); + ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE); ERR_FAIL_COND_V(status != STATUS_NONE, ERR_ALREADY_IN_USE); ERR_FAIL_COND_V(!p_host.is_valid(), ERR_INVALID_PARAMETER); ERR_FAIL_COND_V_MSG(p_port < 1 || p_port > 65535, ERR_INVALID_PARAMETER, "The remote port number must be between 1 and 65535 (inclusive)."); @@ -142,7 +142,7 @@ Error StreamPeerTCP::connect_to_host(const IPAddress &p_host, int p_port) { } Error StreamPeerTCP::write(const uint8_t *p_data, int p_bytes, int &r_sent, bool p_block) { - ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE); + ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE); if (status != STATUS_CONNECTED) { return FAILED; @@ -240,7 +240,7 @@ Error StreamPeerTCP::read(uint8_t *p_buffer, int p_bytes, int &r_received, bool } void StreamPeerTCP::set_no_delay(bool p_enabled) { - ERR_FAIL_COND(!_sock.is_valid() || !_sock->is_open()); + ERR_FAIL_COND(_sock.is_null() || !_sock->is_open()); _sock->set_tcp_no_delay_enabled(p_enabled); } @@ -283,7 +283,7 @@ Error StreamPeerTCP::get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_rec } int StreamPeerTCP::get_available_bytes() const { - ERR_FAIL_COND_V(!_sock.is_valid(), -1); + ERR_FAIL_COND_V(_sock.is_null(), -1); return _sock->get_available_bytes(); } diff --git a/core/io/tcp_server.cpp b/core/io/tcp_server.cpp index 182b7c0aa8..bbca4ba1e8 100644 --- a/core/io/tcp_server.cpp +++ b/core/io/tcp_server.cpp @@ -42,7 +42,7 @@ void TCPServer::_bind_methods() { } Error TCPServer::listen(uint16_t p_port, const IPAddress &p_bind_address) { - ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE); + ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE); ERR_FAIL_COND_V(_sock->is_open(), ERR_ALREADY_IN_USE); ERR_FAIL_COND_V(!p_bind_address.is_valid() && !p_bind_address.is_wildcard(), ERR_INVALID_PARAMETER); @@ -84,13 +84,13 @@ int TCPServer::get_local_port() const { } bool TCPServer::is_listening() const { - ERR_FAIL_COND_V(!_sock.is_valid(), false); + ERR_FAIL_COND_V(_sock.is_null(), false); return _sock->is_open(); } bool TCPServer::is_connection_available() const { - ERR_FAIL_COND_V(!_sock.is_valid(), false); + ERR_FAIL_COND_V(_sock.is_null(), false); if (!_sock->is_open()) { return false; @@ -110,7 +110,7 @@ Ref TCPServer::take_connection() { IPAddress ip; uint16_t port = 0; ns = _sock->accept(ip, port); - if (!ns.is_valid()) { + if (ns.is_null()) { return conn; } diff --git a/core/io/udp_server.cpp b/core/io/udp_server.cpp index 41ff9122cb..1a092327c5 100644 --- a/core/io/udp_server.cpp +++ b/core/io/udp_server.cpp @@ -46,7 +46,7 @@ void UDPServer::_bind_methods() { } Error UDPServer::poll() { - ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE); + ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE); if (!_sock->is_open()) { return ERR_UNCONFIGURED; } @@ -90,7 +90,7 @@ Error UDPServer::poll() { } Error UDPServer::listen(uint16_t p_port, const IPAddress &p_bind_address) { - ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE); + ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE); ERR_FAIL_COND_V(_sock->is_open(), ERR_ALREADY_IN_USE); ERR_FAIL_COND_V(!p_bind_address.is_valid() && !p_bind_address.is_wildcard(), ERR_INVALID_PARAMETER); @@ -125,13 +125,13 @@ int UDPServer::get_local_port() const { } bool UDPServer::is_listening() const { - ERR_FAIL_COND_V(!_sock.is_valid(), false); + ERR_FAIL_COND_V(_sock.is_null(), false); return _sock->is_open(); } bool UDPServer::is_connection_available() const { - ERR_FAIL_COND_V(!_sock.is_valid(), false); + ERR_FAIL_COND_V(_sock.is_null(), false); if (!_sock->is_open()) { return false; diff --git a/core/object/object.cpp b/core/object/object.cpp index fa3e8ca9ab..5a2b5dfecb 100644 --- a/core/object/object.cpp +++ b/core/object/object.cpp @@ -941,7 +941,7 @@ void Object::set_script(const Variant &p_script) { script_instance = nullptr; } - if (!s.is_null()) { + if (s.is_valid()) { if (s->can_instantiate()) { OBJ_DEBUG_LOCK script_instance = s->instance_create(this); @@ -1580,7 +1580,7 @@ void Object::_clear_internal_resource_paths(const Variant &p_var) { switch (p_var.get_type()) { case Variant::OBJECT: { Ref r = p_var; - if (!r.is_valid()) { + if (r.is_null()) { return; } diff --git a/core/os/keyboard.h b/core/os/keyboard.h index a51e717ef9..bba6368ead 100644 --- a/core/os/keyboard.h +++ b/core/os/keyboard.h @@ -251,7 +251,7 @@ enum class Key { enum class KeyModifierMask { CODE_MASK = ((1 << 23) - 1), ///< Apply this mask to any keycode to remove modifiers. - MODIFIER_MASK = (0x7F << 22), ///< Apply this mask to isolate modifiers. + MODIFIER_MASK = (0x7F << 24), ///< Apply this mask to isolate modifiers. //RESERVED = (1 << 23), CMD_OR_CTRL = (1 << 24), SHIFT = (1 << 25), diff --git a/core/templates/cowdata.h b/core/templates/cowdata.h index 38b8d1d925..eeb6eae4e9 100644 --- a/core/templates/cowdata.h +++ b/core/templates/cowdata.h @@ -164,6 +164,8 @@ private: return *out; } + // Decrements the reference count. Deallocates the backing buffer if needed. + // After this function, _ptr is guaranteed to be NULL. void _unref(); void _ref(const CowData *p_from); void _ref(const CowData &p_from); @@ -254,7 +256,7 @@ public: Size count(const T &p_val) const; _FORCE_INLINE_ CowData() {} - _FORCE_INLINE_ ~CowData(); + _FORCE_INLINE_ ~CowData() { _unref(); } _FORCE_INLINE_ CowData(std::initializer_list p_init); _FORCE_INLINE_ CowData(const CowData &p_from) { _ref(p_from); } _FORCE_INLINE_ CowData(CowData &&p_from) { @@ -271,22 +273,30 @@ void CowData::_unref() { SafeNumeric *refc = _get_refcount(); if (refc->decrement() > 0) { - return; // still in use + // Data is still in use elsewhere. + _ptr = nullptr; + return; } - // clean up + // Clean up. + // First, invalidate our own reference. + // NOTE: It is required to do so immediately because it must not be observable outside of this + // function after refcount has already been reduced to 0. + // WARNING: It must be done before calling the destructors, because one of them may otherwise + // observe it through a reference to us. In this case, it may try to access the buffer, + // which is illegal after some of the elements in it have already been destructed, and + // may lead to a segmentation fault. + USize current_size = *_get_size(); + T *prev_ptr = _ptr; + _ptr = nullptr; if constexpr (!std::is_trivially_destructible_v) { - USize current_size = *_get_size(); - for (USize i = 0; i < current_size; ++i) { - // call destructors - T *t = &_ptr[i]; - t->~T(); + prev_ptr[i].~T(); } } // free mem - Memory::free_static(((uint8_t *)_ptr) - DATA_OFFSET, false); + Memory::free_static((uint8_t *)prev_ptr - DATA_OFFSET, false); } template @@ -341,9 +351,8 @@ Error CowData::resize(Size p_size) { } if (p_size == 0) { - // wants to clean up - _unref(); - _ptr = nullptr; + // Wants to clean up. + _unref(); // Resets _ptr to nullptr. return OK; } @@ -486,8 +495,7 @@ void CowData::_ref(const CowData &p_from) { return; // self assign, do nothing. } - _unref(); - _ptr = nullptr; + _unref(); // Resets _ptr to nullptr. if (!p_from._ptr) { return; //nothing to do @@ -498,11 +506,6 @@ void CowData::_ref(const CowData &p_from) { } } -template -CowData::~CowData() { - _unref(); -} - template CowData::CowData(std::initializer_list p_init) { Error err = resize(p_init.size()); diff --git a/core/templates/local_vector.h b/core/templates/local_vector.h index 85fc1ff470..94491697f5 100644 --- a/core/templates/local_vector.h +++ b/core/templates/local_vector.h @@ -297,10 +297,16 @@ public: operator Vector() const { Vector ret; - ret.resize(size()); + ret.resize(count); T *w = ret.ptrw(); if (w) { - memcpy(w, data, sizeof(T) * count); + if constexpr (std::is_trivially_copyable_v) { + memcpy(w, data, sizeof(T) * count); + } else { + for (U i = 0; i < count; i++) { + w[i] = data[i]; + } + } } return ret; } diff --git a/core/variant/binder_common.h b/core/variant/binder_common.h index 25bce196f6..007a42a97b 100644 --- a/core/variant/binder_common.h +++ b/core/variant/binder_common.h @@ -36,7 +36,6 @@ #include "core/input/input_enums.h" #include "core/object/object.h" #include "core/os/keyboard.h" -#include "core/templates/list.h" #include "core/templates/simple_type.h" #include "core/typedefs.h" #include "core/variant/method_ptrcall.h" diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index b2599b23a5..ebb444b1f3 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -853,7 +853,7 @@ print("a", "b", a) # Prints ab[1, 2, 3] [/gdscript] [csharp] - var a = new Godot.Collections.Array { 1, 2, 3 }; + Godot.Collections.Array a = [1, 2, 3]; GD.Print("a", "b", a); // Prints ab[1, 2, 3] [/csharp] [/codeblocks] @@ -2365,7 +2365,7 @@ Key Code mask. - + Modifier key mask. diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml index 983e8fc98f..4cc68c5188 100644 --- a/doc/classes/Array.xml +++ b/doc/classes/Array.xml @@ -17,14 +17,14 @@ print(array[-3]) # Prints "Second" [/gdscript] [csharp] - var array = new Godot.Collections.Array{"First", 2, 3, "Last"}; + Godot.Collections.Array array = ["First", 2, 3, "Last"]; GD.Print(array[0]); // Prints "First" GD.Print(array[2]); // Prints 3 - GD.Print(array[array.Count - 1]); // Prints "Last" + GD.Print(array[^1]); // Prints "Last" - array[2] = "Second"; + array[1] = "Second"; GD.Print(array[1]); // Prints "Second" - GD.Print(array[array.Count - 3]); // Prints "Second" + GD.Print(array[^3]); // Prints "Second" [/csharp] [/codeblocks] [b]Note:[/b] Arrays are always passed by [b]reference[/b]. To get a copy of an array that can be modified independently of the original array, use [method duplicate]. @@ -358,7 +358,7 @@ print(array) # Prints [2, 2, 2, 2, 2] [/gdscript] [csharp] - var array = new Godot.Collections.Array(); + Godot.Collections.Array array = []; array.Resize(5); array.Fill(2); GD.Print(array); // Prints [2, 2, 2, 2, 2] @@ -460,7 +460,7 @@ print(["inside", 7].has("7")) # Prints false [/gdscript] [csharp] - var arr = new Godot.Collections.Array { "inside", 7 }; + Godot.Collections.Array arr = ["inside", 7]; // By C# convention, this method is renamed to `Contains`. GD.Print(arr.Contains("inside")); // Prints True GD.Print(arr.Contains("outside")); // Prints False @@ -573,7 +573,7 @@ print([1, 2, 3.25, "Hi"].pick_random()) [/gdscript] [csharp] - var array = new Godot.Collections.Array { 1, 2, 3.25f, "Hi" }; + Godot.Collections.Array array = [1, 2, 3.25f, "Hi"]; GD.Print(array.PickRandom()); // May print 1, 2, 3.25, or "Hi". [/csharp] [/codeblocks] @@ -755,7 +755,7 @@ print(numbers) # Prints [2.5, 5, 8, 10] [/gdscript] [csharp] - var numbers = new Godot.Collections.Array { 10, 5, 2.5, 8 }; + Godot.Collections.Array numbers = [10, 5, 2.5, 8]; numbers.Sort(); GD.Print(numbers); // Prints [2.5, 5, 8, 10] [/csharp] @@ -817,8 +817,8 @@ [/gdscript] [csharp] // Note that concatenation is not possible with C#'s native Array type. - var array1 = new Godot.Collections.Array{"One", 2}; - var array2 = new Godot.Collections.Array{3, "Four"}; + Godot.Collections.Array array1 = ["One", 2]; + Godot.Collections.Array array2 = [3, "Four"]; GD.Print(array1 + array2); // Prints ["One", 2, 3, "Four"] [/csharp] [/codeblocks] diff --git a/doc/classes/ArrayMesh.xml b/doc/classes/ArrayMesh.xml index 1dc8c91813..ccee1d4a08 100644 --- a/doc/classes/ArrayMesh.xml +++ b/doc/classes/ArrayMesh.xml @@ -25,16 +25,16 @@ m.mesh = arr_mesh [/gdscript] [csharp] - var vertices = new Vector3[] - { + Vector3[] vertices = + [ new Vector3(0, 1, 0), new Vector3(1, 0, 0), new Vector3(0, 0, 1), - }; + ]; // Initialize the ArrayMesh. var arrMesh = new ArrayMesh(); - var arrays = new Godot.Collections.Array(); + Godot.Collections.Array arrays = []; arrays.Resize((int)Mesh.ArrayType.Max); arrays[(int)Mesh.ArrayType.Vertex] = vertices; diff --git a/doc/classes/DTLSServer.xml b/doc/classes/DTLSServer.xml index 0c37f8f2b9..ab7d9002d5 100644 --- a/doc/classes/DTLSServer.xml +++ b/doc/classes/DTLSServer.xml @@ -19,7 +19,7 @@ server.listen(4242) var key = load("key.key") # Your private key. var cert = load("cert.crt") # Your X509 certificate. - dtls.setup(key, cert) + dtls.setup(TlsOptions.server(key, cert)) func _process(delta): while server.is_connection_available(): @@ -45,19 +45,19 @@ { private DtlsServer _dtls = new DtlsServer(); private UdpServer _server = new UdpServer(); - private Godot.Collections.Array<PacketPeerDtls> _peers = new Godot.Collections.Array<PacketPeerDtls>(); + private Godot.Collections.Array<PacketPeerDtls> _peers = []; public override void _Ready() { _server.Listen(4242); var key = GD.Load<CryptoKey>("key.key"); // Your private key. var cert = GD.Load<X509Certificate>("cert.crt"); // Your X509 certificate. - _dtls.Setup(key, cert); + _dtls.Setup(TlsOptions.Server(key, cert)); } public override void _Process(double delta) { - while (Server.IsConnectionAvailable()) + while (_server.IsConnectionAvailable()) { PacketPeerUdp peer = _server.TakeConnection(); PacketPeerDtls dtlsPeer = _dtls.TakeConnection(peer); diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml index e9ac30f4fe..1f6861b4e8 100644 --- a/doc/classes/DisplayServer.xml +++ b/doc/classes/DisplayServer.xml @@ -1730,7 +1730,7 @@ DisplayServer.WindowSetMousePassthrough(GetNode<Polygon2D>("Polygon2D").Polygon); // Reset region to default. - DisplayServer.WindowSetMousePassthrough(new Vector2[] {}); + DisplayServer.WindowSetMousePassthrough([]); [/csharp] [/codeblocks] [b]Note:[/b] On Windows, the portion of a window that lies outside the region is not drawn, while on Linux (X11) and macOS it is. diff --git a/doc/classes/EditorImportPlugin.xml b/doc/classes/EditorImportPlugin.xml index cb318e80e9..eb65b104a2 100644 --- a/doc/classes/EditorImportPlugin.xml +++ b/doc/classes/EditorImportPlugin.xml @@ -63,7 +63,7 @@ public override string[] _GetRecognizedExtensions() { - return new string[] { "special", "spec" }; + return ["special", "spec"]; } public override string _GetSaveExtension() @@ -88,14 +88,14 @@ public override Godot.Collections.Array<Godot.Collections.Dictionary> _GetImportOptions(string path, int presetIndex) { - return new Godot.Collections.Array<Godot.Collections.Dictionary> - { + return + [ new Godot.Collections.Dictionary { { "name", "myOption" }, { "default_value", false }, - } - }; + }, + ]; } public override Error _Import(string sourceFile, string savePath, Godot.Collections.Dictionary options, Godot.Collections.Array<string> platformVariants, Godot.Collections.Array<string> genFiles) diff --git a/doc/classes/EditorInterface.xml b/doc/classes/EditorInterface.xml index 0ee2c00cc4..6b29f762e5 100644 --- a/doc/classes/EditorInterface.xml +++ b/doc/classes/EditorInterface.xml @@ -271,7 +271,7 @@ Plays the main scene. - + diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml index 6c1186ae93..9fb8809298 100644 --- a/doc/classes/EditorSettings.xml +++ b/doc/classes/EditorSettings.xml @@ -519,9 +519,6 @@ - - Specifies the side of 3D editor's viewport where GridMap's mesh palette will appear. - Minimum width of GridMap's mesh palette side panel. diff --git a/doc/classes/EditorTranslationParserPlugin.xml b/doc/classes/EditorTranslationParserPlugin.xml index b9dc654de3..a244d844c2 100644 --- a/doc/classes/EditorTranslationParserPlugin.xml +++ b/doc/classes/EditorTranslationParserPlugin.xml @@ -45,7 +45,7 @@ public override string[] _GetRecognizedExtensions() { - return new string[] { "csv" }; + return ["csv"]; } } [/csharp] @@ -62,11 +62,11 @@ [/gdscript] [csharp] // This will add a message with msgid "Test 1", msgctxt "context", and msgid_plural "test 1 plurals". - msgidsContextPlural.Add(new Godot.Collections.Array{"Test 1", "context", "test 1 Plurals"}); + msgidsContextPlural.Add(["Test 1", "context", "test 1 Plurals"]); // This will add a message with msgid "A test without context" and msgid_plural "plurals". - msgidsContextPlural.Add(new Godot.Collections.Array{"A test without context", "", "plurals"}); + msgidsContextPlural.Add(["A test without context", "", "plurals"]); // This will add a message with msgid "Only with context" and msgctxt "a friendly context". - msgidsContextPlural.Add(new Godot.Collections.Array{"Only with context", "a friendly context", ""}); + msgidsContextPlural.Add(["Only with context", "a friendly context", ""]); [/csharp] [/codeblocks] [b]Note:[/b] If you override parsing logic for standard script types (GDScript, C#, etc.), it would be better to load the [code]path[/code] argument using [method ResourceLoader.load]. This is because built-in scripts are loaded as [Resource] type, not [FileAccess] type. For example: @@ -90,7 +90,7 @@ public override string[] _GetRecognizedExtensions() { - return new string[] { "gd" }; + return ["gd"]; } [/csharp] [/codeblocks] diff --git a/doc/classes/Geometry2D.xml b/doc/classes/Geometry2D.xml index c86861fd13..4c2398d396 100644 --- a/doc/classes/Geometry2D.xml +++ b/doc/classes/Geometry2D.xml @@ -204,7 +204,7 @@ print(polygon) # Prints [(50.0, 50.0), (150.0, 50.0), (150.0, 150.0), (50.0, 150.0)] [/gdscript] [csharp] - var polygon = new Vector2[] { new Vector2(0, 0), new Vector2(100, 0), new Vector2(100, 100), new Vector2(0, 100) }; + Vector2[] polygon = [new Vector2(0, 0), new Vector2(100, 0), new Vector2(100, 100), new Vector2(0, 100)]; var offset = new Vector2(50, 50); polygon = new Transform2D(0, offset) * polygon; GD.Print((Variant)polygon); // Prints [(50, 50), (150, 50), (150, 150), (50, 150)] diff --git a/doc/classes/HTTPClient.xml b/doc/classes/HTTPClient.xml index 366038e43f..961332a8c2 100644 --- a/doc/classes/HTTPClient.xml +++ b/doc/classes/HTTPClient.xml @@ -156,7 +156,7 @@ [csharp] var fields = new Godot.Collections.Dictionary { { "username", "user" }, { "password", "pass" } }; string queryString = new HttpClient().QueryStringFromDict(fields); - string[] headers = { "Content-Type: application/x-www-form-urlencoded", $"Content-Length: {queryString.Length}" }; + string[] headers = ["Content-Type: application/x-www-form-urlencoded", $"Content-Length: {queryString.Length}"]; var result = new HttpClient().Request(HttpClient.Method.Post, "index.php", headers, queryString); [/csharp] [/codeblocks] diff --git a/doc/classes/NavigationPolygon.xml b/doc/classes/NavigationPolygon.xml index 68fbc05931..3f7924d5c2 100644 --- a/doc/classes/NavigationPolygon.xml +++ b/doc/classes/NavigationPolygon.xml @@ -16,7 +16,7 @@ [/gdscript] [csharp] var newNavigationMesh = new NavigationPolygon(); - var boundingOutline = new Vector2[] { new Vector2(0, 0), new Vector2(0, 50), new Vector2(50, 50), new Vector2(50, 0) }; + Vector2[] boundingOutline = [new Vector2(0, 0), new Vector2(0, 50), new Vector2(50, 50), new Vector2(50, 0)]; newNavigationMesh.AddOutline(boundingOutline); NavigationServer2D.BakeFromSourceGeometryData(newNavigationMesh, new NavigationMeshSourceGeometryData2D()); GetNode<NavigationRegion2D>("NavigationRegion2D").NavigationPolygon = newNavigationMesh; @@ -34,9 +34,9 @@ [/gdscript] [csharp] var newNavigationMesh = new NavigationPolygon(); - var newVertices = new Vector2[] { new Vector2(0, 0), new Vector2(0, 50), new Vector2(50, 50), new Vector2(50, 0) }; + Vector2[] newVertices = [new Vector2(0, 0), new Vector2(0, 50), new Vector2(50, 50), new Vector2(50, 0)]; newNavigationMesh.Vertices = newVertices; - var newPolygonIndices = new int[] { 0, 1, 2, 3 }; + int[] newPolygonIndices = [0, 1, 2, 3]; newNavigationMesh.AddPolygon(newPolygonIndices); GetNode<NavigationRegion2D>("NavigationRegion2D").NavigationPolygon = newNavigationMesh; [/csharp] diff --git a/doc/classes/NavigationServer2D.xml b/doc/classes/NavigationServer2D.xml index d1fac97b93..41ef298bc3 100644 --- a/doc/classes/NavigationServer2D.xml +++ b/doc/classes/NavigationServer2D.xml @@ -562,6 +562,13 @@ Returns all navigation regions [RID]s that are currently assigned to the requested navigation [param map]. + + + + + Returns [code]true[/code] if the [param map] synchronization uses an async process that runs on a background thread. + + @@ -608,6 +615,14 @@ Set the map's link connection radius used to connect links to navigation polygons. + + + + + + If [param enabled] is [code]true[/code] the [param map] synchronization uses an async process that runs on a background thread. + + diff --git a/doc/classes/NavigationServer3D.xml b/doc/classes/NavigationServer3D.xml index ab65f3f743..6f0c68740a 100644 --- a/doc/classes/NavigationServer3D.xml +++ b/doc/classes/NavigationServer3D.xml @@ -641,6 +641,13 @@ Returns the map's up direction. + + + + + Returns [code]true[/code] if the [param map] synchronization uses an async process that runs on a background thread. + + @@ -711,6 +718,14 @@ Sets the map up direction. + + + + + + If [param enabled] is [code]true[/code] the [param map] synchronization uses an async process that runs on a background thread. + + diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index 12d5580996..9f5eec6ace 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -59,7 +59,7 @@ var pid = OS.create_process(OS.get_executable_path(), []) [/gdscript] [csharp] - var pid = OS.CreateProcess(OS.GetExecutablePath(), new string[] {}); + var pid = OS.CreateProcess(OS.GetExecutablePath(), []); [/csharp] [/codeblocks] See [method execute] if you wish to run an external command and retrieve the results. @@ -105,8 +105,8 @@ var exit_code = OS.execute("ls", ["-l", "/tmp"], output) [/gdscript] [csharp] - var output = new Godot.Collections.Array(); - int exitCode = OS.Execute("ls", new string[] {"-l", "/tmp"}, output); + Godot.Collections.Array output = []; + int exitCode = OS.Execute("ls", ["-l", "/tmp"], output); [/csharp] [/codeblocks] If you wish to access a shell built-in or execute a composite command, a platform-specific shell can be invoked. For example: @@ -116,8 +116,8 @@ OS.execute("CMD.exe", ["/C", "cd %TEMP% && dir"], output) [/gdscript] [csharp] - var output = new Godot.Collections.Array(); - OS.Execute("CMD.exe", new string[] {"/C", "cd %TEMP% && dir"}, output); + Godot.Collections.Array output = []; + OS.Execute("CMD.exe", ["/C", "cd %TEMP% && dir"], output); [/csharp] [/codeblocks] [b]Note:[/b] This method is implemented on Android, Linux, macOS, and Windows. diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml index aa4f637720..fba21239b1 100644 --- a/doc/classes/Object.xml +++ b/doc/classes/Object.xml @@ -61,14 +61,14 @@ public override Godot.Collections.Array<Godot.Collections.Dictionary> _GetPropertyList() { - return new Godot.Collections.Array<Godot.Collections.Dictionary>() - { + return + [ new Godot.Collections.Dictionary() { { "name", "FakeProperty" }, - { "type", (int)Variant.Type.Int } - } - }; + { "type", (int)Variant.Type.Int }, + }, + ]; } [/csharp] [/codeblocks] @@ -137,11 +137,11 @@ } } - private Godot.Collections.Array<int> _numbers = new(); + private Godot.Collections.Array<int> _numbers = []; public override Godot.Collections.Array<Godot.Collections.Dictionary> _GetPropertyList() { - var properties = new Godot.Collections.Array<Godot.Collections.Dictionary>(); + Godot.Collections.Array<Godot.Collections.Dictionary> properties = []; for (int i = 0; i < _numberCount; i++) { @@ -322,14 +322,14 @@ public override Godot.Collections.Array<Godot.Collections.Dictionary> _GetPropertyList() { - return new Godot.Collections.Array<Godot.Collections.Dictionary>() - { + return + [ new Godot.Collections.Dictionary() { { "name", "FakeProperty" }, - { "type", (int)Variant.Type.Int } - } - }; + { "type", (int)Variant.Type.Int }, + }, + ]; } [/csharp] [/codeblocks] @@ -416,19 +416,19 @@ ]) [/gdscript] [csharp] - AddUserSignal("Hurt", new Godot.Collections.Array() - { + AddUserSignal("Hurt", + [ new Godot.Collections.Dictionary() { { "name", "damage" }, - { "type", (int)Variant.Type.Int } + { "type", (int)Variant.Type.Int }, }, new Godot.Collections.Dictionary() { { "name", "source" }, - { "type", (int)Variant.Type.Object } - } - }); + { "type", (int)Variant.Type.Object }, + }, + ]); [/csharp] [/codeblocks] @@ -494,7 +494,7 @@ [/gdscript] [csharp] var node = new Node3D(); - node.Callv(Node3D.MethodName.Rotate, new Godot.Collections.Array { new Vector3(1f, 0f, 0f), 1.571f }); + node.Callv(Node3D.MethodName.Rotate, [new Vector3(1f, 0f, 0f), 1.571f]); [/csharp] [/codeblocks] [b]Note:[/b] In C#, [param method] must be in snake_case when referring to built-in Redot methods. Prefer using the names exposed in the [code]MethodName[/code] class to avoid allocating a new [StringName] on each call. diff --git a/doc/classes/PackedByteArray.xml b/doc/classes/PackedByteArray.xml index 70457895ff..2c29646c77 100644 --- a/doc/classes/PackedByteArray.xml +++ b/doc/classes/PackedByteArray.xml @@ -369,7 +369,7 @@ print(array.hex_encode()) # Prints: 0b2eff [/gdscript] [csharp] - var array = new byte[] {11, 46, 255}; + byte[] array = [11, 46, 255]; GD.Print(array.HexEncode()); // Prints: 0b2eff [/csharp] [/codeblocks] diff --git a/doc/classes/PolygonPathFinder.xml b/doc/classes/PolygonPathFinder.xml index 98734c3e9b..ab300efaec 100644 --- a/doc/classes/PolygonPathFinder.xml +++ b/doc/classes/PolygonPathFinder.xml @@ -54,13 +54,13 @@ [/gdscript] [csharp] var polygonPathFinder = new PolygonPathFinder(); - var points = new Vector2[] - { + Vector2[] points = + [ new Vector2(0.0f, 0.0f), new Vector2(1.0f, 0.0f), new Vector2(0.0f, 1.0f) - }; - var connections = new int[] { 0, 1, 1, 2, 2, 0 }; + ]; + int[] connections = [0, 1, 1, 2, 2, 0]; polygonPathFinder.Setup(points, connections); GD.Print(polygonPathFinder.IsPointInside(new Vector2(0.2f, 0.2f))); // Prints True GD.Print(polygonPathFinder.IsPointInside(new Vector2(1.0f, 1.0f))); // Prints False @@ -91,13 +91,13 @@ [/gdscript] [csharp] var polygonPathFinder = new PolygonPathFinder(); - var points = new Vector2[] - { + Vector2[] points = + [ new Vector2(0.0f, 0.0f), new Vector2(1.0f, 0.0f), new Vector2(0.0f, 1.0f) - }; - var connections = new int[] { 0, 1, 1, 2, 2, 0 }; + ]; + int[] connections = [0, 1, 1, 2, 2, 0]; polygonPathFinder.Setup(points, connections); [/csharp] [/codeblocks] diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 1710caa7b8..ad15d922fc 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -2165,6 +2165,9 @@ Maximum number of threads that can run pathfinding queries simultaneously on the same pathfinding graph, for example the same navigation map. Additional threads increase memory consumption and synchronization time due to the need for extra data copies prepared for each thread. A value of [code]-1[/code] means unlimited and the maximum available OS processor count is used. Defaults to [code]1[/code] when the OS does not support threads. + + If enabled, navigation map synchronization uses an async process that runs on a background thread. This avoids stalling the main thread but adds an additional delay to any navigation map change. + Maximum number of characters allowed to send as output from the debugger. Over this value, content is dropped. This helps not to stall the debugger connection. diff --git a/doc/classes/String.xml b/doc/classes/String.xml index 7929aa90f6..4179e50fe5 100644 --- a/doc/classes/String.xml +++ b/doc/classes/String.xml @@ -571,7 +571,7 @@ print("---".join(fruits)) # Prints "Apple---Orange---Pear---Kiwi" [/gdscript] [csharp] - var fruits = new string[] {"Apple", "Orange", "Pear", "Kiwi"}; + string[] fruits = ["Apple", "Orange", "Pear", "Kiwi"]; // In C#, this method is static. GD.Print(string.Join(", ", fruits)); // Prints "Apple, Orange, Pear, Kiwi" diff --git a/doc/classes/StringName.xml b/doc/classes/StringName.xml index 7288f0527f..db8f786446 100644 --- a/doc/classes/StringName.xml +++ b/doc/classes/StringName.xml @@ -546,7 +546,7 @@ print("---".join(fruits)) # Prints "Apple---Orange---Pear---Kiwi" [/gdscript] [csharp] - var fruits = new string[] {"Apple", "Orange", "Pear", "Kiwi"}; + string[] fruits = ["Apple", "Orange", "Pear", "Kiwi"]; // In C#, this method is static. GD.Print(string.Join(", ", fruits)); // Prints "Apple, Orange, Pear, Kiwi" diff --git a/doc/classes/Window.xml b/doc/classes/Window.xml index f9b3a8944b..193dbe6a10 100644 --- a/doc/classes/Window.xml +++ b/doc/classes/Window.xml @@ -641,13 +641,13 @@ [/gdscript] [csharp] // Set region, using Path2D node. - GetNode<Window>("Window").MousePassthrough = GetNode<Path2D>("Path2D").Curve.GetBakedPoints(); + GetNode<Window>("Window").MousePassthroughPolygon = GetNode<Path2D>("Path2D").Curve.GetBakedPoints(); // Set region, using Polygon2D node. - GetNode<Window>("Window").MousePassthrough = GetNode<Polygon2D>("Polygon2D").Polygon; + GetNode<Window>("Window").MousePassthroughPolygon = GetNode<Polygon2D>("Polygon2D").Polygon; // Reset region to default. - GetNode<Window>("Window").MousePassthrough = new Vector2[] {}; + GetNode<Window>("Window").MousePassthroughPolygon = []; [/csharp] [/codeblocks] [b]Note:[/b] This property is ignored if [member mouse_passthrough] is set to [code]true[/code]. diff --git a/drivers/alsamidi/midi_driver_alsamidi.cpp b/drivers/alsamidi/midi_driver_alsamidi.cpp index 61dd9f7bf2..63f30dadef 100644 --- a/drivers/alsamidi/midi_driver_alsamidi.cpp +++ b/drivers/alsamidi/midi_driver_alsamidi.cpp @@ -35,7 +35,6 @@ #include "midi_driver_alsamidi.h" #include "core/os/os.h" -#include "core/string/print_string.h" #include diff --git a/drivers/alsamidi/midi_driver_alsamidi.h b/drivers/alsamidi/midi_driver_alsamidi.h index 04987267da..d59f5db683 100644 --- a/drivers/alsamidi/midi_driver_alsamidi.h +++ b/drivers/alsamidi/midi_driver_alsamidi.h @@ -47,8 +47,6 @@ #include #endif -#include - class MIDIDriverALSAMidi : public MIDIDriver { Thread thread; Mutex mutex; diff --git a/drivers/egl/egl_manager.cpp b/drivers/egl/egl_manager.cpp index 53f730aa02..6e855d260b 100644 --- a/drivers/egl/egl_manager.cpp +++ b/drivers/egl/egl_manager.cpp @@ -32,6 +32,8 @@ #include "egl_manager.h" +#include "core/crypto/crypto_core.h" +#include "core/io/dir_access.h" #include "drivers/gles3/rasterizer_gles3.h" #ifdef EGL_ENABLED diff --git a/drivers/egl/egl_manager.h b/drivers/egl/egl_manager.h index 374333f913..1dc47e5a2e 100644 --- a/drivers/egl/egl_manager.h +++ b/drivers/egl/egl_manager.h @@ -38,10 +38,6 @@ // These must come first to avoid windows.h mess. #include "platform_gl.h" -#include "core/config/project_settings.h" -#include "core/crypto/crypto_core.h" -#include "core/io/dir_access.h" -#include "core/io/file_access.h" #include "core/templates/local_vector.h" #include "servers/display_server.h" diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index f844414f2b..95fd752818 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -34,7 +34,6 @@ #ifdef GLES3_ENABLED -#include "core/os/os.h" #include "rasterizer_gles3.h" #include "rasterizer_scene_gles3.h" @@ -859,7 +858,7 @@ void RasterizerCanvasGLES3::_record_item_commands(const Item *p_item, RID p_rend Light *light = p_lights; while (light) { - if (light->render_index_cache >= 0 && p_item->light_mask & light->item_mask && p_item->z_final >= light->z_min && p_item->z_final <= light->z_max && p_item->global_rect_cache.intersects_transformed(light->xform_cache, light->rect_cache)) { + if (light->render_index_cache >= 0 && p_item->light_mask & light->item_mask && p_item->z_final >= light->z_min && p_item->z_final <= light->z_max && p_item->global_rect_cache.intersects(light->rect_cache)) { uint32_t light_index = light->render_index_cache; lights[light_count >> 2] |= light_index << ((light_count & 3) * 8); diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp index 34db37eb76..681fea2825 100644 --- a/drivers/gles3/shader_gles3.cpp +++ b/drivers/gles3/shader_gles3.cpp @@ -34,7 +34,6 @@ #ifdef GLES3_ENABLED -#include "core/io/compression.h" #include "core/io/dir_access.h" #include "core/io/file_access.h" diff --git a/drivers/gles3/shader_gles3.h b/drivers/gles3/shader_gles3.h index e104561376..f384514673 100644 --- a/drivers/gles3/shader_gles3.h +++ b/drivers/gles3/shader_gles3.h @@ -38,17 +38,13 @@ #include "core/string/string_builder.h" #include "core/templates/hash_map.h" #include "core/templates/local_vector.h" -#include "core/templates/rb_map.h" #include "core/templates/rid_owner.h" -#include "core/variant/variant.h" #include "servers/rendering_server.h" #ifdef GLES3_ENABLED #include "platform_gl.h" -#include - class ShaderGLES3 { public: struct TextureUniformData { diff --git a/drivers/gles3/storage/config.cpp b/drivers/gles3/storage/config.cpp index 34990632a4..c60d370217 100644 --- a/drivers/gles3/storage/config.cpp +++ b/drivers/gles3/storage/config.cpp @@ -35,7 +35,6 @@ #include "config.h" #include "../rasterizer_gles3.h" -#include "texture_storage.h" #ifdef WEB_ENABLED #include diff --git a/drivers/gles3/storage/config.h b/drivers/gles3/storage/config.h index 7e7b8f1e43..23392594ba 100644 --- a/drivers/gles3/storage/config.h +++ b/drivers/gles3/storage/config.h @@ -38,7 +38,6 @@ #include "core/config/project_settings.h" #include "core/string/ustring.h" #include "core/templates/hash_set.h" -#include "core/templates/vector.h" #include "platform_gl.h" diff --git a/drivers/gles3/storage/mesh_storage.cpp b/drivers/gles3/storage/mesh_storage.cpp index ea41f236ca..f13c83dab8 100644 --- a/drivers/gles3/storage/mesh_storage.cpp +++ b/drivers/gles3/storage/mesh_storage.cpp @@ -34,7 +34,6 @@ #include "mesh_storage.h" #include "config.h" -#include "material_storage.h" #include "texture_storage.h" #include "utilities.h" diff --git a/drivers/gles3/storage/particles_storage.cpp b/drivers/gles3/storage/particles_storage.cpp index dfdb794b07..b37d47c29f 100644 --- a/drivers/gles3/storage/particles_storage.cpp +++ b/drivers/gles3/storage/particles_storage.cpp @@ -40,7 +40,7 @@ #include "texture_storage.h" #include "utilities.h" -#include "servers/rendering/rendering_server_default.h" +#include "servers/rendering/rendering_server_globals.h" using namespace GLES3; diff --git a/drivers/gles3/storage/texture_storage.cpp b/drivers/gles3/storage/texture_storage.cpp index a741b2534e..e96f0d057d 100644 --- a/drivers/gles3/storage/texture_storage.cpp +++ b/drivers/gles3/storage/texture_storage.cpp @@ -688,7 +688,7 @@ Ref TextureStorage::_get_gl_image_and_format(const Ref &p_image, I } if (need_decompress || p_force_decompress) { - if (!image.is_null()) { + if (image.is_valid()) { image = image->duplicate(); image->decompress(); ERR_FAIL_COND_V(image->is_compressed(), image); diff --git a/drivers/gles3/storage/utilities.cpp b/drivers/gles3/storage/utilities.cpp index 8fdda3431c..c30f8c3ccf 100644 --- a/drivers/gles3/storage/utilities.cpp +++ b/drivers/gles3/storage/utilities.cpp @@ -42,8 +42,6 @@ #include "particles_storage.h" #include "texture_storage.h" -#include "servers/rendering/rendering_server_globals.h" - using namespace GLES3; Utilities *Utilities::singleton = nullptr; diff --git a/drivers/png/image_loader_png.cpp b/drivers/png/image_loader_png.cpp index 0688778e34..cc79ce84d0 100644 --- a/drivers/png/image_loader_png.cpp +++ b/drivers/png/image_loader_png.cpp @@ -32,8 +32,6 @@ #include "image_loader_png.h" -#include "core/os/os.h" -#include "core/string/print_string.h" #include "drivers/png/png_driver_common.h" #include diff --git a/drivers/png/png_driver_common.cpp b/drivers/png/png_driver_common.cpp index c340d2d807..42df4a0c1c 100644 --- a/drivers/png/png_driver_common.cpp +++ b/drivers/png/png_driver_common.cpp @@ -32,7 +32,7 @@ #include "png_driver_common.h" -#include "core/os/os.h" +#include "core/config/engine.h" #include #include diff --git a/drivers/png/resource_saver_png.cpp b/drivers/png/resource_saver_png.cpp index 0a04b25364..3e56fbe630 100644 --- a/drivers/png/resource_saver_png.cpp +++ b/drivers/png/resource_saver_png.cpp @@ -40,7 +40,7 @@ Error ResourceSaverPNG::save(const Ref &p_resource, const String &p_path, uint32_t p_flags) { Ref texture = p_resource; - ERR_FAIL_COND_V_MSG(!texture.is_valid(), ERR_INVALID_PARAMETER, "Can't save invalid texture as PNG."); + ERR_FAIL_COND_V_MSG(texture.is_null(), ERR_INVALID_PARAMETER, "Can't save invalid texture as PNG."); ERR_FAIL_COND_V_MSG(!texture->get_width(), ERR_INVALID_PARAMETER, "Can't save empty texture as PNG."); Ref img = texture->get_image(); diff --git a/drivers/register_driver_types.cpp b/drivers/register_driver_types.cpp index 6867250f7e..619c0ec027 100644 --- a/drivers/register_driver_types.cpp +++ b/drivers/register_driver_types.cpp @@ -32,7 +32,6 @@ #include "register_driver_types.h" -#include "core/extension/gdextension_manager.h" #include "drivers/png/image_loader_png.h" #include "drivers/png/resource_saver_png.h" diff --git a/editor/add_metadata_dialog.cpp b/editor/add_metadata_dialog.cpp index d85db7f2c3..87925cb605 100644 --- a/editor/add_metadata_dialog.cpp +++ b/editor/add_metadata_dialog.cpp @@ -32,6 +32,8 @@ #include "add_metadata_dialog.h" +#include "editor/themes/editor_scale.h" + AddMetadataDialog::AddMetadataDialog() { VBoxContainer *vbc = memnew(VBoxContainer); add_child(vbc); diff --git a/editor/add_metadata_dialog.h b/editor/add_metadata_dialog.h index ad9e15a3f5..e94dda7507 100644 --- a/editor/add_metadata_dialog.h +++ b/editor/add_metadata_dialog.h @@ -33,17 +33,10 @@ #ifndef ADD_METADATA_DIALOG_H #define ADD_METADATA_DIALOG_H -#include "core/object/callable_method_pointer.h" -#include "editor/editor_help.h" -#include "editor/editor_undo_redo_manager.h" #include "editor/gui/editor_validation_panel.h" -#include "editor/themes/editor_scale.h" -#include "scene/gui/button.h" #include "scene/gui/dialogs.h" -#include "scene/gui/item_list.h" #include "scene/gui/line_edit.h" #include "scene/gui/option_button.h" -#include "scene/gui/tree.h" class AddMetadataDialog : public ConfirmationDialog { GDCLASS(AddMetadataDialog, ConfirmationDialog); diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index e845fd659d..3a40c4be78 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -219,14 +219,14 @@ void AnimationBezierTrackEdit::_notification(int p_what) { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { if (EditorSettings::get_singleton()->check_changed_settings_in_group("editors/panning")) { panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); + panner->setup_warped_panning(get_viewport(), EDITOR_GET("editors/panning/warped_mouse_panning")); } } break; case NOTIFICATION_ENTER_TREE: { panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); - panner->set_viewport(get_viewport()); - [[fallthrough]]; - } + panner->setup_warped_panning(get_viewport(), EDITOR_GET("editors/panning/warped_mouse_panning")); + } break; case NOTIFICATION_THEME_CHANGED: { bezier_icon = get_editor_theme_icon(SNAME("KeyBezierPoint")); bezier_handle_icon = get_editor_theme_icon(SNAME("KeyBezierHandle")); diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index b64dac4499..9870859691 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -1453,7 +1453,6 @@ int AnimationTimelineEdit::get_name_limit() const { void AnimationTimelineEdit::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { add_track->set_button_icon(get_editor_theme_icon(SNAME("Add"))); loop->set_button_icon(get_editor_theme_icon(SNAME("Loop"))); @@ -1472,9 +1471,14 @@ void AnimationTimelineEdit::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - if (EditorSettings::get_singleton()->check_changed_settings_in_group("editors/panning")) { - panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); + if (!EditorSettings::get_singleton()->check_changed_settings_in_group("editors/panning")) { + break; } + [[fallthrough]]; + } + case NOTIFICATION_ENTER_TREE: { + panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); + panner->setup_warped_panning(get_viewport(), EDITOR_GET("editors/panning/warped_mouse_panning")); } break; case NOTIFICATION_RESIZED: { @@ -1874,7 +1878,7 @@ void AnimationTimelineEdit::_play_position_draw() { void AnimationTimelineEdit::gui_input(const Ref &p_event) { ERR_FAIL_COND(p_event.is_null()); - if (panner->gui_input(p_event)) { + if (panner->gui_input(p_event, get_global_rect())) { accept_event(); return; } @@ -5140,12 +5144,10 @@ void AnimationTrackEditor::_notification(int p_what) { } [[fallthrough]]; } - case NOTIFICATION_ENTER_TREE: { panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning"))); - panner->set_viewport(get_viewport()); - [[fallthrough]]; - } + panner->setup_warped_panning(get_viewport(), EDITOR_GET("editors/panning/warped_mouse_panning")); + } break; case NOTIFICATION_THEME_CHANGED: { zoom_icon->set_texture(get_editor_theme_icon(SNAME("Zoom"))); bezier_edit_icon->set_button_icon(get_editor_theme_icon(SNAME("EditBezier"))); @@ -5941,7 +5943,7 @@ void AnimationTrackEditor::_box_selection_draw() { void AnimationTrackEditor::_scroll_input(const Ref &p_event) { if (!box_selecting) { - if (panner->gui_input(p_event)) { + if (panner->gui_input(p_event, scroll->get_global_rect())) { scroll->accept_event(); return; } diff --git a/editor/animation_track_editor_plugins.cpp b/editor/animation_track_editor_plugins.cpp index 9f02da2c56..ef24a79b52 100644 --- a/editor/animation_track_editor_plugins.cpp +++ b/editor/animation_track_editor_plugins.cpp @@ -41,7 +41,6 @@ #include "scene/2d/sprite_2d.h" #include "scene/3d/sprite_3d.h" #include "scene/animation/animation_player.h" -#include "scene/resources/text_line.h" #include "servers/audio/audio_stream.h" /// BOOL /// diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 68828c8dcf..ed6447a74a 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -41,39 +41,72 @@ #include "editor/plugins/script_editor_plugin.h" #include "editor/themes/editor_scale.h" #include "editor/themes/editor_theme_manager.h" +#include "scene/gui/line_edit.h" #include "scene/gui/menu_button.h" #include "scene/gui/separator.h" #include "scene/resources/font.h" -void GotoLineDialog::popup_find_line(CodeEdit *p_edit) { - text_editor = p_edit; +void GotoLinePopup::popup_find_line(CodeTextEditor *p_text_editor) { + text_editor = p_text_editor; - // Add 1 because text_editor->get_caret_line() starts from 0, but the editor user interface starts from 1. - line->set_text(itos(text_editor->get_caret_line() + 1)); - line->select_all(); - popup_centered(Size2(180, 80) * EDSCALE); - line->grab_focus(); + original_state = text_editor->get_navigation_state(); + + // Add 1 because the TextEdit starts from 0, but the editor user interface starts from 1. + TextEdit *text_edit = text_editor->get_text_editor(); + int original_line = text_edit->get_caret_line() + 1; + line_input->set_text(itos(original_line)); + text_editor->set_preview_navigation_change(true); + + Rect2i parent_rect = text_editor->get_global_rect(); + Point2i centered_pos(parent_rect.get_center().x - get_contents_minimum_size().x / 2.0, parent_rect.position.y); + popup_on_parent(Rect2i(centered_pos, Size2())); + reset_size(); + line_input->grab_focus(); } -int GotoLineDialog::get_line() const { - return line->get_text().to_int(); -} - -void GotoLineDialog::ok_pressed() { - // Subtract 1 because the editor user interface starts from 1, but text_editor->set_caret_line(n) starts from 0. - const int line_number = get_line() - 1; - if (line_number < 0 || line_number >= text_editor->get_line_count()) { +void GotoLinePopup::_goto_line() { + if (line_input->get_text().is_empty()) { return; } - text_editor->remove_secondary_carets(); - text_editor->unfold_line(line_number); - text_editor->set_caret_line(line_number); - text_editor->set_code_hint(""); - text_editor->cancel_code_completion(); + + PackedStringArray line_col_strings = line_input->get_text().split(":"); + // Subtract 1 because the editor user interface starts from 1, but the TextEdit starts from 0. + const int line_number = line_col_strings[0].to_int() - 1; + if (line_number < 0 || line_number >= text_editor->get_text_editor()->get_line_count()) { + return; + } + + int column_number = 0; + if (line_col_strings.size() >= 2) { + column_number = line_col_strings[1].to_int() - 1; + } + text_editor->goto_line_centered(line_number, column_number); +} + +void GotoLinePopup::_submit() { + _goto_line(); hide(); } -GotoLineDialog::GotoLineDialog() { +void GotoLinePopup::_notification(int p_what) { + switch (p_what) { + case NOTIFICATION_VISIBILITY_CHANGED: { + if (!is_visible()) { + text_editor->set_preview_navigation_change(false); + } + } break; + } +} + +void GotoLinePopup::_input_from_window(const Ref &p_event) { + if (p_event->is_action_pressed(SNAME("ui_cancel"), false, true)) { + // Cancelled, go back to original state. + text_editor->set_edit_state(original_state); + } + PopupPanel::_input_from_window(p_event); +} + +GotoLinePopup::GotoLinePopup() { set_title(TTR("Go to Line")); VBoxContainer *vbc = memnew(VBoxContainer); @@ -87,14 +120,12 @@ GotoLineDialog::GotoLineDialog() { l->set_text(TTR("Line Number:")); vbc->add_child(l); - line = memnew(LineEdit); - vbc->add_child(line); - register_text_enter(line); - text_editor = nullptr; - - line_label = nullptr; - - set_hide_on_ok(false); + line_input = memnew(LineEdit); + line_input->set_custom_minimum_size(Size2(100, 0) * EDSCALE); + line_input->set_select_all_on_focus(true); + line_input->connect(SceneStringName(text_changed), callable_mp(this, &GotoLinePopup::_goto_line).unbind(1)); + line_input->connect(SceneStringName(text_submitted), callable_mp(this, &GotoLinePopup::_submit).unbind(1)); + vbc->add_child(line_input); } void FindReplaceBar::_notification(int p_what) { @@ -1395,6 +1426,20 @@ void CodeTextEditor::store_previous_state() { previous_state = get_navigation_state(); } +bool CodeTextEditor::is_previewing_navigation_change() const { + return preview_navigation_change; +} + +void CodeTextEditor::set_preview_navigation_change(bool p_preview) { + if (preview_navigation_change == p_preview) { + return; + } + preview_navigation_change = p_preview; + if (!preview_navigation_change) { + emit_signal("navigation_preview_ended"); + } +} + void CodeTextEditor::set_edit_state(const Variant &p_state) { Dictionary state = p_state; @@ -1763,6 +1808,7 @@ void CodeTextEditor::_bind_methods() { ADD_SIGNAL(MethodInfo("load_theme_settings")); ADD_SIGNAL(MethodInfo("show_errors_panel")); ADD_SIGNAL(MethodInfo("show_warnings_panel")); + ADD_SIGNAL(MethodInfo("navigation_preview_ended")); ADD_SIGNAL(MethodInfo("zoomed", PropertyInfo(Variant::FLOAT, "p_zoom_factor"))); } diff --git a/editor/code_editor.h b/editor/code_editor.h index 21a42d1878..12cd9485dd 100644 --- a/editor/code_editor.h +++ b/editor/code_editor.h @@ -39,30 +39,33 @@ #include "scene/gui/code_edit.h" #include "scene/gui/dialogs.h" #include "scene/gui/label.h" -#include "scene/gui/line_edit.h" +#include "scene/gui/popup.h" #include "scene/main/timer.h" class MenuButton; +class CodeTextEditor; +class LineEdit; -class GotoLineDialog : public ConfirmationDialog { - GDCLASS(GotoLineDialog, ConfirmationDialog); +class GotoLinePopup : public PopupPanel { + GDCLASS(GotoLinePopup, PopupPanel); - Label *line_label = nullptr; - LineEdit *line = nullptr; + Variant original_state; + LineEdit *line_input = nullptr; + CodeTextEditor *text_editor = nullptr; - CodeEdit *text_editor = nullptr; + void _goto_line(); + void _submit(); - virtual void ok_pressed() override; +protected: + void _notification(int p_what); + virtual void _input_from_window(const Ref &p_event) override; public: - void popup_find_line(CodeEdit *p_edit); - int get_line() const; + void popup_find_line(CodeTextEditor *p_text_editor); - GotoLineDialog(); + GotoLinePopup(); }; -class CodeTextEditor; - class FindReplaceBar : public HBoxContainer { GDCLASS(FindReplaceBar, HBoxContainer); @@ -188,6 +191,7 @@ class CodeTextEditor : public VBoxContainer { int error_line; int error_column; + bool preview_navigation_change = false; Dictionary previous_state; void _update_text_editor_theme(); @@ -266,6 +270,9 @@ public: Variant get_previous_state(); void store_previous_state(); + bool is_previewing_navigation_change() const; + void set_preview_navigation_change(bool p_preview); + void set_error_count(int p_error_count); void set_warning_count(int p_warning_count); diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index 4c20faeb7e..5fb78276c3 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -33,7 +33,6 @@ #include "create_dialog.h" #include "core/object/class_db.h" -#include "core/os/keyboard.h" #include "editor/editor_feature_profile.h" #include "editor/editor_node.h" #include "editor/editor_paths.h" diff --git a/editor/debugger/debug_adapter/debug_adapter_server.cpp b/editor/debugger/debug_adapter/debug_adapter_server.cpp index d90710786b..45ff9f1dd8 100644 --- a/editor/debugger/debug_adapter/debug_adapter_server.cpp +++ b/editor/debugger/debug_adapter/debug_adapter_server.cpp @@ -32,7 +32,6 @@ #include "debug_adapter_server.h" -#include "core/os/os.h" #include "editor/editor_log.h" #include "editor/editor_node.h" #include "editor/editor_settings.h" diff --git a/editor/debugger/editor_debugger_server.cpp b/editor/debugger/editor_debugger_server.cpp index 199edb8f6a..1121e6ecb3 100644 --- a/editor/debugger/editor_debugger_server.cpp +++ b/editor/debugger/editor_debugger_server.cpp @@ -32,9 +32,7 @@ #include "editor_debugger_server.h" -#include "core/io/marshalls.h" #include "core/io/tcp_server.h" -#include "core/os/mutex.h" #include "core/os/thread.h" #include "editor/editor_log.h" #include "editor/editor_node.h" diff --git a/editor/debugger/editor_file_server.cpp b/editor/debugger/editor_file_server.cpp index ad70eb3508..5733931b00 100644 --- a/editor/debugger/editor_file_server.cpp +++ b/editor/debugger/editor_file_server.cpp @@ -33,7 +33,6 @@ #include "editor_file_server.h" #include "../editor_settings.h" -#include "core/io/marshalls.h" #include "editor/editor_node.h" #include "editor/export/editor_export_platform.h" diff --git a/editor/debugger/editor_file_server.h b/editor/debugger/editor_file_server.h index bba8774820..d0ba22c531 100644 --- a/editor/debugger/editor_file_server.h +++ b/editor/debugger/editor_file_server.h @@ -33,9 +33,7 @@ #ifndef EDITOR_FILE_SERVER_H #define EDITOR_FILE_SERVER_H -#include "core/io/packet_peer.h" #include "core/io/tcp_server.h" -#include "core/object/class_db.h" #include "core/os/thread.h" #include "editor/editor_file_system.h" diff --git a/editor/debugger/editor_performance_profiler.h b/editor/debugger/editor_performance_profiler.h index cc0fd02feb..b537724c2c 100644 --- a/editor/debugger/editor_performance_profiler.h +++ b/editor/debugger/editor_performance_profiler.h @@ -34,7 +34,6 @@ #define EDITOR_PERFORMANCE_PROFILER_H #include "core/templates/hash_map.h" -#include "core/templates/rb_map.h" #include "main/performance.h" #include "scene/gui/control.h" #include "scene/gui/label.h" diff --git a/editor/debugger/editor_profiler.cpp b/editor/debugger/editor_profiler.cpp index caab13c7a8..0141dfb814 100644 --- a/editor/debugger/editor_profiler.cpp +++ b/editor/debugger/editor_profiler.cpp @@ -33,12 +33,10 @@ #include "editor_profiler.h" #include "core/io/image.h" -#include "core/os/os.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/gui/editor_run_bar.h" #include "editor/themes/editor_scale.h" -#include "editor/themes/editor_theme_manager.h" #include "scene/gui/check_box.h" #include "scene/resources/image_texture.h" diff --git a/editor/debugger/editor_visual_profiler.cpp b/editor/debugger/editor_visual_profiler.cpp index f0ac38e845..46629629de 100644 --- a/editor/debugger/editor_visual_profiler.cpp +++ b/editor/debugger/editor_visual_profiler.cpp @@ -33,7 +33,6 @@ #include "editor_visual_profiler.h" #include "core/io/image.h" -#include "core/os/os.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/gui/editor_run_bar.h" diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index 1bd2a1923f..72d20a02b2 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -63,13 +63,10 @@ #include "scene/gui/label.h" #include "scene/gui/line_edit.h" #include "scene/gui/margin_container.h" -#include "scene/gui/rich_text_label.h" #include "scene/gui/separator.h" #include "scene/gui/split_container.h" #include "scene/gui/tab_container.h" -#include "scene/gui/texture_button.h" #include "scene/gui/tree.h" -#include "scene/resources/packed_scene.h" #include "servers/debugger/servers_debugger.h" #include "servers/display_server.h" diff --git a/editor/dependency_editor.h b/editor/dependency_editor.h index 2476dac393..6fd08ddfb8 100644 --- a/editor/dependency_editor.h +++ b/editor/dependency_editor.h @@ -36,7 +36,6 @@ #include "scene/gui/box_container.h" #include "scene/gui/dialogs.h" #include "scene/gui/item_list.h" -#include "scene/gui/tab_container.h" #include "scene/gui/tree.h" class EditorFileDialog; diff --git a/editor/directory_create_dialog.cpp b/editor/directory_create_dialog.cpp index 4ff9b7cef2..092bb6adca 100644 --- a/editor/directory_create_dialog.cpp +++ b/editor/directory_create_dialog.cpp @@ -33,7 +33,6 @@ #include "directory_create_dialog.h" #include "core/io/dir_access.h" -#include "editor/editor_file_system.h" #include "editor/editor_node.h" #include "editor/gui/editor_validation_panel.h" #include "editor/themes/editor_scale.h" diff --git a/editor/doc_tools.cpp b/editor/doc_tools.cpp index 26cde71db3..bb92e22aaf 100644 --- a/editor/doc_tools.cpp +++ b/editor/doc_tools.cpp @@ -37,12 +37,11 @@ #include "core/core_constants.h" #include "core/io/compression.h" #include "core/io/dir_access.h" -#include "core/io/marshalls.h" #include "core/io/resource_importer.h" #include "core/object/script_language.h" #include "core/string/translation_server.h" #include "editor/editor_settings.h" -#include "editor/export/editor_export.h" +#include "editor/export/editor_export_platform.h" #include "scene/resources/theme.h" #include "scene/theme/theme_db.h" diff --git a/editor/editor_about.cpp b/editor/editor_about.cpp index 7432f5bf9d..09899cd935 100644 --- a/editor/editor_about.cpp +++ b/editor/editor_about.cpp @@ -40,6 +40,9 @@ #include "editor/gui/editor_version_button.h" #include "editor/themes/editor_scale.h" #include "scene/gui/item_list.h" +#include "scene/gui/separator.h" +#include "scene/gui/split_container.h" +#include "scene/gui/tab_container.h" #include "scene/resources/style_box.h" void EditorAbout::_notification(int p_what) { diff --git a/editor/editor_about.h b/editor/editor_about.h index 4af2e0af17..bb3aabcd46 100644 --- a/editor/editor_about.h +++ b/editor/editor_about.h @@ -37,9 +37,6 @@ #include "scene/gui/item_list.h" #include "scene/gui/rich_text_label.h" #include "scene/gui/scroll_container.h" -#include "scene/gui/separator.h" -#include "scene/gui/split_container.h" -#include "scene/gui/tab_container.h" #include "scene/gui/texture_rect.h" #include "scene/gui/tree.h" diff --git a/editor/editor_atlas_packer.cpp b/editor/editor_atlas_packer.cpp index c081d35203..a9dd929e8c 100644 --- a/editor/editor_atlas_packer.cpp +++ b/editor/editor_atlas_packer.cpp @@ -35,6 +35,7 @@ #include "core/math/geometry_2d.h" #include "core/math/vector2.h" #include "core/math/vector2i.h" +#include "scene/resources/bit_map.h" void EditorAtlasPacker::chart_pack(Vector &charts, int &r_width, int &r_height, int p_atlas_max_size, int p_cell_resolution) { int divide_by = MIN(64, p_cell_resolution); diff --git a/editor/editor_atlas_packer.h b/editor/editor_atlas_packer.h index c13d4557b4..46edd35534 100644 --- a/editor/editor_atlas_packer.h +++ b/editor/editor_atlas_packer.h @@ -33,11 +33,9 @@ #ifndef EDITOR_ATLAS_PACKER_H #define EDITOR_ATLAS_PACKER_H +#include "core/math/vector2.h" +#include "core/math/vector2i.h" #include "core/templates/vector.h" -#include "scene/resources/bit_map.h" - -struct Vector2; -struct Vector2i; class EditorAtlasPacker { public: diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp index 9d3072d0cb..6a36dc79b8 100644 --- a/editor/editor_autoload_settings.cpp +++ b/editor/editor_autoload_settings.cpp @@ -40,7 +40,6 @@ #include "editor/filesystem_dock.h" #include "editor/gui/editor_file_dialog.h" #include "editor/project_settings_editor.h" -#include "editor/themes/editor_scale.h" #include "scene/main/window.h" #include "scene/resources/packed_scene.h" diff --git a/editor/editor_build_profile.cpp b/editor/editor_build_profile.cpp index f998cc9006..0a9c7fce5f 100644 --- a/editor/editor_build_profile.cpp +++ b/editor/editor_build_profile.cpp @@ -32,16 +32,15 @@ #include "editor_build_profile.h" -#include "core/io/dir_access.h" #include "core/io/json.h" #include "editor/editor_file_system.h" #include "editor/editor_node.h" #include "editor/editor_paths.h" -#include "editor/editor_property_name_processor.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/gui/editor_file_dialog.h" #include "editor/themes/editor_scale.h" +#include "scene/gui/separator.h" const char *EditorBuildProfile::build_option_identifiers[BUILD_OPTION_MAX] = { // This maps to SCons build options. diff --git a/editor/editor_build_profile.h b/editor/editor_build_profile.h index a5523df1d8..4dbedd03cd 100644 --- a/editor/editor_build_profile.h +++ b/editor/editor_build_profile.h @@ -33,13 +33,9 @@ #ifndef EDITOR_BUILD_PROFILE_H #define EDITOR_BUILD_PROFILE_H -#include "core/io/file_access.h" #include "core/object/ref_counted.h" #include "editor/editor_help.h" #include "scene/gui/dialogs.h" -#include "scene/gui/option_button.h" -#include "scene/gui/separator.h" -#include "scene/gui/split_container.h" #include "scene/gui/tree.h" class EditorBuildProfile : public RefCounted { diff --git a/editor/editor_command_palette.h b/editor/editor_command_palette.h index b1cf9b320a..7a0ffb7420 100644 --- a/editor/editor_command_palette.h +++ b/editor/editor_command_palette.h @@ -34,7 +34,6 @@ #define EDITOR_COMMAND_PALETTE_H #include "core/input/shortcut.h" -#include "core/os/thread_safe.h" #include "scene/gui/dialogs.h" #include "scene/gui/tree.h" diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index 8c055ef3ec..d4a41ef23d 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -35,17 +35,12 @@ #include "core/config/project_settings.h" #include "core/extension/gdextension_manager.h" #include "core/io/file_access.h" -#include "core/io/image_loader.h" #include "core/io/resource_loader.h" #include "editor/editor_node.h" -#include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" #include "editor/multi_node_edit.h" #include "editor/plugins/editor_context_menu_plugin.h" #include "editor/plugins/editor_plugin.h" -#include "editor/plugins/script_editor_plugin.h" -#include "editor/themes/editor_scale.h" -#include "scene/gui/popup_menu.h" #include "scene/resources/packed_scene.h" void EditorSelectionHistory::cleanup_history() { diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp index 51c6848787..93c2b8c961 100644 --- a/editor/editor_feature_profile.cpp +++ b/editor/editor_feature_profile.cpp @@ -41,6 +41,7 @@ #include "editor/editor_string_names.h" #include "editor/gui/editor_file_dialog.h" #include "editor/themes/editor_scale.h" +#include "scene/gui/separator.h" const char *EditorFeatureProfile::feature_names[FEATURE_MAX] = { TTRC("3D Editor"), diff --git a/editor/editor_feature_profile.h b/editor/editor_feature_profile.h index 859be5fe4e..e42f7cf0da 100644 --- a/editor/editor_feature_profile.h +++ b/editor/editor_feature_profile.h @@ -33,12 +33,10 @@ #ifndef EDITOR_FEATURE_PROFILE_H #define EDITOR_FEATURE_PROFILE_H -#include "core/io/file_access.h" #include "core/object/ref_counted.h" #include "editor/editor_help.h" #include "scene/gui/dialogs.h" #include "scene/gui/option_button.h" -#include "scene/gui/separator.h" #include "scene/gui/split_container.h" #include "scene/gui/tree.h" diff --git a/editor/editor_help.h b/editor/editor_help.h index 8cae00f9ff..227d9e5c73 100644 --- a/editor/editor_help.h +++ b/editor/editor_help.h @@ -34,15 +34,12 @@ #define EDITOR_HELP_H #include "core/os/thread.h" -#include "editor/code_editor.h" #include "editor/doc_tools.h" #include "editor/plugins/editor_plugin.h" -#include "scene/gui/menu_button.h" -#include "scene/gui/panel_container.h" +#include "scene/gui/dialogs.h" #include "scene/gui/popup.h" #include "scene/gui/rich_text_label.h" #include "scene/gui/split_container.h" -#include "scene/gui/tab_container.h" #include "scene/gui/text_edit.h" #include "scene/main/timer.h" diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index 2e185dc30e..a57180df1f 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -32,7 +32,6 @@ #include "editor_help_search.h" -#include "core/os/keyboard.h" #include "editor/editor_feature_profile.h" #include "editor/editor_main_screen.h" #include "editor/editor_node.h" diff --git a/editor/editor_help_search.h b/editor/editor_help_search.h index f171b79786..7fa94a2f15 100644 --- a/editor/editor_help_search.h +++ b/editor/editor_help_search.h @@ -33,10 +33,8 @@ #ifndef EDITOR_HELP_SEARCH_H #define EDITOR_HELP_SEARCH_H -#include "core/templates/rb_map.h" -#include "editor/code_editor.h" -#include "editor/editor_help.h" #include "editor/plugins/editor_plugin.h" +#include "scene/gui/dialogs.h" #include "scene/gui/option_button.h" #include "scene/gui/tree.h" diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 8ddb7bdf97..e56992ff5e 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -50,6 +50,7 @@ #include "editor/themes/editor_scale.h" #include "editor/themes/editor_theme_manager.h" #include "scene/gui/margin_container.h" +#include "scene/gui/separator.h" #include "scene/gui/spin_box.h" #include "scene/gui/texture_rect.h" #include "scene/property_utils.h" diff --git a/editor/editor_interface.cpp b/editor/editor_interface.cpp index 8b9f4bad46..ceaffbe68e 100644 --- a/editor/editor_interface.cpp +++ b/editor/editor_interface.cpp @@ -57,7 +57,6 @@ #include "plugins/editor_preview_plugins.h" #include "scene/3d/light_3d.h" #include "scene/3d/mesh_instance_3d.h" -#include "scene/3d/world_environment.h" #include "scene/gui/box_container.h" #include "scene/gui/control.h" #include "scene/main/window.h" diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp index 9b0d0bc9f1..9c62b4c79d 100644 --- a/editor/editor_log.cpp +++ b/editor/editor_log.cpp @@ -40,7 +40,6 @@ #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/themes/editor_scale.h" -#include "scene/gui/center_container.h" #include "scene/gui/separator.h" #include "scene/resources/font.h" diff --git a/editor/editor_log.h b/editor/editor_log.h index 21d5b57869..63bb2a387e 100644 --- a/editor/editor_log.h +++ b/editor/editor_log.h @@ -36,12 +36,8 @@ #include "core/os/thread.h" #include "scene/gui/box_container.h" #include "scene/gui/button.h" -#include "scene/gui/label.h" #include "scene/gui/line_edit.h" -#include "scene/gui/panel_container.h" #include "scene/gui/rich_text_label.h" -#include "scene/gui/texture_button.h" -#include "scene/gui/texture_rect.h" class UndoRedo; diff --git a/editor/editor_native_shader_source_visualizer.cpp b/editor/editor_native_shader_source_visualizer.cpp index adee5c542c..739d6e3264 100644 --- a/editor/editor_native_shader_source_visualizer.cpp +++ b/editor/editor_native_shader_source_visualizer.cpp @@ -32,10 +32,10 @@ #include "editor_native_shader_source_visualizer.h" -#include "editor/code_editor.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/themes/editor_scale.h" +#include "scene/gui/code_edit.h" #include "scene/gui/text_edit.h" #include "servers/rendering/shader_language.h" diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 67842756be..138920e8cb 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -50,16 +50,15 @@ #include "editor/editor_string_names.h" #include "editor/plugins/editor_context_menu_plugin.h" #include "main/main.h" +#include "scene/2d/node_2d.h" #include "scene/3d/bone_attachment_3d.h" #include "scene/animation/animation_tree.h" #include "scene/gui/color_picker.h" #include "scene/gui/dialogs.h" #include "scene/gui/file_dialog.h" -#include "scene/gui/link_button.h" #include "scene/gui/menu_bar.h" #include "scene/gui/menu_button.h" #include "scene/gui/panel.h" -#include "scene/gui/panel_container.h" #include "scene/gui/popup.h" #include "scene/gui/rich_text_label.h" #include "scene/gui/split_container.h" @@ -99,8 +98,6 @@ #include "editor/editor_property_name_processor.h" #include "editor/editor_resource_picker.h" #include "editor/editor_resource_preview.h" -#include "editor/editor_run.h" -#include "editor/editor_run_native.h" #include "editor/editor_settings.h" #include "editor/editor_settings_dialog.h" #include "editor/editor_translation_parser.h" @@ -169,7 +166,6 @@ #include "editor/themes/editor_theme_manager.h" #include "editor/window_wrapper.h" -#include #include #include "modules/modules_enabled.gen.h" // For gdscript, mono. diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 8e13233b59..f6cef543b3 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -49,7 +49,6 @@ #include "editor/property_selector.h" #include "editor/scene_tree_dock.h" #include "editor/themes/editor_scale.h" -#include "editor/themes/editor_theme_manager.h" #include "scene/2d/gpu_particles_2d.h" #include "scene/3d/fog_volume.h" #include "scene/3d/gpu_particles_3d.h" @@ -58,7 +57,6 @@ #include "scene/main/window.h" #include "scene/resources/font.h" #include "scene/resources/mesh.h" -#include "scene/resources/packed_scene.h" #include "scene/resources/visual_shader_nodes.h" ///////////////////// Nil ///////////////////////// diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index 9f93f757f7..8371742ec7 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -34,6 +34,7 @@ #include "core/input/input.h" #include "core/io/marshalls.h" +#include "editor/editor_file_system.h" #include "editor/editor_properties.h" #include "editor/editor_properties_vector.h" #include "editor/editor_settings.h" @@ -41,10 +42,8 @@ #include "editor/gui/editor_spin_slider.h" #include "editor/inspector_dock.h" #include "editor/themes/editor_scale.h" -#include "editor/themes/editor_theme_manager.h" #include "scene/gui/button.h" #include "scene/gui/margin_container.h" -#include "scene/resources/packed_scene.h" bool EditorPropertyArrayObject::_set(const StringName &p_name, const Variant &p_value) { String name = p_name; diff --git a/editor/editor_properties_array_dict.h b/editor/editor_properties_array_dict.h index 53fb918aaf..d510cfe592 100644 --- a/editor/editor_properties_array_dict.h +++ b/editor/editor_properties_array_dict.h @@ -35,7 +35,6 @@ #include "editor/editor_inspector.h" #include "editor/editor_locale_dialog.h" -#include "editor/filesystem_dock.h" class Button; class EditorSpinSlider; diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp index 60efc969bf..bbf88daca5 100644 --- a/editor/editor_resource_picker.cpp +++ b/editor/editor_resource_picker.cpp @@ -39,7 +39,6 @@ #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/filesystem_dock.h" -#include "editor/gui/editor_file_dialog.h" #include "editor/gui/editor_quick_open_dialog.h" #include "editor/plugins/editor_resource_conversion_plugin.h" #include "editor/plugins/script_editor_plugin.h" @@ -184,6 +183,15 @@ void EditorResourcePicker::_resource_saved(Object *p_resource) { } } +void EditorResourcePicker::_load_button_pressed() { + Vector base_types; + for (const String &type : base_type.split(",")) { + base_types.push_back(type); + } + + EditorNode::get_singleton()->get_quick_open_dialog()->popup_dialog(base_types, callable_mp(this, &EditorResourcePicker::_file_selected)); +} + void EditorResourcePicker::_update_menu() { _update_menu_items(); @@ -199,20 +207,23 @@ void EditorResourcePicker::_update_menu_items() { _ensure_resource_menu(); edit_menu->clear(); + bool added_create_options = false; + // Add options for creating specific subtypes of the base resource type. if (is_editable()) { + int previous_item_count = edit_menu->get_item_count(); + set_create_options(edit_menu); - // Add an option to load a resource from a file using the QuickOpen dialog. - edit_menu->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTR("Quick Load..."), OBJ_MENU_QUICKLOAD); - edit_menu->set_item_tooltip(-1, TTR("Opens a quick menu to select from a list of allowed Resource files.")); - - // Add an option to load a resource from a file using the regular file dialog. - edit_menu->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTR("Load..."), OBJ_MENU_LOAD); + added_create_options = previous_item_count != edit_menu->get_item_count(); } // Add options for changing existing value of the resource. if (edited_resource.is_valid()) { + if (added_create_options) { + edit_menu->add_separator(); + } + // Determine if the edited resource is part of another scene (foreign) which was imported bool is_edited_resource_foreign_import = EditorNode::get_singleton()->is_resource_read_only(edited_resource, true); @@ -312,47 +323,6 @@ void EditorResourcePicker::_update_menu_items() { void EditorResourcePicker::_edit_menu_cbk(int p_which) { switch (p_which) { - case OBJ_MENU_LOAD: { - List extensions; - for (int i = 0; i < base_type.get_slice_count(","); i++) { - String base = base_type.get_slice(",", i); - ResourceLoader::get_recognized_extensions_for_type(base, &extensions); - if (ScriptServer::is_global_class(base)) { - ResourceLoader::get_recognized_extensions_for_type(ScriptServer::get_global_class_native_base(base), &extensions); - } - } - - HashSet valid_extensions; - for (const String &E : extensions) { - valid_extensions.insert(E); - } - - if (!file_dialog) { - file_dialog = memnew(EditorFileDialog); - file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); - add_child(file_dialog); - file_dialog->connect("file_selected", callable_mp(this, &EditorResourcePicker::_file_selected)); - } - - file_dialog->clear_filters(); - for (const String &E : valid_extensions) { - file_dialog->add_filter("*." + E, E.to_upper()); - } - - file_dialog->popup_file_dialog(); - } break; - - case OBJ_MENU_QUICKLOAD: { - const Vector &base_types_string = base_type.split(","); - - Vector base_types; - for (const String &type : base_types_string) { - base_types.push_back(type); - } - - EditorNode::get_singleton()->get_quick_open_dialog()->popup_dialog(base_types, callable_mp(this, &EditorResourcePicker::_file_selected)); - } break; - case OBJ_MENU_INSPECT: { if (edited_resource.is_valid()) { emit_signal(SNAME("resource_selected"), edited_resource, true); @@ -504,29 +474,25 @@ void EditorResourcePicker::set_create_options(Object *p_menu_node) { HashSet allowed_types = allowed_types_without_convert; for (const StringName &E : allowed_types) { - const String &t = E; + const String &type = E; - if (!ClassDB::can_instantiate(t)) { + if (!ClassDB::can_instantiate(type)) { continue; } - inheritors_array.push_back(t); + inheritors_array.push_back(type); - Ref icon = EditorNode::get_singleton()->get_class_icon(t, "Object"); + Ref icon = EditorNode::get_singleton()->get_class_icon(type, "Object"); int id = TYPE_BASE_ID + idx; - edit_menu->add_icon_item(icon, vformat(TTR("New %s"), t), id); + edit_menu->add_icon_item(icon, vformat(TTR("New %s"), type), id); - HashMap::Iterator class_doc = EditorHelp::get_doc_data()->class_list.find(t); + HashMap::Iterator class_doc = EditorHelp::get_doc_data()->class_list.find(type); if (class_doc) { edit_menu->set_item_tooltip(-1, DTR(class_doc->value.brief_description)); } idx++; } - - if (edit_menu->get_item_count()) { - edit_menu->add_separator(); - } } } @@ -843,6 +809,7 @@ void EditorResourcePicker::_notification(int p_what) { edit_menu->add_theme_constant_override("icon_max_width", icon_width); } + load_button->set_button_icon(get_editor_theme_icon(SNAME("Load"))); edit_button->set_button_icon(get_theme_icon(SNAME("select_arrow"), SNAME("Tree"))); } break; @@ -984,6 +951,7 @@ void EditorResourcePicker::set_resource_owner(Object *p_object) { void EditorResourcePicker::set_editable(bool p_editable) { editable = p_editable; assign_button->set_disabled(!editable && !edited_resource.is_valid()); + load_button->set_visible(editable); edit_button->set_visible(editable); } @@ -1109,12 +1077,17 @@ EditorResourcePicker::EditorResourcePicker(bool p_hide_assign_button_controls) { assign_button->add_child(preview_rect); } + load_button = memnew(Button); + load_button->set_flat(false); + add_child(load_button); + load_button->connect(SceneStringName(pressed), callable_mp(this, &EditorResourcePicker::_load_button_pressed)); + edit_button = memnew(Button); edit_button->set_flat(false); edit_button->set_toggle_mode(true); edit_button->set_action_mode(BaseButton::ACTION_MODE_BUTTON_PRESS); - edit_button->connect(SceneStringName(pressed), callable_mp(this, &EditorResourcePicker::_update_menu)); add_child(edit_button); + edit_button->connect(SceneStringName(pressed), callable_mp(this, &EditorResourcePicker::_update_menu)); edit_button->connect(SceneStringName(gui_input), callable_mp(this, &EditorResourcePicker::_button_input)); add_theme_constant_override("separation", 0); @@ -1138,7 +1111,6 @@ void EditorScriptPicker::set_create_options(Object *p_menu_node) { menu_node->add_icon_item(get_editor_theme_icon(SNAME("ScriptExtend")), TTR("Extend Script..."), OBJ_MENU_EXTEND_SCRIPT); } } - menu_node->add_separator(); } bool EditorScriptPicker::handle_menu_selected(int p_which) { @@ -1188,7 +1160,6 @@ void EditorShaderPicker::set_create_options(Object *p_menu_node) { } menu_node->add_icon_item(get_editor_theme_icon(SNAME("Shader")), TTR("New Shader..."), OBJ_MENU_NEW_SHADER); - menu_node->add_separator(); } bool EditorShaderPicker::handle_menu_selected(int p_which) { diff --git a/editor/editor_resource_picker.h b/editor/editor_resource_picker.h index 85d830240b..bc06f4c0fa 100644 --- a/editor/editor_resource_picker.h +++ b/editor/editor_resource_picker.h @@ -37,7 +37,6 @@ class Button; class ConfirmationDialog; -class EditorFileDialog; class PopupMenu; class TextureRect; class Tree; @@ -58,8 +57,8 @@ class EditorResourcePicker : public HBoxContainer { Button *assign_button = nullptr; TextureRect *preview_rect = nullptr; + Button *load_button = nullptr; Button *edit_button = nullptr; - EditorFileDialog *file_dialog = nullptr; ConfirmationDialog *duplicate_resources_dialog = nullptr; Tree *duplicate_resources_tree = nullptr; @@ -67,8 +66,6 @@ class EditorResourcePicker : public HBoxContainer { Size2i assign_button_min_size = Size2i(1, 1); enum MenuOption { - OBJ_MENU_LOAD, - OBJ_MENU_QUICKLOAD, OBJ_MENU_INSPECT, OBJ_MENU_CLEAR, OBJ_MENU_MAKE_UNIQUE, @@ -95,6 +92,7 @@ class EditorResourcePicker : public HBoxContainer { void _resource_saved(Object *p_resource); + void _load_button_pressed(); void _update_menu(); void _update_menu_items(); void _edit_menu_cbk(int p_which); diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp index 470b9d244a..ec106efb8d 100644 --- a/editor/editor_resource_preview.cpp +++ b/editor/editor_resource_preview.cpp @@ -44,7 +44,7 @@ #include "editor/themes/editor_scale.h" #include "scene/main/window.h" #include "scene/resources/image_texture.h" -#include "servers/rendering/rendering_server_default.h" +#include "servers/rendering/rendering_server_globals.h" bool EditorResourcePreviewGenerator::handles(const String &p_type) const { bool success = false; diff --git a/editor/editor_run.cpp b/editor/editor_run.cpp index 8fec3f71d0..5879d197c6 100644 --- a/editor/editor_run.cpp +++ b/editor/editor_run.cpp @@ -287,6 +287,9 @@ void EditorRun::stop() { } OS::ProcessID EditorRun::get_current_process() const { + if (pids.front() == nullptr) { + return 0; + } return pids.front()->get(); } diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index f4d239615c..332d3317de 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -766,8 +766,6 @@ void EditorSettings::_load_defaults(Ref p_extra_config) { _initial_set("editors/grid_map/palette_min_width", 230); set_restart_if_changed("editors/grid_map/palette_min_width", true); _initial_set("editors/grid_map/preview_size", 64); - // GridMapEditorPlugin - EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "editors/grid_map/editor_side", 1, "Left,Right"); // 3D EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "editors/3d/primary_grid_color", Color(0.56, 0.56, 0.56, 0.5), "") diff --git a/editor/editor_settings.h b/editor/editor_settings.h index dcf03f3bee..1ffb247adc 100644 --- a/editor/editor_settings.h +++ b/editor/editor_settings.h @@ -37,7 +37,6 @@ #include "core/io/config_file.h" #include "core/io/resource.h" #include "core/os/thread_safe.h" -#include "core/templates/rb_set.h" class EditorPlugin; diff --git a/editor/editor_settings_dialog.cpp b/editor/editor_settings_dialog.cpp index 8e228e7f78..1c2341337f 100644 --- a/editor/editor_settings_dialog.cpp +++ b/editor/editor_settings_dialog.cpp @@ -52,6 +52,7 @@ #include "scene/gui/panel_container.h" #include "scene/gui/tab_container.h" #include "scene/gui/texture_rect.h" +#include "scene/gui/tree.h" void EditorSettingsDialog::ok_pressed() { if (!EditorSettings::get_singleton()) { diff --git a/editor/editor_translation.h b/editor/editor_translation.h index a6c08e643e..b58b4f53b5 100644 --- a/editor/editor_translation.h +++ b/editor/editor_translation.h @@ -34,7 +34,6 @@ #define EDITOR_TRANSLATION_H #include "core/string/ustring.h" -#include "core/templates/list.h" #include "core/templates/vector.h" Vector get_editor_locales(); diff --git a/editor/editor_undo_redo_manager.cpp b/editor/editor_undo_redo_manager.cpp index 4689e8aec4..2fe180337c 100644 --- a/editor/editor_undo_redo_manager.cpp +++ b/editor/editor_undo_redo_manager.cpp @@ -34,7 +34,6 @@ #include "core/io/resource.h" #include "core/os/os.h" -#include "core/templates/local_vector.h" #include "editor/debugger/editor_debugger_inspector.h" #include "editor/debugger/editor_debugger_node.h" #include "editor/editor_log.h" diff --git a/editor/editor_undo_redo_manager.h b/editor/editor_undo_redo_manager.h index 8c56c72262..a5d2d2b7ac 100644 --- a/editor/editor_undo_redo_manager.h +++ b/editor/editor_undo_redo_manager.h @@ -33,7 +33,6 @@ #ifndef EDITOR_UNDO_REDO_MANAGER_H #define EDITOR_UNDO_REDO_MANAGER_H -#include "core/object/class_db.h" #include "core/object/object.h" #include "core/object/undo_redo.h" diff --git a/editor/editor_vcs_interface.h b/editor/editor_vcs_interface.h index 00f4613960..5e30afb281 100644 --- a/editor/editor_vcs_interface.h +++ b/editor/editor_vcs_interface.h @@ -33,10 +33,8 @@ #ifndef EDITOR_VCS_INTERFACE_H #define EDITOR_VCS_INTERFACE_H -#include "core/object/class_db.h" #include "core/object/gdvirtual.gen.inc" #include "core/string/ustring.h" -#include "core/variant/type_info.h" #include "core/variant/typed_array.h" class EditorVCSInterface : public Object { diff --git a/editor/engine_update_label.cpp b/editor/engine_update_label.cpp index 318657fbac..dd17426004 100644 --- a/editor/engine_update_label.cpp +++ b/editor/engine_update_label.cpp @@ -37,9 +37,6 @@ #include "core/os/time.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" -#include "editor/themes/editor_scale.h" -#include "scene/gui/box_container.h" -#include "scene/gui/button.h" #include "scene/main/http_request.h" bool EngineUpdateLabel::_can_check_updates() const { diff --git a/editor/export/codesign.cpp b/editor/export/codesign.cpp index cfcbbf0216..a6d69b738a 100644 --- a/editor/export/codesign.cpp +++ b/editor/export/codesign.cpp @@ -32,13 +32,13 @@ #include "codesign.h" +#include "core/crypto/crypto_core.h" +#include "core/io/dir_access.h" #include "lipo.h" #include "macho.h" #include "core/io/plist.h" -#include "core/os/os.h" #include "editor/editor_paths.h" -#include "editor/editor_settings.h" #include "modules/modules_enabled.gen.h" // For regex. @@ -46,6 +46,8 @@ #ifdef MODULE_REGEX_ENABLED +#include "modules/regex/regex.h" + /*************************************************************************/ /* CodeSignCodeResources */ /*************************************************************************/ diff --git a/editor/export/codesign.h b/editor/export/codesign.h index 44a6cd1ace..516c47fab2 100644 --- a/editor/export/codesign.h +++ b/editor/export/codesign.h @@ -43,16 +43,10 @@ // - Requirements code generator is not implemented (only hard-coded requirements for the ad-hoc signing is supported). // - RFC5652/CMS blob generation is not implemented, supports ad-hoc signing only. -#include "core/crypto/crypto_core.h" -#include "core/io/dir_access.h" #include "core/io/file_access.h" -#include "core/io/plist.h" #include "core/object/ref_counted.h" #include "modules/modules_enabled.gen.h" // For regex. -#ifdef MODULE_REGEX_ENABLED -#include "modules/regex/regex.h" -#endif #ifdef MODULE_REGEX_ENABLED diff --git a/editor/export/editor_export_plugin.cpp b/editor/export/editor_export_plugin.cpp index eee0ca5de0..d49224a8a2 100644 --- a/editor/export/editor_export_plugin.cpp +++ b/editor/export/editor_export_plugin.cpp @@ -33,12 +33,7 @@ #include "editor_export_plugin.h" #include "core/config/project_settings.h" -#include "core/io/dir_access.h" -#include "core/io/file_access.h" -#include "editor/editor_paths.h" -#include "editor/editor_settings.h" #include "editor/export/editor_export_platform.h" -#include "scene/resources/resource_format_text.h" void EditorExportPlugin::set_export_preset(const Ref &p_preset) { if (p_preset.is_valid()) { diff --git a/editor/export/editor_export_plugin.h b/editor/export/editor_export_plugin.h index 513dfc4590..f29bcc90ba 100644 --- a/editor/export/editor_export_plugin.h +++ b/editor/export/editor_export_plugin.h @@ -33,7 +33,6 @@ #ifndef EDITOR_EXPORT_PLUGIN_H #define EDITOR_EXPORT_PLUGIN_H -#include "core/extension/gdextension.h" #include "core/os/shared_object.h" #include "editor_export_platform.h" #include "editor_export_preset.h" diff --git a/editor/export/export_template_manager.cpp b/editor/export/export_template_manager.cpp index 117f4d51b8..1ac820cc9d 100644 --- a/editor/export/export_template_manager.cpp +++ b/editor/export/export_template_manager.cpp @@ -41,7 +41,7 @@ #include "editor/editor_paths.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" -#include "editor/export/editor_export.h" +#include "editor/export/editor_export_preset.h" #include "editor/progress_dialog.h" #include "editor/themes/editor_scale.h" #include "scene/gui/file_dialog.h" diff --git a/editor/export/lipo.cpp b/editor/export/lipo.cpp index e2df1a573f..8119e9a8dd 100644 --- a/editor/export/lipo.cpp +++ b/editor/export/lipo.cpp @@ -32,6 +32,8 @@ #include "lipo.h" +#include "macho.h" + bool LipO::is_lipo(const String &p_path) { Ref fb = FileAccess::open(p_path, FileAccess::READ); ERR_FAIL_COND_V_MSG(fb.is_null(), false, vformat("LipO: Can't open file: \"%s\".", p_path)); diff --git a/editor/export/lipo.h b/editor/export/lipo.h index ad1f1652ce..fa65f0f87d 100644 --- a/editor/export/lipo.h +++ b/editor/export/lipo.h @@ -35,8 +35,6 @@ // Universal / Universal 2 fat binary file creator and extractor. -#include "macho.h" - #include "core/io/file_access.h" #include "core/object/ref_counted.h" diff --git a/editor/export/macho.cpp b/editor/export/macho.cpp index f0496cb57e..d48fbbd2c5 100644 --- a/editor/export/macho.cpp +++ b/editor/export/macho.cpp @@ -32,6 +32,8 @@ #include "macho.h" +#include "core/crypto/crypto_core.h" + uint32_t MachO::seg_align(uint64_t p_vmaddr, uint32_t p_min, uint32_t p_max) { uint32_t salign = p_max; if (p_vmaddr != 0) { diff --git a/editor/export/macho.h b/editor/export/macho.h index 82871bac6f..7662550f18 100644 --- a/editor/export/macho.h +++ b/editor/export/macho.h @@ -35,8 +35,6 @@ // Mach-O binary object file format parser and editor. -#include "core/crypto/crypto.h" -#include "core/crypto/crypto_core.h" #include "core/io/file_access.h" #include "core/object/ref_counted.h" diff --git a/editor/export/project_export.cpp b/editor/export/project_export.cpp index 686b3eac6d..2b1ae18a67 100644 --- a/editor/export/project_export.cpp +++ b/editor/export/project_export.cpp @@ -43,7 +43,6 @@ #include "editor/gui/editor_file_dialog.h" #include "editor/import/resource_importer_texture_settings.h" #include "editor/themes/editor_scale.h" -#include "scene/gui/check_box.h" #include "scene/gui/check_button.h" #include "scene/gui/item_list.h" #include "scene/gui/link_button.h" diff --git a/editor/file_info.h b/editor/file_info.h index 00e2f9c40a..070ce51d2b 100644 --- a/editor/file_info.h +++ b/editor/file_info.h @@ -33,7 +33,8 @@ #ifndef FILE_INFO_H #define FILE_INFO_H -#include "core/variant/variant.h" +#include "core/string/string_name.h" +#include "core/templates/list.h" enum class FileSortOption { FILE_SORT_NAME = 0, diff --git a/editor/gui/scene_tree_editor.cpp b/editor/gui/scene_tree_editor.cpp index b03640d63a..3271bdad91 100644 --- a/editor/gui/scene_tree_editor.cpp +++ b/editor/gui/scene_tree_editor.cpp @@ -45,6 +45,7 @@ #include "editor/plugins/canvas_item_editor_plugin.h" #include "editor/plugins/script_editor_plugin.h" #include "editor/themes/editor_scale.h" +#include "scene/2d/node_2d.h" #include "scene/gui/flow_container.h" #include "scene/gui/label.h" #include "scene/gui/texture_rect.h" diff --git a/editor/import/3d/collada.cpp b/editor/import/3d/collada.cpp index cd26855e3a..c5ebb9d012 100644 --- a/editor/import/3d/collada.cpp +++ b/editor/import/3d/collada.cpp @@ -32,7 +32,7 @@ #include "collada.h" -#include +#include "core/config/project_settings.h" //#define DEBUG_DEFAULT_ANIMATION //#define DEBUG_COLLADA diff --git a/editor/import/3d/collada.h b/editor/import/3d/collada.h index 32bc059817..577ffb1382 100644 --- a/editor/import/3d/collada.h +++ b/editor/import/3d/collada.h @@ -33,10 +33,7 @@ #ifndef COLLADA_H #define COLLADA_H -#include "core/config/project_settings.h" #include "core/io/xml_parser.h" -#include "core/templates/rb_map.h" -#include "scene/resources/material.h" class Collada { public: diff --git a/editor/import/3d/editor_import_collada.cpp b/editor/import/3d/editor_import_collada.cpp index 19ffed243c..bb0379febe 100644 --- a/editor/import/3d/editor_import_collada.cpp +++ b/editor/import/3d/editor_import_collada.cpp @@ -32,20 +32,17 @@ #include "editor_import_collada.h" -#include "core/os/os.h" -#include "editor/editor_node.h" +#include "core/config/project_settings.h" #include "editor/import/3d/collada.h" #include "scene/3d/camera_3d.h" #include "scene/3d/importer_mesh_instance_3d.h" #include "scene/3d/light_3d.h" -#include "scene/3d/mesh_instance_3d.h" #include "scene/3d/node_3d.h" #include "scene/3d/path_3d.h" #include "scene/3d/skeleton_3d.h" #include "scene/animation/animation_player.h" #include "scene/resources/3d/importer_mesh.h" #include "scene/resources/animation.h" -#include "scene/resources/packed_scene.h" #include "scene/resources/surface_tool.h" struct ColladaImport { diff --git a/editor/import/3d/post_import_plugin_skeleton_renamer.cpp b/editor/import/3d/post_import_plugin_skeleton_renamer.cpp index f25672faa0..2d19737e16 100644 --- a/editor/import/3d/post_import_plugin_skeleton_renamer.cpp +++ b/editor/import/3d/post_import_plugin_skeleton_renamer.cpp @@ -32,7 +32,6 @@ #include "post_import_plugin_skeleton_renamer.h" -#include "editor/import/3d/scene_import_settings.h" #include "scene/3d/bone_attachment_3d.h" #include "scene/3d/importer_mesh_instance_3d.h" #include "scene/3d/skeleton_3d.h" diff --git a/editor/import/3d/post_import_plugin_skeleton_rest_fixer.cpp b/editor/import/3d/post_import_plugin_skeleton_rest_fixer.cpp index b574d0f08c..a8605bcabe 100644 --- a/editor/import/3d/post_import_plugin_skeleton_rest_fixer.cpp +++ b/editor/import/3d/post_import_plugin_skeleton_rest_fixer.cpp @@ -32,7 +32,6 @@ #include "post_import_plugin_skeleton_rest_fixer.h" -#include "editor/import/3d/scene_import_settings.h" #include "scene/3d/bone_attachment_3d.h" #include "scene/3d/importer_mesh_instance_3d.h" #include "scene/3d/retarget_modifier_3d.h" diff --git a/editor/import/3d/post_import_plugin_skeleton_track_organizer.cpp b/editor/import/3d/post_import_plugin_skeleton_track_organizer.cpp index 7063bd8189..8cef10724e 100644 --- a/editor/import/3d/post_import_plugin_skeleton_track_organizer.cpp +++ b/editor/import/3d/post_import_plugin_skeleton_track_organizer.cpp @@ -32,7 +32,6 @@ #include "post_import_plugin_skeleton_track_organizer.h" -#include "editor/import/3d/scene_import_settings.h" #include "scene/3d/skeleton_3d.h" #include "scene/animation/animation_player.h" #include "scene/resources/bone_map.h" diff --git a/editor/import/3d/resource_importer_obj.cpp b/editor/import/3d/resource_importer_obj.cpp index 08aea54dba..2845fed12c 100644 --- a/editor/import/3d/resource_importer_obj.cpp +++ b/editor/import/3d/resource_importer_obj.cpp @@ -35,7 +35,6 @@ #include "core/io/file_access.h" #include "core/io/resource_saver.h" #include "scene/3d/importer_mesh_instance_3d.h" -#include "scene/3d/mesh_instance_3d.h" #include "scene/3d/node_3d.h" #include "scene/resources/3d/importer_mesh.h" #include "scene/resources/mesh.h" diff --git a/editor/import/3d/resource_importer_scene.cpp b/editor/import/3d/resource_importer_scene.cpp index 3477b696aa..9548f55aab 100644 --- a/editor/import/3d/resource_importer_scene.cpp +++ b/editor/import/3d/resource_importer_scene.cpp @@ -46,7 +46,6 @@ #include "scene/3d/occluder_instance_3d.h" #include "scene/3d/physics/area_3d.h" #include "scene/3d/physics/collision_shape_3d.h" -#include "scene/3d/physics/physics_body_3d.h" #include "scene/3d/physics/static_body_3d.h" #include "scene/3d/physics/vehicle_body_3d.h" #include "scene/animation/animation_player.h" @@ -59,7 +58,6 @@ #include "scene/resources/bone_map.h" #include "scene/resources/packed_scene.h" #include "scene/resources/resource_format_text.h" -#include "scene/resources/surface_tool.h" uint32_t EditorSceneFormatImporter::get_import_flags() const { uint32_t ret; diff --git a/editor/import/3d/resource_importer_scene.h b/editor/import/3d/resource_importer_scene.h index 42795a29f1..9f4d394ae6 100644 --- a/editor/import/3d/resource_importer_scene.h +++ b/editor/import/3d/resource_importer_scene.h @@ -41,7 +41,6 @@ #include "scene/resources/3d/capsule_shape_3d.h" #include "scene/resources/3d/cylinder_shape_3d.h" #include "scene/resources/3d/importer_mesh.h" -#include "scene/resources/3d/skin.h" #include "scene/resources/3d/sphere_shape_3d.h" #include "scene/resources/animation.h" #include "scene/resources/mesh.h" diff --git a/editor/import/3d/scene_import_settings.cpp b/editor/import/3d/scene_import_settings.cpp index 7c5073df7c..484b9c3900 100644 --- a/editor/import/3d/scene_import_settings.cpp +++ b/editor/import/3d/scene_import_settings.cpp @@ -43,6 +43,7 @@ #include "editor/themes/editor_scale.h" #include "scene/3d/importer_mesh_instance_3d.h" #include "scene/animation/animation_player.h" +#include "scene/gui/subviewport_container.h" #include "scene/resources/3d/importer_mesh.h" #include "scene/resources/surface_tool.h" diff --git a/editor/import/3d/scene_import_settings.h b/editor/import/3d/scene_import_settings.h index 51fb34d89d..33f65e88d3 100644 --- a/editor/import/3d/scene_import_settings.h +++ b/editor/import/3d/scene_import_settings.h @@ -39,13 +39,11 @@ #include "scene/3d/mesh_instance_3d.h" #include "scene/3d/skeleton_3d.h" #include "scene/gui/dialogs.h" -#include "scene/gui/item_list.h" #include "scene/gui/menu_button.h" #include "scene/gui/option_button.h" #include "scene/gui/panel_container.h" #include "scene/gui/slider.h" #include "scene/gui/split_container.h" -#include "scene/gui/subviewport_container.h" #include "scene/gui/tab_container.h" #include "scene/gui/tree.h" #include "scene/resources/3d/primitive_meshes.h" diff --git a/editor/import/dynamic_font_import_settings.cpp b/editor/import/dynamic_font_import_settings.cpp index 02d5fc57af..a91c231d93 100644 --- a/editor/import/dynamic_font_import_settings.cpp +++ b/editor/import/dynamic_font_import_settings.cpp @@ -33,16 +33,15 @@ #include "dynamic_font_import_settings.h" #include "core/config/project_settings.h" -#include "core/string/translation_server.h" +#include "core/string/translation.h" #include "editor/editor_file_system.h" #include "editor/editor_inspector.h" #include "editor/editor_locale_dialog.h" #include "editor/editor_node.h" -#include "editor/editor_property_name_processor.h" -#include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/gui/editor_file_dialog.h" #include "editor/themes/editor_scale.h" +#include "scene/gui/split_container.h" /*************************************************************************/ /* Settings data */ diff --git a/editor/import/dynamic_font_import_settings.h b/editor/import/dynamic_font_import_settings.h index 4d06406db1..f38359c502 100644 --- a/editor/import/dynamic_font_import_settings.h +++ b/editor/import/dynamic_font_import_settings.h @@ -33,19 +33,13 @@ #ifndef DYNAMIC_FONT_IMPORT_SETTINGS_H #define DYNAMIC_FONT_IMPORT_SETTINGS_H -#include "editor/import/resource_importer_dynamic_font.h" +#include "core/io/resource_importer.h" -#include "core/templates/rb_set.h" #include "scene/gui/dialogs.h" -#include "scene/gui/item_list.h" -#include "scene/gui/option_button.h" -#include "scene/gui/split_container.h" -#include "scene/gui/subviewport_container.h" #include "scene/gui/tab_container.h" #include "scene/gui/text_edit.h" #include "scene/gui/tree.h" #include "scene/resources/font.h" -#include "servers/text_server.h" class DynamicFontImportSettingsDialog; diff --git a/editor/import/resource_importer_image.cpp b/editor/import/resource_importer_image.cpp index 7ae9cab32e..0a5d8a65ec 100644 --- a/editor/import/resource_importer_image.cpp +++ b/editor/import/resource_importer_image.cpp @@ -34,8 +34,6 @@ #include "core/io/file_access.h" #include "core/io/image_loader.h" -#include "core/io/resource_saver.h" -#include "scene/resources/texture.h" String ResourceImporterImage::get_importer_name() const { return "image"; diff --git a/editor/import/resource_importer_layered_texture.cpp b/editor/import/resource_importer_layered_texture.cpp index 336e569515..cc0d66b2c8 100644 --- a/editor/import/resource_importer_layered_texture.cpp +++ b/editor/import/resource_importer_layered_texture.cpp @@ -34,15 +34,12 @@ #include "core/config/project_settings.h" #include "core/error/error_macros.h" -#include "core/io/config_file.h" #include "core/io/image_loader.h" #include "core/object/ref_counted.h" #include "editor/editor_file_system.h" -#include "editor/editor_node.h" #include "editor/import/resource_importer_texture.h" #include "editor/import/resource_importer_texture_settings.h" #include "scene/resources/compressed_texture.h" -#include "scene/resources/texture.h" String ResourceImporterLayeredTexture::get_importer_name() const { switch (mode) { diff --git a/editor/import/resource_importer_shader_file.cpp b/editor/import/resource_importer_shader_file.cpp index fc8446d667..a2d30f8870 100644 --- a/editor/import/resource_importer_shader_file.cpp +++ b/editor/import/resource_importer_shader_file.cpp @@ -33,7 +33,6 @@ #include "resource_importer_shader_file.h" #include "core/io/file_access.h" -#include "core/io/marshalls.h" #include "core/io/resource_saver.h" #include "editor/editor_node.h" #include "editor/plugins/shader_file_editor_plugin.h" diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp index 90586daf5c..e09bca02b0 100644 --- a/editor/import/resource_importer_texture.cpp +++ b/editor/import/resource_importer_texture.cpp @@ -37,7 +37,6 @@ #include "core/io/image_loader.h" #include "core/version.h" #include "editor/editor_file_system.h" -#include "editor/editor_node.h" #include "editor/gui/editor_toaster.h" #include "editor/import/resource_importer_texture_settings.h" #include "editor/themes/editor_scale.h" diff --git a/editor/import/resource_importer_texture.h b/editor/import/resource_importer_texture.h index 9804a6dff1..cdcb59c596 100644 --- a/editor/import/resource_importer_texture.h +++ b/editor/import/resource_importer_texture.h @@ -36,7 +36,6 @@ #include "core/io/file_access.h" #include "core/io/image.h" #include "core/io/resource_importer.h" -#include "scene/resources/texture.h" #include "servers/rendering_server.h" class CompressedTexture2D; diff --git a/editor/import/resource_importer_texture_atlas.cpp b/editor/import/resource_importer_texture_atlas.cpp index 623904740c..99f252b630 100644 --- a/editor/import/resource_importer_texture_atlas.cpp +++ b/editor/import/resource_importer_texture_atlas.cpp @@ -34,12 +34,12 @@ #include "atlas_import_failed.xpm" #include "core/config/project_settings.h" -#include "core/io/file_access.h" #include "core/io/image_loader.h" #include "core/io/resource_saver.h" #include "core/math/geometry_2d.h" #include "editor/editor_atlas_packer.h" #include "scene/resources/atlas_texture.h" +#include "scene/resources/bit_map.h" #include "scene/resources/image_texture.h" #include "scene/resources/mesh.h" #include "scene/resources/mesh_texture.h" diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp index c304b32148..9725461f0d 100644 --- a/editor/import/resource_importer_wav.cpp +++ b/editor/import/resource_importer_wav.cpp @@ -32,8 +32,6 @@ #include "resource_importer_wav.h" -#include "core/io/file_access.h" -#include "core/io/marshalls.h" #include "core/io/resource_saver.h" String ResourceImporterWAV::get_importer_name() const { diff --git a/editor/localization_editor.cpp b/editor/localization_editor.cpp index 2c626e137b..ada53639bf 100644 --- a/editor/localization_editor.cpp +++ b/editor/localization_editor.cpp @@ -40,6 +40,7 @@ #include "editor/gui/editor_file_dialog.h" #include "editor/pot_generator.h" #include "scene/gui/control.h" +#include "scene/gui/tab_container.h" void LocalizationEditor::_notification(int p_what) { switch (p_what) { diff --git a/editor/multi_node_edit.h b/editor/multi_node_edit.h index 6b20e44728..37d5b696d5 100644 --- a/editor/multi_node_edit.h +++ b/editor/multi_node_edit.h @@ -33,7 +33,7 @@ #ifndef MULTI_NODE_EDIT_H #define MULTI_NODE_EDIT_H -#include "scene/main/node.h" +#include "core/object/ref_counted.h" class MultiNodeEdit : public RefCounted { GDCLASS(MultiNodeEdit, RefCounted); diff --git a/editor/node_dock.cpp b/editor/node_dock.cpp index 001640db37..1106d2778c 100644 --- a/editor/node_dock.cpp +++ b/editor/node_dock.cpp @@ -33,7 +33,6 @@ #include "node_dock.h" #include "editor/connections_dialog.h" -#include "editor/editor_node.h" #include "editor/themes/editor_scale.h" void NodeDock::show_groups() { diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp index 00d6e93d33..95cf6d0dfb 100644 --- a/editor/plugins/abstract_polygon_2d_editor.cpp +++ b/editor/plugins/abstract_polygon_2d_editor.cpp @@ -42,7 +42,6 @@ #include "editor/themes/editor_scale.h" #include "scene/gui/button.h" #include "scene/gui/dialogs.h" -#include "scene/gui/separator.h" bool AbstractPolygon2DEditor::Vertex::operator==(const AbstractPolygon2DEditor::Vertex &p_vertex) const { return polygon == p_vertex.polygon && vertex == p_vertex.vertex; diff --git a/editor/plugins/abstract_polygon_2d_editor.h b/editor/plugins/abstract_polygon_2d_editor.h index adca1dd951..d72f7ff353 100644 --- a/editor/plugins/abstract_polygon_2d_editor.h +++ b/editor/plugins/abstract_polygon_2d_editor.h @@ -34,7 +34,7 @@ #define ABSTRACT_POLYGON_2D_EDITOR_H #include "editor/plugins/editor_plugin.h" -#include "scene/2d/polygon_2d.h" +#include "scene/2d/node_2d.h" #include "scene/gui/box_container.h" class Button; diff --git a/editor/plugins/animation_blend_space_1d_editor.h b/editor/plugins/animation_blend_space_1d_editor.h index 6387f5ff03..fcf4fb160f 100644 --- a/editor/plugins/animation_blend_space_1d_editor.h +++ b/editor/plugins/animation_blend_space_1d_editor.h @@ -37,7 +37,6 @@ #include "editor/plugins/editor_plugin.h" #include "scene/animation/animation_blend_space_1d.h" #include "scene/gui/graph_edit.h" -#include "scene/gui/popup.h" class Button; class CheckBox; diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index cce7ea2fdc..f799f5a6f4 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -32,8 +32,6 @@ #include "animation_blend_space_2d_editor.h" -#include "core/config/project_settings.h" -#include "core/input/input.h" #include "core/io/resource_loader.h" #include "core/math/geometry_2d.h" #include "core/os/keyboard.h" diff --git a/editor/plugins/animation_blend_space_2d_editor.h b/editor/plugins/animation_blend_space_2d_editor.h index ad501ff53d..7210aefffc 100644 --- a/editor/plugins/animation_blend_space_2d_editor.h +++ b/editor/plugins/animation_blend_space_2d_editor.h @@ -37,7 +37,6 @@ #include "editor/plugins/editor_plugin.h" #include "scene/animation/animation_blend_space_2d.h" #include "scene/gui/graph_edit.h" -#include "scene/gui/popup.h" class Button; class CheckBox; diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index cb29ea9a1d..f86e6d3661 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -33,9 +33,7 @@ #include "animation_blend_tree_editor_plugin.h" #include "core/config/project_settings.h" -#include "core/input/input.h" #include "core/io/resource_loader.h" -#include "core/os/keyboard.h" #include "editor/editor_inspector.h" #include "editor/editor_node.h" #include "editor/editor_properties.h" @@ -45,17 +43,14 @@ #include "editor/gui/editor_file_dialog.h" #include "editor/themes/editor_scale.h" #include "scene/3d/skeleton_3d.h" -#include "scene/animation/animation_player.h" #include "scene/gui/check_box.h" #include "scene/gui/grid_container.h" #include "scene/gui/menu_button.h" #include "scene/gui/option_button.h" -#include "scene/gui/panel.h" #include "scene/gui/progress_bar.h" #include "scene/gui/separator.h" #include "scene/gui/view_panner.h" #include "scene/main/window.h" -#include "scene/resources/style_box_flat.h" void AnimationNodeBlendTreeEditor::add_custom_type(const String &p_name, const Ref