1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-09 12:50:35 +00:00

Improve use of Ref.is_null/valid

Use `is_null` over `!is_valid` and vice versa.
This commit is contained in:
A Thousand Ships
2024-08-25 14:15:10 +02:00
committed by AThousandShips
parent 0f95e9f8e6
commit a1846b27ea
177 changed files with 517 additions and 519 deletions

View File

@@ -1633,7 +1633,7 @@ Ref<MultiplayerAPI> SceneTree::get_multiplayer(const NodePath &p_for_path) const
void SceneTree::set_multiplayer(Ref<MultiplayerAPI> p_multiplayer, const NodePath &p_root_path) {
ERR_FAIL_COND_MSG(!Thread::is_main_thread(), "Multiplayer can only be manipulated from the main thread.");
if (p_root_path.is_empty()) {
ERR_FAIL_COND(!p_multiplayer.is_valid());
ERR_FAIL_COND(p_multiplayer.is_null());
if (multiplayer.is_valid()) {
multiplayer->object_configuration_remove(nullptr, NodePath("/" + root->get_name()));
}
@@ -1849,7 +1849,7 @@ SceneTree::SceneTree() {
}
#ifndef _3D_DISABLED
if (!root->get_world_3d().is_valid()) {
if (root->get_world_3d().is_null()) {
root->set_world_3d(Ref<World3D>(memnew(World3D)));
}
root->set_as_audio_listener_3d(true);