diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2021-07-24 15:46:25 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2021-07-25 12:22:25 +0200 |
commit | ac3322b0af8f23e8e2dac8111200bc69b5604c9f (patch) | |
tree | 59a079f13b5c03c2dd3328a26c55f3618e6014f6 /editor/plugins/animation_state_machine_editor.cpp | |
parent | a0f7f42b842462646281f5c4c9a8db070e034adc (diff) |
Use const references where possible for List range iterators
Diffstat (limited to 'editor/plugins/animation_state_machine_editor.cpp')
-rw-r--r-- | editor/plugins/animation_state_machine_editor.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index bee6af3cbb..a1f96f21bf 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -93,14 +93,14 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv if (ap) { List<StringName> names; ap->get_animation_list(&names); - for (StringName &E : names) { + for (const StringName &E : names) { animations_menu->add_icon_item(get_theme_icon(SNAME("Animation"), SNAME("EditorIcons")), E); animations_to_add.push_back(E); } } } - for (StringName &E : classes) { + for (const StringName &E : classes) { String name = String(E).replace_first("AnimationNode", ""); if (name == "Animation") { continue; // nope @@ -318,7 +318,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv float best_d_x = 1e20; float best_d_y = 1e20; - for (StringName &E : nodes) { + for (const StringName &E : nodes) { if (E == selected_node) { continue; } @@ -409,7 +409,7 @@ void AnimationNodeStateMachineEditor::_add_menu_type(int p_index) { open_file->clear_filters(); List<String> filters; ResourceLoader::get_recognized_extensions_for_type("AnimationRootNode", &filters); - for (String &E : filters) { + for (const String &E : filters) { open_file->add_filter("*." + E); } open_file->popup_file_dialog(); @@ -606,7 +606,7 @@ void AnimationNodeStateMachineEditor::_state_machine_draw() { } //pre pass nodes so we know the rectangles - for (StringName &E : nodes) { + for (const StringName &E : nodes) { Ref<AnimationNode> anode = state_machine->get_node(E); String name = E; bool needs_editor = EditorNode::get_singleton()->item_has_editor(anode.ptr()); |