summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/animation_blend_space_1d_editor.cpp16
-rw-r--r--editor/plugins/animation_blend_space_2d_editor.cpp16
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.cpp82
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp25
-rw-r--r--editor/plugins/animation_state_machine_editor.cpp40
-rw-r--r--editor/plugins/animation_tree_editor_plugin.cpp4
-rw-r--r--editor/plugins/asset_library_editor_plugin.cpp2
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp150
-rw-r--r--editor/plugins/cpu_particles_2d_editor_plugin.cpp4
-rw-r--r--editor/plugins/editor_preview_plugins.cpp8
-rw-r--r--editor/plugins/gpu_particles_2d_editor_plugin.cpp4
-rw-r--r--editor/plugins/material_editor_plugin.cpp40
-rw-r--r--editor/plugins/mesh_instance_3d_editor_plugin.cpp4
-rw-r--r--editor/plugins/mesh_library_editor_plugin.cpp12
-rw-r--r--editor/plugins/node_3d_editor_gizmos.cpp7
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp64
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.cpp12
-rw-r--r--editor/plugins/root_motion_editor_plugin.cpp4
-rw-r--r--editor/plugins/script_editor_plugin.cpp36
-rw-r--r--editor/plugins/script_text_editor.cpp40
-rw-r--r--editor/plugins/shader_editor_plugin.cpp12
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp26
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp27
-rw-r--r--editor/plugins/theme_editor_plugin.cpp194
-rw-r--r--editor/plugins/tiles/tile_set_atlas_source_editor.cpp6
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp198
26 files changed, 501 insertions, 532 deletions
diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp
index 9e58332e41..ab11680e2f 100644
--- a/editor/plugins/animation_blend_space_1d_editor.cpp
+++ b/editor/plugins/animation_blend_space_1d_editor.cpp
@@ -72,22 +72,22 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven
List<StringName> names;
ap->get_animation_list(&names);
- for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
- animations_menu->add_icon_item(get_theme_icon(SNAME("Animation"), SNAME("EditorIcons")), E->get());
- animations_to_add.push_back(E->get());
+ for (StringName &E : names) {
+ animations_menu->add_icon_item(get_theme_icon(SNAME("Animation"), SNAME("EditorIcons")), E);
+ animations_to_add.push_back(E);
}
}
}
- for (List<StringName>::Element *E = classes.front(); E; E = E->next()) {
- String name = String(E->get()).replace_first("AnimationNode", "");
+ for (StringName &E : classes) {
+ String name = String(E).replace_first("AnimationNode", "");
if (name == "Animation") {
continue;
}
int idx = menu->get_item_count();
menu->add_item(vformat("Add %s", name), idx);
- menu->set_item_metadata(idx, E->get());
+ menu->set_item_metadata(idx, E);
}
Ref<AnimationNode> clipb = EditorSettings::get_singleton()->get_resource_clipboard();
@@ -373,8 +373,8 @@ void AnimationNodeBlendSpace1DEditor::_add_menu_type(int p_index) {
open_file->clear_filters();
List<String> filters;
ResourceLoader::get_recognized_extensions_for_type("AnimationRootNode", &filters);
- for (List<String>::Element *E = filters.front(); E; E = E->next()) {
- open_file->add_filter("*." + E->get());
+ for (String &E : filters) {
+ open_file->add_filter("*." + E);
}
open_file->popup_file_dialog();
return;
diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp
index bbf88bbd8f..3fb90eb4ff 100644
--- a/editor/plugins/animation_blend_space_2d_editor.cpp
+++ b/editor/plugins/animation_blend_space_2d_editor.cpp
@@ -96,21 +96,21 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven
if (ap) {
List<StringName> names;
ap->get_animation_list(&names);
- for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
- animations_menu->add_icon_item(get_theme_icon(SNAME("Animation"), SNAME("EditorIcons")), E->get());
- animations_to_add.push_back(E->get());
+ for (StringName &E : names) {
+ animations_menu->add_icon_item(get_theme_icon(SNAME("Animation"), SNAME("EditorIcons")), E);
+ animations_to_add.push_back(E);
}
}
}
- for (List<StringName>::Element *E = classes.front(); E; E = E->next()) {
- String name = String(E->get()).replace_first("AnimationNode", "");
+ for (StringName &E : classes) {
+ String name = String(E).replace_first("AnimationNode", "");
if (name == "Animation") {
continue; // nope
}
int idx = menu->get_item_count();
menu->add_item(vformat("Add %s", name), idx);
- menu->set_item_metadata(idx, E->get());
+ menu->set_item_metadata(idx, E);
}
Ref<AnimationNode> clipb = EditorSettings::get_singleton()->get_resource_clipboard();
@@ -295,8 +295,8 @@ void AnimationNodeBlendSpace2DEditor::_add_menu_type(int p_index) {
open_file->clear_filters();
List<String> filters;
ResourceLoader::get_recognized_extensions_for_type("AnimationRootNode", &filters);
- for (List<String>::Element *E = filters.front(); E; E = E->next()) {
- open_file->add_filter("*." + E->get());
+ for (String &E : filters) {
+ open_file->add_filter("*." + E);
}
open_file->popup_file_dialog();
return;
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp
index 7930bc1e1c..705a1d0fc0 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp
@@ -121,21 +121,21 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
List<StringName> nodes;
blend_tree->get_node_list(&nodes);
- for (List<StringName>::Element *E = nodes.front(); E; E = E->next()) {
+ for (StringName &E : nodes) {
GraphNode *node = memnew(GraphNode);
graph->add_child(node);
- Ref<AnimationNode> agnode = blend_tree->get_node(E->get());
+ Ref<AnimationNode> agnode = blend_tree->get_node(E);
- node->set_position_offset(blend_tree->get_node_position(E->get()) * EDSCALE);
+ node->set_position_offset(blend_tree->get_node_position(E) * EDSCALE);
node->set_title(agnode->get_caption());
- node->set_name(E->get());
+ node->set_name(E);
int base = 0;
- if (String(E->get()) != "output") {
+ if (String(E) != "output") {
LineEdit *name = memnew(LineEdit);
- name->set_text(E->get());
+ name->set_text(E);
name->set_expand_to_text_length_enabled(true);
node->add_child(name);
node->set_slot(0, false, 0, Color(), true, 0, get_theme_color(SNAME("font_color"), SNAME("Label")));
@@ -143,7 +143,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
name->connect("focus_exited", callable_mp(this, &AnimationNodeBlendTreeEditor::_node_renamed_focus_out), varray(name, agnode), CONNECT_DEFERRED);
base = 1;
node->set_show_close_button(true);
- node->connect("close_request", callable_mp(this, &AnimationNodeBlendTreeEditor::_delete_request), varray(E->get()), CONNECT_DEFERRED);
+ node->connect("close_request", callable_mp(this, &AnimationNodeBlendTreeEditor::_delete_request), varray(E), CONNECT_DEFERRED);
}
for (int i = 0; i < agnode->get_input_count(); i++) {
@@ -155,12 +155,12 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
List<PropertyInfo> pinfo;
agnode->get_parameter_list(&pinfo);
- for (List<PropertyInfo>::Element *F = pinfo.front(); F; F = F->next()) {
- if (!(F->get().usage & PROPERTY_USAGE_EDITOR)) {
+ for (PropertyInfo &F : pinfo) {
+ if (!(F.usage & PROPERTY_USAGE_EDITOR)) {
continue;
}
- String base_path = AnimationTreeEditor::get_singleton()->get_base_path() + String(E->get()) + "/" + F->get().name;
- EditorProperty *prop = EditorInspector::instantiate_property_editor(AnimationTreeEditor::get_singleton()->get_tree(), F->get().type, base_path, F->get().hint, F->get().hint_string, F->get().usage);
+ String base_path = AnimationTreeEditor::get_singleton()->get_base_path() + String(E) + "/" + F.name;
+ EditorProperty *prop = EditorInspector::instantiate_property_editor(AnimationTreeEditor::get_singleton()->get_tree(), F.type, base_path, F.hint, F.hint_string, F.usage);
if (prop) {
prop->set_object_and_property(AnimationTreeEditor::get_singleton()->get_tree(), base_path);
prop->update_property();
@@ -171,7 +171,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
}
}
- node->connect("dragged", callable_mp(this, &AnimationNodeBlendTreeEditor::_node_dragged), varray(E->get()));
+ node->connect("dragged", callable_mp(this, &AnimationNodeBlendTreeEditor::_node_dragged), varray(E));
if (AnimationTreeEditor::get_singleton()->can_edit(agnode)) {
node->add_child(memnew(HSeparator));
@@ -179,7 +179,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
open_in_editor->set_text(TTR("Open Editor"));
open_in_editor->set_icon(get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")));
node->add_child(open_in_editor);
- open_in_editor->connect("pressed", callable_mp(this, &AnimationNodeBlendTreeEditor::_open_in_editor), varray(E->get()), CONNECT_DEFERRED);
+ open_in_editor->connect("pressed", callable_mp(this, &AnimationNodeBlendTreeEditor::_open_in_editor), varray(E), CONNECT_DEFERRED);
open_in_editor->set_h_size_flags(SIZE_SHRINK_CENTER);
}
@@ -189,7 +189,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
edit_filters->set_text(TTR("Edit Filters"));
edit_filters->set_icon(get_theme_icon(SNAME("AnimationFilter"), SNAME("EditorIcons")));
node->add_child(edit_filters);
- edit_filters->connect("pressed", callable_mp(this, &AnimationNodeBlendTreeEditor::_edit_filters), varray(E->get()), CONNECT_DEFERRED);
+ edit_filters->connect("pressed", callable_mp(this, &AnimationNodeBlendTreeEditor::_edit_filters), varray(E), CONNECT_DEFERRED);
edit_filters->set_h_size_flags(SIZE_SHRINK_CENTER);
}
@@ -212,9 +212,9 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
List<StringName> anims;
ap->get_animation_list(&anims);
- for (List<StringName>::Element *F = anims.front(); F; F = F->next()) {
- mb->get_popup()->add_item(F->get());
- options.push_back(F->get());
+ for (StringName &F : anims) {
+ mb->get_popup()->add_item(F);
+ options.push_back(F);
}
if (ap->has_animation(anim->get_animation())) {
@@ -225,10 +225,10 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
pb->set_percent_visible(false);
pb->set_custom_minimum_size(Vector2(0, 14) * EDSCALE);
- animations[E->get()] = pb;
+ animations[E] = pb;
node->add_child(pb);
- mb->get_popup()->connect("index_pressed", callable_mp(this, &AnimationNodeBlendTreeEditor::_anim_selected), varray(options, E->get()), CONNECT_DEFERRED);
+ mb->get_popup()->connect("index_pressed", callable_mp(this, &AnimationNodeBlendTreeEditor::_anim_selected), varray(options, E), CONNECT_DEFERRED);
}
Ref<StyleBoxFlat> sb = node->get_theme_stylebox(SNAME("frame"), SNAME("GraphNode"));
@@ -246,10 +246,10 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
List<AnimationNodeBlendTree::NodeConnection> connections;
blend_tree->get_node_connections(&connections);
- for (List<AnimationNodeBlendTree::NodeConnection>::Element *E = connections.front(); E; E = E->next()) {
- StringName from = E->get().output_node;
- StringName to = E->get().input_node;
- int to_idx = E->get().input_index;
+ for (AnimationNodeBlendTree::NodeConnection &E : connections) {
+ StringName from = E.output_node;
+ StringName to = E.input_node;
+ int to_idx = E.input_index;
graph->connect_node(from, 0, to, to_idx);
}
@@ -274,8 +274,8 @@ void AnimationNodeBlendTreeEditor::_add_node(int p_idx) {
open_file->clear_filters();
List<String> filters;
ResourceLoader::get_recognized_extensions_for_type("AnimationNode", &filters);
- for (List<String>::Element *E = filters.front(); E; E = E->next()) {
- open_file->add_filter("*." + E->get());
+ for (String &E : filters) {
+ open_file->add_filter("*." + E);
}
open_file->popup_file_dialog();
return;
@@ -394,9 +394,9 @@ void AnimationNodeBlendTreeEditor::_delete_request(const String &p_which) {
List<AnimationNodeBlendTree::NodeConnection> conns;
blend_tree->get_node_connections(&conns);
- for (List<AnimationNodeBlendTree::NodeConnection>::Element *E = conns.front(); E; E = E->next()) {
- if (E->get().output_node == p_which || E->get().input_node == p_which) {
- undo_redo->add_undo_method(blend_tree.ptr(), "connect_node", E->get().input_node, E->get().input_index, E->get().output_node);
+ for (AnimationNodeBlendTree::NodeConnection &E : conns) {
+ if (E.output_node == p_which || E.input_node == p_which) {
+ undo_redo->add_undo_method(blend_tree.ptr(), "connect_node", E.input_node, E.input_index, E.output_node);
}
}
@@ -423,8 +423,8 @@ void AnimationNodeBlendTreeEditor::_delete_nodes_request() {
undo_redo->create_action(TTR("Delete Node(s)"));
- for (List<StringName>::Element *F = to_erase.front(); F; F = F->next()) {
- _delete_request(F->get());
+ for (StringName &F : to_erase) {
+ _delete_request(F);
}
undo_redo->commit_action();
@@ -517,8 +517,8 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
List<StringName> animations;
player->get_animation_list(&animations);
- for (List<StringName>::Element *E = animations.front(); E; E = E->next()) {
- Ref<Animation> anim = player->get_animation(E->get());
+ for (StringName &E : animations) {
+ Ref<Animation> anim = player->get_animation(E);
for (int i = 0; i < anim->get_track_count(); i++) {
String track_path = anim->track_get_path(i);
paths.insert(track_path);
@@ -718,13 +718,13 @@ void AnimationNodeBlendTreeEditor::_notification(int p_what) {
List<AnimationNodeBlendTree::NodeConnection> conns;
blend_tree->get_node_connections(&conns);
- for (List<AnimationNodeBlendTree::NodeConnection>::Element *E = conns.front(); E; E = E->next()) {
+ for (AnimationNodeBlendTree::NodeConnection &E : conns) {
float activity = 0;
- StringName path = AnimationTreeEditor::get_singleton()->get_base_path() + E->get().input_node;
+ StringName path = AnimationTreeEditor::get_singleton()->get_base_path() + E.input_node;
if (AnimationTreeEditor::get_singleton()->get_tree() && !AnimationTreeEditor::get_singleton()->get_tree()->is_state_invalid()) {
- activity = AnimationTreeEditor::get_singleton()->get_tree()->get_connection_activity(path, E->get().input_index);
+ activity = AnimationTreeEditor::get_singleton()->get_tree()->get_connection_activity(path, E.input_index);
}
- graph->set_connection_activity(E->get().output_node, 0, E->get().input_node, E->get().input_index, activity);
+ graph->set_connection_activity(E.output_node, 0, E.input_node, E.input_index, activity);
}
AnimationTree *graph_player = AnimationTreeEditor::get_singleton()->get_tree();
@@ -741,7 +741,7 @@ void AnimationNodeBlendTreeEditor::_notification(int p_what) {
Ref<Animation> anim = player->get_animation(an->get_animation());
if (anim.is_valid()) {
E->get()->set_max(anim->get_length());
- //StringName path = AnimationTreeEditor::get_singleton()->get_base_path() + E->get().input_node;
+ //StringName path = AnimationTreeEditor::get_singleton()->get_base_path() + E.input_node;
StringName time_path = AnimationTreeEditor::get_singleton()->get_base_path() + String(E->key()) + "/time";
E->get()->set_value(AnimationTreeEditor::get_singleton()->get_tree()->get(time_path));
}
@@ -828,10 +828,10 @@ void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<Anima
List<AnimationNodeBlendTree::NodeConnection> connections;
blend_tree->get_node_connections(&connections);
- for (List<AnimationNodeBlendTree::NodeConnection>::Element *E = connections.front(); E; E = E->next()) {
- StringName from = E->get().output_node;
- StringName to = E->get().input_node;
- int to_idx = E->get().input_index;
+ for (AnimationNodeBlendTree::NodeConnection &E : connections) {
+ StringName from = E.output_node;
+ StringName to = E.input_node;
+ int to_idx = E.input_index;
graph->connect_node(from, 0, to, to_idx);
}
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index cbce5bb3f5..1bdbc2980c 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -350,8 +350,8 @@ void AnimationPlayerEditor::_animation_load() {
List<String> extensions;
ResourceLoader::get_recognized_extensions_for_type("Animation", &extensions);
- for (List<String>::Element *E = extensions.front(); E; E = E->next()) {
- file->add_filter("*." + E->get() + " ; " + E->get().to_upper());
+ for (String &E : extensions) {
+ file->add_filter("*." + E + " ; " + E.to_upper());
}
file->popup_file_dialog();
@@ -584,8 +584,7 @@ void AnimationPlayerEditor::_animation_blend() {
blend_editor.next->clear();
blend_editor.next->add_item("", i);
- for (List<StringName>::Element *E = anims.front(); E; E = E->next()) {
- String to = E->get();
+ for (StringName &to : anims) {
TreeItem *blend = blend_editor.tree->create_item(root);
blend->set_editable(0, false);
blend->set_editable(1, true);
@@ -830,20 +829,20 @@ void AnimationPlayerEditor::_update_player() {
}
int active_idx = -1;
- for (List<StringName>::Element *E = animlist.front(); E; E = E->next()) {
+ for (StringName &E : animlist) {
Ref<Texture2D> icon;
- if (E->get() == player->get_autoplay()) {
- if (E->get() == "RESET") {
+ if (E == player->get_autoplay()) {
+ if (E == "RESET") {
icon = autoplay_reset_icon;
} else {
icon = autoplay_icon;
}
- } else if (E->get() == "RESET") {
+ } else if (E == "RESET") {
icon = reset_icon;
}
- animation->add_icon_item(icon, E->get());
+ animation->add_icon_item(icon, E);
- if (player->get_assigned_animation() == E->get()) {
+ if (player->get_assigned_animation() == E) {
active_idx = animation->get_item_count() - 1;
}
}
@@ -966,9 +965,9 @@ void AnimationPlayerEditor::_animation_duplicate() {
Ref<Animation> new_anim = memnew(Animation);
List<PropertyInfo> plist;
anim->get_property_list(&plist);
- for (List<PropertyInfo>::Element *E = plist.front(); E; E = E->next()) {
- if (E->get().usage & PROPERTY_USAGE_STORAGE) {
- new_anim->set(E->get().name, anim->get(E->get().name));
+ for (PropertyInfo &E : plist) {
+ if (E.usage & PROPERTY_USAGE_STORAGE) {
+ new_anim->set(E.name, anim->get(E.name));
}
}
new_anim->set_path("");
diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp
index 8abe20c3c9..bee6af3cbb 100644
--- a/editor/plugins/animation_state_machine_editor.cpp
+++ b/editor/plugins/animation_state_machine_editor.cpp
@@ -93,21 +93,21 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
if (ap) {
List<StringName> names;
ap->get_animation_list(&names);
- for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
- animations_menu->add_icon_item(get_theme_icon(SNAME("Animation"), SNAME("EditorIcons")), E->get());
- animations_to_add.push_back(E->get());
+ for (StringName &E : names) {
+ animations_menu->add_icon_item(get_theme_icon(SNAME("Animation"), SNAME("EditorIcons")), E);
+ animations_to_add.push_back(E);
}
}
}
- for (List<StringName>::Element *E = classes.front(); E; E = E->next()) {
- String name = String(E->get()).replace_first("AnimationNode", "");
+ for (StringName &E : classes) {
+ String name = String(E).replace_first("AnimationNode", "");
if (name == "Animation") {
continue; // nope
}
int idx = menu->get_item_count();
menu->add_item(vformat("Add %s", name), idx);
- menu->set_item_metadata(idx, E->get());
+ menu->set_item_metadata(idx, E);
}
Ref<AnimationNode> clipb = EditorSettings::get_singleton()->get_resource_clipboard();
@@ -318,24 +318,24 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
float best_d_x = 1e20;
float best_d_y = 1e20;
- for (List<StringName>::Element *E = nodes.front(); E; E = E->next()) {
- if (E->get() == selected_node) {
+ for (StringName &E : nodes) {
+ if (E == selected_node) {
continue;
}
- Vector2 npos = state_machine->get_node_position(E->get());
+ Vector2 npos = state_machine->get_node_position(E);
float d_x = ABS(npos.x - cpos.x);
if (d_x < MIN(5, best_d_x)) {
drag_ofs.x -= cpos.x - npos.x;
best_d_x = d_x;
- snap_x = E->get();
+ snap_x = E;
}
float d_y = ABS(npos.y - cpos.y);
if (d_y < MIN(5, best_d_y)) {
drag_ofs.y -= cpos.y - npos.y;
best_d_y = d_y;
- snap_y = E->get();
+ snap_y = E;
}
}
}
@@ -409,8 +409,8 @@ void AnimationNodeStateMachineEditor::_add_menu_type(int p_index) {
open_file->clear_filters();
List<String> filters;
ResourceLoader::get_recognized_extensions_for_type("AnimationRootNode", &filters);
- for (List<String>::Element *E = filters.front(); E; E = E->next()) {
- open_file->add_filter("*." + E->get());
+ for (String &E : filters) {
+ open_file->add_filter("*." + E);
}
open_file->popup_file_dialog();
return;
@@ -606,11 +606,11 @@ void AnimationNodeStateMachineEditor::_state_machine_draw() {
}
//pre pass nodes so we know the rectangles
- for (List<StringName>::Element *E = nodes.front(); E; E = E->next()) {
- Ref<AnimationNode> anode = state_machine->get_node(E->get());
- String name = E->get();
+ for (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());
- Ref<StyleBox> sb = E->get() == selected_node ? style_selected : style;
+ Ref<StyleBox> sb = E == selected_node ? style_selected : style;
Size2 s = sb->get_minimum_size();
int strsize = font->get_string_size(name, font_size).width;
@@ -622,8 +622,8 @@ void AnimationNodeStateMachineEditor::_state_machine_draw() {
}
Vector2 offset;
- offset += state_machine->get_node_position(E->get()) * EDSCALE;
- if (selected_node == E->get() && dragging_selected) {
+ offset += state_machine->get_node_position(E) * EDSCALE;
+ if (selected_node == E && dragging_selected) {
offset += drag_ofs;
}
offset -= s / 2;
@@ -633,7 +633,7 @@ void AnimationNodeStateMachineEditor::_state_machine_draw() {
NodeRect nr;
nr.node = Rect2(offset, s);
- nr.node_name = E->get();
+ nr.node_name = E;
scroll_range = scroll_range.merge(nr.node); //merge with range
diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp
index 9c28e023dd..67d5600a3c 100644
--- a/editor/plugins/animation_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_tree_editor_plugin.cpp
@@ -215,8 +215,8 @@ Vector<String> AnimationTreeEditor::get_animation_list() {
List<StringName> anims;
ap->get_animation_list(&anims);
Vector<String> ret;
- for (List<StringName>::Element *E = anims.front(); E; E = E->next()) {
- ret.push_back(E->get());
+ for (StringName &E : anims) {
+ ret.push_back(E);
}
return ret;
diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp
index 556f35d4b0..785bab42cf 100644
--- a/editor/plugins/asset_library_editor_plugin.cpp
+++ b/editor/plugins/asset_library_editor_plugin.cpp
@@ -607,7 +607,7 @@ void EditorAssetLibrary::_update_repository_options() {
Dictionary available_urls = _EDITOR_DEF("asset_library/available_urls", default_urls, true);
repository->clear();
Array keys = available_urls.keys();
- for (int i = 0; i < available_urls.size(); i++) {
+ for (int i = 0; i < keys.size(); i++) {
String key = keys[i];
repository->add_item(key);
repository->set_item_metadata(i, available_urls[key]);
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index d5ef13e426..6bdb9eceb8 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -301,8 +301,8 @@ void CanvasItemEditor::_snap_other_nodes(
// Check if the element is in the exception
bool exception = false;
- for (List<const CanvasItem *>::Element *E = p_exceptions.front(); E; E = E->next()) {
- if (E->get() == p_current) {
+ for (const CanvasItem *&E : p_exceptions) {
+ if (E == p_current) {
exception = true;
break;
}
@@ -399,8 +399,8 @@ Point2 CanvasItemEditor::snap_point(Point2 p_target, unsigned int p_modes, unsig
if ((is_snap_active && snap_other_nodes && (p_modes & SNAP_OTHER_NODES)) || (p_forced_modes & SNAP_OTHER_NODES)) {
Transform2D to_snap_transform = Transform2D();
List<const CanvasItem *> exceptions = List<const CanvasItem *>();
- for (List<CanvasItem *>::Element *E = p_other_nodes_exceptions.front(); E; E = E->next()) {
- exceptions.push_back(E->get());
+ for (CanvasItem *E : p_other_nodes_exceptions) {
+ exceptions.push_back(E);
}
if (p_self_canvas_item) {
exceptions.push_back(p_self_canvas_item);
@@ -527,8 +527,7 @@ Rect2 CanvasItemEditor::_get_encompassing_rect_from_list(List<CanvasItem *> p_li
Rect2 rect = Rect2(canvas_item->get_global_transform_with_canvas().xform(canvas_item->_edit_get_rect().position + canvas_item->_edit_get_rect().size / 2), Size2());
// Expand with the other ones
- for (List<CanvasItem *>::Element *E = p_list.front(); E; E = E->next()) {
- CanvasItem *canvas_item2 = E->get();
+ for (CanvasItem *canvas_item2 : p_list) {
Transform2D xform = canvas_item2->get_global_transform_with_canvas();
Rect2 current_rect = canvas_item2->_edit_get_rect();
@@ -760,9 +759,9 @@ List<CanvasItem *> CanvasItemEditor::_get_edited_canvas_items(bool retreive_lock
if (remove_canvas_item_if_parent_in_selection) {
List<CanvasItem *> filtered_selection;
- for (List<CanvasItem *>::Element *E = selection.front(); E; E = E->next()) {
- if (!selection.find(E->get()->get_parent())) {
- filtered_selection.push_back(E->get());
+ for (CanvasItem *E : selection) {
+ if (!selection.find(E->get_parent())) {
+ filtered_selection.push_back(E);
}
}
return filtered_selection;
@@ -800,8 +799,7 @@ Vector2 CanvasItemEditor::_position_to_anchor(const Control *p_control, Vector2
}
void CanvasItemEditor::_save_canvas_item_state(List<CanvasItem *> p_canvas_items, bool save_bones) {
- for (List<CanvasItem *>::Element *E = p_canvas_items.front(); E; E = E->next()) {
- CanvasItem *canvas_item = E->get();
+ for (CanvasItem *canvas_item : p_canvas_items) {
CanvasItemEditorSelectedItem *se = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
if (se) {
se->undo_state = canvas_item->_edit_get_state();
@@ -816,8 +814,7 @@ void CanvasItemEditor::_save_canvas_item_state(List<CanvasItem *> p_canvas_items
}
void CanvasItemEditor::_restore_canvas_item_state(List<CanvasItem *> p_canvas_items, bool restore_bones) {
- for (List<CanvasItem *>::Element *E = drag_selection.front(); E; E = E->next()) {
- CanvasItem *canvas_item = E->get();
+ for (CanvasItem *canvas_item : drag_selection) {
CanvasItemEditorSelectedItem *se = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
canvas_item->_edit_set_state(se->undo_state);
}
@@ -825,8 +822,7 @@ void CanvasItemEditor::_restore_canvas_item_state(List<CanvasItem *> p_canvas_it
void CanvasItemEditor::_commit_canvas_item_state(List<CanvasItem *> p_canvas_items, String action_name, bool commit_bones) {
List<CanvasItem *> modified_canvas_items;
- for (List<CanvasItem *>::Element *E = p_canvas_items.front(); E; E = E->next()) {
- CanvasItem *canvas_item = E->get();
+ for (CanvasItem *canvas_item : p_canvas_items) {
Dictionary old_state = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item)->undo_state;
Dictionary new_state = canvas_item->_edit_get_state();
@@ -840,17 +836,16 @@ void CanvasItemEditor::_commit_canvas_item_state(List<CanvasItem *> p_canvas_ite
}
undo_redo->create_action(action_name);
- for (List<CanvasItem *>::Element *E = modified_canvas_items.front(); E; E = E->next()) {
- CanvasItem *canvas_item = E->get();
+ for (CanvasItem *canvas_item : modified_canvas_items) {
CanvasItemEditorSelectedItem *se = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
if (se) {
undo_redo->add_do_method(canvas_item, "_edit_set_state", canvas_item->_edit_get_state());
undo_redo->add_undo_method(canvas_item, "_edit_set_state", se->undo_state);
if (commit_bones) {
- for (List<Dictionary>::Element *F = se->pre_drag_bones_undo_state.front(); F; F = F->next()) {
+ for (Dictionary &F : se->pre_drag_bones_undo_state) {
canvas_item = Object::cast_to<CanvasItem>(canvas_item->get_parent());
undo_redo->add_do_method(canvas_item, "_edit_set_state", canvas_item->_edit_get_state());
- undo_redo->add_undo_method(canvas_item, "_edit_set_state", F->get());
+ undo_redo->add_undo_method(canvas_item, "_edit_set_state", F);
}
}
}
@@ -1304,8 +1299,7 @@ bool CanvasItemEditor::_gui_input_pivot(const Ref<InputEvent> &p_event) {
// Filters the selection with nodes that allow setting the pivot
drag_selection = List<CanvasItem *>();
- for (List<CanvasItem *>::Element *E = selection.front(); E; E = E->next()) {
- CanvasItem *canvas_item = E->get();
+ for (CanvasItem *canvas_item : selection) {
if (canvas_item->_edit_use_pivot()) {
drag_selection.push_back(canvas_item);
}
@@ -1321,8 +1315,7 @@ bool CanvasItemEditor::_gui_input_pivot(const Ref<InputEvent> &p_event) {
} else {
new_pos = snap_point(drag_from, SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL, 0, nullptr, drag_selection);
}
- for (List<CanvasItem *>::Element *E = drag_selection.front(); E; E = E->next()) {
- CanvasItem *canvas_item = E->get();
+ for (CanvasItem *canvas_item : drag_selection) {
canvas_item->_edit_set_pivot(canvas_item->get_global_transform_with_canvas().affine_inverse().xform(new_pos));
}
@@ -1343,8 +1336,7 @@ bool CanvasItemEditor::_gui_input_pivot(const Ref<InputEvent> &p_event) {
} else {
new_pos = snap_point(drag_to, SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL);
}
- for (List<CanvasItem *>::Element *E = drag_selection.front(); E; E = E->next()) {
- CanvasItem *canvas_item = E->get();
+ for (CanvasItem *canvas_item : drag_selection) {
canvas_item->_edit_set_pivot(canvas_item->get_global_transform_with_canvas().affine_inverse().xform(new_pos));
}
return true;
@@ -1387,8 +1379,8 @@ bool CanvasItemEditor::_gui_input_rotate(const Ref<InputEvent> &p_event) {
List<CanvasItem *> selection = _get_edited_canvas_items();
// Remove not movable nodes
- for (List<CanvasItem *>::Element *E = selection.front(); E; E = E->next()) {
- if (!_is_node_movable(E->get(), true)) {
+ for (CanvasItem *E : selection) {
+ if (!_is_node_movable(E, true)) {
selection.erase(E);
}
}
@@ -1414,8 +1406,7 @@ bool CanvasItemEditor::_gui_input_rotate(const Ref<InputEvent> &p_event) {
// Rotate the node
if (m.is_valid()) {
_restore_canvas_item_state(drag_selection);
- for (List<CanvasItem *>::Element *E = drag_selection.front(); E; E = E->next()) {
- CanvasItem *canvas_item = E->get();
+ for (CanvasItem *canvas_item : drag_selection) {
drag_to = transform.affine_inverse().xform(m->get_position());
//Rotate the opposite way if the canvas item's compounded scale has an uneven number of negative elements
bool opposite = (canvas_item->get_global_transform().get_scale().sign().dot(canvas_item->get_transform().get_scale().sign()) == 0);
@@ -2046,8 +2037,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
}
int index = 0;
- for (List<CanvasItem *>::Element *E = drag_selection.front(); E; E = E->next()) {
- CanvasItem *canvas_item = E->get();
+ for (CanvasItem *canvas_item : drag_selection) {
Transform2D xform = canvas_item->get_global_transform_with_canvas().affine_inverse() * canvas_item->get_transform();
canvas_item->_edit_set_position(canvas_item->_edit_get_position() + xform.xform(new_pos) - xform.xform(previous_pos));
@@ -2162,8 +2152,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
}
int index = 0;
- for (List<CanvasItem *>::Element *E = drag_selection.front(); E; E = E->next()) {
- CanvasItem *canvas_item = E->get();
+ for (CanvasItem *canvas_item : drag_selection) {
Transform2D xform = canvas_item->get_global_transform_with_canvas().affine_inverse() * canvas_item->get_transform();
canvas_item->_edit_set_position(canvas_item->_edit_get_position() + xform.xform(new_pos) - xform.xform(previous_pos));
@@ -2375,8 +2364,8 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
if (selitems.size() == 1 && editor_selection->get_selected_node_list().is_empty()) {
editor->push_item(selitems[0]);
}
- for (List<CanvasItem *>::Element *E = selitems.front(); E; E = E->next()) {
- editor_selection->add_node(E->get());
+ for (CanvasItem *E : selitems) {
+ editor_selection->add_node(E);
}
}
@@ -3248,8 +3237,8 @@ void CanvasItemEditor::_draw_selection() {
List<CanvasItem *> selection = _get_edited_canvas_items(true, false);
bool single = selection.size() == 1;
- for (List<CanvasItem *>::Element *E = selection.front(); E; E = E->next()) {
- CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E->get());
+ for (CanvasItem *E : selection) {
+ CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E);
CanvasItemEditorSelectedItem *se = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
bool item_locked = canvas_item->has_meta("_edit_lock_");
@@ -3566,9 +3555,9 @@ void CanvasItemEditor::_draw_hover() {
Point2 pos = transform.xform(hovering_results[i].position) - Point2(0, item_size.y) + (Point2(node_icon->get_size().x, -node_icon->get_size().y) / 4);
// Rectify the position to avoid overlapping items
- for (List<Rect2>::Element *E = previous_rects.front(); E; E = E->next()) {
- if (E->get().intersects(Rect2(pos, item_size))) {
- pos.y = E->get().get_position().y - item_size.y;
+ for (Rect2 &E : previous_rects) {
+ if (E.intersects(Rect2(pos, item_size))) {
+ pos.y = E.get_position().y - item_size.y;
}
}
@@ -3642,14 +3631,14 @@ void CanvasItemEditor::_draw_viewport() {
all_locked = false;
all_group = false;
} else {
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- if (Object::cast_to<CanvasItem>(E->get()) && !Object::cast_to<CanvasItem>(E->get())->has_meta("_edit_lock_")) {
+ for (Node *E : selection) {
+ if (Object::cast_to<CanvasItem>(E) && !Object::cast_to<CanvasItem>(E)->has_meta("_edit_lock_")) {
all_locked = false;
break;
}
}
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- if (Object::cast_to<CanvasItem>(E->get()) && !Object::cast_to<CanvasItem>(E->get())->has_meta("_edit_group_")) {
+ for (Node *E : selection) {
+ if (Object::cast_to<CanvasItem>(E) && !Object::cast_to<CanvasItem>(E)->has_meta("_edit_group_")) {
all_group = false;
break;
}
@@ -3716,8 +3705,7 @@ void CanvasItemEditor::_notification(int p_what) {
// Update the viewport if the canvas_item changes
List<CanvasItem *> selection = _get_edited_canvas_items(true);
- for (List<CanvasItem *>::Element *E = selection.front(); E; E = E->next()) {
- CanvasItem *canvas_item = E->get();
+ for (CanvasItem *canvas_item : selection) {
CanvasItemEditorSelectedItem *se = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
Rect2 rect;
@@ -3932,8 +3920,8 @@ void CanvasItemEditor::_selection_changed() {
int nbValidControls = 0;
int nbAnchorsMode = 0;
List<Node *> selection = editor_selection->get_selected_node_list();
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- Control *control = Object::cast_to<Control>(E->get());
+ for (Node *E : selection) {
+ Control *control = Object::cast_to<Control>(E);
if (!control) {
continue;
}
@@ -4101,8 +4089,8 @@ void CanvasItemEditor::_set_anchors_and_offsets_preset(Control::LayoutPreset p_p
undo_redo->create_action(TTR("Change Anchors and Offsets"));
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- Control *control = Object::cast_to<Control>(E->get());
+ for (Node *E : selection) {
+ Control *control = Object::cast_to<Control>(E);
if (control) {
undo_redo->add_do_method(control, "set_anchors_preset", p_preset);
switch (p_preset) {
@@ -4142,8 +4130,8 @@ void CanvasItemEditor::_set_anchors_and_offsets_to_keep_ratio() {
undo_redo->create_action(TTR("Change Anchors and Offsets"));
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- Control *control = Object::cast_to<Control>(E->get());
+ for (Node *E : selection) {
+ Control *control = Object::cast_to<Control>(E);
if (control) {
Point2 top_left_anchor = _position_to_anchor(control, Point2());
Point2 bottom_right_anchor = _position_to_anchor(control, control->get_size());
@@ -4169,8 +4157,8 @@ void CanvasItemEditor::_set_anchors_preset(Control::LayoutPreset p_preset) {
List<Node *> selection = editor_selection->get_selected_node_list();
undo_redo->create_action(TTR("Change Anchors"));
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- Control *control = Object::cast_to<Control>(E->get());
+ for (Node *E : selection) {
+ Control *control = Object::cast_to<Control>(E);
if (control) {
undo_redo->add_do_method(control, "set_anchors_preset", p_preset);
undo_redo->add_undo_method(control, "_edit_set_state", control->_edit_get_state());
@@ -4295,15 +4283,15 @@ void CanvasItemEditor::_insert_animation_keys(bool p_location, bool p_rotation,
}
if (has_chain && ik_chain.size()) {
- for (List<Node2D *>::Element *F = ik_chain.front(); F; F = F->next()) {
+ for (Node2D *&F : ik_chain) {
if (key_pos) {
- AnimationPlayerEditor::singleton->get_track_editor()->insert_node_value_key(F->get(), "position", F->get()->get_position(), p_on_existing);
+ AnimationPlayerEditor::singleton->get_track_editor()->insert_node_value_key(F, "position", F->get_position(), p_on_existing);
}
if (key_rot) {
- AnimationPlayerEditor::singleton->get_track_editor()->insert_node_value_key(F->get(), "rotation", F->get()->get_rotation(), p_on_existing);
+ AnimationPlayerEditor::singleton->get_track_editor()->insert_node_value_key(F, "rotation", F->get_rotation(), p_on_existing);
}
if (key_scale) {
- AnimationPlayerEditor::singleton->get_track_editor()->insert_node_value_key(F->get(), "scale", F->get()->get_scale(), p_on_existing);
+ AnimationPlayerEditor::singleton->get_track_editor()->insert_node_value_key(F, "scale", F->get_scale(), p_on_existing);
}
}
}
@@ -4327,8 +4315,8 @@ void CanvasItemEditor::_insert_animation_keys(bool p_location, bool p_rotation,
void CanvasItemEditor::_button_toggle_anchor_mode(bool p_status) {
List<CanvasItem *> selection = _get_edited_canvas_items(false, false);
- for (List<CanvasItem *>::Element *E = selection.front(); E; E = E->next()) {
- Control *control = Object::cast_to<Control>(E->get());
+ for (CanvasItem *E : selection) {
+ Control *control = Object::cast_to<Control>(E);
if (!control || Object::cast_to<Container>(control->get_parent())) {
continue;
}
@@ -4441,13 +4429,13 @@ void CanvasItemEditor::_popup_callback(int p_op) {
} break;
case SKELETON_SHOW_BONES: {
List<Node *> selection = editor_selection->get_selected_node_list();
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
+ for (Node *E : selection) {
// Add children nodes so they are processed
- for (int child = 0; child < E->get()->get_child_count(); child++) {
- selection.push_back(E->get()->get_child(child));
+ for (int child = 0; child < E->get_child_count(); child++) {
+ selection.push_back(E->get_child(child));
}
- Bone2D *bone_2d = Object::cast_to<Bone2D>(E->get());
+ Bone2D *bone_2d = Object::cast_to<Bone2D>(E);
if (!bone_2d || !bone_2d->is_inside_tree()) {
continue;
}
@@ -4477,8 +4465,8 @@ void CanvasItemEditor::_popup_callback(int p_op) {
undo_redo->create_action(TTR("Lock Selected"));
List<Node *> selection = editor_selection->get_selected_node_list();
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E->get());
+ for (Node *E : selection) {
+ CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E);
if (!canvas_item || !canvas_item->is_inside_tree()) {
continue;
}
@@ -4499,8 +4487,8 @@ void CanvasItemEditor::_popup_callback(int p_op) {
undo_redo->create_action(TTR("Unlock Selected"));
List<Node *> selection = editor_selection->get_selected_node_list();
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E->get());
+ for (Node *E : selection) {
+ CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E);
if (!canvas_item || !canvas_item->is_inside_tree()) {
continue;
}
@@ -4521,8 +4509,8 @@ void CanvasItemEditor::_popup_callback(int p_op) {
undo_redo->create_action(TTR("Group Selected"));
List<Node *> selection = editor_selection->get_selected_node_list();
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E->get());
+ for (Node *E : selection) {
+ CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E);
if (!canvas_item || !canvas_item->is_inside_tree()) {
continue;
}
@@ -4543,8 +4531,8 @@ void CanvasItemEditor::_popup_callback(int p_op) {
undo_redo->create_action(TTR("Ungroup Selected"));
List<Node *> selection = editor_selection->get_selected_node_list();
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E->get());
+ for (Node *E : selection) {
+ CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E);
if (!canvas_item || !canvas_item->is_inside_tree()) {
continue;
}
@@ -4711,14 +4699,14 @@ void CanvasItemEditor::_popup_callback(int p_op) {
}
undo_redo->create_action(TTR("Paste Pose"));
- for (List<PoseClipboard>::Element *E = pose_clipboard.front(); E; E = E->next()) {
- Node2D *n2d = Object::cast_to<Node2D>(ObjectDB::get_instance(E->get().id));
+ for (PoseClipboard &E : pose_clipboard) {
+ Node2D *n2d = Object::cast_to<Node2D>(ObjectDB::get_instance(E.id));
if (!n2d) {
continue;
}
- undo_redo->add_do_method(n2d, "set_position", E->get().pos);
- undo_redo->add_do_method(n2d, "set_rotation", E->get().rot);
- undo_redo->add_do_method(n2d, "set_scale", E->get().scale);
+ undo_redo->add_do_method(n2d, "set_position", E.pos);
+ undo_redo->add_do_method(n2d, "set_rotation", E.rot);
+ undo_redo->add_do_method(n2d, "set_scale", E.scale);
undo_redo->add_undo_method(n2d, "set_position", n2d->get_position());
undo_redo->add_undo_method(n2d, "set_rotation", n2d->get_rotation());
undo_redo->add_undo_method(n2d, "set_scale", n2d->get_scale());
@@ -5819,14 +5807,14 @@ void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String &
String property = "texture";
List<PropertyInfo> props;
child->get_property_list(&props);
- for (const List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
- if (E->get().name == "config/texture") { // Particles2D
+ for (const PropertyInfo &E : props) {
+ if (E.name == "config/texture") { // Particles2D
property = "config/texture";
break;
- } else if (E->get().name == "texture/texture") { // Polygon2D
+ } else if (E.name == "texture/texture") { // Polygon2D
property = "texture/texture";
break;
- } else if (E->get().name == "normal") { // TouchScreenButton
+ } else if (E.name == "normal") { // TouchScreenButton
property = "normal";
break;
}
diff --git a/editor/plugins/cpu_particles_2d_editor_plugin.cpp b/editor/plugins/cpu_particles_2d_editor_plugin.cpp
index c4deb296fb..7e0eb89359 100644
--- a/editor/plugins/cpu_particles_2d_editor_plugin.cpp
+++ b/editor/plugins/cpu_particles_2d_editor_plugin.cpp
@@ -253,8 +253,8 @@ CPUParticles2DEditorPlugin::CPUParticles2DEditorPlugin(EditorNode *p_node) {
file = memnew(EditorFileDialog);
List<String> ext;
ImageLoader::get_recognized_extensions(&ext);
- for (List<String>::Element *E = ext.front(); E; E = E->next()) {
- file->add_filter("*." + E->get() + "; " + E->get().to_upper());
+ for (String &E : ext) {
+ file->add_filter("*." + E + "; " + E.to_upper());
}
file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
toolbar->add_child(file);
diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp
index a233d66d82..19204e3bf8 100644
--- a/editor/plugins/editor_preview_plugins.cpp
+++ b/editor/plugins/editor_preview_plugins.cpp
@@ -490,11 +490,11 @@ Ref<Texture2D> EditorScriptPreviewPlugin::generate(const RES &p_from, const Size
Set<String> control_flow_keywords;
Set<String> keywords;
- for (List<String>::Element *E = kwors.front(); E; E = E->next()) {
- if (scr->get_language()->is_control_flow_keyword(E->get())) {
- control_flow_keywords.insert(E->get());
+ for (String &E : kwors) {
+ if (scr->get_language()->is_control_flow_keyword(E)) {
+ control_flow_keywords.insert(E);
} else {
- keywords.insert(E->get());
+ keywords.insert(E);
}
}
diff --git a/editor/plugins/gpu_particles_2d_editor_plugin.cpp b/editor/plugins/gpu_particles_2d_editor_plugin.cpp
index cc5793a1f9..4412d51077 100644
--- a/editor/plugins/gpu_particles_2d_editor_plugin.cpp
+++ b/editor/plugins/gpu_particles_2d_editor_plugin.cpp
@@ -361,8 +361,8 @@ GPUParticles2DEditorPlugin::GPUParticles2DEditorPlugin(EditorNode *p_node) {
file = memnew(EditorFileDialog);
List<String> ext;
ImageLoader::get_recognized_extensions(&ext);
- for (List<String>::Element *E = ext.front(); E; E = E->next()) {
- file->add_filter("*." + E->get() + "; " + E->get().to_upper());
+ for (String &E : ext) {
+ file->add_filter("*." + E + "; " + E.to_upper());
}
file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
toolbar->add_child(file);
diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp
index 7105d351b0..32d5865d0b 100644
--- a/editor/plugins/material_editor_plugin.cpp
+++ b/editor/plugins/material_editor_plugin.cpp
@@ -265,15 +265,15 @@ Ref<Resource> StandardMaterial3DConversionPlugin::convert(const Ref<Resource> &p
List<PropertyInfo> params;
RS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), &params);
- for (List<PropertyInfo>::Element *E = params.front(); E; E = E->next()) {
+ for (PropertyInfo &E : params) {
// Texture parameter has to be treated specially since StandardMaterial3D saved it
// as RID but ShaderMaterial needs Texture itself
- Ref<Texture2D> texture = mat->get_texture_by_name(E->get().name);
+ Ref<Texture2D> texture = mat->get_texture_by_name(E.name);
if (texture.is_valid()) {
- smat->set_shader_param(E->get().name, texture);
+ smat->set_shader_param(E.name, texture);
} else {
- Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E->get().name);
- smat->set_shader_param(E->get().name, value);
+ Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E.name);
+ smat->set_shader_param(E.name, value);
}
}
@@ -309,9 +309,9 @@ Ref<Resource> ParticlesMaterialConversionPlugin::convert(const Ref<Resource> &p_
List<PropertyInfo> params;
RS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), &params);
- for (List<PropertyInfo>::Element *E = params.front(); E; E = E->next()) {
- Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E->get().name);
- smat->set_shader_param(E->get().name, value);
+ for (PropertyInfo &E : params) {
+ Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E.name);
+ smat->set_shader_param(E.name, value);
}
smat->set_render_priority(mat->get_render_priority());
@@ -346,9 +346,9 @@ Ref<Resource> CanvasItemMaterialConversionPlugin::convert(const Ref<Resource> &p
List<PropertyInfo> params;
RS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), &params);
- for (List<PropertyInfo>::Element *E = params.front(); E; E = E->next()) {
- Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E->get().name);
- smat->set_shader_param(E->get().name, value);
+ for (PropertyInfo &E : params) {
+ Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E.name);
+ smat->set_shader_param(E.name, value);
}
smat->set_render_priority(mat->get_render_priority());
@@ -383,9 +383,9 @@ Ref<Resource> ProceduralSkyMaterialConversionPlugin::convert(const Ref<Resource>
List<PropertyInfo> params;
RS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), &params);
- for (List<PropertyInfo>::Element *E = params.front(); E; E = E->next()) {
- Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E->get().name);
- smat->set_shader_param(E->get().name, value);
+ for (PropertyInfo &E : params) {
+ Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E.name);
+ smat->set_shader_param(E.name, value);
}
smat->set_render_priority(mat->get_render_priority());
@@ -420,9 +420,9 @@ Ref<Resource> PanoramaSkyMaterialConversionPlugin::convert(const Ref<Resource> &
List<PropertyInfo> params;
RS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), &params);
- for (List<PropertyInfo>::Element *E = params.front(); E; E = E->next()) {
- Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E->get().name);
- smat->set_shader_param(E->get().name, value);
+ for (PropertyInfo &E : params) {
+ Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E.name);
+ smat->set_shader_param(E.name, value);
}
smat->set_render_priority(mat->get_render_priority());
@@ -457,9 +457,9 @@ Ref<Resource> PhysicalSkyMaterialConversionPlugin::convert(const Ref<Resource> &
List<PropertyInfo> params;
RS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), &params);
- for (List<PropertyInfo>::Element *E = params.front(); E; E = E->next()) {
- Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E->get().name);
- smat->set_shader_param(E->get().name, value);
+ for (PropertyInfo &E : params) {
+ Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E.name);
+ smat->set_shader_param(E.name, value);
}
smat->set_render_priority(mat->get_render_priority());
diff --git a/editor/plugins/mesh_instance_3d_editor_plugin.cpp b/editor/plugins/mesh_instance_3d_editor_plugin.cpp
index 91415f4883..9ee1fcb325 100644
--- a/editor/plugins/mesh_instance_3d_editor_plugin.cpp
+++ b/editor/plugins/mesh_instance_3d_editor_plugin.cpp
@@ -90,8 +90,8 @@ void MeshInstance3DEditor::_menu_option(int p_option) {
ur->create_action(TTR("Create Static Trimesh Body"));
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- MeshInstance3D *instance = Object::cast_to<MeshInstance3D>(E->get());
+ for (Node *E : selection) {
+ MeshInstance3D *instance = Object::cast_to<MeshInstance3D>(E);
if (!instance) {
continue;
}
diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp
index 15b6a0f3a0..b3f92c9d95 100644
--- a/editor/plugins/mesh_library_editor_plugin.cpp
+++ b/editor/plugins/mesh_library_editor_plugin.cpp
@@ -122,23 +122,23 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library,
List<uint32_t> shapes;
sb->get_shape_owners(&shapes);
- for (List<uint32_t>::Element *E = shapes.front(); E; E = E->next()) {
- if (sb->is_shape_owner_disabled(E->get())) {
+ for (uint32_t &E : shapes) {
+ if (sb->is_shape_owner_disabled(E)) {
continue;
}
- //Transform3D shape_transform = sb->shape_owner_get_transform(E->get());
+ //Transform3D shape_transform = sb->shape_owner_get_transform(E);
//shape_transform.set_origin(shape_transform.get_origin() - phys_offset);
- for (int k = 0; k < sb->shape_owner_get_shape_count(E->get()); k++) {
- Ref<Shape3D> collision = sb->shape_owner_get_shape(E->get(), k);
+ for (int k = 0; k < sb->shape_owner_get_shape_count(E); k++) {
+ Ref<Shape3D> collision = sb->shape_owner_get_shape(E, k);
if (!collision.is_valid()) {
continue;
}
MeshLibrary::ShapeData shape_data;
shape_data.shape = collision;
- shape_data.local_transform = sb->get_transform() * sb->shape_owner_get_transform(E->get());
+ shape_data.local_transform = sb->get_transform() * sb->shape_owner_get_transform(E);
collisions.push_back(shape_data);
}
}
diff --git a/editor/plugins/node_3d_editor_gizmos.cpp b/editor/plugins/node_3d_editor_gizmos.cpp
index 492ba51b8a..393aaff207 100644
--- a/editor/plugins/node_3d_editor_gizmos.cpp
+++ b/editor/plugins/node_3d_editor_gizmos.cpp
@@ -4013,8 +4013,7 @@ void CollisionObject3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
List<uint32_t> owners;
co->get_shape_owners(&owners);
- for (List<uint32_t>::Element *E = owners.front(); E; E = E->next()) {
- uint32_t owner_id = E->get();
+ for (uint32_t &owner_id : owners) {
Transform3D xform = co->shape_owner_get_transform(owner_id);
Object *owner = co->shape_owner_get_owner(owner_id);
// Exclude CollisionShape3D and CollisionPolygon3D as they have their gizmo.
@@ -4747,9 +4746,7 @@ void NavigationRegion3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
Vector3 *tw = tmeshfaces.ptrw();
int tidx = 0;
- for (List<Face3>::Element *E = faces.front(); E; E = E->next()) {
- const Face3 &f = E->get();
-
+ for (Face3 &f : faces) {
for (int j = 0; j < 3; j++) {
tw[tidx++] = f.vertex[j];
_EdgeKey ek;
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index ebf593e556..6292ef9f6a 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -1327,8 +1327,8 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
List<Node *> &selection = editor_selection->get_selected_node_list();
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- Node3D *sp = Object::cast_to<Node3D>(E->get());
+ for (Node *E : selection) {
+ Node3D *sp = Object::cast_to<Node3D>(E);
if (!sp) {
continue;
}
@@ -1771,8 +1771,8 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
String::num(motion_snapped.y, snap_step_decimals) + ", " + String::num(motion_snapped.z, snap_step_decimals) + ")");
List<Node *> &selection = editor_selection->get_selected_node_list();
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- Node3D *sp = Object::cast_to<Node3D>(E->get());
+ for (Node *E : selection) {
+ Node3D *sp = Object::cast_to<Node3D>(E);
if (!sp) {
continue;
}
@@ -1870,8 +1870,8 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
String::num(motion_snapped.y, snap_step_decimals) + ", " + String::num(motion_snapped.z, snap_step_decimals) + ")");
List<Node *> &selection = editor_selection->get_selected_node_list();
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- Node3D *sp = Object::cast_to<Node3D>(E->get());
+ for (Node *E : selection) {
+ Node3D *sp = Object::cast_to<Node3D>(E);
if (!sp) {
continue;
}
@@ -1955,8 +1955,8 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
bool local_coords = (spatial_editor->are_local_coords_enabled() && _edit.plane != TRANSFORM_VIEW); // Disable local transformation for TRANSFORM_VIEW
List<Node *> &selection = editor_selection->get_selected_node_list();
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- Node3D *sp = Object::cast_to<Node3D>(E->get());
+ for (Node *E : selection) {
+ Node3D *sp = Object::cast_to<Node3D>(E);
if (!sp) {
continue;
}
@@ -2186,8 +2186,8 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
List<Node *> &selection = editor_selection->get_selected_node_list();
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- Node3D *sp = Object::cast_to<Node3D>(E->get());
+ for (Node *E : selection) {
+ Node3D *sp = Object::cast_to<Node3D>(E);
if (!sp) {
continue;
}
@@ -3052,8 +3052,8 @@ void Node3DEditorViewport::_menu_option(int p_option) {
undo_redo->create_action(TTR("Align Transform with View"));
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- Node3D *sp = Object::cast_to<Node3D>(E->get());
+ for (Node *E : selection) {
+ Node3D *sp = Object::cast_to<Node3D>(E);
if (!sp) {
continue;
}
@@ -3088,8 +3088,8 @@ void Node3DEditorViewport::_menu_option(int p_option) {
List<Node *> &selection = editor_selection->get_selected_node_list();
undo_redo->create_action(TTR("Align Rotation with View"));
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- Node3D *sp = Object::cast_to<Node3D>(E->get());
+ for (Node *E : selection) {
+ Node3D *sp = Object::cast_to<Node3D>(E);
if (!sp) {
continue;
}
@@ -3741,8 +3741,8 @@ void Node3DEditorViewport::focus_selection() {
List<Node *> &selection = editor_selection->get_selected_node_list();
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- Node3D *sp = Object::cast_to<Node3D>(E->get());
+ for (Node *E : selection) {
+ Node3D *sp = Object::cast_to<Node3D>(E);
if (!sp) {
continue;
}
@@ -5176,8 +5176,8 @@ void Node3DEditor::_xform_dialog_action() {
List<Node *> &selection = editor_selection->get_selected_node_list();
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- Node3D *sp = Object::cast_to<Node3D>(E->get());
+ for (Node *E : selection) {
+ Node3D *sp = Object::cast_to<Node3D>(E);
if (!sp) {
continue;
}
@@ -5413,8 +5413,8 @@ void Node3DEditor::_menu_item_pressed(int p_option) {
List<Node *> &selection = editor_selection->get_selected_node_list();
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- Node3D *spatial = Object::cast_to<Node3D>(E->get());
+ for (Node *E : selection) {
+ Node3D *spatial = Object::cast_to<Node3D>(E);
if (!spatial || !spatial->is_inside_tree()) {
continue;
}
@@ -5438,8 +5438,8 @@ void Node3DEditor::_menu_item_pressed(int p_option) {
List<Node *> &selection = editor_selection->get_selected_node_list();
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- Node3D *spatial = Object::cast_to<Node3D>(E->get());
+ for (Node *E : selection) {
+ Node3D *spatial = Object::cast_to<Node3D>(E);
if (!spatial || !spatial->is_inside_tree()) {
continue;
}
@@ -5463,8 +5463,8 @@ void Node3DEditor::_menu_item_pressed(int p_option) {
List<Node *> &selection = editor_selection->get_selected_node_list();
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- Node3D *spatial = Object::cast_to<Node3D>(E->get());
+ for (Node *E : selection) {
+ Node3D *spatial = Object::cast_to<Node3D>(E);
if (!spatial || !spatial->is_inside_tree()) {
continue;
}
@@ -5487,8 +5487,8 @@ void Node3DEditor::_menu_item_pressed(int p_option) {
undo_redo->create_action(TTR("Ungroup Selected"));
List<Node *> &selection = editor_selection->get_selected_node_list();
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- Node3D *spatial = Object::cast_to<Node3D>(E->get());
+ for (Node *E : selection) {
+ Node3D *spatial = Object::cast_to<Node3D>(E);
if (!spatial || !spatial->is_inside_tree()) {
continue;
}
@@ -6243,14 +6243,14 @@ void Node3DEditor::_refresh_menu_icons() {
all_locked = false;
all_grouped = false;
} else {
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- if (Object::cast_to<Node3D>(E->get()) && !Object::cast_to<Node3D>(E->get())->has_meta("_edit_lock_")) {
+ for (Node *E : selection) {
+ if (Object::cast_to<Node3D>(E) && !Object::cast_to<Node3D>(E)->has_meta("_edit_lock_")) {
all_locked = false;
break;
}
}
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- if (Object::cast_to<Node3D>(E->get()) && !Object::cast_to<Node3D>(E->get())->has_meta("_edit_group_")) {
+ for (Node *E : selection) {
+ if (Object::cast_to<Node3D>(E) && !Object::cast_to<Node3D>(E)->has_meta("_edit_group_")) {
all_grouped = false;
break;
}
@@ -6303,8 +6303,8 @@ void Node3DEditor::snap_selected_nodes_to_floor() {
List<Node *> &selection = editor_selection->get_selected_node_list();
Dictionary snap_data;
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- Node3D *sp = Object::cast_to<Node3D>(E->get());
+ for (Node *E : selection) {
+ Node3D *sp = Object::cast_to<Node3D>(E);
if (sp) {
Vector3 from = Vector3();
Vector3 position_offset = Vector3();
diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp
index e099c8b5fd..0cb5a2e1e4 100644
--- a/editor/plugins/resource_preloader_editor_plugin.cpp
+++ b/editor/plugins/resource_preloader_editor_plugin.cpp
@@ -181,21 +181,21 @@ void ResourcePreloaderEditor::_update_library() {
preloader->get_resource_list(&rnames);
List<String> names;
- for (List<StringName>::Element *E = rnames.front(); E; E = E->next()) {
- names.push_back(E->get());
+ for (StringName &E : rnames) {
+ names.push_back(E);
}
names.sort();
- for (List<String>::Element *E = names.front(); E; E = E->next()) {
+ for (String &E : names) {
TreeItem *ti = tree->create_item(root);
ti->set_cell_mode(0, TreeItem::CELL_MODE_STRING);
ti->set_editable(0, true);
ti->set_selectable(0, true);
- ti->set_text(0, E->get());
- ti->set_metadata(0, E->get());
+ ti->set_text(0, E);
+ ti->set_metadata(0, E);
- RES r = preloader->get_resource(E->get());
+ RES r = preloader->get_resource(E);
ERR_CONTINUE(r.is_null());
diff --git a/editor/plugins/root_motion_editor_plugin.cpp b/editor/plugins/root_motion_editor_plugin.cpp
index cea76f5233..95e23d0c57 100644
--- a/editor/plugins/root_motion_editor_plugin.cpp
+++ b/editor/plugins/root_motion_editor_plugin.cpp
@@ -70,8 +70,8 @@ void EditorPropertyRootMotion::_node_assign() {
List<StringName> animations;
player->get_animation_list(&animations);
- for (List<StringName>::Element *E = animations.front(); E; E = E->next()) {
- Ref<Animation> anim = player->get_animation(E->get());
+ for (StringName &E : animations) {
+ Ref<Animation> anim = player->get_animation(E);
for (int i = 0; i < anim->get_track_count(); i++) {
paths.insert(anim->track_get_path(i));
}
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 1851ffdc34..ab783c87e9 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -103,8 +103,8 @@ void EditorStandardSyntaxHighlighter::_update_cache() {
const Color type_color = EDITOR_GET("text_editor/highlighting/engine_type_color");
List<StringName> types;
ClassDB::get_class_list(&types);
- for (List<StringName>::Element *E = types.front(); E; E = E->next()) {
- String n = E->get();
+ for (StringName &E : types) {
+ String n = E;
if (n.begins_with("_")) {
n = n.substr(1, n.length());
}
@@ -115,8 +115,8 @@ void EditorStandardSyntaxHighlighter::_update_cache() {
const Color usertype_color = EDITOR_GET("text_editor/highlighting/user_type_color");
List<StringName> global_classes;
ScriptServer::get_global_class_list(&global_classes);
- for (List<StringName>::Element *E = global_classes.front(); E; E = E->next()) {
- highlighter->add_keyword_color(E->get(), usertype_color);
+ for (StringName &E : global_classes) {
+ highlighter->add_keyword_color(E, usertype_color);
}
/* Autoloads. */
@@ -134,8 +134,8 @@ void EditorStandardSyntaxHighlighter::_update_cache() {
const Color basetype_color = EDITOR_GET("text_editor/highlighting/base_type_color");
List<String> core_types;
script->get_language()->get_core_type_words(&core_types);
- for (List<String>::Element *E = core_types.front(); E; E = E->next()) {
- highlighter->add_keyword_color(E->get(), basetype_color);
+ for (String &E : core_types) {
+ highlighter->add_keyword_color(E, basetype_color);
}
/* Reserved words. */
@@ -143,11 +143,11 @@ void EditorStandardSyntaxHighlighter::_update_cache() {
const Color control_flow_keyword_color = EDITOR_GET("text_editor/highlighting/control_flow_keyword_color");
List<String> keywords;
script->get_language()->get_reserved_words(&keywords);
- for (List<String>::Element *E = keywords.front(); E; E = E->next()) {
- if (script->get_language()->is_control_flow_keyword(E->get())) {
- highlighter->add_keyword_color(E->get(), control_flow_keyword_color);
+ for (String &E : keywords) {
+ if (script->get_language()->is_control_flow_keyword(E)) {
+ highlighter->add_keyword_color(E, control_flow_keyword_color);
} else {
- highlighter->add_keyword_color(E->get(), keyword_color);
+ highlighter->add_keyword_color(E, keyword_color);
}
}
@@ -157,9 +157,9 @@ void EditorStandardSyntaxHighlighter::_update_cache() {
if (instance_base != StringName()) {
List<PropertyInfo> plist;
ClassDB::get_property_list(instance_base, &plist);
- for (List<PropertyInfo>::Element *E = plist.front(); E; E = E->next()) {
- String name = E->get().name;
- if (E->get().usage & PROPERTY_USAGE_CATEGORY || E->get().usage & PROPERTY_USAGE_GROUP || E->get().usage & PROPERTY_USAGE_SUBGROUP) {
+ for (PropertyInfo &E : plist) {
+ String name = E.name;
+ if (E.usage & PROPERTY_USAGE_CATEGORY || E.usage & PROPERTY_USAGE_GROUP || E.usage & PROPERTY_USAGE_SUBGROUP) {
continue;
}
if (name.find("/") != -1) {
@@ -170,8 +170,8 @@ void EditorStandardSyntaxHighlighter::_update_cache() {
List<String> clist;
ClassDB::get_integer_constant_list(instance_base, &clist);
- for (List<String>::Element *E = clist.front(); E; E = E->next()) {
- highlighter->add_member_keyword_color(E->get(), member_variable_color);
+ for (String &E : clist) {
+ highlighter->add_member_keyword_color(E, member_variable_color);
}
}
@@ -179,8 +179,7 @@ void EditorStandardSyntaxHighlighter::_update_cache() {
const Color comment_color = EDITOR_GET("text_editor/highlighting/comment_color");
List<String> comments;
script->get_language()->get_comment_delimiters(&comments);
- for (List<String>::Element *E = comments.front(); E; E = E->next()) {
- String comment = E->get();
+ for (String &comment : comments) {
String beg = comment.get_slice(" ", 0);
String end = comment.get_slice_count(" ") > 1 ? comment.get_slice(" ", 1) : String();
highlighter->add_color_region(beg, end, comment_color, end == "");
@@ -190,8 +189,7 @@ void EditorStandardSyntaxHighlighter::_update_cache() {
const Color string_color = EDITOR_GET("text_editor/highlighting/string_color");
List<String> strings;
script->get_language()->get_string_delimiters(&strings);
- for (List<String>::Element *E = strings.front(); E; E = E->next()) {
- String string = E->get();
+ for (String &string : strings) {
String beg = string.get_slice(" ", 0);
String end = string.get_slice_count(" ") > 1 ? string.get_slice(" ", 1) : String();
highlighter->add_color_region(beg, end, string_color, end == "");
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 1a6dfa273e..f9a0f307c3 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -50,9 +50,7 @@ void ConnectionInfoDialog::popup_connections(String p_method, Vector<Node *> p_n
List<Connection> all_connections;
p_nodes[i]->get_signals_connected_to_this(&all_connections);
- for (List<Connection>::Element *E = all_connections.front(); E; E = E->next()) {
- Connection connection = E->get();
-
+ for (Connection &connection : all_connections) {
if (connection.callable.get_method() != p_method) {
continue;
}
@@ -116,8 +114,8 @@ Vector<String> ScriptTextEditor::get_functions() {
if (script->get_language()->validate(text, script->get_path(), &fnc)) {
//if valid rewrite functions to latest
functions.clear();
- for (List<String>::Element *E = fnc.front(); E; E = E->next()) {
- functions.push_back(E->get());
+ for (String &E : fnc) {
+ functions.push_back(E);
}
}
@@ -203,8 +201,7 @@ void ScriptTextEditor::_set_theme_for_script() {
List<String> strings;
script->get_language()->get_string_delimiters(&strings);
text_edit->clear_string_delimiters();
- for (List<String>::Element *E = strings.front(); E; E = E->next()) {
- String string = E->get();
+ for (String &string : strings) {
String beg = string.get_slice(" ", 0);
String end = string.get_slice_count(" ") > 1 ? string.get_slice(" ", 1) : String();
text_edit->add_string_delimiter(beg, end, end == "");
@@ -213,8 +210,7 @@ void ScriptTextEditor::_set_theme_for_script() {
List<String> comments;
script->get_language()->get_comment_delimiters(&comments);
text_edit->clear_comment_delimiters();
- for (List<String>::Element *E = comments.front(); E; E = E->next()) {
- String comment = E->get();
+ for (String &comment : comments) {
String beg = comment.get_slice(" ", 0);
String end = comment.get_slice_count(" ") > 1 ? comment.get_slice(" ", 1) : String();
text_edit->add_comment_delimiter(beg, end, end == "");
@@ -417,8 +413,8 @@ void ScriptTextEditor::_validate_script() {
}
functions.clear();
- for (List<String>::Element *E = fnc.front(); E; E = E->next()) {
- functions.push_back(E->get());
+ for (String &E : fnc) {
+ functions.push_back(E);
}
script_is_valid = true;
}
@@ -432,9 +428,7 @@ void ScriptTextEditor::_validate_script() {
Node *base = get_tree()->get_edited_scene_root();
if (base && missing_connections.size() > 0) {
warnings_panel->push_table(1);
- for (List<Connection>::Element *E = missing_connections.front(); E; E = E->next()) {
- Connection connection = E->get();
-
+ for (Connection &connection : missing_connections) {
String base_path = base->get_name();
String source_path = base == connection.signal.get_object() ? base_path : base_path + "/" + base->get_path_to(Object::cast_to<Node>(connection.signal.get_object()));
String target_path = base == connection.callable.get_object() ? base_path : base_path + "/" + base->get_path_to(Object::cast_to<Node>(connection.callable.get_object()));
@@ -456,9 +450,7 @@ void ScriptTextEditor::_validate_script() {
// Add script warnings.
warnings_panel->push_table(3);
- for (List<ScriptLanguage::Warning>::Element *E = warnings.front(); E; E = E->next()) {
- ScriptLanguage::Warning w = E->get();
-
+ for (ScriptLanguage::Warning &w : warnings) {
Dictionary ignore_meta;
ignore_meta["line"] = w.start_line;
ignore_meta["code"] = w.string_code.to_lower();
@@ -488,9 +480,7 @@ void ScriptTextEditor::_validate_script() {
errors_panel->clear();
errors_panel->push_table(2);
- for (List<ScriptLanguage::ScriptError>::Element *E = errors.front(); E; E = E->next()) {
- ScriptLanguage::ScriptError err = E->get();
-
+ for (ScriptLanguage::ScriptError &err : errors) {
errors_panel->push_cell();
errors_panel->push_meta(err.line - 1);
errors_panel->push_color(warnings_panel->get_theme_color(SNAME("error_color"), SNAME("Editor")));
@@ -511,8 +501,8 @@ void ScriptTextEditor::_validate_script() {
if (errors.is_empty()) {
te->set_line_background_color(i, Color(0, 0, 0, 0));
} else {
- for (List<ScriptLanguage::ScriptError>::Element *E = errors.front(); E; E = E->next()) {
- bool error_line = i == E->get().line - 1;
+ for (ScriptLanguage::ScriptError &E : errors) {
+ bool error_line = i == E.line - 1;
te->set_line_background_color(i, error_line ? marked_line_color : Color(0, 0, 0, 0));
if (error_line) {
break;
@@ -910,8 +900,7 @@ void ScriptTextEditor::_update_connected_methods() {
List<Connection> connections;
nodes[i]->get_signals_connected_to_this(&connections);
- for (List<Connection>::Element *E = connections.front(); E; E = E->next()) {
- Connection connection = E->get();
+ for (Connection &connection : connections) {
if (!(connection.flags & CONNECT_PERSIST)) {
continue;
}
@@ -1286,8 +1275,7 @@ void ScriptTextEditor::_edit_option_toggle_inline_comment() {
List<String> comment_delimiters;
script->get_language()->get_comment_delimiters(&comment_delimiters);
- for (List<String>::Element *E = comment_delimiters.front(); E; E = E->next()) {
- String script_delimiter = E->get();
+ for (String &script_delimiter : comment_delimiters) {
if (script_delimiter.find(" ") == -1) {
delimiter = script_delimiter;
break;
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index 0d65dec87b..6c589ee07c 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -118,11 +118,11 @@ void ShaderTextEditor::_load_theme_settings() {
const Color keyword_color = EDITOR_GET("text_editor/highlighting/keyword_color");
const Color control_flow_keyword_color = EDITOR_GET("text_editor/highlighting/control_flow_keyword_color");
- for (List<String>::Element *E = keywords.front(); E; E = E->next()) {
- if (ShaderLanguage::is_control_flow_keyword(E->get())) {
- syntax_highlighter->add_keyword_color(E->get(), control_flow_keyword_color);
+ for (String &E : keywords) {
+ if (ShaderLanguage::is_control_flow_keyword(E)) {
+ syntax_highlighter->add_keyword_color(E, control_flow_keyword_color);
} else {
- syntax_highlighter->add_keyword_color(E->get(), keyword_color);
+ syntax_highlighter->add_keyword_color(E, keyword_color);
}
}
@@ -144,8 +144,8 @@ void ShaderTextEditor::_load_theme_settings() {
const Color member_variable_color = EDITOR_GET("text_editor/highlighting/member_variable_color");
- for (List<String>::Element *E = built_ins.front(); E; E = E->next()) {
- syntax_highlighter->add_keyword_color(E->get(), member_variable_color);
+ for (String &E : built_ins) {
+ syntax_highlighter->add_keyword_color(E, member_variable_color);
}
// Colorize comments.
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index 9bb8fbacbb..486a40a4fd 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -365,8 +365,8 @@ void SpriteFramesEditor::_file_load_request(const Vector<String> &p_path, int p_
int count = 0;
- for (List<Ref<Texture2D>>::Element *E = resources.front(); E; E = E->next()) {
- undo_redo->add_do_method(frames, "add_frame", edited_anim, E->get(), p_at_pos == -1 ? -1 : p_at_pos + count);
+ for (Ref<Texture2D> &E : resources) {
+ undo_redo->add_do_method(frames, "add_frame", edited_anim, E, p_at_pos == -1 ? -1 : p_at_pos + count);
undo_redo->add_undo_method(frames, "remove_frame", edited_anim, p_at_pos == -1 ? fc : p_at_pos);
count++;
}
@@ -624,10 +624,10 @@ void SpriteFramesEditor::_animation_name_edited() {
undo_redo->add_do_method(frames, "rename_animation", edited_anim, name);
undo_redo->add_undo_method(frames, "rename_animation", name, edited_anim);
- for (List<Node *>::Element *E = nodes.front(); E; E = E->next()) {
- String current = E->get()->call("get_animation");
- undo_redo->add_do_method(E->get(), "set_animation", name);
- undo_redo->add_undo_method(E->get(), "set_animation", edited_anim);
+ for (Node *E : nodes) {
+ String current = E->call("get_animation");
+ undo_redo->add_do_method(E, "set_animation", name);
+ undo_redo->add_undo_method(E, "set_animation", edited_anim);
}
undo_redo->add_do_method(this, "_update_library");
@@ -655,10 +655,10 @@ void SpriteFramesEditor::_animation_add() {
undo_redo->add_do_method(this, "_update_library");
undo_redo->add_undo_method(this, "_update_library");
- for (List<Node *>::Element *E = nodes.front(); E; E = E->next()) {
- String current = E->get()->call("get_animation");
- undo_redo->add_do_method(E->get(), "set_animation", name);
- undo_redo->add_undo_method(E->get(), "set_animation", current);
+ for (Node *E : nodes) {
+ String current = E->call("get_animation");
+ undo_redo->add_do_method(E, "set_animation", name);
+ undo_redo->add_undo_method(E, "set_animation", current);
}
edited_anim = name;
@@ -788,8 +788,8 @@ void SpriteFramesEditor::_update_library(bool p_skip_selector) {
anim_names.sort_custom<StringName::AlphCompare>();
- for (List<StringName>::Element *E = anim_names.front(); E; E = E->next()) {
- String name = E->get();
+ for (StringName &E : anim_names) {
+ String name = E;
TreeItem *it = animations->create_item(anim_root);
@@ -798,7 +798,7 @@ void SpriteFramesEditor::_update_library(bool p_skip_selector) {
it->set_text(0, name);
it->set_editable(0, true);
- if (E->get() == edited_anim) {
+ if (E == edited_anim) {
it->select(0);
}
}
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index e323f1571d..34227ee894 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -144,8 +144,7 @@ void TextureRegionEditor::_region_draw() {
}
}
} else if (snap_mode == SNAP_AUTOSLICE) {
- for (List<Rect2>::Element *E = autoslice_cache.front(); E; E = E->next()) {
- Rect2 r = E->get();
+ for (Rect2 &r : autoslice_cache) {
Vector2 endpoints[4] = {
mtx.basis_xform(r.position),
mtx.basis_xform(r.position + Vector2(r.size.x, 0)),
@@ -328,9 +327,9 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
}
if (edited_margin < 0 && snap_mode == SNAP_AUTOSLICE) {
Vector2 point = mtx.affine_inverse().xform(Vector2(mb->get_position().x, mb->get_position().y));
- for (List<Rect2>::Element *E = autoslice_cache.front(); E; E = E->next()) {
- if (E->get().has_point(point)) {
- rect = E->get();
+ for (Rect2 &E : autoslice_cache) {
+ if (E.has_point(point)) {
+ rect = E;
if (Input::get_singleton()->is_key_pressed(KEY_CTRL) && !(Input::get_singleton()->is_key_pressed(KEY_SHIFT | KEY_ALT))) {
Rect2 r;
if (node_sprite) {
@@ -749,12 +748,12 @@ void TextureRegionEditor::_update_autoslice() {
for (int x = 0; x < texture->get_width(); x++) {
if (texture->is_pixel_opaque(x, y)) {
bool found = false;
- for (List<Rect2>::Element *E = autoslice_cache.front(); E; E = E->next()) {
- Rect2 grown = E->get().grow(1.5);
+ for (Rect2 &E : autoslice_cache) {
+ Rect2 grown = E.grow(1.5);
if (grown.has_point(Point2(x, y))) {
- E->get().expand_to(Point2(x, y));
- E->get().expand_to(Point2(x + 1, y + 1));
- x = E->get().position.x + E->get().size.x - 1;
+ E.expand_to(Point2(x, y));
+ E.expand_to(Point2(x + 1, y + 1));
+ x = E.position.x + E.size.x - 1;
bool merged = true;
while (merged) {
merged = false;
@@ -764,12 +763,12 @@ void TextureRegionEditor::_update_autoslice() {
autoslice_cache.erase(F->prev());
queue_erase = false;
}
- if (F == E) {
+ if (F->get() == E) {
continue;
}
- if (E->get().grow(1).intersects(F->get())) {
- E->get().expand_to(F->get().position);
- E->get().expand_to(F->get().position + F->get().size);
+ if (E.grow(1).intersects(F->get())) {
+ E.expand_to(F->get().position);
+ E.expand_to(F->get().position + F->get().size);
if (F->prev()) {
F = F->prev();
autoslice_cache.erase(F->next());
diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp
index 9338ea6ddd..991c298caa 100644
--- a/editor/plugins/theme_editor_plugin.cpp
+++ b/editor/plugins/theme_editor_plugin.cpp
@@ -65,8 +65,8 @@ void ThemeItemImportTree::_update_items_tree() {
tree_icon_items.clear();
tree_stylebox_items.clear();
- for (List<StringName>::Element *E = types.front(); E; E = E->next()) {
- String type_name = (String)E->get();
+ for (StringName &E : types) {
+ String type_name = (String)E;
TreeItem *type_node = import_items_tree->create_item(root);
type_node->set_meta("_can_be_imported", false);
@@ -89,12 +89,12 @@ void ThemeItemImportTree::_update_items_tree() {
names.clear();
filtered_names.clear();
- base_theme->get_theme_item_list(dt, E->get(), &names);
+ base_theme->get_theme_item_list(dt, E, &names);
bool data_type_has_filtered_items = false;
- for (List<StringName>::Element *F = names.front(); F; F = F->next()) {
- String item_name = (String)F->get();
+ for (StringName &F : names) {
+ String item_name = (String)F;
bool is_item_matching_filter = (item_name.findn(filter_text) > -1);
if (!filter_text.is_empty() && !is_matching_filter && !is_item_matching_filter) {
continue;
@@ -105,7 +105,7 @@ void ThemeItemImportTree::_update_items_tree() {
has_filtered_items = true;
data_type_has_filtered_items = true;
}
- filtered_names.push_back(F->get());
+ filtered_names.push_back(F);
}
if (filtered_names.size() == 0) {
@@ -182,10 +182,10 @@ void ThemeItemImportTree::_update_items_tree() {
bool data_type_any_checked_with_data = false;
filtered_names.sort_custom<StringName::AlphCompare>();
- for (List<StringName>::Element *F = filtered_names.front(); F; F = F->next()) {
+ for (StringName &F : filtered_names) {
TreeItem *item_node = import_items_tree->create_item(data_type_node);
item_node->set_meta("_can_be_imported", true);
- item_node->set_text(0, F->get());
+ item_node->set_text(0, F);
item_node->set_cell_mode(IMPORT_ITEM, TreeItem::CELL_MODE_CHECK);
item_node->set_checked(IMPORT_ITEM, false);
item_node->set_editable(IMPORT_ITEM, true);
@@ -1236,16 +1236,16 @@ void ThemeItemEditorDialog::_update_edit_types() {
bool item_reselected = false;
edit_type_list->clear();
int e_idx = 0;
- for (List<StringName>::Element *E = theme_types.front(); E; E = E->next()) {
+ for (StringName &E : theme_types) {
Ref<Texture2D> item_icon;
- if (E->get() == "") {
+ if (E == "") {
item_icon = get_theme_icon(SNAME("NodeDisabled"), SNAME("EditorIcons"));
} else {
- item_icon = EditorNode::get_singleton()->get_class_icon(E->get(), "NodeDisabled");
+ item_icon = EditorNode::get_singleton()->get_class_icon(E, "NodeDisabled");
}
- edit_type_list->add_item(E->get(), item_icon);
+ edit_type_list->add_item(E, item_icon);
- if (E->get() == edited_item_type) {
+ if (E == edited_item_type) {
edit_type_list->select(e_idx);
item_reselected = true;
}
@@ -1318,9 +1318,9 @@ void ThemeItemEditorDialog::_update_edit_item_tree(String p_item_type) {
color_root->add_button(0, get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_DATA_TYPE, false, TTR("Remove All Color Items"));
names.sort_custom<StringName::AlphCompare>();
- for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
+ for (StringName &E : names) {
TreeItem *item = edit_items_tree->create_item(color_root);
- item->set_text(0, E->get());
+ item->set_text(0, E);
item->add_button(0, get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")), ITEMS_TREE_RENAME_ITEM, false, TTR("Rename Item"));
item->add_button(0, get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_ITEM, false, TTR("Remove Item"));
}
@@ -1339,9 +1339,9 @@ void ThemeItemEditorDialog::_update_edit_item_tree(String p_item_type) {
constant_root->add_button(0, get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_DATA_TYPE, false, TTR("Remove All Constant Items"));
names.sort_custom<StringName::AlphCompare>();
- for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
+ for (StringName &E : names) {
TreeItem *item = edit_items_tree->create_item(constant_root);
- item->set_text(0, E->get());
+ item->set_text(0, E);
item->add_button(0, get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")), ITEMS_TREE_RENAME_ITEM, false, TTR("Rename Item"));
item->add_button(0, get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_ITEM, false, TTR("Remove Item"));
}
@@ -1360,9 +1360,9 @@ void ThemeItemEditorDialog::_update_edit_item_tree(String p_item_type) {
font_root->add_button(0, get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_DATA_TYPE, false, TTR("Remove All Font Items"));
names.sort_custom<StringName::AlphCompare>();
- for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
+ for (StringName &E : names) {
TreeItem *item = edit_items_tree->create_item(font_root);
- item->set_text(0, E->get());
+ item->set_text(0, E);
item->add_button(0, get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")), ITEMS_TREE_RENAME_ITEM, false, TTR("Rename Item"));
item->add_button(0, get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_ITEM, false, TTR("Remove Item"));
}
@@ -1381,9 +1381,9 @@ void ThemeItemEditorDialog::_update_edit_item_tree(String p_item_type) {
font_size_root->add_button(0, get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_DATA_TYPE, false, TTR("Remove All Font Size Items"));
names.sort_custom<StringName::AlphCompare>();
- for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
+ for (StringName &E : names) {
TreeItem *item = edit_items_tree->create_item(font_size_root);
- item->set_text(0, E->get());
+ item->set_text(0, E);
item->add_button(0, get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")), ITEMS_TREE_RENAME_ITEM, false, TTR("Rename Item"));
item->add_button(0, get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_ITEM, false, TTR("Remove Item"));
}
@@ -1402,9 +1402,9 @@ void ThemeItemEditorDialog::_update_edit_item_tree(String p_item_type) {
icon_root->add_button(0, get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_DATA_TYPE, false, TTR("Remove All Icon Items"));
names.sort_custom<StringName::AlphCompare>();
- for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
+ for (StringName &E : names) {
TreeItem *item = edit_items_tree->create_item(icon_root);
- item->set_text(0, E->get());
+ item->set_text(0, E);
item->add_button(0, get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")), ITEMS_TREE_RENAME_ITEM, false, TTR("Rename Item"));
item->add_button(0, get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_ITEM, false, TTR("Remove Item"));
}
@@ -1423,9 +1423,9 @@ void ThemeItemEditorDialog::_update_edit_item_tree(String p_item_type) {
stylebox_root->add_button(0, get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_DATA_TYPE, false, TTR("Remove All StyleBox Items"));
names.sort_custom<StringName::AlphCompare>();
- for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
+ for (StringName &E : names) {
TreeItem *item = edit_items_tree->create_item(stylebox_root);
- item->set_text(0, E->get());
+ item->set_text(0, E);
item->add_button(0, get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")), ITEMS_TREE_RENAME_ITEM, false, TTR("Rename Item"));
item->add_button(0, get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_ITEM, false, TTR("Remove Item"));
}
@@ -1507,8 +1507,8 @@ void ThemeItemEditorDialog::_remove_data_type_items(Theme::DataType p_data_type,
edited_theme->_freeze_change_propagation();
edited_theme->get_theme_item_list(p_data_type, p_item_type, &names);
- for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
- edited_theme->clear_theme_item(p_data_type, E->get(), p_item_type);
+ for (StringName &E : names) {
+ edited_theme->clear_theme_item(p_data_type, E, p_item_type);
}
// Allow changes to be reported now that the operation is finished.
@@ -1526,9 +1526,9 @@ void ThemeItemEditorDialog::_remove_class_items() {
names.clear();
Theme::get_default()->get_theme_item_list(data_type, edited_item_type, &names);
- for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
- if (edited_theme->has_theme_item_nocheck(data_type, E->get(), edited_item_type)) {
- edited_theme->clear_theme_item(data_type, E->get(), edited_item_type);
+ for (StringName &E : names) {
+ if (edited_theme->has_theme_item_nocheck(data_type, E, edited_item_type)) {
+ edited_theme->clear_theme_item(data_type, E, edited_item_type);
}
}
}
@@ -1550,9 +1550,9 @@ void ThemeItemEditorDialog::_remove_custom_items() {
names.clear();
edited_theme->get_theme_item_list(data_type, edited_item_type, &names);
- for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
- if (!Theme::get_default()->has_theme_item_nocheck(data_type, E->get(), edited_item_type)) {
- edited_theme->clear_theme_item(data_type, E->get(), edited_item_type);
+ for (StringName &E : names) {
+ if (!Theme::get_default()->has_theme_item_nocheck(data_type, E, edited_item_type)) {
+ edited_theme->clear_theme_item(data_type, E, edited_item_type);
}
}
}
@@ -1574,8 +1574,8 @@ void ThemeItemEditorDialog::_remove_all_items() {
names.clear();
edited_theme->get_theme_item_list(data_type, edited_item_type, &names);
- for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
- edited_theme->clear_theme_item(data_type, E->get(), edited_item_type);
+ for (StringName &E : names) {
+ edited_theme->clear_theme_item(data_type, E, edited_item_type);
}
}
@@ -1927,8 +1927,8 @@ ThemeItemEditorDialog::ThemeItemEditorDialog() {
import_another_theme_dialog->set_title(TTR("Select Another Theme Resource:"));
List<String> ext;
ResourceLoader::get_recognized_extensions_for_type("Theme", &ext);
- for (List<String>::Element *E = ext.front(); E; E = E->next()) {
- import_another_theme_dialog->add_filter("*." + E->get() + "; Theme Resource");
+ for (String &E : ext) {
+ import_another_theme_dialog->add_filter("*." + E + "; Theme Resource");
}
import_another_file_hb->add_child(import_another_theme_dialog);
import_another_theme_dialog->connect("file_selected", callable_mp(this, &ThemeItemEditorDialog::_select_another_theme_cbk));
@@ -1969,26 +1969,26 @@ void ThemeTypeDialog::_update_add_type_options(const String &p_filter) {
names.sort_custom<StringName::AlphCompare>();
Vector<StringName> unique_names;
- for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
+ for (StringName &E : names) {
// Filter out undesired values.
- if (!p_filter.is_subsequence_ofi(String(E->get()))) {
+ if (!p_filter.is_subsequence_ofi(String(E))) {
continue;
}
// Skip duplicate values.
- if (unique_names.has(E->get())) {
+ if (unique_names.has(E)) {
continue;
}
- unique_names.append(E->get());
+ unique_names.append(E);
Ref<Texture2D> item_icon;
- if (E->get() == "") {
+ if (E == "") {
item_icon = get_theme_icon(SNAME("NodeDisabled"), SNAME("EditorIcons"));
} else {
- item_icon = EditorNode::get_singleton()->get_class_icon(E->get(), "NodeDisabled");
+ item_icon = EditorNode::get_singleton()->get_class_icon(E, "NodeDisabled");
}
- add_type_options->add_item(E->get(), item_icon);
+ add_type_options->add_item(E, item_icon);
}
}
@@ -2132,16 +2132,16 @@ void ThemeTypeEditor::_update_type_list() {
bool item_reselected = false;
int e_idx = 0;
- for (List<StringName>::Element *E = theme_types.front(); E; E = E->next()) {
+ for (StringName &E : theme_types) {
Ref<Texture2D> item_icon;
- if (E->get() == "") {
+ if (E == "") {
item_icon = get_theme_icon(SNAME("NodeDisabled"), SNAME("EditorIcons"));
} else {
- item_icon = EditorNode::get_singleton()->get_class_icon(E->get(), "NodeDisabled");
+ item_icon = EditorNode::get_singleton()->get_class_icon(E, "NodeDisabled");
}
- theme_type_list->add_icon_item(item_icon, E->get());
+ theme_type_list->add_icon_item(item_icon, E);
- if (E->get() == edited_type) {
+ if (E == edited_type) {
theme_type_list->select(e_idx);
item_reselected = true;
}
@@ -2182,8 +2182,8 @@ OrderedHashMap<StringName, bool> ThemeTypeEditor::_get_type_items(String p_type_
(Theme::get_default().operator->()->*get_list_func)(default_type, &names);
names.sort_custom<StringName::AlphCompare>();
- for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
- items[E->get()] = false;
+ for (StringName &E : names) {
+ items[E] = false;
}
}
@@ -2191,8 +2191,8 @@ OrderedHashMap<StringName, bool> ThemeTypeEditor::_get_type_items(String p_type_
names.clear();
(edited_theme.operator->()->*get_list_func)(p_type_name, &names);
names.sort_custom<StringName::AlphCompare>();
- for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
- items[E->get()] = true;
+ for (StringName &E : names) {
+ items[E] = true;
}
}
@@ -2203,8 +2203,8 @@ OrderedHashMap<StringName, bool> ThemeTypeEditor::_get_type_items(String p_type_
keys.sort_custom<StringName::AlphCompare>();
OrderedHashMap<StringName, bool> ordered_items;
- for (List<StringName>::Element *E = keys.front(); E; E = E->next()) {
- ordered_items[E->get()] = items[E->get()];
+ for (StringName &E : keys) {
+ ordered_items[E] = items[E];
}
return ordered_items;
@@ -2580,54 +2580,54 @@ void ThemeTypeEditor::_add_default_type_items() {
{
names.clear();
Theme::get_default()->get_icon_list(default_type, &names);
- for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
- if (!edited_theme->has_icon(E->get(), edited_type)) {
- edited_theme->set_icon(E->get(), edited_type, Ref<Texture2D>());
+ for (StringName &E : names) {
+ if (!edited_theme->has_icon(E, edited_type)) {
+ edited_theme->set_icon(E, edited_type, Ref<Texture2D>());
}
}
}
{
names.clear();
Theme::get_default()->get_stylebox_list(default_type, &names);
- for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
- if (!edited_theme->has_stylebox(E->get(), edited_type)) {
- edited_theme->set_stylebox(E->get(), edited_type, Ref<StyleBox>());
+ for (StringName &E : names) {
+ if (!edited_theme->has_stylebox(E, edited_type)) {
+ edited_theme->set_stylebox(E, edited_type, Ref<StyleBox>());
}
}
}
{
names.clear();
Theme::get_default()->get_font_list(default_type, &names);
- for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
- if (!edited_theme->has_font(E->get(), edited_type)) {
- edited_theme->set_font(E->get(), edited_type, Ref<Font>());
+ for (StringName &E : names) {
+ if (!edited_theme->has_font(E, edited_type)) {
+ edited_theme->set_font(E, edited_type, Ref<Font>());
}
}
}
{
names.clear();
Theme::get_default()->get_font_size_list(default_type, &names);
- for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
- if (!edited_theme->has_font_size(E->get(), edited_type)) {
- edited_theme->set_font_size(E->get(), edited_type, Theme::get_default()->get_font_size(E->get(), default_type));
+ for (StringName &E : names) {
+ if (!edited_theme->has_font_size(E, edited_type)) {
+ edited_theme->set_font_size(E, edited_type, Theme::get_default()->get_font_size(E, default_type));
}
}
}
{
names.clear();
Theme::get_default()->get_color_list(default_type, &names);
- for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
- if (!edited_theme->has_color(E->get(), edited_type)) {
- edited_theme->set_color(E->get(), edited_type, Theme::get_default()->get_color(E->get(), default_type));
+ for (StringName &E : names) {
+ if (!edited_theme->has_color(E, edited_type)) {
+ edited_theme->set_color(E, edited_type, Theme::get_default()->get_color(E, default_type));
}
}
}
{
names.clear();
Theme::get_default()->get_constant_list(default_type, &names);
- for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
- if (!edited_theme->has_constant(E->get(), edited_type)) {
- edited_theme->set_constant(E->get(), edited_type, Theme::get_default()->get_constant(E->get(), default_type));
+ for (StringName &E : names) {
+ if (!edited_theme->has_constant(E, edited_type)) {
+ edited_theme->set_constant(E, edited_type, Theme::get_default()->get_constant(E, default_type));
}
}
}
@@ -2882,12 +2882,12 @@ void ThemeTypeEditor::_update_stylebox_from_leading() {
List<StringName> names;
edited_theme->get_stylebox_list(edited_type, &names);
List<Ref<StyleBox>> styleboxes;
- for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
- if (E->get() == leading_stylebox.item_name) {
+ for (StringName &E : names) {
+ if (E == leading_stylebox.item_name) {
continue;
}
- Ref<StyleBox> sb = edited_theme->get_stylebox(E->get(), edited_type);
+ Ref<StyleBox> sb = edited_theme->get_stylebox(E, edited_type);
if (sb->get_class() == leading_stylebox.stylebox->get_class()) {
styleboxes.push_back(sb);
}
@@ -2895,20 +2895,20 @@ void ThemeTypeEditor::_update_stylebox_from_leading() {
List<PropertyInfo> props;
leading_stylebox.stylebox->get_property_list(&props);
- for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
- if (!(E->get().usage & PROPERTY_USAGE_STORAGE)) {
+ for (PropertyInfo &E : props) {
+ if (!(E.usage & PROPERTY_USAGE_STORAGE)) {
continue;
}
- Variant value = leading_stylebox.stylebox->get(E->get().name);
- Variant ref_value = leading_stylebox.ref_stylebox->get(E->get().name);
+ Variant value = leading_stylebox.stylebox->get(E.name);
+ Variant ref_value = leading_stylebox.ref_stylebox->get(E.name);
if (value == ref_value) {
continue;
}
- for (List<Ref<StyleBox>>::Element *F = styleboxes.front(); F; F = F->next()) {
- Ref<StyleBox> sb = F->get();
- sb->set(E->get().name, value);
+ for (Ref<StyleBox> F : styleboxes) {
+ Ref<StyleBox> sb = F;
+ sb->set(E.name, value);
}
}
@@ -3301,8 +3301,8 @@ ThemeEditor::ThemeEditor() {
preview_scene_dialog->set_title(TTR("Select UI Scene:"));
List<String> ext;
ResourceLoader::get_recognized_extensions_for_type("PackedScene", &ext);
- for (List<String>::Element *E = ext.front(); E; E = E->next()) {
- preview_scene_dialog->add_filter("*." + E->get() + "; Scene");
+ for (String &E : ext) {
+ preview_scene_dialog->add_filter("*." + E + "; Scene");
}
main_hs->add_child(preview_scene_dialog);
preview_scene_dialog->connect("file_selected", callable_mp(this, &ThemeEditor::_preview_scene_dialog_cbk));
@@ -3343,12 +3343,12 @@ bool ThemeEditorPlugin::handles(Object *p_node) const {
List<StringName> names;
edited_theme->get_font_type_list(&types);
- for (List<StringName>::Element *E = types.front(); E; E = E->next()) {
+ for (StringName &E : types) {
names.clear();
- edited_theme->get_font_list(E->get(), &names);
+ edited_theme->get_font_list(E, &names);
- for (List<StringName>::Element *F = names.front(); F; F = F->next()) {
- if (font_item == edited_theme->get_font(F->get(), E->get())) {
+ for (StringName &F : names) {
+ if (font_item == edited_theme->get_font(F, E)) {
belongs_to_theme = true;
break;
}
@@ -3360,12 +3360,12 @@ bool ThemeEditorPlugin::handles(Object *p_node) const {
List<StringName> names;
edited_theme->get_stylebox_type_list(&types);
- for (List<StringName>::Element *E = types.front(); E; E = E->next()) {
+ for (StringName &E : types) {
names.clear();
- edited_theme->get_stylebox_list(E->get(), &names);
+ edited_theme->get_stylebox_list(E, &names);
- for (List<StringName>::Element *F = names.front(); F; F = F->next()) {
- if (stylebox_item == edited_theme->get_stylebox(F->get(), E->get())) {
+ for (StringName &F : names) {
+ if (stylebox_item == edited_theme->get_stylebox(F, E)) {
belongs_to_theme = true;
break;
}
@@ -3377,12 +3377,12 @@ bool ThemeEditorPlugin::handles(Object *p_node) const {
List<StringName> names;
edited_theme->get_icon_type_list(&types);
- for (List<StringName>::Element *E = types.front(); E; E = E->next()) {
+ for (StringName &E : types) {
names.clear();
- edited_theme->get_icon_list(E->get(), &names);
+ edited_theme->get_icon_list(E, &names);
- for (List<StringName>::Element *F = names.front(); F; F = F->next()) {
- if (icon_item == edited_theme->get_icon(F->get(), E->get())) {
+ for (StringName &F : names) {
+ if (icon_item == edited_theme->get_icon(F, E)) {
belongs_to_theme = true;
break;
}
diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
index de910dfd32..ab26e1c380 100644
--- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
+++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
@@ -303,9 +303,9 @@ void TileSetAtlasSourceEditor::AtlasTileProxyObject::_get_property_list(List<Pro
}
// Add only properties that are common to all tiles.
- for (List<PLData *>::Element *E = data_list.front(); E; E = E->next()) {
- if (E->get()->uses == tiles.size()) {
- p_list->push_back(E->get()->property_info);
+ for (PLData *E : data_list) {
+ if (E->uses == tiles.size()) {
+ p_list->push_back(E->property_info);
}
}
}
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index f49279aa33..7e3244dddf 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -666,8 +666,8 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id) {
if (valid_left) {
name_left = vsnode->get_input_port_name(i);
port_left = vsnode->get_input_port_type(i);
- for (List<VisualShader::Connection>::Element *E = connections.front(); E; E = E->next()) {
- if (E->get().to_node == p_id && E->get().to_port == j) {
+ for (VisualShader::Connection &E : connections) {
+ if (E.to_node == p_id && E.to_port == j) {
port_left_used = true;
}
}
@@ -899,11 +899,11 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id) {
expression_box->set_syntax_highlighter(expression_syntax_highlighter);
expression_box->add_theme_color_override("background_color", background_color);
- for (List<String>::Element *E = VisualShaderEditor::get_singleton()->keyword_list.front(); E; E = E->next()) {
- if (ShaderLanguage::is_control_flow_keyword(E->get())) {
- expression_syntax_highlighter->add_keyword_color(E->get(), control_flow_keyword_color);
+ for (String &E : VisualShaderEditor::get_singleton()->keyword_list) {
+ if (ShaderLanguage::is_control_flow_keyword(E)) {
+ expression_syntax_highlighter->add_keyword_color(E, control_flow_keyword_color);
} else {
- expression_syntax_highlighter->add_keyword_color(E->get(), keyword_color);
+ expression_syntax_highlighter->add_keyword_color(E, keyword_color);
}
}
@@ -961,7 +961,7 @@ void VisualShaderGraphPlugin::connect_nodes(VisualShader::Type p_type, int p_fro
void VisualShaderGraphPlugin::disconnect_nodes(VisualShader::Type p_type, int p_from_node, int p_from_port, int p_to_node, int p_to_port) {
if (visual_shader->get_shader_type() == p_type) {
VisualShaderEditor::get_singleton()->graph->disconnect_node(itos(p_from_node), p_from_port, itos(p_to_node), p_to_port);
- for (List<VisualShader::Connection>::Element *E = connections.front(); E; E = E->next()) {
+ for (const List<VisualShader::Connection>::Element *E = connections.front(); E; E = E->next()) {
if (E->get().from_node == p_from_node && E->get().from_port == p_from_port && E->get().to_node == p_to_node && E->get().to_port == p_to_port) {
connections.erase(E);
break;
@@ -1470,11 +1470,11 @@ void VisualShaderEditor::_update_graph() {
graph_plugin->make_dirty(false);
- for (List<VisualShader::Connection>::Element *E = connections.front(); E; E = E->next()) {
- int from = E->get().from_node;
- int from_idx = E->get().from_port;
- int to = E->get().to_node;
- int to_idx = E->get().to_port;
+ for (VisualShader::Connection &E : connections) {
+ int from = E.from_node;
+ int from_idx = E.from_port;
+ int to = E.to_node;
+ int to_idx = E.to_port;
graph->connect_node(itos(from), from_idx, itos(to), to_idx);
}
@@ -1634,11 +1634,11 @@ void VisualShaderEditor::_expand_output_port(int p_node, int p_port, bool p_expa
List<VisualShader::Connection> conns;
visual_shader->get_node_connections(type, &conns);
- for (List<VisualShader::Connection>::Element *E = conns.front(); E; E = E->next()) {
- int from_node = E->get().from_node;
- int from_port = E->get().from_port;
- int to_node = E->get().to_node;
- int to_port = E->get().to_port;
+ for (VisualShader::Connection &E : conns) {
+ int from_node = E.from_node;
+ int from_port = E.from_port;
+ int to_node = E.to_node;
+ int to_port = E.to_port;
if (from_node == p_node) {
if (p_expand) {
@@ -1708,11 +1708,11 @@ void VisualShaderEditor::_remove_input_port(int p_node, int p_port) {
List<VisualShader::Connection> conns;
visual_shader->get_node_connections(type, &conns);
- for (List<VisualShader::Connection>::Element *E = conns.front(); E; E = E->next()) {
- int from_node = E->get().from_node;
- int from_port = E->get().from_port;
- int to_node = E->get().to_node;
- int to_port = E->get().to_port;
+ for (VisualShader::Connection &E : conns) {
+ int from_node = E.from_node;
+ int from_port = E.from_port;
+ int to_node = E.to_node;
+ int to_port = E.to_port;
if (to_node == p_node) {
if (to_port == p_port) {
@@ -1757,11 +1757,11 @@ void VisualShaderEditor::_remove_output_port(int p_node, int p_port) {
List<VisualShader::Connection> conns;
visual_shader->get_node_connections(type, &conns);
- for (List<VisualShader::Connection>::Element *E = conns.front(); E; E = E->next()) {
- int from_node = E->get().from_node;
- int from_port = E->get().from_port;
- int to_node = E->get().to_node;
- int to_port = E->get().to_port;
+ for (VisualShader::Connection &E : conns) {
+ int from_node = E.from_node;
+ int from_port = E.from_port;
+ int to_node = E.to_node;
+ int to_port = E.to_port;
if (from_node == p_node) {
if (from_port == p_port) {
@@ -2518,11 +2518,11 @@ void VisualShaderEditor::_nodes_dragged() {
undo_redo->create_action(TTR("Node(s) Moved"));
- for (List<DragOp>::Element *E = drag_buffer.front(); E; E = E->next()) {
- undo_redo->add_do_method(visual_shader.ptr(), "set_node_position", E->get().type, E->get().node, E->get().to);
- undo_redo->add_undo_method(visual_shader.ptr(), "set_node_position", E->get().type, E->get().node, E->get().from);
- undo_redo->add_do_method(graph_plugin.ptr(), "set_node_position", E->get().type, E->get().node, E->get().to);
- undo_redo->add_undo_method(graph_plugin.ptr(), "set_node_position", E->get().type, E->get().node, E->get().from);
+ for (DragOp &E : drag_buffer) {
+ undo_redo->add_do_method(visual_shader.ptr(), "set_node_position", E.type, E.node, E.to);
+ undo_redo->add_undo_method(visual_shader.ptr(), "set_node_position", E.type, E.node, E.from);
+ undo_redo->add_do_method(graph_plugin.ptr(), "set_node_position", E.type, E.node, E.to);
+ undo_redo->add_undo_method(graph_plugin.ptr(), "set_node_position", E.type, E.node, E.from);
}
drag_buffer.clear();
@@ -2544,12 +2544,12 @@ void VisualShaderEditor::_connection_request(const String &p_from, int p_from_in
List<VisualShader::Connection> conns;
visual_shader->get_node_connections(type, &conns);
- for (List<VisualShader::Connection>::Element *E = conns.front(); E; E = E->next()) {
- if (E->get().to_node == to && E->get().to_port == p_to_index) {
- undo_redo->add_do_method(visual_shader.ptr(), "disconnect_nodes", type, E->get().from_node, E->get().from_port, E->get().to_node, E->get().to_port);
- undo_redo->add_undo_method(visual_shader.ptr(), "connect_nodes", type, E->get().from_node, E->get().from_port, E->get().to_node, E->get().to_port);
- undo_redo->add_do_method(graph_plugin.ptr(), "disconnect_nodes", type, E->get().from_node, E->get().from_port, E->get().to_node, E->get().to_port);
- undo_redo->add_undo_method(graph_plugin.ptr(), "connect_nodes", type, E->get().from_node, E->get().from_port, E->get().to_node, E->get().to_port);
+ for (VisualShader::Connection &E : conns) {
+ if (E.to_node == to && E.to_port == p_to_index) {
+ undo_redo->add_do_method(visual_shader.ptr(), "disconnect_nodes", type, E.from_node, E.from_port, E.to_node, E.to_port);
+ undo_redo->add_undo_method(visual_shader.ptr(), "connect_nodes", type, E.from_node, E.from_port, E.to_node, E.to_port);
+ undo_redo->add_do_method(graph_plugin.ptr(), "disconnect_nodes", type, E.from_node, E.from_port, E.to_node, E.to_port);
+ undo_redo->add_undo_method(graph_plugin.ptr(), "connect_nodes", type, E.from_node, E.from_port, E.to_node, E.to_port);
}
}
@@ -2597,22 +2597,22 @@ void VisualShaderEditor::_delete_nodes(int p_type, const List<int> &p_nodes) {
List<VisualShader::Connection> conns;
visual_shader->get_node_connections(type, &conns);
- for (const List<int>::Element *F = p_nodes.front(); F; F = F->next()) {
- for (List<VisualShader::Connection>::Element *E = conns.front(); E; E = E->next()) {
- if (E->get().from_node == F->get() || E->get().to_node == F->get()) {
- undo_redo->add_do_method(graph_plugin.ptr(), "disconnect_nodes", type, E->get().from_node, E->get().from_port, E->get().to_node, E->get().to_port);
+ for (const int &F : p_nodes) {
+ for (VisualShader::Connection &E : conns) {
+ if (E.from_node == F || E.to_node == F) {
+ undo_redo->add_do_method(graph_plugin.ptr(), "disconnect_nodes", type, E.from_node, E.from_port, E.to_node, E.to_port);
}
}
}
Set<String> uniform_names;
- for (const List<int>::Element *F = p_nodes.front(); F; F = F->next()) {
- Ref<VisualShaderNode> node = visual_shader->get_node(type, F->get());
+ for (const int &F : p_nodes) {
+ Ref<VisualShaderNode> node = visual_shader->get_node(type, F);
- undo_redo->add_do_method(visual_shader.ptr(), "remove_node", type, F->get());
- undo_redo->add_undo_method(visual_shader.ptr(), "add_node", type, node, visual_shader->get_node_position(type, F->get()), F->get());
- undo_redo->add_undo_method(graph_plugin.ptr(), "add_node", type, F->get());
+ undo_redo->add_do_method(visual_shader.ptr(), "remove_node", type, F);
+ undo_redo->add_undo_method(visual_shader.ptr(), "add_node", type, node, visual_shader->get_node_position(type, F), F);
+ undo_redo->add_undo_method(graph_plugin.ptr(), "add_node", type, F);
undo_redo->add_do_method(this, "_clear_buffer");
undo_redo->add_undo_method(this, "_clear_buffer");
@@ -2638,28 +2638,28 @@ void VisualShaderEditor::_delete_nodes(int p_type, const List<int> &p_nodes) {
}
List<VisualShader::Connection> used_conns;
- for (const List<int>::Element *F = p_nodes.front(); F; F = F->next()) {
- for (List<VisualShader::Connection>::Element *E = conns.front(); E; E = E->next()) {
- if (E->get().from_node == F->get() || E->get().to_node == F->get()) {
+ for (const int &F : p_nodes) {
+ for (VisualShader::Connection &E : conns) {
+ if (E.from_node == F || E.to_node == F) {
bool cancel = false;
for (List<VisualShader::Connection>::Element *R = used_conns.front(); R; R = R->next()) {
- if (R->get().from_node == E->get().from_node && R->get().from_port == E->get().from_port && R->get().to_node == E->get().to_node && R->get().to_port == E->get().to_port) {
+ if (R->get().from_node == E.from_node && R->get().from_port == E.from_port && R->get().to_node == E.to_node && R->get().to_port == E.to_port) {
cancel = true; // to avoid ERR_ALREADY_EXISTS warning
break;
}
}
if (!cancel) {
- undo_redo->add_undo_method(visual_shader.ptr(), "connect_nodes", type, E->get().from_node, E->get().from_port, E->get().to_node, E->get().to_port);
- undo_redo->add_undo_method(graph_plugin.ptr(), "connect_nodes", type, E->get().from_node, E->get().from_port, E->get().to_node, E->get().to_port);
- used_conns.push_back(E->get());
+ undo_redo->add_undo_method(visual_shader.ptr(), "connect_nodes", type, E.from_node, E.from_port, E.to_node, E.to_port);
+ undo_redo->add_undo_method(graph_plugin.ptr(), "connect_nodes", type, E.from_node, E.from_port, E.to_node, E.to_port);
+ used_conns.push_back(E);
}
}
}
}
// delete nodes from the graph
- for (const List<int>::Element *F = p_nodes.front(); F; F = F->next()) {
- undo_redo->add_do_method(graph_plugin.ptr(), "remove_node", type, F->get());
+ for (const int &F : p_nodes) {
+ undo_redo->add_do_method(graph_plugin.ptr(), "remove_node", type, F);
}
// update uniform refs if any uniform has been deleted
@@ -3094,11 +3094,11 @@ void VisualShaderEditor::_notification(int p_what) {
preview_text->add_theme_color_override("background_color", background_color);
- for (List<String>::Element *E = keyword_list.front(); E; E = E->next()) {
- if (ShaderLanguage::is_control_flow_keyword(E->get())) {
- syntax_highlighter->add_keyword_color(E->get(), control_flow_keyword_color);
+ for (String &E : keyword_list) {
+ if (ShaderLanguage::is_control_flow_keyword(E)) {
+ syntax_highlighter->add_keyword_color(E, control_flow_keyword_color);
} else {
- syntax_highlighter->add_keyword_color(E->get(), keyword_color);
+ syntax_highlighter->add_keyword_color(E, keyword_color);
}
}
@@ -3206,9 +3206,9 @@ void VisualShaderEditor::_dup_paste_nodes(int p_type, int p_pasted_type, List<in
Map<int, int> connection_remap;
Set<int> unsupported_set;
- for (List<int>::Element *E = r_nodes.front(); E; E = E->next()) {
- connection_remap[E->get()] = id_from;
- Ref<VisualShaderNode> node = visual_shader->get_node(pasted_type, E->get());
+ for (int &E : r_nodes) {
+ connection_remap[E] = id_from;
+ Ref<VisualShaderNode> node = visual_shader->get_node(pasted_type, E);
bool unsupported = false;
for (int i = 0; i < add_options.size(); i++) {
@@ -3220,13 +3220,13 @@ void VisualShaderEditor::_dup_paste_nodes(int p_type, int p_pasted_type, List<in
}
}
if (unsupported) {
- unsupported_set.insert(E->get());
+ unsupported_set.insert(E);
continue;
}
Ref<VisualShaderNode> dupli = node->duplicate();
- undo_redo->add_do_method(visual_shader.ptr(), "add_node", type, dupli, visual_shader->get_node_position(pasted_type, E->get()) + p_offset, id_from);
+ undo_redo->add_do_method(visual_shader.ptr(), "add_node", type, dupli, visual_shader->get_node_position(pasted_type, E) + p_offset, id_from);
undo_redo->add_do_method(graph_plugin.ptr(), "add_node", type, id_from);
// duplicate size, inputs and outputs if node is group
@@ -3249,19 +3249,19 @@ void VisualShaderEditor::_dup_paste_nodes(int p_type, int p_pasted_type, List<in
List<VisualShader::Connection> conns;
visual_shader->get_node_connections(pasted_type, &conns);
- for (List<VisualShader::Connection>::Element *E = conns.front(); E; E = E->next()) {
- if (unsupported_set.has(E->get().from_node) || unsupported_set.has(E->get().to_node)) {
+ for (VisualShader::Connection &E : conns) {
+ if (unsupported_set.has(E.from_node) || unsupported_set.has(E.to_node)) {
continue;
}
- if (connection_remap.has(E->get().from_node) && connection_remap.has(E->get().to_node)) {
- undo_redo->add_do_method(visual_shader.ptr(), "connect_nodes", type, connection_remap[E->get().from_node], E->get().from_port, connection_remap[E->get().to_node], E->get().to_port);
- undo_redo->add_do_method(graph_plugin.ptr(), "connect_nodes", type, connection_remap[E->get().from_node], E->get().from_port, connection_remap[E->get().to_node], E->get().to_port);
- undo_redo->add_undo_method(graph_plugin.ptr(), "disconnect_nodes", type, connection_remap[E->get().from_node], E->get().from_port, connection_remap[E->get().to_node], E->get().to_port);
+ if (connection_remap.has(E.from_node) && connection_remap.has(E.to_node)) {
+ undo_redo->add_do_method(visual_shader.ptr(), "connect_nodes", type, connection_remap[E.from_node], E.from_port, connection_remap[E.to_node], E.to_port);
+ undo_redo->add_do_method(graph_plugin.ptr(), "connect_nodes", type, connection_remap[E.from_node], E.from_port, connection_remap[E.to_node], E.to_port);
+ undo_redo->add_undo_method(graph_plugin.ptr(), "disconnect_nodes", type, connection_remap[E.from_node], E.from_port, connection_remap[E.to_node], E.to_port);
}
}
id_from = base_id;
- for (List<int>::Element *E = r_nodes.front(); E; E = E->next()) {
+ for (int i = 0; i < r_nodes.size(); i++) {
undo_redo->add_undo_method(visual_shader.ptr(), "remove_node", type, id_from);
undo_redo->add_undo_method(graph_plugin.ptr(), "remove_node", type, id_from);
id_from++;
@@ -3399,17 +3399,17 @@ void VisualShaderEditor::_input_select_item(Ref<VisualShaderNodeInput> p_input,
if (type_changed) {
List<VisualShader::Connection> conns;
visual_shader->get_node_connections(type, &conns);
- for (List<VisualShader::Connection>::Element *E = conns.front(); E; E = E->next()) {
- if (E->get().from_node == id) {
- if (visual_shader->is_port_types_compatible(p_input->get_input_type_by_name(p_name), visual_shader->get_node(type, E->get().to_node)->get_input_port_type(E->get().to_port))) {
- undo_redo->add_do_method(visual_shader.ptr(), "connect_nodes", type, E->get().from_node, E->get().from_port, E->get().to_node, E->get().to_port);
- undo_redo->add_undo_method(visual_shader.ptr(), "connect_nodes", type, E->get().from_node, E->get().from_port, E->get().to_node, E->get().to_port);
+ for (VisualShader::Connection &E : conns) {
+ if (E.from_node == id) {
+ if (visual_shader->is_port_types_compatible(p_input->get_input_type_by_name(p_name), visual_shader->get_node(type, E.to_node)->get_input_port_type(E.to_port))) {
+ undo_redo->add_do_method(visual_shader.ptr(), "connect_nodes", type, E.from_node, E.from_port, E.to_node, E.to_port);
+ undo_redo->add_undo_method(visual_shader.ptr(), "connect_nodes", type, E.from_node, E.from_port, E.to_node, E.to_port);
continue;
}
- undo_redo->add_do_method(visual_shader.ptr(), "disconnect_nodes", type, E->get().from_node, E->get().from_port, E->get().to_node, E->get().to_port);
- undo_redo->add_undo_method(visual_shader.ptr(), "connect_nodes", type, E->get().from_node, E->get().from_port, E->get().to_node, E->get().to_port);
- undo_redo->add_do_method(graph_plugin.ptr(), "disconnect_nodes", type, E->get().from_node, E->get().from_port, E->get().to_node, E->get().to_port);
- undo_redo->add_undo_method(graph_plugin.ptr(), "connect_nodes", type, E->get().from_node, E->get().from_port, E->get().to_node, E->get().to_port);
+ undo_redo->add_do_method(visual_shader.ptr(), "disconnect_nodes", type, E.from_node, E.from_port, E.to_node, E.to_port);
+ undo_redo->add_undo_method(visual_shader.ptr(), "connect_nodes", type, E.from_node, E.from_port, E.to_node, E.to_port);
+ undo_redo->add_do_method(graph_plugin.ptr(), "disconnect_nodes", type, E.from_node, E.from_port, E.to_node, E.to_port);
+ undo_redo->add_undo_method(graph_plugin.ptr(), "connect_nodes", type, E.from_node, E.from_port, E.to_node, E.to_port);
}
}
}
@@ -3445,15 +3445,15 @@ void VisualShaderEditor::_uniform_select_item(Ref<VisualShaderNodeUniformRef> p_
if (type_changed) {
List<VisualShader::Connection> conns;
visual_shader->get_node_connections(type, &conns);
- for (List<VisualShader::Connection>::Element *E = conns.front(); E; E = E->next()) {
- if (E->get().from_node == id) {
- if (visual_shader->is_port_types_compatible(p_uniform_ref->get_uniform_type_by_name(p_name), visual_shader->get_node(type, E->get().to_node)->get_input_port_type(E->get().to_port))) {
+ for (VisualShader::Connection &E : conns) {
+ if (E.from_node == id) {
+ if (visual_shader->is_port_types_compatible(p_uniform_ref->get_uniform_type_by_name(p_name), visual_shader->get_node(type, E.to_node)->get_input_port_type(E.to_port))) {
continue;
}
- undo_redo->add_do_method(visual_shader.ptr(), "disconnect_nodes", type, E->get().from_node, E->get().from_port, E->get().to_node, E->get().to_port);
- undo_redo->add_undo_method(visual_shader.ptr(), "connect_nodes", type, E->get().from_node, E->get().from_port, E->get().to_node, E->get().to_port);
- undo_redo->add_do_method(graph_plugin.ptr(), "disconnect_nodes", type, E->get().from_node, E->get().from_port, E->get().to_node, E->get().to_port);
- undo_redo->add_undo_method(graph_plugin.ptr(), "connect_nodes", type, E->get().from_node, E->get().from_port, E->get().to_node, E->get().to_port);
+ undo_redo->add_do_method(visual_shader.ptr(), "disconnect_nodes", type, E.from_node, E.from_port, E.to_node, E.to_port);
+ undo_redo->add_undo_method(visual_shader.ptr(), "connect_nodes", type, E.from_node, E.from_port, E.to_node, E.to_port);
+ undo_redo->add_do_method(graph_plugin.ptr(), "disconnect_nodes", type, E.from_node, E.from_port, E.to_node, E.to_port);
+ undo_redo->add_undo_method(graph_plugin.ptr(), "connect_nodes", type, E.from_node, E.from_port, E.to_node, E.to_port);
}
}
}
@@ -4825,10 +4825,10 @@ Control *VisualShaderNodePluginDefault::create_editor(const Ref<Resource> &p_par
Vector<PropertyInfo> pinfo;
- for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
+ for (PropertyInfo &E : props) {
for (int i = 0; i < properties.size(); i++) {
- if (E->get().name == String(properties[i])) {
- pinfo.push_back(E->get());
+ if (E.name == String(properties[i])) {
+ pinfo.push_back(E);
}
}
}
@@ -4894,9 +4894,9 @@ void EditorPropertyShaderMode::_option_selected(int p_which) {
VisualShader::Type type = VisualShader::Type(i);
List<VisualShader::Connection> conns;
visual_shader->get_node_connections(type, &conns);
- for (List<VisualShader::Connection>::Element *E = conns.front(); E; E = E->next()) {
- if (E->get().to_node == VisualShader::NODE_ID_OUTPUT) {
- undo_redo->add_undo_method(visual_shader.ptr(), "connect_nodes", type, E->get().from_node, E->get().from_port, E->get().to_node, E->get().to_port);
+ for (VisualShader::Connection &E : conns) {
+ if (E.to_node == VisualShader::NODE_ID_OUTPUT) {
+ undo_redo->add_undo_method(visual_shader.ptr(), "connect_nodes", type, E.from_node, E.from_port, E.to_node, E.to_port);
}
}
}
@@ -4918,9 +4918,9 @@ void EditorPropertyShaderMode::_option_selected(int p_which) {
List<PropertyInfo> props;
visual_shader->get_property_list(&props);
- for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
- if (E->get().name.begins_with("flags/") || E->get().name.begins_with("modes/")) {
- undo_redo->add_undo_property(visual_shader.ptr(), E->get().name, visual_shader->get(E->get().name));
+ for (PropertyInfo &E : props) {
+ if (E.name.begins_with("flags/") || E.name.begins_with("modes/")) {
+ undo_redo->add_undo_property(visual_shader.ptr(), E.name, visual_shader->get(E.name));
}
}
@@ -5024,8 +5024,8 @@ void VisualShaderNodePortPreview::_shader_changed() {
if (src_mat && src_mat->get_shader().is_valid()) {
List<PropertyInfo> params;
src_mat->get_shader()->get_param_list(&params);
- for (List<PropertyInfo>::Element *E = params.front(); E; E = E->next()) {
- material->set(E->get().name, src_mat->get(E->get().name));
+ for (PropertyInfo &E : params) {
+ material->set(E.name, src_mat->get(E.name));
}
}
}