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

@@ -97,7 +97,7 @@ void AnimationPlayerEditor::_notification(int p_what) {
if (player->has_animation(animname)) {
Ref<Animation> anim = player->get_animation(animname);
if (!anim.is_null()) {
if (anim.is_valid()) {
frame->set_max((double)anim->get_length());
}
}
@@ -1314,7 +1314,7 @@ void AnimationPlayerEditor::_animation_duplicate() {
String current = animation->get_item_text(animation->get_selected());
Ref<Animation> anim = player->get_animation(current);
if (!anim.is_valid()) {
if (anim.is_null()) {
return;
}
@@ -1713,7 +1713,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_1() {
void AnimationPlayerEditor::_prepare_onion_layers_2_prolog() {
Ref<Animation> anim = player->get_animation(player->get_assigned_animation());
if (!anim.is_valid()) {
if (anim.is_null()) {
return;
}
@@ -1931,7 +1931,7 @@ Node *AnimationPlayerEditor::get_cached_root_node() const {
bool AnimationPlayerEditor::_validate_tracks(const Ref<Animation> p_anim) {
bool is_valid = true;
if (!p_anim.is_valid()) {
if (p_anim.is_null()) {
return true; // There is a problem outside of the animation track.
}
int len = p_anim->get_track_count();