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
No known key found for this signature in database
GPG key ID: DEFC5A5B1306947D
177 changed files with 517 additions and 519 deletions

View file

@ -555,7 +555,7 @@ void SceneDebuggerObject::serialize(Array &r_arr, int p_max_size) {
PropertyHint hint = pi.hint;
String hint_string = pi.hint_string;
if (!res.is_null() && !res->get_path().is_empty()) {
if (res.is_valid() && !res->get_path().is_empty()) {
var = res->get_path();
} else { //only send information that can be sent..
int len = 0; //test how big is this to encode
@ -793,7 +793,7 @@ void LiveEditor::_node_set_func(int p_id, const StringName &p_prop, const Varian
void LiveEditor::_node_set_res_func(int p_id, const StringName &p_prop, const String &p_value) {
Ref<Resource> r = ResourceLoader::load(p_value);
if (!r.is_valid()) {
if (r.is_null()) {
return;
}
_node_set_func(p_id, p_prop, r);
@ -875,7 +875,7 @@ void LiveEditor::_res_set_func(int p_id, const StringName &p_prop, const Variant
}
Ref<Resource> r = ResourceCache::get_ref(resp);
if (!r.is_valid()) {
if (r.is_null()) {
return;
}
@ -884,7 +884,7 @@ void LiveEditor::_res_set_func(int p_id, const StringName &p_prop, const Variant
void LiveEditor::_res_set_res_func(int p_id, const StringName &p_prop, const String &p_value) {
Ref<Resource> r = ResourceLoader::load(p_value);
if (!r.is_valid()) {
if (r.is_null()) {
return;
}
_res_set_func(p_id, p_prop, r);
@ -902,7 +902,7 @@ void LiveEditor::_res_call_func(int p_id, const StringName &p_method, const Vari
}
Ref<Resource> r = ResourceCache::get_ref(resp);
if (!r.is_valid()) {
if (r.is_null()) {
return;
}
@ -961,7 +961,7 @@ void LiveEditor::_instance_node_func(const NodePath &p_parent, const String &p_p
Ref<PackedScene> ps = ResourceLoader::load(p_path);
if (!ps.is_valid()) {
if (ps.is_null()) {
return;
}
@ -1375,7 +1375,7 @@ void RuntimeNodeSelect::_root_window_input(const Ref<InputEvent> &p_event) {
}
Ref<InputEventMouseButton> b = p_event;
if (!b.is_valid() || !b->is_pressed()) {
if (b.is_null() || !b->is_pressed()) {
return;
}