Skip to content

Commit 106ba51

Browse files
authored
Merge pull request #910 from Spartan322/merge/75ce426
Merge commit godotengine/godot@75ce426
2 parents 20b6554 + 1609981 commit 106ba51

File tree

595 files changed

+2436
-1943
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

595 files changed

+2436
-1943
lines changed

.pre-commit-config.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,15 @@ repos:
5050
stages: [manual] # Not automatically triggered, invoked via `pre-commit run --hook-stage manual clang-tidy`
5151

5252
- repo: https://github.com/astral-sh/ruff-pre-commit
53-
rev: v0.7.3
53+
rev: v0.8.4
5454
hooks:
5555
- id: ruff
5656
args: [--fix]
57+
files: (\.py|SConstruct|SCsub)$
58+
types_or: [text]
5759
- id: ruff-format
60+
files: (\.py|SConstruct|SCsub)$
61+
types_or: [text]
5862

5963
- repo: https://github.com/pre-commit/mirrors-mypy
6064
rev: v1.13.0
@@ -204,7 +208,7 @@ repos:
204208
language: python
205209
entry: python misc/scripts/header_guards.py
206210
files: \.(h|hpp|hh|hxx)$
207-
exclude: ^.*/(thread|platform_config|platform_gl)\.h$
211+
exclude: ^.*/(dummy|thread|platform_config|platform_gl)\.h$
208212

209213
- id: file-format
210214
name: file-format

core/input/input_map.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ List<StringName> InputMap::get_actions() const {
160160
}
161161

162162
List<Ref<InputEvent>>::Element *InputMap::_find_event(Action &p_action, const Ref<InputEvent> &p_event, bool p_exact_match, bool *r_pressed, float *r_strength, float *r_raw_strength, int *r_event_index) const {
163-
ERR_FAIL_COND_V(!p_event.is_valid(), nullptr);
163+
ERR_FAIL_COND_V(p_event.is_null(), nullptr);
164164

165165
int i = 0;
166166
for (List<Ref<InputEvent>>::Element *E = p_action.inputs.front(); E; E = E->next()) {

core/io/image.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3994,7 +3994,7 @@ Error Image::load_svg_from_buffer(const Vector<uint8_t> &p_array, float scale) {
39943994
ERR_FAIL_COND_V(buffer_size == 0, ERR_INVALID_PARAMETER);
39953995

39963996
Ref<Image> image = _svg_scalable_mem_loader_func(p_array.ptr(), buffer_size, scale);
3997-
ERR_FAIL_COND_V(!image.is_valid(), ERR_PARSE_ERROR);
3997+
ERR_FAIL_COND_V(image.is_null(), ERR_PARSE_ERROR);
39983998

39993999
copy_internals_from(image);
40004000

@@ -4061,7 +4061,7 @@ Error Image::_load_from_buffer(const Vector<uint8_t> &p_array, ImageMemLoadFunc
40614061
const uint8_t *r = p_array.ptr();
40624062

40634063
Ref<Image> image = p_loader(r, buffer_size);
4064-
ERR_FAIL_COND_V(!image.is_valid(), ERR_PARSE_ERROR);
4064+
ERR_FAIL_COND_V(image.is_null(), ERR_PARSE_ERROR);
40654065

40664066
copy_internals_from(image);
40674067

core/io/packet_peer_udp.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void PacketPeerUDP::set_broadcast_enabled(bool p_enabled) {
4949

5050
Error PacketPeerUDP::join_multicast_group(IPAddress p_multi_address, const String &p_if_name) {
5151
ERR_FAIL_COND_V(udp_server, ERR_LOCKED);
52-
ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE);
52+
ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE);
5353
ERR_FAIL_COND_V(!p_multi_address.is_valid(), ERR_INVALID_PARAMETER);
5454

5555
if (!_sock->is_open()) {
@@ -64,7 +64,7 @@ Error PacketPeerUDP::join_multicast_group(IPAddress p_multi_address, const Strin
6464

6565
Error PacketPeerUDP::leave_multicast_group(IPAddress p_multi_address, const String &p_if_name) {
6666
ERR_FAIL_COND_V(udp_server, ERR_LOCKED);
67-
ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE);
67+
ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE);
6868
ERR_FAIL_COND_V(!_sock->is_open(), ERR_UNCONFIGURED);
6969
return _sock->leave_multicast_group(p_multi_address, p_if_name);
7070
}
@@ -139,7 +139,7 @@ Error PacketPeerUDP::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
139139
}
140140

141141
Error PacketPeerUDP::put_packet(const uint8_t *p_buffer, int p_buffer_size) {
142-
ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE);
142+
ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE);
143143
ERR_FAIL_COND_V(!peer_addr.is_valid(), ERR_UNCONFIGURED);
144144

145145
Error err;
@@ -180,7 +180,7 @@ int PacketPeerUDP::get_max_packet_size() const {
180180
}
181181

182182
Error PacketPeerUDP::bind(int p_port, const IPAddress &p_bind_address, int p_recv_buffer_size) {
183-
ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE);
183+
ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE);
184184
ERR_FAIL_COND_V(_sock->is_open(), ERR_ALREADY_IN_USE);
185185
ERR_FAIL_COND_V(!p_bind_address.is_valid() && !p_bind_address.is_wildcard(), ERR_INVALID_PARAMETER);
186186
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() {
229229

230230
Error PacketPeerUDP::connect_to_host(const IPAddress &p_host, int p_port) {
231231
ERR_FAIL_COND_V(udp_server, ERR_LOCKED);
232-
ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE);
232+
ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE);
233233
ERR_FAIL_COND_V(!p_host.is_valid(), ERR_INVALID_PARAMETER);
234234
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).");
235235

