1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +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

@@ -48,7 +48,7 @@
TileSetEditor *TileSetEditor::singleton = nullptr;
void TileSetEditor::_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) {
ERR_FAIL_COND(!tile_set.is_valid());
ERR_FAIL_COND(tile_set.is_null());
if (!_can_drop_data_fw(p_point, p_data, p_from)) {
return;
@@ -63,7 +63,7 @@ void TileSetEditor::_drop_data_fw(const Point2 &p_point, const Variant &p_data,
}
bool TileSetEditor::_can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const {
ERR_FAIL_COND_V(!tile_set.is_valid(), false);
ERR_FAIL_COND_V(tile_set.is_null(), false);
if (read_only) {
return false;
@@ -202,7 +202,7 @@ void TileSetEditor::_update_sources_list(int force_selected_id) {
if (item_text.is_empty()) {
item_text = vformat(TTR("Unknown Type Source (ID: %d)"), source_id);
}
if (!texture.is_valid()) {
if (texture.is_null()) {
texture = missing_texture_texture;
}
@@ -240,7 +240,7 @@ void TileSetEditor::_update_sources_list(int force_selected_id) {
}
void TileSetEditor::_source_selected(int p_source_index) {
ERR_FAIL_COND(!tile_set.is_valid());
ERR_FAIL_COND(tile_set.is_null());
// Update the selected source.
sources_delete_button->set_disabled(p_source_index < 0 || read_only);
@@ -272,7 +272,7 @@ void TileSetEditor::_source_selected(int p_source_index) {
}
void TileSetEditor::_source_delete_pressed() {
ERR_FAIL_COND(!tile_set.is_valid());
ERR_FAIL_COND(tile_set.is_null());
// Update the selected source.
int to_delete = sources_list->get_item_metadata(sources_list->get_current());
@@ -290,7 +290,7 @@ void TileSetEditor::_source_delete_pressed() {
}
void TileSetEditor::_source_add_id_pressed(int p_id_pressed) {
ERR_FAIL_COND(!tile_set.is_valid());
ERR_FAIL_COND(tile_set.is_null());
switch (p_id_pressed) {
case 0: {
@@ -328,7 +328,7 @@ void TileSetEditor::_source_add_id_pressed(int p_id_pressed) {
}
void TileSetEditor::_sources_advanced_menu_id_pressed(int p_id_pressed) {
ERR_FAIL_COND(!tile_set.is_valid());
ERR_FAIL_COND(tile_set.is_null());
switch (p_id_pressed) {
case 0: {
@@ -405,7 +405,7 @@ void TileSetEditor::_notification(int p_what) {
}
void TileSetEditor::_patterns_item_list_gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(!tile_set.is_valid());
ERR_FAIL_COND(tile_set.is_null());
if (EditorNode::get_singleton()->is_resource_read_only(tile_set)) {
return;
@@ -436,7 +436,7 @@ void TileSetEditor::_pattern_preview_done(Ref<TileMapPattern> p_pattern, Ref<Tex
}
void TileSetEditor::_update_patterns_list() {
ERR_FAIL_COND(!tile_set.is_valid());
ERR_FAIL_COND(tile_set.is_null());
// Recreate the items.
patterns_item_list->clear();