diff options
author | Wilson E. Alvarez <wilson.e.alvarez@rubonnek.com> | 2023-12-13 11:06:14 -0500 |
---|---|---|
committer | Wilson E. Alvarez <wilson.e.alvarez@rubonnek.com> | 2023-12-13 11:06:26 -0500 |
commit | 80fb8db31ff3c5bebf66f18247df8f58fddfb95f (patch) | |
tree | 255267fdfe64d6345a3a3462b9847a9a1e6cac72 /editor | |
parent | aa5b6ed13e4644633baf2a8a1384c82e91c533a1 (diff) | |
download | redot-engine-80fb8db31ff3c5bebf66f18247df8f58fddfb95f.tar.gz |
Remove unnecessary assignments
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Diffstat (limited to 'editor')
-rw-r--r-- | editor/animation_track_editor_plugins.cpp | 6 | ||||
-rw-r--r-- | editor/editor_resource_picker.cpp | 6 | ||||
-rw-r--r-- | editor/gui/scene_tree_editor.cpp | 3 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 3 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 3 | ||||
-rw-r--r-- | editor/plugins/tiles/tile_set_editor.cpp | 3 | ||||
-rw-r--r-- | editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp | 3 | ||||
-rw-r--r-- | editor/plugins/visual_shader_editor_plugin.cpp | 8 | ||||
-rw-r--r-- | editor/plugins/visual_shader_editor_plugin.h | 2 |
9 files changed, 13 insertions, 24 deletions
diff --git a/editor/animation_track_editor_plugins.cpp b/editor/animation_track_editor_plugins.cpp index 91a0f213ec..390b722b7b 100644 --- a/editor/animation_track_editor_plugins.cpp +++ b/editor/animation_track_editor_plugins.cpp @@ -973,8 +973,7 @@ bool AnimationTrackEditTypeAudio::can_drop_data(const Point2 &p_point, const Var Vector<String> files = drag_data["files"]; if (files.size() == 1) { - String file = files[0]; - Ref<AudioStream> res = ResourceLoader::load(file); + Ref<AudioStream> res = ResourceLoader::load(files[0]); if (res.is_valid()) { return true; } @@ -995,8 +994,7 @@ void AnimationTrackEditTypeAudio::drop_data(const Point2 &p_point, const Variant Vector<String> files = drag_data["files"]; if (files.size() == 1) { - String file = files[0]; - stream = ResourceLoader::load(file); + stream = ResourceLoader::load(files[0]); } } diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp index 822b379091..8bb1a34f6f 100644 --- a/editor/editor_resource_picker.cpp +++ b/editor/editor_resource_picker.cpp @@ -661,8 +661,7 @@ bool EditorResourcePicker::_is_drop_valid(const Dictionary &p_drag_data) const { // TODO: Extract the typename of the dropped filepath's resource in a more performant way, without fully loading it. if (files.size() == 1) { - String file = files[0]; - res = ResourceLoader::load(file); + res = ResourceLoader::load(files[0]); } } @@ -727,8 +726,7 @@ void EditorResourcePicker::drop_data_fw(const Point2 &p_point, const Variant &p_ Vector<String> files = drag_data["files"]; if (files.size() == 1) { - String file = files[0]; - dropped_resource = ResourceLoader::load(file); + dropped_resource = ResourceLoader::load(files[0]); } } diff --git a/editor/gui/scene_tree_editor.cpp b/editor/gui/scene_tree_editor.cpp index ba4fa994b7..327b73f993 100644 --- a/editor/gui/scene_tree_editor.cpp +++ b/editor/gui/scene_tree_editor.cpp @@ -1326,8 +1326,7 @@ bool SceneTreeEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_d bool scene_drop = true; for (int i = 0; i < files.size(); i++) { - String file = files[i]; - String ftype = EditorFileSystem::get_singleton()->get_file_type(file); + String ftype = EditorFileSystem::get_singleton()->get_file_type(files[i]); if (ftype != "PackedScene") { scene_drop = false; break; diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 85846d7bc6..bac2a4909f 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -5613,8 +5613,7 @@ void CanvasItemEditorViewport::_on_change_type_closed() { void CanvasItemEditorViewport::_create_preview(const Vector<String> &files) const { bool add_preview = false; for (int i = 0; i < files.size(); i++) { - String path = files[i]; - Ref<Resource> res = ResourceLoader::load(path); + Ref<Resource> res = ResourceLoader::load(files[i]); ERR_FAIL_COND(res.is_null()); Ref<Texture2D> texture = Ref<Texture2D>(Object::cast_to<Texture2D>(*res)); Ref<PackedScene> scene = Ref<PackedScene>(Object::cast_to<PackedScene>(*res)); diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index ad7ef2b6ef..52f17c4a45 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -4154,8 +4154,7 @@ Node *Node3DEditorViewport::_sanitize_preview_node(Node *p_node) const { void Node3DEditorViewport::_create_preview_node(const Vector<String> &files) const { bool add_preview = false; for (int i = 0; i < files.size(); i++) { - String path = files[i]; - Ref<Resource> res = ResourceLoader::load(path); + Ref<Resource> res = ResourceLoader::load(files[i]); ERR_CONTINUE(res.is_null()); Ref<PackedScene> scene = Ref<PackedScene>(Object::cast_to<PackedScene>(*res)); Ref<Mesh> mesh = Ref<Mesh>(Object::cast_to<Mesh>(*res)); diff --git a/editor/plugins/tiles/tile_set_editor.cpp b/editor/plugins/tiles/tile_set_editor.cpp index 5bde1f754b..ef56e66e85 100644 --- a/editor/plugins/tiles/tile_set_editor.cpp +++ b/editor/plugins/tiles/tile_set_editor.cpp @@ -86,8 +86,7 @@ bool TileSetEditor::_can_drop_data_fw(const Point2 &p_point, const Variant &p_da } for (int i = 0; i < files.size(); i++) { - String file = files[i]; - String ftype = EditorFileSystem::get_singleton()->get_file_type(file); + String ftype = EditorFileSystem::get_singleton()->get_file_type(files[i]); if (!ClassDB::is_parent_class(ftype, "Texture2D")) { return false; diff --git a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp index eaf7a2b50b..1f4c3651e9 100644 --- a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp @@ -479,8 +479,7 @@ bool TileSetScenesCollectionSourceEditor::_can_drop_data_fw(const Point2 &p_poin } for (int i = 0; i < files.size(); i++) { - String file = files[i]; - String ftype = EditorFileSystem::get_singleton()->get_file_type(file); + String ftype = EditorFileSystem::get_singleton()->get_file_type(files[i]); if (!ClassDB::is_parent_class(ftype, "PackedScene")) { return false; diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 5cae151531..5c22e454ab 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -4826,16 +4826,14 @@ void VisualShaderEditor::_varying_create() { add_varying_dialog->hide(); } -void VisualShaderEditor::_varying_name_changed(const String &p_text) { - String name = p_text; - - if (!name.is_valid_identifier()) { +void VisualShaderEditor::_varying_name_changed(const String &p_name) { + if (!p_name.is_valid_identifier()) { varying_error_label->show(); varying_error_label->set_text(TTR("Invalid name for varying.")); add_varying_dialog->get_ok_button()->set_disabled(true); return; } - if (visual_shader->has_varying(name)) { + if (visual_shader->has_varying(p_name)) { varying_error_label->show(); varying_error_label->set_text(TTR("Varying with that name is already exist.")); add_varying_dialog->get_ok_button()->set_disabled(true); diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h index c4ee654b25..5f1fde3a52 100644 --- a/editor/plugins/visual_shader_editor_plugin.h +++ b/editor/plugins/visual_shader_editor_plugin.h @@ -491,7 +491,7 @@ class VisualShaderEditor : public VBoxContainer { void _member_cancel(); void _varying_create(); - void _varying_name_changed(const String &p_text); + void _varying_name_changed(const String &p_name); void _varying_deleted(); void _varying_selected(); void _varying_unselected(); |