summaryrefslogtreecommitdiff
path: root/scene/main
diff options
context:
space:
mode:
Diffstat (limited to 'scene/main')
-rw-r--r--scene/main/node.cpp24
-rw-r--r--scene/main/node.h18
-rw-r--r--scene/main/resource_preloader.cpp9
-rw-r--r--scene/main/resource_preloader.h2
-rw-r--r--scene/main/scene_tree.cpp80
-rw-r--r--scene/main/scene_tree.h10
-rw-r--r--scene/main/viewport.cpp42
-rw-r--r--scene/main/viewport.h12
-rw-r--r--scene/main/window.cpp4
-rw-r--r--scene/main/window.h2
10 files changed, 104 insertions, 99 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 8961b5ba54..0c1a62c667 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -1637,7 +1637,7 @@ Node *Node::find_common_parent_with(const Node *p_node) const {
return const_cast<Node *>(p_node);
}
- Set<const Node *> visited;
+ RBSet<const Node *> visited;
const Node *n = this;
@@ -1669,7 +1669,7 @@ NodePath Node::get_path_to(const Node *p_node) const {
return NodePath(".");
}
- Set<const Node *> visited;
+ RBSet<const Node *> visited;
const Node *n = this;
@@ -1763,15 +1763,15 @@ void Node::add_to_group(const StringName &p_identifier, bool p_persistent) {
void Node::remove_from_group(const StringName &p_identifier) {
ERR_FAIL_COND(!data.grouped.has(p_identifier));
- Map<StringName, GroupData>::Element *E = data.grouped.find(p_identifier);
+ HashMap<StringName, GroupData>::Iterator E = data.grouped.find(p_identifier);
ERR_FAIL_COND(!E);
if (data.tree) {
- data.tree->remove_from_group(E->key(), this);
+ data.tree->remove_from_group(E->key, this);
}
- data.grouped.erase(E);
+ data.grouped.remove(E);
}
Array Node::_get_groups() const {
@@ -2042,7 +2042,7 @@ StringName Node::get_property_store_alias(const StringName &p_property) const {
}
#endif
-void Node::get_storable_properties(Set<StringName> &r_storable_properties) const {
+void Node::get_storable_properties(RBSet<StringName> &r_storable_properties) const {
List<PropertyInfo> pi;
get_property_list(&pi);
for (List<PropertyInfo>::Element *E = pi.front(); E; E = E->next()) {
@@ -2088,7 +2088,7 @@ bool Node::get_scene_instance_load_placeholder() const {
return data.use_placeholder;
}
-Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const {
+Node *Node::_duplicate(int p_flags, HashMap<const Node *, Node *> *r_duplimap) const {
Node *node = nullptr;
bool instantiated = false;
@@ -2280,11 +2280,11 @@ Node *Node::duplicate(int p_flags) const {
}
#ifdef TOOLS_ENABLED
-Node *Node::duplicate_from_editor(Map<const Node *, Node *> &r_duplimap) const {
- return duplicate_from_editor(r_duplimap, Map<Ref<Resource>, Ref<Resource>>());
+Node *Node::duplicate_from_editor(HashMap<const Node *, Node *> &r_duplimap) const {
+ return duplicate_from_editor(r_duplimap, HashMap<Ref<Resource>, Ref<Resource>>());
}
-Node *Node::duplicate_from_editor(Map<const Node *, Node *> &r_duplimap, const Map<Ref<Resource>, Ref<Resource>> &p_resource_remap) const {
+Node *Node::duplicate_from_editor(HashMap<const Node *, Node *> &r_duplimap, const HashMap<Ref<Resource>, Ref<Resource>> &p_resource_remap) const {
Node *dupe = _duplicate(DUPLICATE_SIGNALS | DUPLICATE_GROUPS | DUPLICATE_SCRIPTS | DUPLICATE_USE_INSTANCING | DUPLICATE_FROM_EDITOR, &r_duplimap);
// This is used by SceneTreeDock's paste functionality. When pasting to foreign scene, resources are duplicated.
@@ -2300,7 +2300,7 @@ Node *Node::duplicate_from_editor(Map<const Node *, Node *> &r_duplimap, const M
return dupe;
}
-void Node::remap_node_resources(Node *p_node, const Map<Ref<Resource>, Ref<Resource>> &p_resource_remap) const {
+void Node::remap_node_resources(Node *p_node, const HashMap<Ref<Resource>, Ref<Resource>> &p_resource_remap) const {
List<PropertyInfo> props;
p_node->get_property_list(&props);
@@ -2326,7 +2326,7 @@ void Node::remap_node_resources(Node *p_node, const Map<Ref<Resource>, Ref<Resou
}
}
-void Node::remap_nested_resources(Ref<Resource> p_resource, const Map<Ref<Resource>, Ref<Resource>> &p_resource_remap) const {
+void Node::remap_nested_resources(Ref<Resource> p_resource, const HashMap<Ref<Resource>, Ref<Resource>> &p_resource_remap) const {
List<PropertyInfo> props;
p_resource->get_property_list(&props);
diff --git a/scene/main/node.h b/scene/main/node.h
index 72f340bbc3..8505d2618f 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -32,7 +32,7 @@
#define NODE_H
#include "core/string/node_path.h"
-#include "core/templates/map.h"
+#include "core/templates/rb_map.h"
#include "core/variant/typed_array.h"
#include "scene/main/scene_tree.h"
@@ -119,7 +119,7 @@ private:
Viewport *viewport = nullptr;
- Map<StringName, GroupData> grouped;
+ HashMap<StringName, GroupData> grouped;
List<Node *>::Element *OW = nullptr; // Owned element.
List<Node *> owned;
@@ -177,7 +177,7 @@ private:
Array _get_node_and_resource(const NodePath &p_path);
void _duplicate_signals(const Node *p_original, Node *p_copy) const;
- Node *_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap = nullptr) const;
+ Node *_duplicate(int p_flags, HashMap<const Node *, Node *> *r_duplimap = nullptr) const;
TypedArray<Node> _get_children(bool p_include_internal = true) const;
Array _get_groups() const;
@@ -378,7 +378,7 @@ public:
bool is_property_pinned(const StringName &p_property) const;
virtual StringName get_property_store_alias(const StringName &p_property) const;
#endif
- void get_storable_properties(Set<StringName> &r_storable_properties) const;
+ void get_storable_properties(RBSet<StringName> &r_storable_properties) const;
virtual String to_string() override;
@@ -420,10 +420,10 @@ public:
Node *duplicate(int p_flags = DUPLICATE_GROUPS | DUPLICATE_SIGNALS | DUPLICATE_SCRIPTS) const;
#ifdef TOOLS_ENABLED
- Node *duplicate_from_editor(Map<const Node *, Node *> &r_duplimap) const;
- Node *duplicate_from_editor(Map<const Node *, Node *> &r_duplimap, const Map<Ref<Resource>, Ref<Resource>> &p_resource_remap) const;
- void remap_node_resources(Node *p_node, const Map<Ref<Resource>, Ref<Resource>> &p_resource_remap) const;
- void remap_nested_resources(Ref<Resource> p_resource, const Map<Ref<Resource>, Ref<Resource>> &p_resource_remap) const;
+ Node *duplicate_from_editor(HashMap<const Node *, Node *> &r_duplimap) const;
+ Node *duplicate_from_editor(HashMap<const Node *, Node *> &r_duplimap, const HashMap<Ref<Resource>, Ref<Resource>> &p_resource_remap) const;
+ void remap_node_resources(Node *p_node, const HashMap<Ref<Resource>, Ref<Resource>> &p_resource_remap) const;
+ void remap_nested_resources(Ref<Resource> p_resource, const HashMap<Ref<Resource>, Ref<Resource>> &p_resource_remap) const;
#endif
// used by editors, to save what has changed only
@@ -522,6 +522,6 @@ public:
VARIANT_ENUM_CAST(Node::DuplicateFlags);
-typedef Set<Node *, Node::Comparator> NodeSet;
+typedef RBSet<Node *, Node::Comparator> NodeSet;
#endif
diff --git a/scene/main/resource_preloader.cpp b/scene/main/resource_preloader.cpp
index 8fb7456335..b3595c6227 100644
--- a/scene/main/resource_preloader.cpp
+++ b/scene/main/resource_preloader.cpp
@@ -55,14 +55,14 @@ Array ResourcePreloader::_get_resources() const {
arr.resize(resources.size());
names.resize(resources.size());
- Set<String> sorted_names;
+ RBSet<String> sorted_names;
for (const KeyValue<StringName, Ref<Resource>> &E : resources) {
sorted_names.insert(E.key);
}
int i = 0;
- for (Set<String>::Element *E = sorted_names.front(); E; E = E->next()) {
+ for (RBSet<String>::Element *E = sorted_names.front(); E; E = E->next()) {
names.set(i, E->get());
arr[i] = resources[E->get()];
i++;
@@ -123,8 +123,9 @@ Vector<String> ResourcePreloader::_get_resource_list() const {
Vector<String> res;
res.resize(resources.size());
int i = 0;
- for (Map<StringName, Ref<Resource>>::Element *E = resources.front(); E; E = E->next(), i++) {
- res.set(i, E->key());
+ for (const KeyValue<StringName, Ref<Resource>> &E : resources) {
+ res.set(i, E.key);
+ i++;
}
return res;
diff --git a/scene/main/resource_preloader.h b/scene/main/resource_preloader.h
index 2df8b5cda7..fe59bc8ae3 100644
--- a/scene/main/resource_preloader.h
+++ b/scene/main/resource_preloader.h
@@ -36,7 +36,7 @@
class ResourcePreloader : public Node {
GDCLASS(ResourcePreloader, Node);
- Map<StringName, Ref<Resource>> resources;
+ HashMap<StringName, Ref<Resource>> resources;
void _set_resources(const Array &p_data);
Array _get_resources() const;
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index baa0362f63..231b672f63 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -129,32 +129,32 @@ void SceneTree::node_renamed(Node *p_node) {
}
SceneTree::Group *SceneTree::add_to_group(const StringName &p_group, Node *p_node) {
- Map<StringName, Group>::Element *E = group_map.find(p_group);
+ HashMap<StringName, Group>::Iterator E = group_map.find(p_group);
if (!E) {
E = group_map.insert(p_group, Group());
}
- ERR_FAIL_COND_V_MSG(E->get().nodes.has(p_node), &E->get(), "Already in group: " + p_group + ".");
- E->get().nodes.push_back(p_node);
- //E->get().last_tree_version=0;
- E->get().changed = true;
- return &E->get();
+ ERR_FAIL_COND_V_MSG(E->value.nodes.has(p_node), &E->value, "Already in group: " + p_group + ".");
+ E->value.nodes.push_back(p_node);
+ //E->value.last_tree_version=0;
+ E->value.changed = true;
+ return &E->value;
}
void SceneTree::remove_from_group(const StringName &p_group, Node *p_node) {
- Map<StringName, Group>::Element *E = group_map.find(p_group);
+ HashMap<StringName, Group>::Iterator E = group_map.find(p_group);
ERR_FAIL_COND(!E);
- E->get().nodes.erase(p_node);
- if (E->get().nodes.is_empty()) {
- group_map.erase(E);
+ E->value.nodes.erase(p_node);
+ if (E->value.nodes.is_empty()) {
+ group_map.remove(E);
}
}
void SceneTree::make_group_changed(const StringName &p_group) {
- Map<StringName, Group>::Element *E = group_map.find(p_group);
+ HashMap<StringName, Group>::Iterator E = group_map.find(p_group);
if (E) {
- E->get().changed = true;
+ E->value.changed = true;
}
}
@@ -173,17 +173,17 @@ void SceneTree::_flush_ugc() {
ugc_locked = true;
while (unique_group_calls.size()) {
- Map<UGCall, Vector<Variant>>::Element *E = unique_group_calls.front();
+ HashMap<UGCall, Vector<Variant>, UGCall>::Iterator E = unique_group_calls.begin();
- const Variant **argptrs = (const Variant **)alloca(E->get().size() * sizeof(Variant *));
+ const Variant **argptrs = (const Variant **)alloca(E->value.size() * sizeof(Variant *));
- for (int i = 0; i < E->get().size(); i++) {
- argptrs[i] = &E->get()[i];
+ for (int i = 0; i < E->value.size(); i++) {
+ argptrs[i] = &E->value[i];
}
- call_group_flagsp(GROUP_CALL_DEFAULT, E->key().group, E->key().call, argptrs, E->get().size());
+ call_group_flagsp(GROUP_CALL_DEFAULT, E->key.group, E->key.call, argptrs, E->value.size());
- unique_group_calls.erase(E);
+ unique_group_calls.remove(E);
}
ugc_locked = false;
@@ -211,11 +211,11 @@ void SceneTree::_update_group_order(Group &g, bool p_use_priority) {
}
void SceneTree::call_group_flagsp(uint32_t p_call_flags, const StringName &p_group, const StringName &p_function, const Variant **p_args, int p_argcount) {
- Map<StringName, Group>::Element *E = group_map.find(p_group);
+ HashMap<StringName, Group>::Iterator E = group_map.find(p_group);
if (!E) {
return;
}
- Group &g = E->get();
+ Group &g = E->value;
if (g.nodes.is_empty()) {
return;
}
@@ -284,11 +284,11 @@ void SceneTree::call_group_flagsp(uint32_t p_call_flags, const StringName &p_gro
}
void SceneTree::notify_group_flags(uint32_t p_call_flags, const StringName &p_group, int p_notification) {
- Map<StringName, Group>::Element *E = group_map.find(p_group);
+ HashMap<StringName, Group>::Iterator E = group_map.find(p_group);
if (!E) {
return;
}
- Group &g = E->get();
+ Group &g = E->value;
if (g.nodes.is_empty()) {
return;
}
@@ -335,11 +335,11 @@ void SceneTree::notify_group_flags(uint32_t p_call_flags, const StringName &p_gr
}
void SceneTree::set_group_flags(uint32_t p_call_flags, const StringName &p_group, const String &p_name, const Variant &p_value) {
- Map<StringName, Group>::Element *E = group_map.find(p_group);
+ HashMap<StringName, Group>::Iterator E = group_map.find(p_group);
if (!E) {
return;
}
- Group &g = E->get();
+ Group &g = E->value;
if (g.nodes.is_empty()) {
return;
}
@@ -818,11 +818,11 @@ bool SceneTree::is_paused() const {
}
void SceneTree::_notify_group_pause(const StringName &p_group, int p_notification) {
- Map<StringName, Group>::Element *E = group_map.find(p_group);
+ HashMap<StringName, Group>::Iterator E = group_map.find(p_group);
if (!E) {
return;
}
- Group &g = E->get();
+ Group &g = E->value;
if (g.nodes.is_empty()) {
return;
}
@@ -862,11 +862,11 @@ void SceneTree::_notify_group_pause(const StringName &p_group, int p_notificatio
}
void SceneTree::_call_input_pause(const StringName &p_group, CallInputType p_call_type, const Ref<InputEvent> &p_input, Viewport *p_viewport) {
- Map<StringName, Group>::Element *E = group_map.find(p_group);
+ HashMap<StringName, Group>::Iterator E = group_map.find(p_group);
if (!E) {
return;
}
- Group &g = E->get();
+ Group &g = E->value;
if (g.nodes.is_empty()) {
return;
}
@@ -952,20 +952,20 @@ int64_t SceneTree::get_frame() const {
Array SceneTree::_get_nodes_in_group(const StringName &p_group) {
Array ret;
- Map<StringName, Group>::Element *E = group_map.find(p_group);
+ HashMap<StringName, Group>::Iterator E = group_map.find(p_group);
if (!E) {
return ret;
}
- _update_group_order(E->get()); //update order just in case
- int nc = E->get().nodes.size();
+ _update_group_order(E->value); //update order just in case
+ int nc = E->value.nodes.size();
if (nc == 0) {
return ret;
}
ret.resize(nc);
- Node **ptr = E->get().nodes.ptrw();
+ Node **ptr = E->value.nodes.ptrw();
for (int i = 0; i < nc; i++) {
ret[i] = ptr[i];
}
@@ -978,32 +978,32 @@ bool SceneTree::has_group(const StringName &p_identifier) const {
}
Node *SceneTree::get_first_node_in_group(const StringName &p_group) {
- Map<StringName, Group>::Element *E = group_map.find(p_group);
+ HashMap<StringName, Group>::Iterator E = group_map.find(p_group);
if (!E) {
return nullptr; // No group.
}
- _update_group_order(E->get()); // Update order just in case.
+ _update_group_order(E->value); // Update order just in case.
- if (E->get().nodes.is_empty()) {
+ if (E->value.nodes.is_empty()) {
return nullptr;
}
- return E->get().nodes[0];
+ return E->value.nodes[0];
}
void SceneTree::get_nodes_in_group(const StringName &p_group, List<Node *> *p_list) {
- Map<StringName, Group>::Element *E = group_map.find(p_group);
+ HashMap<StringName, Group>::Iterator E = group_map.find(p_group);
if (!E) {
return;
}
- _update_group_order(E->get()); //update order just in case
- int nc = E->get().nodes.size();
+ _update_group_order(E->value); //update order just in case
+ int nc = E->value.nodes.size();
if (nc == 0) {
return;
}
- Node **ptr = E->get().nodes.ptrw();
+ Node **ptr = E->value.nodes.ptrw();
for (int i = 0; i < nc; i++) {
p_list->push_back(ptr[i]);
}
diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h
index d633fb38d0..bdcfd2d35a 100644
--- a/scene/main/scene_tree.h
+++ b/scene/main/scene_tree.h
@@ -102,7 +102,7 @@ private:
bool paused = false;
int root_lock = 0;
- Map<StringName, Group> group_map;
+ HashMap<StringName, Group> group_map;
bool _quit = false;
bool initialized = false;
@@ -121,16 +121,20 @@ private:
StringName group;
StringName call;
+ static uint32_t hash(const UGCall &p_val) {
+ return p_val.group.hash() ^ p_val.call.hash();
+ }
+ bool operator==(const UGCall &p_with) const { return group == p_with.group && call == p_with.call; }
bool operator<(const UGCall &p_with) const { return group == p_with.group ? call < p_with.call : group < p_with.group; }
};
// Safety for when a node is deleted while a group is being called.
int call_lock = 0;
- Set<Node *> call_skip; // Skip erased nodes.
+ RBSet<Node *> call_skip; // Skip erased nodes.
List<ObjectID> delete_queue;
- Map<UGCall, Vector<Variant>> unique_group_calls;
+ HashMap<UGCall, Vector<Variant>, UGCall> unique_group_calls;
bool ugc_locked = false;
void _flush_ugc();
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index e4037c2843..a2399c8b5a 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -412,7 +412,7 @@ void Viewport::_notification(int p_what) {
#ifndef _3D_DISABLED
if (audio_listener_3d_set.size() && !audio_listener_3d) {
AudioListener3D *first = nullptr;
- for (Set<AudioListener3D *>::Element *E = audio_listener_3d_set.front(); E; E = E->next()) {
+ for (RBSet<AudioListener3D *>::Element *E = audio_listener_3d_set.front(); E; E = E->next()) {
if (first == nullptr || first->is_greater_than(E->get())) {
first = E->get();
}
@@ -426,7 +426,7 @@ void Viewport::_notification(int p_what) {
if (camera_3d_set.size() && !camera_3d) {
// There are cameras but no current camera, pick first in tree and make it current.
Camera3D *first = nullptr;
- for (Set<Camera3D *>::Element *E = camera_3d_set.front(); E; E = E->next()) {
+ for (RBSet<Camera3D *>::Element *E = camera_3d_set.front(); E; E = E->next()) {
if (first == nullptr || first->is_greater_than(E->get())) {
first = E->get();
}
@@ -647,7 +647,7 @@ void Viewport::_process_picking() {
uint64_t frame = get_tree()->get_frame();
PhysicsDirectSpaceState2D::ShapeResult res[64];
- for (Set<CanvasLayer *>::Element *E = canvas_layers.front(); E; E = E->next()) {
+ for (RBSet<CanvasLayer *>::Element *E = canvas_layers.front(); E; E = E->next()) {
Transform2D canvas_transform;
ObjectID canvas_layer_id;
if (E->get()) {
@@ -675,23 +675,23 @@ void Viewport::_process_picking() {
if (co && co->can_process()) {
bool send_event = true;
if (is_mouse) {
- Map<ObjectID, uint64_t>::Element *F = physics_2d_mouseover.find(res[i].collider_id);
+ HashMap<ObjectID, uint64_t>::Iterator F = physics_2d_mouseover.find(res[i].collider_id);
if (!F) {
physics_2d_mouseover.insert(res[i].collider_id, frame);
co->_mouse_enter();
} else {
- F->get() = frame;
+ F->value = frame;
// It was already hovered, so don't send the event if it's faked.
if (mm.is_valid() && mm->get_device() == InputEvent::DEVICE_ID_INTERNAL) {
send_event = false;
}
}
- Map<Pair<ObjectID, int>, uint64_t, PairSort<ObjectID, int>>::Element *SF = physics_2d_shape_mouseover.find(Pair(res[i].collider_id, res[i].shape));
+ HashMap<Pair<ObjectID, int>, uint64_t, PairHash<ObjectID, int>>::Iterator SF = physics_2d_shape_mouseover.find(Pair(res[i].collider_id, res[i].shape));
if (!SF) {
physics_2d_shape_mouseover.insert(Pair(res[i].collider_id, res[i].shape), frame);
co->_mouse_shape_enter(res[i].shape);
} else {
- SF->get() = frame;
+ SF->value = frame;
}
}
@@ -2250,14 +2250,14 @@ void Viewport::_drop_physics_mouseover(bool p_paused_only) {
}
void Viewport::_cleanup_mouseover_colliders(bool p_clean_all_frames, bool p_paused_only, uint64_t p_frame_reference) {
- List<Map<ObjectID, uint64_t>::Element *> to_erase;
+ List<ObjectID> to_erase;
- for (Map<ObjectID, uint64_t>::Element *E = physics_2d_mouseover.front(); E; E = E->next()) {
- if (!p_clean_all_frames && E->get() == p_frame_reference) {
+ for (const KeyValue<ObjectID, uint64_t> &E : physics_2d_mouseover) {
+ if (!p_clean_all_frames && E.value == p_frame_reference) {
continue;
}
- Object *o = ObjectDB::get_instance(E->key());
+ Object *o = ObjectDB::get_instance(E.key);
if (o) {
CollisionObject2D *co = Object::cast_to<CollisionObject2D>(o);
if (co && co->is_inside_tree()) {
@@ -2267,7 +2267,7 @@ void Viewport::_cleanup_mouseover_colliders(bool p_clean_all_frames, bool p_paus
co->_mouse_exit();
}
}
- to_erase.push_back(E);
+ to_erase.push_back(E.key);
}
while (to_erase.size()) {
@@ -2276,24 +2276,24 @@ void Viewport::_cleanup_mouseover_colliders(bool p_clean_all_frames, bool p_paus
}
// Per-shape.
- List<Map<Pair<ObjectID, int>, uint64_t, PairSort<ObjectID, int>>::Element *> shapes_to_erase;
+ List<Pair<ObjectID, int>> shapes_to_erase;
- for (Map<Pair<ObjectID, int>, uint64_t, PairSort<ObjectID, int>>::Element *E = physics_2d_shape_mouseover.front(); E; E = E->next()) {
- if (!p_clean_all_frames && E->get() == p_frame_reference) {
+ for (KeyValue<Pair<ObjectID, int>, uint64_t> &E : physics_2d_shape_mouseover) {
+ if (!p_clean_all_frames && E.value == p_frame_reference) {
continue;
}
- Object *o = ObjectDB::get_instance(E->key().first);
+ Object *o = ObjectDB::get_instance(E.key.first);
if (o) {
CollisionObject2D *co = Object::cast_to<CollisionObject2D>(o);
if (co && co->is_inside_tree()) {
if (p_clean_all_frames && p_paused_only && co->can_process()) {
continue;
}
- co->_mouse_shape_exit(E->key().second);
+ co->_mouse_shape_exit(E.key.second);
}
}
- shapes_to_erase.push_back(E);
+ shapes_to_erase.push_back(E.key);
}
while (shapes_to_erase.size()) {
@@ -3179,7 +3179,7 @@ void Viewport::_audio_listener_3d_remove(AudioListener3D *p_listener) {
void Viewport::_audio_listener_3d_make_next_current(AudioListener3D *p_exclude) {
if (audio_listener_3d_set.size() > 0) {
- for (Set<AudioListener3D *>::Element *E = audio_listener_3d_set.front(); E; E = E->next()) {
+ for (RBSet<AudioListener3D *>::Element *E = audio_listener_3d_set.front(); E; E = E->next()) {
if (p_exclude == E->get()) {
continue;
}
@@ -3267,7 +3267,7 @@ void Viewport::_camera_3d_remove(Camera3D *p_camera) {
}
void Viewport::_camera_3d_make_next_current(Camera3D *p_exclude) {
- for (Set<Camera3D *>::Element *E = camera_3d_set.front(); E; E = E->next()) {
+ for (RBSet<Camera3D *>::Element *E = camera_3d_set.front(); E; E = E->next()) {
if (p_exclude == E->get()) {
continue;
}
@@ -3913,7 +3913,7 @@ Viewport::Viewport() {
Viewport::~Viewport() {
// Erase itself from viewport textures.
- for (Set<ViewportTexture *>::Element *E = viewport_textures.front(); E; E = E->next()) {
+ for (RBSet<ViewportTexture *>::Element *E = viewport_textures.front(); E; E = E->next()) {
E->get()->vp = nullptr;
}
RenderingServer::get_singleton()->free(viewport);
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index c1e71c69a3..c1e4b30c20 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -203,7 +203,7 @@ private:
AudioListener2D *audio_listener_2d = nullptr;
Camera2D *camera_2d = nullptr;
- Set<CanvasLayer *> canvas_layers;
+ RBSet<CanvasLayer *> canvas_layers;
RID viewport;
RID current_canvas;
@@ -258,9 +258,9 @@ private:
bool local_input_handled = false;
// Collider to frame
- Map<ObjectID, uint64_t> physics_2d_mouseover;
+ HashMap<ObjectID, uint64_t> physics_2d_mouseover;
// Collider & shape to frame
- Map<Pair<ObjectID, int>, uint64_t, PairSort<ObjectID, int>> physics_2d_shape_mouseover;
+ HashMap<Pair<ObjectID, int>, uint64_t, PairHash<ObjectID, int>> physics_2d_shape_mouseover;
// Cleans up colliders corresponding to old frames or all of them.
void _cleanup_mouseover_colliders(bool p_clean_all_frames, bool p_paused_only, uint64_t p_frame_reference = 0);
@@ -301,7 +301,7 @@ private:
bool use_occlusion_culling = false;
Ref<ViewportTexture> default_texture;
- Set<ViewportTexture *> viewport_textures;
+ RBSet<ViewportTexture *> viewport_textures;
SDFOversize sdf_oversize = SDF_OVERSIZE_120_PERCENT;
SDFScale sdf_scale = SDF_SCALE_50_PERCENT;
@@ -615,7 +615,7 @@ public:
bool use_xr = false;
friend class AudioListener3D;
AudioListener3D *audio_listener_3d = nullptr;
- Set<AudioListener3D *> audio_listener_3d_set;
+ RBSet<AudioListener3D *> audio_listener_3d_set;
bool is_audio_listener_3d_enabled = false;
RID internal_audio_listener_3d;
AudioListener3D *get_audio_listener_3d() const;
@@ -650,7 +650,7 @@ public:
friend class Camera3D;
Camera3D *camera_3d = nullptr;
- Set<Camera3D *> camera_3d_set;
+ RBSet<Camera3D *> camera_3d_set;
Camera3D *get_camera_3d() const;
void _camera_3d_transform_changed_notify();
void _camera_3d_set(Camera3D *p_camera);
diff --git a/scene/main/window.cpp b/scene/main/window.cpp
index 6feccb7eec..d8264e7d33 100644
--- a/scene/main/window.cpp
+++ b/scene/main/window.cpp
@@ -263,7 +263,7 @@ void Window::_make_window() {
DisplayServer::get_singleton()->window_set_transient(window_id, transient_parent->window_id);
}
- for (Set<Window *>::Element *E = transient_children.front(); E; E = E->next()) {
+ for (RBSet<Window *>::Element *E = transient_children.front(); E; E = E->next()) {
if (E->get()->window_id != DisplayServer::INVALID_WINDOW_ID) {
DisplayServer::get_singleton()->window_set_transient(E->get()->window_id, transient_parent->window_id);
}
@@ -290,7 +290,7 @@ void Window::_clear_window() {
DisplayServer::get_singleton()->window_set_transient(window_id, DisplayServer::INVALID_WINDOW_ID);
}
- for (Set<Window *>::Element *E = transient_children.front(); E; E = E->next()) {
+ for (RBSet<Window *>::Element *E = transient_children.front(); E; E = E->next()) {
if (E->get()->window_id != DisplayServer::INVALID_WINDOW_ID) {
DisplayServer::get_singleton()->window_set_transient(E->get()->window_id, DisplayServer::INVALID_WINDOW_ID);
}
diff --git a/scene/main/window.h b/scene/main/window.h
index f674f6425a..80dd9a854c 100644
--- a/scene/main/window.h
+++ b/scene/main/window.h
@@ -131,7 +131,7 @@ private:
void _make_transient();
Window *transient_parent = nullptr;
Window *exclusive_child = nullptr;
- Set<Window *> transient_children;
+ RBSet<Window *> transient_children;
friend class Control;
Ref<Theme> theme;