You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Replace String comparisons with "", String() to is_empty()
Also: - Adds two stress tests to test_string.h - Changes to .empty() on std::strings
This commit is contained in:
@@ -190,7 +190,7 @@ void AnimationPlayerEditor::_play_pressed() {
|
||||
current = animation->get_item_text(animation->get_selected());
|
||||
}
|
||||
|
||||
if (current != "") {
|
||||
if (!current.is_empty()) {
|
||||
if (current == player->get_assigned_animation()) {
|
||||
player->stop(); //so it won't blend with itself
|
||||
}
|
||||
@@ -207,7 +207,7 @@ void AnimationPlayerEditor::_play_from_pressed() {
|
||||
current = animation->get_item_text(animation->get_selected());
|
||||
}
|
||||
|
||||
if (current != "") {
|
||||
if (!current.is_empty()) {
|
||||
float time = player->get_current_animation_position();
|
||||
|
||||
if (current == player->get_assigned_animation() && player->is_playing()) {
|
||||
@@ -228,7 +228,7 @@ void AnimationPlayerEditor::_play_bw_pressed() {
|
||||
current = animation->get_item_text(animation->get_selected());
|
||||
}
|
||||
|
||||
if (current != "") {
|
||||
if (!current.is_empty()) {
|
||||
if (current == player->get_assigned_animation()) {
|
||||
player->stop(); //so it won't blend with itself
|
||||
}
|
||||
@@ -245,7 +245,7 @@ void AnimationPlayerEditor::_play_bw_from_pressed() {
|
||||
current = animation->get_item_text(animation->get_selected());
|
||||
}
|
||||
|
||||
if (current != "") {
|
||||
if (!current.is_empty()) {
|
||||
float time = player->get_current_animation_position();
|
||||
if (current == player->get_assigned_animation()) {
|
||||
player->stop(); //so it won't blend with itself
|
||||
@@ -280,7 +280,7 @@ void AnimationPlayerEditor::_animation_selected(int p_which) {
|
||||
current = animation->get_item_text(animation->get_selected());
|
||||
}
|
||||
|
||||
if (current != "") {
|
||||
if (!current.is_empty()) {
|
||||
player->set_assigned_animation(current);
|
||||
|
||||
Ref<Animation> anim = player->get_animation(current);
|
||||
@@ -397,7 +397,7 @@ void AnimationPlayerEditor::_animation_save_as(const Ref<Resource> &p_resource)
|
||||
|
||||
String path;
|
||||
//file->set_current_path(current_path);
|
||||
if (p_resource->get_path() != "") {
|
||||
if (!p_resource->get_path().is_empty()) {
|
||||
path = p_resource->get_path();
|
||||
if (extensions.size()) {
|
||||
if (extensions.find(p_resource->get_path().get_extension().to_lower()) == nullptr) {
|
||||
@@ -406,7 +406,7 @@ void AnimationPlayerEditor::_animation_save_as(const Ref<Resource> &p_resource)
|
||||
}
|
||||
} else {
|
||||
if (extensions.size()) {
|
||||
if (p_resource->get_name() != "") {
|
||||
if (!p_resource->get_name().is_empty()) {
|
||||
path = p_resource->get_name() + "." + extensions.front()->get().to_lower();
|
||||
} else {
|
||||
String resource_name_snake_case = p_resource->get_class().camelcase_to_underscore();
|
||||
@@ -486,7 +486,7 @@ void AnimationPlayerEditor::_animation_name_edited() {
|
||||
player->stop();
|
||||
|
||||
String new_name = name->get_text();
|
||||
if (new_name == "" || new_name.find(":") != -1 || new_name.find("/") != -1) {
|
||||
if (new_name.is_empty() || new_name.find(":") != -1 || new_name.find("/") != -1) {
|
||||
error_dialog->set_text(TTR("Invalid animation name!"));
|
||||
error_dialog->popup_centered();
|
||||
return;
|
||||
@@ -720,7 +720,7 @@ void AnimationPlayerEditor::_animation_edit() {
|
||||
|
||||
void AnimationPlayerEditor::_save_animation(String p_file) {
|
||||
String current = animation->get_item_text(animation->get_selected());
|
||||
if (current != "") {
|
||||
if (!current.is_empty()) {
|
||||
Ref<Animation> anim = player->get_animation(current);
|
||||
|
||||
ERR_FAIL_COND(!Object::cast_to<Resource>(*anim));
|
||||
@@ -1007,7 +1007,7 @@ void AnimationPlayerEditor::_seek_value_changed(float p_value, bool p_set, bool
|
||||
|
||||
updating = true;
|
||||
String current = player->get_assigned_animation();
|
||||
if (current == "" || !player->has_animation(current)) {
|
||||
if (current.is_empty() || !player->has_animation(current)) {
|
||||
updating = false;
|
||||
current = "";
|
||||
return;
|
||||
@@ -1086,7 +1086,7 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) {
|
||||
}
|
||||
|
||||
Ref<Animation> anim;
|
||||
if (current != String()) {
|
||||
if (!current.is_empty()) {
|
||||
anim = player->get_animation(current);
|
||||
}
|
||||
|
||||
@@ -1141,7 +1141,7 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) {
|
||||
}
|
||||
|
||||
String name = anim2->get_name();
|
||||
if (name == "") {
|
||||
if (name.is_empty()) {
|
||||
name = TTR("Pasted Animation");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user