@@ -280,12 +280,12 @@ void PacketPeerUDP::close() {
280280
}
281281

282282
Error PacketPeerUDP::wait() {
283-
ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE);
283+
ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE);
284284
return _sock->poll(NetSocket::POLL_TYPE_IN, -1);
285285
}
286286

287287
Error PacketPeerUDP::_poll() {
288-
ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE);
288+
ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE);
289289

290290
if (!_sock->is_open()) {
291291
return FAILED;

core/io/plist.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ bool PList::load_string(const String &p_string, String &r_err_out) {
713713
stack.push_back(dict);
714714
} else {
715715
// Add root node.
716-
if (!root.is_null()) {
716+
if (root.is_valid()) {
717717
r_err_out = "Root node already set.";
718718
return false;
719719
}
@@ -745,7 +745,7 @@ bool PList::load_string(const String &p_string, String &r_err_out) {
745745
stack.push_back(arr);
746746
} else {
747747
// Add root node.
748-
if (!root.is_null()) {
748+
if (root.is_valid()) {
749749
r_err_out = "Root node already set.";
750750
return false;
751751
}

core/io/remote_filesystem_client.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
Vector<RemoteFilesystemClient::FileCache> RemoteFilesystemClient::_load_cache_file() {
4848
Ref<FileAccess> fa = FileAccess::open(cache_path.path_join(FILES_CACHE_FILE), FileAccess::READ);
49-
if (!fa.is_valid()) {
49+
if (fa.is_null()) {
5050
return Vector<FileCache>(); // No cache, return empty
5151
}
5252

core/io/resource.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ void Resource::reload_from_file() {
233233

234234
Ref<Resource> s = ResourceLoader::load(ResourceLoader::path_remap(path), get_class(), ResourceFormatLoader::CACHE_MODE_IGNORE);
235235

236-
if (!s.is_valid()) {
236+
if (s.is_null()) {
237237
return;
238238
}
239239

@@ -653,7 +653,7 @@ Ref<Resource> ResourceCache::get_ref(const String &p_path) {
653653
ref = Ref<Resource>(*res);
654654
}
655655

656-
if (res && !ref.is_valid()) {
656+
if (res && ref.is_null()) {
657657
// This resource is in the process of being deleted, ignore its existence
658658
(*res)->path_cache = String();
659659
resources.erase(p_path);
@@ -672,7 +672,7 @@ void ResourceCache::get_cached_resources(List<Ref<Resource>> *p_resources) {
672672
for (KeyValue<String, Resource *> &E : resources) {
673673
Ref<Resource> ref = Ref<Resource>(E.value);
674674

675-
if (!ref.is_valid()) {
675+
if (ref.is_null()) {
676676
// This resource is in the process of being deleted, ignore its existence
677677
E.value->path_cache = String();
678678
to_remove.push_back(E.key);

core/io/resource_format_binary.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ Error ResourceLoaderBinary::load() {
699699

700700
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
701701
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);
702-
if (!external_resources[i].load_token.is_valid()) {
702+
if (external_resources[i].load_token.is_null()) {
703703
if (!ResourceLoader::get_abort_on_missing_resources()) {
704704
ResourceLoader::notify_dependency_error(local_path, path, external_resources[i].type);
705705
} else {
@@ -1389,7 +1389,7 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, cons
13891389

13901390
ERR_FAIL_COND_V(err != ERR_FILE_EOF, ERR_FILE_CORRUPT);
13911391
Ref<Resource> res = loader.get_resource();
1392-
ERR_FAIL_COND_V(!res.is_valid(), ERR_FILE_CORRUPT);
1392+
ERR_FAIL_COND_V(res.is_null(), ERR_FILE_CORRUPT);
13931393

13941394
return ResourceFormatSaverBinary::singleton->save(res, p_path);
13951395
}

core/io/resource_loader.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ Ref<Resource> ResourceLoader::load(const String &p_path, const String &p_type_hi
527527
thread_mode = LOAD_THREAD_SPAWN_SINGLE;
528528
}
529529
Ref<LoadToken> load_token = _load_start(p_path, p_type_hint, thread_mode, p_cache_mode);
530-
if (!load_token.is_valid()) {
530+
if (load_token.is_null()) {
531531
if (r_error) {
532532
*r_error = FAILED;
533533
}
@@ -947,7 +947,7 @@ Ref<Resource> ResourceLoader::ensure_resource_ref_override_for_outer_load(const
947947
Object *obj = ClassDB::instantiate(p_res_type);
948948
ERR_FAIL_NULL_V(obj, Ref<Resource>());
949949
Ref<Resource> res(obj);
950-
if (!res.is_valid()) {
950+
if (res.is_null()) {
951951
memdelete(obj);
952952
ERR_FAIL_V(Ref<Resource>());
953953
}

core/io/stream_peer_tcp.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void StreamPeerTCP::accept_socket(Ref<NetSocket> p_sock, IPAddress p_host, uint1
9191
}
9292

9393
Error StreamPeerTCP::bind(int p_port, const IPAddress &p_host) {
94-
ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE);
94+
ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE);
9595
ERR_FAIL_COND_V(_sock->is_open(), ERR_ALREADY_IN_USE);
9696
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).");
9797

@@ -108,7 +108,7 @@ Error StreamPeerTCP::bind(int p_port, const IPAddress &p_host) {
108108
}
109109

110110
Error StreamPeerTCP::connect_to_host(const IPAddress &p_host, int p_port) {
111-
ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE);
111+
ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE);
112112
ERR_FAIL_COND_V(status != STATUS_NONE, ERR_ALREADY_IN_USE);
113113
ERR_FAIL_COND_V(!p_host.is_valid(), ERR_INVALID_PARAMETER);
114114
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) {
142142
}
143143

144144
Error StreamPeerTCP::write(const uint8_t *p_data, int p_bytes, int &r_sent, bool p_block) {
145-
ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE);
145+
ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE);
146146

147147
if (status != STATUS_CONNECTED) {
148148
return FAILED;
@@ -240,7 +240,7 @@ Error StreamPeerTCP::read(uint8_t *p_buffer, int p_bytes, int &r_received, bool
240240
}
241241

242242
void StreamPeerTCP::set_no_delay(bool p_enabled) {
243-
ERR_FAIL_COND(!_sock.is_valid() || !_sock->is_open());
243+
ERR_FAIL_COND(_sock.is_null() || !_sock->is_open());
244244
_sock->set_tcp_no_delay_enabled(p_enabled);
245245
}
246246

@@ -283,7 +283,7 @@ Error StreamPeerTCP::get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_rec
283283
}
284284

285285
int StreamPeerTCP::get_available_bytes() const {
286-
ERR_FAIL_COND_V(!_sock.is_valid(), -1);
286+
ERR_FAIL_COND_V(_sock.is_null(), -1);
287287
return _sock->get_available_bytes();
288288
}
289289

core/io/tcp_server.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ void TCPServer::_bind_methods() {
4242
}
4343

4444
Error TCPServer::listen(uint16_t p_port, const IPAddress &p_bind_address) {
45-
ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE);
45+
ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE);
4646
ERR_FAIL_COND_V(_sock->is_open(), ERR_ALREADY_IN_USE);
4747
ERR_FAIL_COND_V(!p_bind_address.is_valid() && !p_bind_address.is_wildcard(), ERR_INVALID_PARAMETER);
4848

@@ -84,13 +84,13 @@ int TCPServer::get_local_port() const {
8484
}
8585

8686
bool TCPServer::is_listening() const {
87-
ERR_FAIL_COND_V(!_sock.is_valid(), false);
87+
ERR_FAIL_COND_V(_sock.is_null(), false);
8888

8989
return _sock->is_open();
9090
}
9191

9292
bool TCPServer::is_connection_available() const {
93-
ERR_FAIL_COND_V(!_sock.is_valid(), false);
93+
ERR_FAIL_COND_V(_sock.is_null(), false);
9494

9595
if (!_sock->is_open()) {
9696
return false;
@@ -110,7 +110,7 @@ Ref<StreamPeerTCP> TCPServer::take_connection() {
110110
IPAddress ip;
111111
uint16_t port = 0;
112112
ns = _sock->accept(ip, port);
113-
if (!ns.is_valid()) {
113+
if (ns.is_null()) {
114114
return conn;
115115
}
116116

core/io/udp_server.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void UDPServer::_bind_methods() {
4646
}
4747

4848
Error UDPServer::poll() {
49-
ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE);
49+
ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE);
5050
if (!_sock->is_open()) {
5151
return ERR_UNCONFIGURED;
5252
}
@@ -90,7 +90,7 @@ Error UDPServer::poll() {
9090
}
9191

9292
Error UDPServer::listen(uint16_t p_port, const IPAddress &p_bind_address) {
93-
ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE);
93+
ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE);
9494
ERR_FAIL_COND_V(_sock->is_open(), ERR_ALREADY_IN_USE);
9595
ERR_FAIL_COND_V(!p_bind_address.is_valid() && !p_bind_address.is_wildcard(), ERR_INVALID_PARAMETER);
9696

@@ -125,13 +125,13 @@ int UDPServer::get_local_port() const {
125125
}
126126

127127
bool UDPServer::is_listening() const {
128-
ERR_FAIL_COND_V(!_sock.is_valid(), false);
128+
ERR_FAIL_COND_V(_sock.is_null(), false);
129129

130130
return _sock->is_open();
131131
}
132132

133133
bool UDPServer::is_connection_available() const {
134-
ERR_FAIL_COND_V(!_sock.is_valid(), false);
134+
ERR_FAIL_COND_V(_sock.is_null(), false);
135135

136136
if (!_sock->is_open()) {
137137
return false;

core/object/object.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ void Object::set_script(const Variant &p_script) {
941941
script_instance = nullptr;
942942
}
943943

944-
if (!s.is_null()) {
944+
if (s.is_valid()) {
945945
if (s->can_instantiate()) {
946946
OBJ_DEBUG_LOCK
947947
script_instance = s->instance_create(this);
@@ -1580,7 +1580,7 @@ void Object::_clear_internal_resource_paths(const Variant &p_var) {
15801580
switch (p_var.get_type()) {
15811581
case Variant::OBJECT: {
15821582
Ref<Resource> r = p_var;
1583-
if (!r.is_valid()) {
1583+
if (r.is_null()) {
15841584
return;
15851585
}
15861586

core/os/keyboard.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ enum class Key {
251251

252252
enum class KeyModifierMask {
253253
CODE_MASK = ((1 << 23) - 1), ///< Apply this mask to any keycode to remove modifiers.
254-
MODIFIER_MASK = (0x7F << 22), ///< Apply this mask to isolate modifiers.
254+
MODIFIER_MASK = (0x7F << 24), ///< Apply this mask to isolate modifiers.
255255
//RESERVED = (1 << 23),
256256
CMD_OR_CTRL = (1 << 24),
257257
SHIFT = (1 << 25),

0 commit comments

Comments
 (0)