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

@@ -105,7 +105,7 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i
}
} else if (p_id == BUTTON_SCRIPT) {
Ref<Script> script_typed = n->get_script();
if (!script_typed.is_null()) {
if (script_typed.is_valid()) {
emit_signal(SNAME("open_script"), script_typed);
}
@@ -565,7 +565,7 @@ void SceneTreeEditor::_update_node(Node *p_node, TreeItem *p_item, bool p_part_o
// Show buttons only when necessary (SceneTreeDock) to avoid crashes.
if (can_open_instance && is_scene_tree_dock) {
Ref<Script> scr = p_node->get_script();
if (!scr.is_null()) {
if (scr.is_valid()) {
String additional_notes;
Color button_color = Color(1, 1, 1);
// Can't set tooltip after adding button, need to do it before.