Skip to content

Commit

Permalink
Subscript cases
Browse files Browse the repository at this point in the history
  • Loading branch information
AThousandShips committed Oct 2, 2024
1 parent 3783440 commit fcfcf0a
Show file tree
Hide file tree
Showing 27 changed files with 95 additions and 95 deletions.
4 changes: 2 additions & 2 deletions core/debugger/remote_debugger_peer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ bool RemoteDebuggerPeerTCP::has_message() {
Array RemoteDebuggerPeerTCP::get_message() {
MutexLock lock(mutex);
ERR_FAIL_COND_V(!has_message(), Array());
Array out = in_queue.front()->get();
Array out = in_queue.get_front();
in_queue.pop_front();
return out;
}
Expand Down Expand Up @@ -100,7 +100,7 @@ void RemoteDebuggerPeerTCP::_write_out() {
break; // Nothing left to send
}
mutex.lock();
Variant var = out_queue.front()->get();
Variant var = out_queue.get_front();
out_queue.pop_front();
mutex.unlock();
int size = 0;
Expand Down
2 changes: 1 addition & 1 deletion core/io/udp_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ Ref<PacketPeerUDP> UDPServer::take_connection() {
return conn;
}

Peer peer = pending.front()->get();
Peer peer = pending.get_front();
pending.pop_front();
peers.push_back(peer);
return peer.peer;
Expand Down
2 changes: 1 addition & 1 deletion editor/debugger/editor_debugger_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void EditorDebuggerTree::update_scene_tree(const SceneDebuggerTree *p_tree, int
for (const SceneDebuggerTree::RemoteNode &node : p_tree->nodes) {
TreeItem *parent = nullptr;
if (parents.size()) { // Find last parent.
Pair<TreeItem *, int> &p = parents.front()->get();
Pair<TreeItem *, int> &p = parents.get_front();
parent = p.first;
if (!(--p.second)) { // If no child left, remove it.
parents.pop_front();
Expand Down
4 changes: 2 additions & 2 deletions editor/editor_inspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2605,12 +2605,12 @@ EditorProperty *EditorInspector::instantiate_property_editor(Object *p_object, c
memdelete(E->get().property_editor);
}

EditorProperty *prop = Object::cast_to<EditorProperty>(inspector_plugins[i]->added_editors.front()->get().property_editor);
EditorProperty *prop = Object::cast_to<EditorProperty>(inspector_plugins[i]->added_editors.get_front().property_editor);
if (prop) {
inspector_plugins[i]->added_editors.clear();
return prop;
} else {
memdelete(inspector_plugins[i]->added_editors.front()->get().property_editor);
memdelete(inspector_plugins[i]->added_editors.get_front().property_editor);
inspector_plugins[i]->added_editors.clear();
}
}
Expand Down
2 changes: 1 addition & 1 deletion editor/export/project_export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,7 @@ void ProjectExportDialog::_export_project() {
export_project->set_current_path(current->get_export_path());
} else {
if (extension_list.size() >= 1) {
export_project->set_current_file(default_filename + "." + extension_list.front()->get());
export_project->set_current_file(default_filename + "." + extension_list.get_front());
} else {
export_project->set_current_file(default_filename);
}
Expand Down
6 changes: 3 additions & 3 deletions editor/import/3d/resource_importer_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1434,7 +1434,7 @@ Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, HashMap<
List<StringName> anim_list;
anim_player->get_animation_list(&anim_list);
if (anim_list.size() == 1) {
selected_animation_name = anim_list.front()->get();
selected_animation_name = anim_list.get_front();
}
rest_animation = anim_player->get_animation(selected_animation_name);
if (rest_animation.is_valid()) {
Expand All @@ -1450,7 +1450,7 @@ Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, HashMap<
List<StringName> anim_list;
library->get_animation_list(&anim_list);
if (anim_list.size() == 1) {
selected_animation_name = String(anim_list.front()->get());
selected_animation_name = String(anim_list.get_front());
}
rest_animation = library->get_animation(selected_animation_name);
}
Expand Down Expand Up @@ -2250,7 +2250,7 @@ bool ResourceImporterScene::get_internal_option_visibility(InternalImportCategor
List<StringName> anim_list;
library->get_animation_list(&anim_list);
if (anim_list.size() == 1) {
selected_animation_name = String(anim_list.front()->get());
selected_animation_name = String(anim_list.get_front());
}
if (library->has_animation(selected_animation_name)) {
anim = library->get_animation(selected_animation_name);
Expand Down
2 changes: 1 addition & 1 deletion editor/import/3d/scene_import_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class SceneImportSettingsData : public Object {
List<StringName> anim_names;
library->get_animation_list(&anim_names);
if (anim_names.size() == 1) {
(*settings)["rest_pose/selected_animation"] = String(anim_names.front()->get());
(*settings)["rest_pose/selected_animation"] = String(anim_names.get_front());
}
for (StringName anim_name : anim_names) {
hint_string += "," + anim_name; // Include preceding, as a catch-all.
Expand Down
88 changes: 44 additions & 44 deletions editor/plugins/canvas_item_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,8 @@ Point2 CanvasItemEditor::snap_point(Point2 p_target, unsigned int p_modes, unsig
Point2 offset = grid_offset;
if (snap_relative) {
List<CanvasItem *> selection = _get_edited_canvas_items();
if (selection.size() == 1 && Object::cast_to<Node2D>(selection.front()->get())) {
offset = Object::cast_to<Node2D>(selection.front()->get())->get_global_position();
if (selection.size() == 1 && Object::cast_to<Node2D>(selection.get_front())) {
offset = Object::cast_to<Node2D>(selection.get_front())->get_global_position();
} else if (selection.size() > 0) {
offset = _get_encompassing_rect_from_list(selection).position;
}
Expand Down Expand Up @@ -760,7 +760,7 @@ bool CanvasItemEditor::_select_click_on_item(CanvasItem *item, Point2 p_click_po
still_selected = false;

if (editor_selection->get_selected_node_list().size() == 1) {
EditorNode::get_singleton()->push_item(editor_selection->get_selected_node_list().front()->get());
EditorNode::get_singleton()->push_item(editor_selection->get_selected_node_list().get_front());
}
} else {
// Add the item to the selection
Expand Down Expand Up @@ -1381,7 +1381,7 @@ bool CanvasItemEditor::_gui_input_pivot(const Ref<InputEvent> &p_event) {
drag_from = transform.affine_inverse().xform(event_pos);
Vector2 new_pos;
if (drag_selection.size() == 1) {
new_pos = snap_point(drag_from, SNAP_NODE_SIDES | SNAP_NODE_CENTER | SNAP_NODE_ANCHORS | SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL, 0, drag_selection.front()->get());
new_pos = snap_point(drag_from, SNAP_NODE_SIDES | SNAP_NODE_CENTER | SNAP_NODE_ANCHORS | SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL, 0, drag_selection.get_front());
} else {
new_pos = snap_point(drag_from, SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL, 0, nullptr, drag_selection);
}
Expand All @@ -1402,7 +1402,7 @@ bool CanvasItemEditor::_gui_input_pivot(const Ref<InputEvent> &p_event) {
_restore_canvas_item_state(drag_selection);
Vector2 new_pos;
if (drag_selection.size() == 1) {
new_pos = snap_point(drag_to, SNAP_NODE_SIDES | SNAP_NODE_CENTER | SNAP_NODE_ANCHORS | SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL, 0, drag_selection.front()->get());
new_pos = snap_point(drag_to, SNAP_NODE_SIDES | SNAP_NODE_CENTER | SNAP_NODE_ANCHORS | SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL, 0, drag_selection.get_front());
} else {
new_pos = snap_point(drag_to, SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL);
}
Expand All @@ -1420,9 +1420,9 @@ bool CanvasItemEditor::_gui_input_pivot(const Ref<InputEvent> &p_event) {
drag_selection,
vformat(
TTR("Set CanvasItem \"%s\" Pivot Offset to (%d, %d)"),
drag_selection.front()->get()->get_name(),
drag_selection.front()->get()->_edit_get_pivot().x,
drag_selection.front()->get()->_edit_get_pivot().y));
drag_selection.get_front()->get_name(),
drag_selection.get_front()->_edit_get_pivot().x,
drag_selection.get_front()->_edit_get_pivot().y));
_reset_drag();
return true;
}
Expand Down Expand Up @@ -1474,7 +1474,7 @@ bool CanvasItemEditor::_gui_input_rotate(const Ref<InputEvent> &p_event) {
if (drag_selection.size() > 0) {
drag_type = DRAG_ROTATE;
drag_from = transform.affine_inverse().xform(b->get_position());
CanvasItem *ci = drag_selection.front()->get();
CanvasItem *ci = drag_selection.get_front();
if (!Math::is_inf(temp_pivot.x) || !Math::is_inf(temp_pivot.y)) {
drag_rotation_center = temp_pivot;
} else if (ci->_edit_use_pivot()) {
Expand Down Expand Up @@ -1528,8 +1528,8 @@ bool CanvasItemEditor::_gui_input_rotate(const Ref<InputEvent> &p_event) {
_commit_canvas_item_state(
drag_selection,
vformat(TTR("Rotate CanvasItem \"%s\" to %d degrees"),
drag_selection.front()->get()->get_name(),
Math::rad_to_deg(drag_selection.front()->get()->_edit_get_rotation())),
drag_selection.get_front()->get_name(),
Math::rad_to_deg(drag_selection.get_front()->_edit_get_rotation())),
true);
}

Expand Down Expand Up @@ -1559,7 +1559,7 @@ bool CanvasItemEditor::_gui_input_open_scene_on_double_click(const Ref<InputEven
if (b.is_valid() && b->get_button_index() == MouseButton::LEFT && b->is_pressed() && b->is_double_click() && tool == TOOL_SELECT) {
List<CanvasItem *> selection = _get_edited_canvas_items();
if (selection.size() == 1) {
CanvasItem *ci = selection.front()->get();
CanvasItem *ci = selection.get_front();
if (!ci->get_scene_file_path().is_empty() && ci != EditorNode::get_singleton()->get_edited_scene()) {
EditorNode::get_singleton()->open_request(ci->get_scene_file_path());
return true;
Expand All @@ -1578,7 +1578,7 @@ bool CanvasItemEditor::_gui_input_anchors(const Ref<InputEvent> &p_event) {
if (b.is_valid() && b->get_button_index() == MouseButton::LEFT && b->is_pressed() && tool == TOOL_SELECT) {
List<CanvasItem *> selection = _get_edited_canvas_items();
if (selection.size() == 1) {
Control *control = Object::cast_to<Control>(selection.front()->get());
Control *control = Object::cast_to<Control>(selection.get_front());
if (control && _is_node_movable(control)) {
Vector2 anchor_pos[4];
anchor_pos[0] = Vector2(control->get_anchor(SIDE_LEFT), control->get_anchor(SIDE_TOP));
Expand Down Expand Up @@ -1627,7 +1627,7 @@ bool CanvasItemEditor::_gui_input_anchors(const Ref<InputEvent> &p_event) {
// Drag the anchor
if (m.is_valid()) {
_restore_canvas_item_state(drag_selection);
Control *control = Object::cast_to<Control>(drag_selection.front()->get());
Control *control = Object::cast_to<Control>(drag_selection.get_front());

drag_to = transform.affine_inverse().xform(m->get_position());

Expand Down Expand Up @@ -1698,7 +1698,7 @@ bool CanvasItemEditor::_gui_input_anchors(const Ref<InputEvent> &p_event) {
if (drag_selection.size() >= 1 && b.is_valid() && b->get_button_index() == MouseButton::LEFT && !b->is_pressed()) {
_commit_canvas_item_state(
drag_selection,
vformat(TTR("Move CanvasItem \"%s\" Anchor"), drag_selection.front()->get()->get_name()));
vformat(TTR("Move CanvasItem \"%s\" Anchor"), drag_selection.get_front()->get_name()));
snap_target[0] = SNAP_TARGET_NONE;
snap_target[1] = SNAP_TARGET_NONE;
_reset_drag();
Expand Down Expand Up @@ -1728,7 +1728,7 @@ bool CanvasItemEditor::_gui_input_resize(const Ref<InputEvent> &p_event) {
if (b.is_valid() && b->get_button_index() == MouseButton::LEFT && b->is_pressed() && tool == TOOL_SELECT) {
List<CanvasItem *> selection = _get_edited_canvas_items();
if (selection.size() == 1) {
CanvasItem *ci = selection.front()->get();
CanvasItem *ci = selection.get_front();
if (ci->_edit_use_rect() && _is_node_movable(ci)) {
Rect2 rect = ci->_edit_get_rect();
Transform2D xform = transform * ci->get_global_transform_with_canvas();
Expand Down Expand Up @@ -1789,7 +1789,7 @@ bool CanvasItemEditor::_gui_input_resize(const Ref<InputEvent> &p_event) {
drag_type == DRAG_TOP_LEFT || drag_type == DRAG_TOP_RIGHT || drag_type == DRAG_BOTTOM_LEFT || drag_type == DRAG_BOTTOM_RIGHT) {
// Resize the node
if (m.is_valid()) {
CanvasItem *ci = drag_selection.front()->get();
CanvasItem *ci = drag_selection.get_front();
CanvasItemEditorSelectedItem *se = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(ci);
//Reset state
ci->_edit_set_state(se->undo_state);
Expand Down Expand Up @@ -1874,27 +1874,27 @@ bool CanvasItemEditor::_gui_input_resize(const Ref<InputEvent> &p_event) {

// Confirm resize
if (drag_selection.size() >= 1 && b.is_valid() && b->get_button_index() == MouseButton::LEFT && !b->is_pressed()) {
const Node2D *node2d = Object::cast_to<Node2D>(drag_selection.front()->get());
const Node2D *node2d = Object::cast_to<Node2D>(drag_selection.get_front());
if (node2d) {
// Extends from Node2D.
// Node2D doesn't have an actual stored rect size, unlike Controls.
_commit_canvas_item_state(
drag_selection,
vformat(
TTR("Scale Node2D \"%s\" to (%s, %s)"),
drag_selection.front()->get()->get_name(),
Math::snapped(drag_selection.front()->get()->_edit_get_scale().x, 0.01),
Math::snapped(drag_selection.front()->get()->_edit_get_scale().y, 0.01)),
drag_selection.get_front()->get_name(),
Math::snapped(drag_selection.get_front()->_edit_get_scale().x, 0.01),
Math::snapped(drag_selection.get_front()->_edit_get_scale().y, 0.01)),
true);
} else {
// Extends from Control.
_commit_canvas_item_state(
drag_selection,
vformat(
TTR("Resize Control \"%s\" to (%d, %d)"),
drag_selection.front()->get()->get_name(),
drag_selection.front()->get()->_edit_get_rect().size.x,
drag_selection.front()->get()->_edit_get_rect().size.y),
drag_selection.get_front()->get_name(),
drag_selection.get_front()->_edit_get_rect().size.x,
drag_selection.get_front()->_edit_get_rect().size.y),
true);
}

Expand Down Expand Up @@ -1932,7 +1932,7 @@ bool CanvasItemEditor::_gui_input_scale(const Ref<InputEvent> &p_event) {
bool has_locked_items = false;
List<CanvasItem *> selection = _get_edited_canvas_items(false, true, &has_locked_items);
if (selection.size() == 1) {
CanvasItem *ci = selection.front()->get();
CanvasItem *ci = selection.get_front();

if (_is_node_movable(ci)) {
Transform2D xform = transform * ci->get_global_transform_with_canvas();
Expand Down Expand Up @@ -1972,7 +1972,7 @@ bool CanvasItemEditor::_gui_input_scale(const Ref<InputEvent> &p_event) {
// Resize the node
if (m.is_valid()) {
_restore_canvas_item_state(drag_selection);
CanvasItem *ci = drag_selection.front()->get();
CanvasItem *ci = drag_selection.get_front();

drag_to = transform.affine_inverse().xform(m->get_position());

Expand Down Expand Up @@ -2040,9 +2040,9 @@ bool CanvasItemEditor::_gui_input_scale(const Ref<InputEvent> &p_event) {
_commit_canvas_item_state(
drag_selection,
vformat(TTR("Scale CanvasItem \"%s\" to (%s, %s)"),
drag_selection.front()->get()->get_name(),
Math::snapped(drag_selection.front()->get()->_edit_get_scale().x, 0.01),
Math::snapped(drag_selection.front()->get()->_edit_get_scale().y, 0.01)),
drag_selection.get_front()->get_name(),
Math::snapped(drag_selection.get_front()->_edit_get_scale().x, 0.01),
Math::snapped(drag_selection.get_front()->_edit_get_scale().y, 0.01)),
true);
}
if (key_auto_insert_button->is_pressed()) {
Expand Down Expand Up @@ -2087,7 +2087,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {

drag_type = DRAG_MOVE;

CanvasItem *ci = selection.front()->get();
CanvasItem *ci = selection.get_front();
Transform2D parent_xform = ci->get_global_transform_with_canvas() * ci->get_transform().affine_inverse();
Transform2D unscaled_transform = (transform * parent_xform * ci->_edit_get_transform()).orthonormalized();
Transform2D simple_xform = viewport->get_transform() * unscaled_transform;
Expand Down Expand Up @@ -2126,8 +2126,8 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
drag_to = transform.affine_inverse().xform(m->get_position());
Point2 previous_pos;
if (drag_selection.size() == 1) {
Transform2D parent_xform = drag_selection.front()->get()->get_global_transform_with_canvas() * drag_selection.front()->get()->get_transform().affine_inverse();
previous_pos = parent_xform.xform(drag_selection.front()->get()->_edit_get_position());
Transform2D parent_xform = drag_selection.get_front()->get_global_transform_with_canvas() * drag_selection.get_front()->get_transform().affine_inverse();
previous_pos = parent_xform.xform(drag_selection.get_front()->_edit_get_position());
} else {
previous_pos = _get_encompassing_rect_from_list(drag_selection).position;
}
Expand Down Expand Up @@ -2178,9 +2178,9 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
drag_selection,
vformat(
TTR("Move CanvasItem \"%s\" to (%d, %d)"),
drag_selection.front()->get()->get_name(),
drag_selection.front()->get()->_edit_get_position().x,
drag_selection.front()->get()->_edit_get_position().y),
drag_selection.get_front()->get_name(),
drag_selection.get_front()->_edit_get_position().x,
drag_selection.get_front()->_edit_get_position().y),
true);
}
}
Expand Down Expand Up @@ -2256,15 +2256,15 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {

Point2 previous_pos;
if (drag_selection.size() == 1) {
Transform2D xform = drag_selection.front()->get()->get_global_transform_with_canvas() * drag_selection.front()->get()->get_transform().affine_inverse();
previous_pos = xform.xform(drag_selection.front()->get()->_edit_get_position());
Transform2D xform = drag_selection.get_front()->get_global_transform_with_canvas() * drag_selection.get_front()->get_transform().affine_inverse();
previous_pos = xform.xform(drag_selection.get_front()->_edit_get_position());
} else {
previous_pos = _get_encompassing_rect_from_list(drag_selection).position;
}

Point2 new_pos;
if (drag_selection.size() == 1) {
Node2D *node_2d = Object::cast_to<Node2D>(drag_selection.front()->get());
Node2D *node_2d = Object::cast_to<Node2D>(drag_selection.get_front());
if (node_2d && move_local_base_rotated) {
Transform2D m2;
m2.rotate(node_2d->get_rotation());
Expand Down Expand Up @@ -2302,9 +2302,9 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
_commit_canvas_item_state(
drag_selection,
vformat(TTR("Move CanvasItem \"%s\" to (%d, %d)"),
drag_selection.front()->get()->get_name(),
drag_selection.front()->get()->_edit_get_position().x,
drag_selection.front()->get()->_edit_get_position().y),
drag_selection.get_front()->get_name(),
drag_selection.get_front()->_edit_get_position().x,
drag_selection.get_front()->_edit_get_position().y),
true);
}
_reset_drag();
Expand Down Expand Up @@ -2516,7 +2516,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {

_find_canvas_items_in_rect(Rect2(bsfrom, bsto - bsfrom), scene, &selitems);
if (selitems.size() == 1 && editor_selection->get_selected_node_list().is_empty()) {
EditorNode::get_singleton()->push_item(selitems.front()->get());
EditorNode::get_singleton()->push_item(selitems.get_front());
}
for (CanvasItem *E : selitems) {
editor_selection->add_node(E);
Expand Down Expand Up @@ -2770,7 +2770,7 @@ Control::CursorShape CanvasItemEditor::get_cursor_shape(const Point2 &p_pos) con

List<CanvasItem *> selection = _get_edited_canvas_items();
if (selection.size() == 1) {
const double angle = Math::fposmod((double)selection.front()->get()->get_global_transform_with_canvas().get_rotation(), Math_PI);
const double angle = Math::fposmod((double)selection.get_front()->get_global_transform_with_canvas().get_rotation(), Math_PI);
if (angle > Math_PI * 7.0 / 8.0) {
rotation_array_index = 0;
} else if (angle > Math_PI * 5.0 / 8.0) {
Expand Down Expand Up @@ -6233,7 +6233,7 @@ void CanvasItemEditorViewport::drop_data(const Point2 &p_point, const Variant &p
List<Node *> selected_nodes = EditorNode::get_singleton()->get_editor_selection()->get_selected_node_list();
Node *root_node = EditorNode::get_singleton()->get_edited_scene();
if (selected_nodes.size() > 0) {
Node *selected_node = selected_nodes.front()->get();
Node *selected_node = selected_nodes.get_front();
if (is_alt) {
target_node = root_node;
} else if (is_shift) {
Expand Down
Loading

0 comments on commit fcfcf0a

Please sign in to comment.