You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Improve use of Ref.is_null/valid
Use `is_null` over `!is_valid` and vice versa.
This commit is contained in:
committed by
AThousandShips
parent
0f95e9f8e6
commit
a1846b27ea
@@ -93,7 +93,7 @@ String AnimationNodeStateMachineEditor::_get_root_playback_path(String &r_node_d
|
||||
while (!is_playable_anodesm_found) {
|
||||
base_path = String("/").join(edited_path);
|
||||
Ref<AnimationNodeStateMachine> anodesm = !edited_path.size() ? Ref<AnimationNode>(tree->get_root_animation_node().ptr()) : tree->get_root_animation_node()->find_node_by_path(base_path);
|
||||
if (!anodesm.is_valid()) {
|
||||
if (anodesm.is_null()) {
|
||||
break;
|
||||
} else {
|
||||
if (anodesm->get_state_machine_type() != AnimationNodeStateMachine::STATE_MACHINE_TYPE_GROUPED) {
|
||||
@@ -133,7 +133,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
|
||||
|
||||
String node_directory;
|
||||
Ref<AnimationNodeStateMachinePlayback> playback = tree->get(_get_root_playback_path(node_directory));
|
||||
if (!playback.is_valid()) {
|
||||
if (playback.is_null()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -344,7 +344,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
|
||||
Ref<AnimationNodeStateMachine> anodesm = node;
|
||||
Ref<AnimationNodeEndState> end_node = node;
|
||||
|
||||
if (state_machine->has_transition(connecting_from, connecting_to_node) && state_machine->can_edit_node(connecting_to_node) && !anodesm.is_valid()) {
|
||||
if (state_machine->has_transition(connecting_from, connecting_to_node) && state_machine->can_edit_node(connecting_to_node) && anodesm.is_null()) {
|
||||
EditorNode::get_singleton()->show_warning(TTR("Transition exists!"));
|
||||
connecting = false;
|
||||
} else {
|
||||
@@ -798,7 +798,7 @@ void AnimationNodeStateMachineEditor::_add_menu_type(int p_index) {
|
||||
base_name = type.replace_first("AnimationNode", "");
|
||||
}
|
||||
|
||||
if (!node.is_valid()) {
|
||||
if (node.is_null()) {
|
||||
EditorNode::get_singleton()->show_warning(TTR("This type of node can't be used. Only root nodes are allowed."));
|
||||
return;
|
||||
}
|
||||
@@ -1332,7 +1332,7 @@ void AnimationNodeStateMachineEditor::_state_machine_pos_draw_individual(const S
|
||||
}
|
||||
|
||||
Ref<AnimationNodeStateMachinePlayback> playback = tree->get(AnimationTreeEditor::get_singleton()->get_base_path() + "playback");
|
||||
if (!playback.is_valid() || !playback->is_playing()) {
|
||||
if (playback.is_null() || !playback->is_playing()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1381,7 +1381,7 @@ void AnimationNodeStateMachineEditor::_state_machine_pos_draw_all() {
|
||||
}
|
||||
|
||||
Ref<AnimationNodeStateMachinePlayback> playback = tree->get(AnimationTreeEditor::get_singleton()->get_base_path() + "playback");
|
||||
if (!playback.is_valid() || !playback->is_playing()) {
|
||||
if (playback.is_null() || !playback->is_playing()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user