1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-08 12:40:44 +00:00

Replace most uses of Map by HashMap

* Map is unnecessary and inefficient in almost every case.
* Replaced by the new HashMap.
* Renamed Map to RBMap and Set to RBSet for cases that still make sense
  (order matters) but use is discouraged.

There were very few cases where replacing by HashMap was undesired because
keeping the key order was intended.
I tried to keep those (as RBMap) as much as possible, but might have missed
some. Review appreciated!
This commit is contained in:
reduz
2022-05-13 15:04:37 +02:00
committed by Rémi Verschelde
parent 396def9b66
commit 746dddc067
587 changed files with 3707 additions and 3538 deletions

View File

@@ -4085,7 +4085,7 @@ void CanvasItemEditor::_button_tool_select(int p_index) {
}
void CanvasItemEditor::_insert_animation_keys(bool p_location, bool p_rotation, bool p_scale, bool p_on_existing) {
const Map<Node *, Object *> &selection = editor_selection->get_selection();
const HashMap<Node *, Object *> &selection = editor_selection->get_selection();
for (const KeyValue<Node *, Object *> &E : selection) {
CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E.key);
@@ -4396,7 +4396,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
case ANIM_COPY_POSE: {
pose_clipboard.clear();
const Map<Node *, Object *> &selection = editor_selection->get_selection();
const HashMap<Node *, Object *> &selection = editor_selection->get_selection();
for (const KeyValue<Node *, Object *> &E : selection) {
CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E.key);
@@ -4442,7 +4442,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
} break;
case ANIM_CLEAR_POSE: {
Map<Node *, Object *> &selection = editor_selection->get_selection();
HashMap<Node *, Object *> &selection = editor_selection->get_selection();
for (const KeyValue<Node *, Object *> &E : selection) {
CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E.key);
@@ -4511,7 +4511,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
} break;
case SKELETON_MAKE_BONES: {
Map<Node *, Object *> &selection = editor_selection->get_selection();
HashMap<Node *, Object *> &selection = editor_selection->get_selection();
Node *editor_root = EditorNode::get_singleton()->get_edited_scene()->get_tree()->get_edited_scene_root();
undo_redo->create_action(TTR("Create Custom Bone2D(s) from Node(s)"));
@@ -4559,7 +4559,7 @@ void CanvasItemEditor::_focus_selection(int p_op) {
Rect2 rect;
int count = 0;
const Map<Node *, Object *> &selection = editor_selection->get_selection();
const HashMap<Node *, Object *> &selection = editor_selection->get_selection();
for (const KeyValue<Node *, Object *> &E : selection) {
CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E.key);
if (!canvas_item) {