summaryrefslogtreecommitdiff
path: root/editor/plugins/node_3d_editor_plugin.cpp
diff options
context:
space:
mode:
authorAaron Franke <arnfranke@yahoo.com>2021-07-15 23:45:57 -0400
committerAaron Franke <arnfranke@yahoo.com>2021-07-23 17:38:28 -0400
commit4e6efd1b07f1c6d53d226977ddc729333b74306a (patch)
treea52f672e7f622bb65e3b65f2a2edc9d19b1ecdcf /editor/plugins/node_3d_editor_plugin.cpp
parentb918c4c3ce84af1f8af2d06ef31784f48a15551a (diff)
Use C++ iterators for Lists in many situations
Diffstat (limited to 'editor/plugins/node_3d_editor_plugin.cpp')
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp64
1 files changed, 32 insertions, 32 deletions
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();