diff options
Diffstat (limited to 'editor/scene_tree_dock.cpp')
-rw-r--r-- | editor/scene_tree_dock.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index b36275322a..1934850160 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -190,7 +190,7 @@ void SceneTreeDock::_perform_instantiate_scenes(const Vector<String> &p_files, N break; } - if (edited_scene->get_scene_file_path() != "") { + if (!edited_scene->get_scene_file_path().is_empty()) { if (_cyclical_dependency_exists(edited_scene->get_scene_file_path(), instantiated_scene)) { accept->set_text(vformat(TTR("Cannot instance the scene '%s' because the current scene exists within one of its nodes."), p_files[i])); accept->popup_centered(); @@ -467,7 +467,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { } bool has_cycle = false; - if (edited_scene->get_scene_file_path() != String()) { + if (!edited_scene->get_scene_file_path().is_empty()) { for (Node *E : node_clipboard) { if (edited_scene->get_scene_file_path() == E->get_scene_file_path()) { has_cycle = true; @@ -810,7 +810,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { return; } - if (node->get_scene_file_path() != String()) { + if (!node->get_scene_file_path().is_empty()) { accept->set_text(TTR("Instantiated scenes can't become root")); accept->popup_centered(); return; @@ -889,7 +889,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { Node *node = remove_list[0]; if (node == editor_data->get_edited_scene_root()) { msg = vformat(TTR("Delete the root node \"%s\"?"), node->get_name()); - } else if (node->get_scene_file_path() == "" && node->get_child_count() > 0) { + } else if (node->get_scene_file_path().is_empty() && node->get_child_count() > 0) { // Display this message only for non-instantiated scenes msg = vformat(TTR("Delete node \"%s\" and its children?"), node->get_name()); } else { @@ -936,7 +936,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { break; } - if (tocopy != editor_data->get_edited_scene_root() && tocopy->get_scene_file_path() != "") { + if (tocopy != editor_data->get_edited_scene_root() && !tocopy->get_scene_file_path().is_empty()) { accept->set_text(TTR("Can't save the branch of an already instantiated scene.\nTo create a variation of a scene, you can make an inherited scene based on the instantiated scene using Scene > New Inherited Scene... instead.")); accept->popup_centered(); break; @@ -1052,7 +1052,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { break; } - ERR_FAIL_COND(node->get_scene_file_path() == String()); + ERR_FAIL_COND(node->get_scene_file_path().is_empty()); undo_redo->create_action(TTR("Make Local")); undo_redo->add_do_method(node, "set_scene_file_path", ""); undo_redo->add_undo_method(node, "set_scene_file_path", node->get_scene_file_path()); @@ -1703,7 +1703,7 @@ bool SceneTreeDock::_validate_no_instance() { List<Node *> selection = editor_selection->get_selected_node_list(); for (Node *E : selection) { - if (E != edited_scene && E->get_scene_file_path() != "") { + if (E != edited_scene && !E->get_scene_file_path().is_empty()) { accept->set_text(TTR("This operation can't be done on instantiated scenes.")); accept->popup_centered(); return false; @@ -2761,7 +2761,7 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) { bool can_replace = true; for (Node *E : selection) { - if (E != edited_scene && (E->get_owner() != edited_scene || E->get_scene_file_path() != "")) { + if (E != edited_scene && (E->get_owner() != edited_scene || !E->get_scene_file_path().is_empty())) { can_replace = false; break; } @@ -2793,7 +2793,7 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) { menu->add_icon_shortcut(get_theme_icon(SNAME("CopyNodePath"), SNAME("EditorIcons")), ED_GET_SHORTCUT("scene_tree/copy_node_path"), TOOL_COPY_NODE_PATH); } - bool is_external = (selection[0]->get_scene_file_path() != ""); + bool is_external = (!selection[0]->get_scene_file_path().is_empty()); if (is_external) { bool is_inherited = selection[0]->get_scene_inherited_state() != nullptr; bool is_top_level = selection[0]->get_owner() == nullptr; @@ -2906,9 +2906,9 @@ void SceneTreeDock::attach_script_to_selected(bool p_extend) { Ref<Script> existing = selected->get_script(); String path = selected->get_scene_file_path(); - if (path == "") { + if (path.is_empty()) { String root_path = editor_data->get_edited_scene_root()->get_scene_file_path(); - if (root_path == "") { + if (root_path.is_empty()) { path = String("res://").plus_file(selected->get_name()); } else { path = root_path.get_base_dir().plus_file(selected->get_name()); @@ -2956,7 +2956,7 @@ void SceneTreeDock::attach_shader_to_selected(int p_preferred_mode) { } String path = selected_shader_material->get_path(); - if (path == "") { + if (path.is_empty()) { String root_path; if (editor_data->get_edited_scene_root()) { root_path = editor_data->get_edited_scene_root()->get_scene_file_path(); @@ -2967,7 +2967,7 @@ void SceneTreeDock::attach_shader_to_selected(int p_preferred_mode) { } else { shader_name = selected_shader_material->get_name(); } - if (root_path == "") { + if (root_path.is_empty()) { path = String("res://").plus_file(shader_name); } else { path = root_path.get_base_dir().plus_file(shader_name); @@ -3070,7 +3070,7 @@ void SceneTreeDock::_update_create_root_dialog() { while (!f->eof_reached()) { String l = f->get_line().strip_edges(); - if (l != String()) { + if (!l.is_empty()) { Button *button = memnew(Button); favorite_nodes->add_child(button); button->set_text(l); |