summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.cpp14
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.h2
-rw-r--r--editor/plugins/animation_state_machine_editor.cpp2
-rw-r--r--editor/plugins/animation_state_machine_editor.h4
-rw-r--r--editor/plugins/asset_library_editor_plugin.h2
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp10
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h2
-rw-r--r--editor/plugins/control_editor_plugin.cpp2
-rw-r--r--editor/plugins/editor_preview_plugins.cpp4
-rw-r--r--editor/plugins/gdextension_export_plugin.h4
-rw-r--r--editor/plugins/gpu_particles_3d_editor_plugin.cpp6
-rw-r--r--editor/plugins/mesh_instance_3d_editor_plugin.cpp2
-rw-r--r--editor/plugins/mesh_library_editor_plugin.cpp2
-rw-r--r--editor/plugins/multimesh_editor_plugin.cpp6
-rw-r--r--editor/plugins/node_3d_editor_gizmos.cpp36
-rw-r--r--editor/plugins/node_3d_editor_gizmos.h8
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp38
-rw-r--r--editor/plugins/node_3d_editor_plugin.h2
-rw-r--r--editor/plugins/packed_scene_translation_parser_plugin.h4
-rw-r--r--editor/plugins/root_motion_editor_plugin.cpp6
-rw-r--r--editor/plugins/script_editor_plugin.cpp42
-rw-r--r--editor/plugins/script_editor_plugin.h4
-rw-r--r--editor/plugins/script_text_editor.cpp18
-rw-r--r--editor/plugins/script_text_editor.h4
-rw-r--r--editor/plugins/shader_editor_plugin.cpp2
-rw-r--r--editor/plugins/skeleton_3d_editor_plugin.cpp4
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp4
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.h4
-rw-r--r--editor/plugins/text_control_editor_plugin.cpp8
-rw-r--r--editor/plugins/text_control_editor_plugin.h2
-rw-r--r--editor/plugins/text_editor.cpp10
-rw-r--r--editor/plugins/text_editor.h2
-rw-r--r--editor/plugins/texture_region_editor_plugin.h2
-rw-r--r--editor/plugins/theme_editor_plugin.cpp6
-rw-r--r--editor/plugins/theme_editor_plugin.h2
-rw-r--r--editor/plugins/tiles/atlas_merging_dialog.cpp2
-rw-r--r--editor/plugins/tiles/atlas_merging_dialog.h2
-rw-r--r--editor/plugins/tiles/tile_atlas_view.cpp4
-rw-r--r--editor/plugins/tiles/tile_atlas_view.h2
-rw-r--r--editor/plugins/tiles/tile_data_editors.cpp28
-rw-r--r--editor/plugins/tiles/tile_data_editors.h16
-rw-r--r--editor/plugins/tiles/tile_map_editor.cpp200
-rw-r--r--editor/plugins/tiles/tile_map_editor.h26
-rw-r--r--editor/plugins/tiles/tile_set_atlas_source_editor.cpp66
-rw-r--r--editor/plugins/tiles/tile_set_atlas_source_editor.h14
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp51
-rw-r--r--editor/plugins/visual_shader_editor_plugin.h12
47 files changed, 362 insertions, 331 deletions
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp
index 0b3164aada..da1594517f 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp
@@ -557,8 +557,8 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
updating = true;
- Set<String> paths;
- HashMap<String, Set<String>> types;
+ RBSet<String> paths;
+ HashMap<String, RBSet<String>> types;
{
List<StringName> animations;
player->get_animation_list(&animations);
@@ -595,9 +595,9 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
filters->clear();
TreeItem *root = filters->create_item();
- Map<String, TreeItem *> parenthood;
+ HashMap<String, TreeItem *> parenthood;
- for (Set<String>::Element *E = paths.front(); E; E = E->next()) {
+ for (RBSet<String>::Element *E = paths.front(); E; E = E->next()) {
NodePath path = E->get();
TreeItem *ti = nullptr;
String accum;
@@ -692,7 +692,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
//just a node, not a property track
String types_text = "[";
if (types.has(path)) {
- Set<String>::Element *F = types[path].front();
+ RBSet<String>::Element *F = types[path].front();
types_text += F->get();
while (F->next()) {
F = F->next();
@@ -903,8 +903,8 @@ void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<Anima
}
//update animations
- for (Map<StringName, ProgressBar *>::Element *E = animations.front(); E; E = E->next()) {
- if (E->key() == prev_name) {
+ for (const KeyValue<StringName, ProgressBar *> &E : animations) {
+ if (E.key == prev_name) {
animations[new_name] = animations[prev_name];
animations.erase(prev_name);
break;
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.h b/editor/plugins/animation_blend_tree_editor_plugin.h
index cacf8379f9..7e96e069c7 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.h
+++ b/editor/plugins/animation_blend_tree_editor_plugin.h
@@ -61,7 +61,7 @@ class AnimationNodeBlendTreeEditor : public AnimationTreeNodeEditorPlugin {
Tree *filters = nullptr;
CheckBox *filter_enabled = nullptr;
- Map<StringName, ProgressBar *> animations;
+ HashMap<StringName, ProgressBar *> animations;
Vector<EditorProperty *> visible_properties;
String to_node = "";
diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp
index 920fe347ca..2b90b4cdd6 100644
--- a/editor/plugins/animation_state_machine_editor.cpp
+++ b/editor/plugins/animation_state_machine_editor.cpp
@@ -609,7 +609,7 @@ void AnimationNodeStateMachineEditor::_group_selected_nodes() {
void AnimationNodeStateMachineEditor::_ungroup_selected_nodes() {
bool find = false;
- Set<StringName> new_selected_nodes;
+ RBSet<StringName> new_selected_nodes;
for (const StringName &E : selected_nodes) {
Ref<AnimationNodeStateMachine> group_sm = state_machine->get_node(E);
diff --git a/editor/plugins/animation_state_machine_editor.h b/editor/plugins/animation_state_machine_editor.h
index 1247d99389..3db4d91367 100644
--- a/editor/plugins/animation_state_machine_editor.h
+++ b/editor/plugins/animation_state_machine_editor.h
@@ -64,7 +64,7 @@ class AnimationNodeStateMachineEditor : public AnimationTreeNodeEditorPlugin {
PanelContainer *panel = nullptr;
StringName selected_node;
- Set<StringName> selected_nodes;
+ RBSet<StringName> selected_nodes;
HScrollBar *h_scroll = nullptr;
VScrollBar *v_scroll = nullptr;
@@ -105,7 +105,7 @@ class AnimationNodeStateMachineEditor : public AnimationTreeNodeEditorPlugin {
Point2 box_selecting_from;
Point2 box_selecting_to;
Rect2 box_selecting_rect;
- Set<StringName> previous_selected;
+ RBSet<StringName> previous_selected;
bool dragging_selected_attempt = false;
bool dragging_selected = false;
diff --git a/editor/plugins/asset_library_editor_plugin.h b/editor/plugins/asset_library_editor_plugin.h
index 24d7c1d24c..af961e1403 100644
--- a/editor/plugins/asset_library_editor_plugin.h
+++ b/editor/plugins/asset_library_editor_plugin.h
@@ -252,7 +252,7 @@ class EditorAssetLibrary : public PanelContainer {
};
int last_queue_id;
- Map<int, ImageQueue> image_queue;
+ HashMap<int, ImageQueue> image_queue;
void _image_update(bool use_cache, bool final, const PackedByteArray &p_data, int p_queue_id);
void _image_request_completed(int p_status, int p_code, const PackedStringArray &headers, const PackedByteArray &p_data, int p_queue_id);
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index c129d705c9..54408e953e 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -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) {
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index 7a49041131..a4099079f3 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -283,7 +283,7 @@ private:
}
};
- Map<BoneKey, BoneList> bone_list;
+ HashMap<BoneKey, BoneList> bone_list;
struct PoseClipboard {
Vector2 pos;
diff --git a/editor/plugins/control_editor_plugin.cpp b/editor/plugins/control_editor_plugin.cpp
index 4ab03c123b..ebb0da1ad7 100644
--- a/editor/plugins/control_editor_plugin.cpp
+++ b/editor/plugins/control_editor_plugin.cpp
@@ -335,7 +335,7 @@ void EditorPropertySizeFlags::setup(const Vector<String> &p_options, bool p_vert
return;
}
- Map<int, String> flags;
+ HashMap<int, String> flags;
for (int i = 0, j = 0; i < p_options.size(); i++, j++) {
Vector<String> text_split = p_options[i].split(":");
int64_t current_val = text_split[1].to_int();
diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp
index 80fc1c64d0..0560365a58 100644
--- a/editor/plugins/editor_preview_plugins.cpp
+++ b/editor/plugins/editor_preview_plugins.cpp
@@ -481,8 +481,8 @@ Ref<Texture2D> EditorScriptPreviewPlugin::generate(const Ref<Resource> &p_from,
List<String> kwors;
scr->get_language()->get_reserved_words(&kwors);
- Set<String> control_flow_keywords;
- Set<String> keywords;
+ RBSet<String> control_flow_keywords;
+ RBSet<String> keywords;
for (const String &E : kwors) {
if (scr->get_language()->is_control_flow_keyword(E)) {
diff --git a/editor/plugins/gdextension_export_plugin.h b/editor/plugins/gdextension_export_plugin.h
index 8ed72b1c42..28c37fed52 100644
--- a/editor/plugins/gdextension_export_plugin.h
+++ b/editor/plugins/gdextension_export_plugin.h
@@ -35,10 +35,10 @@
class GDExtensionExportPlugin : public EditorExportPlugin {
protected:
- virtual void _export_file(const String &p_path, const String &p_type, const Set<String> &p_features);
+ virtual void _export_file(const String &p_path, const String &p_type, const RBSet<String> &p_features);
};
-void GDExtensionExportPlugin::_export_file(const String &p_path, const String &p_type, const Set<String> &p_features) {
+void GDExtensionExportPlugin::_export_file(const String &p_path, const String &p_type, const RBSet<String> &p_features) {
if (p_type != "NativeExtension") {
return;
}
diff --git a/editor/plugins/gpu_particles_3d_editor_plugin.cpp b/editor/plugins/gpu_particles_3d_editor_plugin.cpp
index 4b1081ed92..b022fcc1c9 100644
--- a/editor/plugins/gpu_particles_3d_editor_plugin.cpp
+++ b/editor/plugins/gpu_particles_3d_editor_plugin.cpp
@@ -42,7 +42,7 @@ bool GPUParticles3DEditorBase::_generate(Vector<Vector3> &points, Vector<Vector3
if (emission_fill->get_selected() < 2) {
float area_accum = 0;
- Map<float, int> triangle_area_map;
+ RBMap<float, int> triangle_area_map;
for (int i = 0; i < geometry.size(); i++) {
float area = geometry[i].get_area();
@@ -63,9 +63,9 @@ bool GPUParticles3DEditorBase::_generate(Vector<Vector3> &points, Vector<Vector3
for (int i = 0; i < emissor_count; i++) {
float areapos = Math::random(0.0f, area_accum);
- Map<float, int>::Element *E = triangle_area_map.find_closest(areapos);
+ RBMap<float, int>::Iterator E = triangle_area_map.find_closest(areapos);
ERR_FAIL_COND_V(!E, false);
- int index = E->get();
+ int index = E->value;
ERR_FAIL_INDEX_V(index, geometry.size(), false);
// ok FINALLY get face
diff --git a/editor/plugins/mesh_instance_3d_editor_plugin.cpp b/editor/plugins/mesh_instance_3d_editor_plugin.cpp
index 1c75591b34..3094e24659 100644
--- a/editor/plugins/mesh_instance_3d_editor_plugin.cpp
+++ b/editor/plugins/mesh_instance_3d_editor_plugin.cpp
@@ -373,7 +373,7 @@ void MeshInstance3DEditor::_create_uv_lines(int p_layer) {
Ref<Mesh> mesh = node->get_mesh();
ERR_FAIL_COND(!mesh.is_valid());
- Set<MeshInstance3DEditorEdgeSort> edges;
+ RBSet<MeshInstance3DEditorEdgeSort> edges;
uv_lines.clear();
for (int i = 0; i < mesh->get_surface_count(); i++) {
if (mesh->surface_get_primitive_type(i) != Mesh::PRIMITIVE_TRIANGLES) {
diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp
index 423ec5f4ed..914ccb54c1 100644
--- a/editor/plugins/mesh_library_editor_plugin.cpp
+++ b/editor/plugins/mesh_library_editor_plugin.cpp
@@ -71,7 +71,7 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library,
p_library->clear();
}
- Map<int, MeshInstance3D *> mesh_instances;
+ HashMap<int, MeshInstance3D *> mesh_instances;
for (int i = 0; i < p_scene->get_child_count(); i++) {
Node *child = p_scene->get_child(i);
diff --git a/editor/plugins/multimesh_editor_plugin.cpp b/editor/plugins/multimesh_editor_plugin.cpp
index b54fa41e88..0fab3aed0d 100644
--- a/editor/plugins/multimesh_editor_plugin.cpp
+++ b/editor/plugins/multimesh_editor_plugin.cpp
@@ -141,7 +141,7 @@ void MultiMeshEditor::_populate() {
const Face3 *r = faces.ptr();
float area_accum = 0;
- Map<float, int> triangle_area_map;
+ RBMap<float, int> triangle_area_map;
for (int i = 0; i < facecount; i++) {
float area = r[i].get_area();
if (area < CMP_EPSILON) {
@@ -180,9 +180,9 @@ void MultiMeshEditor::_populate() {
for (int i = 0; i < instance_count; i++) {
float areapos = Math::random(0.0f, area_accum);
- Map<float, int>::Element *E = triangle_area_map.find_closest(areapos);
+ RBMap<float, int>::Iterator E = triangle_area_map.find_closest(areapos);
ERR_FAIL_COND(!E);
- int index = E->get();
+ int index = E->value;
ERR_FAIL_INDEX(index, facecount);
// ok FINALLY get face
diff --git a/editor/plugins/node_3d_editor_gizmos.cpp b/editor/plugins/node_3d_editor_gizmos.cpp
index 6829e25ef3..58cdf3533c 100644
--- a/editor/plugins/node_3d_editor_gizmos.cpp
+++ b/editor/plugins/node_3d_editor_gizmos.cpp
@@ -2993,10 +2993,15 @@ void GPUParticles3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
////
GPUParticlesCollision3DGizmoPlugin::GPUParticlesCollision3DGizmoPlugin() {
- Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/particle_collision", Color(0.5, 0.7, 1));
- create_material("shape_material", gizmo_color);
- gizmo_color.a = 0.15;
- create_material("shape_material_internal", gizmo_color);
+ Color gizmo_color_attractor = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/particle_attractor", Color(1, 0.7, 0.5));
+ create_material("shape_material_attractor", gizmo_color_attractor);
+ gizmo_color_attractor.a = 0.15;
+ create_material("shape_material_attractor_internal", gizmo_color_attractor);
+
+ Color gizmo_color_collision = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/particle_collision", Color(0.5, 0.7, 1));
+ create_material("shape_material_collision", gizmo_color_collision);
+ gizmo_color_collision.a = 0.15;
+ create_material("shape_material_collision_internal", gizmo_color_collision);
create_handle_material("handles");
}
@@ -3122,12 +3127,17 @@ void GPUParticlesCollision3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
p_gizmo->clear();
- const Ref<Material> material =
- get_material("shape_material", p_gizmo);
- const Ref<Material> material_internal =
- get_material("shape_material_internal", p_gizmo);
+ Ref<Material> material;
+ Ref<Material> material_internal;
+ if (Object::cast_to<GPUParticlesAttractor3D>(cs)) {
+ material = get_material("shape_material_attractor", p_gizmo);
+ material_internal = get_material("shape_material_attractor_internal", p_gizmo);
+ } else {
+ material = get_material("shape_material_collision", p_gizmo);
+ material_internal = get_material("shape_material_collision_internal", p_gizmo);
+ }
- Ref<Material> handles_material = get_material("handles");
+ const Ref<Material> handles_material = get_material("handles");
if (Object::cast_to<GPUParticlesCollisionSphere3D>(cs) || Object::cast_to<GPUParticlesAttractorSphere3D>(cs)) {
float r = cs->call("get_radius");
@@ -3789,7 +3799,7 @@ void LightmapGIGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
p_gizmo->clear();
Vector<Vector3> lines;
- Set<Vector2i> lines_found;
+ RBSet<Vector2i> lines_found;
Vector<Vector3> points = data->get_capture_points();
if (points.size() == 0) {
@@ -4755,7 +4765,7 @@ void NavigationRegion3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
return;
}
- Map<_EdgeKey, bool> edge_map;
+ HashMap<_EdgeKey, bool, _EdgeKey> edge_map;
Vector<Vector3> tmeshfaces;
tmeshfaces.resize(faces.size() * 3);
@@ -4773,10 +4783,10 @@ void NavigationRegion3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
SWAP(ek.from, ek.to);
}
- Map<_EdgeKey, bool>::Element *F = edge_map.find(ek);
+ HashMap<_EdgeKey, bool, _EdgeKey>::Iterator F = edge_map.find(ek);
if (F) {
- F->get() = false;
+ F->value = false;
} else {
edge_map[ek] = true;
diff --git a/editor/plugins/node_3d_editor_gizmos.h b/editor/plugins/node_3d_editor_gizmos.h
index 4df329a2c5..a0d7715347 100644
--- a/editor/plugins/node_3d_editor_gizmos.h
+++ b/editor/plugins/node_3d_editor_gizmos.h
@@ -601,7 +601,13 @@ class NavigationRegion3DGizmoPlugin : public EditorNode3DGizmoPlugin {
Vector3 from;
Vector3 to;
- bool operator<(const _EdgeKey &p_with) const { return from == p_with.from ? to < p_with.to : from < p_with.from; }
+ static uint32_t hash(const _EdgeKey &p_key) {
+ return HashMapHasherDefault::hash(p_key.from) ^ HashMapHasherDefault::hash(p_key.to);
+ }
+
+ bool operator==(const _EdgeKey &p_with) const {
+ return HashMapComparatorDefault<Vector3>::compare(from, p_with.from) && HashMapComparatorDefault<Vector3>::compare(to, p_with.to);
+ }
};
public:
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index d2af13d7fa..1d85e80331 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -369,7 +369,7 @@ Transform3D Node3DEditorViewport::to_camera_transform(const Cursor &p_cursor) co
}
int Node3DEditorViewport::get_selected_count() const {
- const Map<Node *, Object *> &selection = editor_selection->get_selection();
+ const HashMap<Node *, Object *> &selection = editor_selection->get_selection();
int count = 0;
@@ -518,7 +518,7 @@ ObjectID Node3DEditorViewport::_select_ray(const Point2 &p_pos) {
}
Vector<ObjectID> instances = RenderingServer::get_singleton()->instances_cull_ray(pos, pos + ray * camera->get_far(), get_tree()->get_root()->get_world_3d()->get_scenario());
- Set<Ref<EditorNode3DGizmo>> found_gizmos;
+ RBSet<Ref<EditorNode3DGizmo>> found_gizmos;
Node *edited_scene = get_tree()->get_edited_scene_root();
ObjectID closest;
@@ -581,7 +581,7 @@ void Node3DEditorViewport::_find_items_at_pos(const Point2 &p_pos, Vector<_RayRe
Vector3 pos = _get_ray_pos(p_pos);
Vector<ObjectID> instances = RenderingServer::get_singleton()->instances_cull_ray(pos, pos + ray * camera->get_far(), get_tree()->get_root()->get_world_3d()->get_scenario());
- Set<Node3D *> found_nodes;
+ RBSet<Node3D *> found_nodes;
for (int i = 0; i < instances.size(); i++) {
Node3D *spat = Object::cast_to<Node3D>(ObjectDB::get_instance(instances[i]));
@@ -764,7 +764,7 @@ void Node3DEditorViewport::_select_region() {
}
Vector<ObjectID> instances = RenderingServer::get_singleton()->instances_cull_convex(frustum, get_tree()->get_root()->get_world_3d()->get_scenario());
- Set<Node3D *> found_nodes;
+ RBSet<Node3D *> found_nodes;
Vector<Node *> selected;
Node *edited_scene = get_tree()->get_edited_scene_root();
@@ -2465,7 +2465,7 @@ void Node3DEditorViewport::_notification(int p_what) {
_update_camera(delta);
- const Map<Node *, Object *> &selection = editor_selection->get_selection();
+ const HashMap<Node *, Object *> &selection = editor_selection->get_selection();
bool changed = false;
bool exist = false;
@@ -6685,8 +6685,8 @@ void Node3DEditor::_refresh_menu_icons() {
}
template <typename T>
-Set<T *> _get_child_nodes(Node *parent_node) {
- Set<T *> nodes = Set<T *>();
+RBSet<T *> _get_child_nodes(Node *parent_node) {
+ RBSet<T *> nodes = RBSet<T *>();
T *node = Node::cast_to<T>(parent_node);
if (node) {
nodes.insert(node);
@@ -6694,8 +6694,8 @@ Set<T *> _get_child_nodes(Node *parent_node) {
for (int i = 0; i < parent_node->get_child_count(); i++) {
Node *child_node = parent_node->get_child(i);
- Set<T *> child_nodes = _get_child_nodes<T>(child_node);
- for (typename Set<T *>::Element *I = child_nodes.front(); I; I = I->next()) {
+ RBSet<T *> child_nodes = _get_child_nodes<T>(child_node);
+ for (typename RBSet<T *>::Element *I = child_nodes.front(); I; I = I->next()) {
nodes.insert(I->get());
}
}
@@ -6703,14 +6703,14 @@ Set<T *> _get_child_nodes(Node *parent_node) {
return nodes;
}
-Set<RID> _get_physics_bodies_rid(Node *node) {
- Set<RID> rids = Set<RID>();
+RBSet<RID> _get_physics_bodies_rid(Node *node) {
+ RBSet<RID> rids = RBSet<RID>();
PhysicsBody3D *pb = Node::cast_to<PhysicsBody3D>(node);
if (pb) {
rids.insert(pb->get_rid());
}
- Set<PhysicsBody3D *> child_nodes = _get_child_nodes<PhysicsBody3D>(node);
- for (Set<PhysicsBody3D *>::Element *I = child_nodes.front(); I; I = I->next()) {
+ RBSet<PhysicsBody3D *> child_nodes = _get_child_nodes<PhysicsBody3D>(node);
+ for (RBSet<PhysicsBody3D *>::Element *I = child_nodes.front(); I; I = I->next()) {
rids.insert(I->get()->get_rid());
}
@@ -6728,13 +6728,13 @@ void Node3DEditor::snap_selected_nodes_to_floor() {
Vector3 position_offset = Vector3();
// Priorities for snapping to floor are CollisionShapes, VisualInstances and then origin
- Set<VisualInstance3D *> vi = _get_child_nodes<VisualInstance3D>(sp);
- Set<CollisionShape3D *> cs = _get_child_nodes<CollisionShape3D>(sp);
+ RBSet<VisualInstance3D *> vi = _get_child_nodes<VisualInstance3D>(sp);
+ RBSet<CollisionShape3D *> cs = _get_child_nodes<CollisionShape3D>(sp);
bool found_valid_shape = false;
if (cs.size()) {
AABB aabb;
- Set<CollisionShape3D *>::Element *I = cs.front();
+ RBSet<CollisionShape3D *>::Element *I = cs.front();
if (I->get()->get_shape().is_valid()) {
CollisionShape3D *collision_shape = cs.front()->get();
aabb = collision_shape->get_global_transform().xform(collision_shape->get_shape()->get_debug_mesh()->get_aabb());
@@ -6755,7 +6755,7 @@ void Node3DEditor::snap_selected_nodes_to_floor() {
}
if (!found_valid_shape && vi.size()) {
AABB aabb = vi.front()->get()->get_transformed_aabb();
- for (Set<VisualInstance3D *>::Element *I = vi.front(); I; I = I->next()) {
+ for (RBSet<VisualInstance3D *>::Element *I = vi.front(); I; I = I->next()) {
aabb.merge_with(I->get()->get_transformed_aabb());
}
Vector3 size = aabb.size * Vector3(0.5, 0.0, 0.5);
@@ -6798,7 +6798,7 @@ void Node3DEditor::snap_selected_nodes_to_floor() {
Dictionary d = snap_data[node];
Vector3 from = d["from"];
Vector3 to = from - Vector3(0.0, max_snap_height, 0.0);
- Set<RID> excluded = _get_physics_bodies_rid(sp);
+ RBSet<RID> excluded = _get_physics_bodies_rid(sp);
PhysicsDirectSpaceState3D::RayParameters ray_params;
ray_params.from = from;
@@ -6820,7 +6820,7 @@ void Node3DEditor::snap_selected_nodes_to_floor() {
Dictionary d = snap_data[node];
Vector3 from = d["from"];
Vector3 to = from - Vector3(0.0, max_snap_height, 0.0);
- Set<RID> excluded = _get_physics_bodies_rid(sp);
+ RBSet<RID> excluded = _get_physics_bodies_rid(sp);
PhysicsDirectSpaceState3D::RayParameters ray_params;
ray_params.from = from;
diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h
index 43efdeec72..511135a5f1 100644
--- a/editor/plugins/node_3d_editor_plugin.h
+++ b/editor/plugins/node_3d_editor_plugin.h
@@ -461,7 +461,7 @@ public:
RID sbox_instance_xray;
RID sbox_instance_xray_offset;
Ref<EditorNode3DGizmo> gizmo;
- Map<int, Transform3D> subgizmos; // map ID -> initial transform
+ HashMap<int, Transform3D> subgizmos; // map ID -> initial transform
Node3DEditorSelectedItem() {
sp = nullptr;
diff --git a/editor/plugins/packed_scene_translation_parser_plugin.h b/editor/plugins/packed_scene_translation_parser_plugin.h
index ecd090b31b..9135498333 100644
--- a/editor/plugins/packed_scene_translation_parser_plugin.h
+++ b/editor/plugins/packed_scene_translation_parser_plugin.h
@@ -37,9 +37,9 @@ class PackedSceneEditorTranslationParserPlugin : public EditorTranslationParserP
GDCLASS(PackedSceneEditorTranslationParserPlugin, EditorTranslationParserPlugin);
// Scene Node's properties that contain translation strings.
- Set<String> lookup_properties;
+ RBSet<String> lookup_properties;
// Properties from specific Nodes that should be ignored.
- Map<String, Vector<String>> exception_list;
+ HashMap<String, Vector<String>> exception_list;
public:
virtual Error parse_file(const String &p_path, Vector<String> *r_ids, Vector<Vector<String>> *r_ids_ctx_plural) override;
diff --git a/editor/plugins/root_motion_editor_plugin.cpp b/editor/plugins/root_motion_editor_plugin.cpp
index bfb672d694..b632b0d641 100644
--- a/editor/plugins/root_motion_editor_plugin.cpp
+++ b/editor/plugins/root_motion_editor_plugin.cpp
@@ -65,7 +65,7 @@ void EditorPropertyRootMotion::_node_assign() {
return;
}
- Set<String> paths;
+ RBSet<String> paths;
{
List<StringName> animations;
player->get_animation_list(&animations);
@@ -81,9 +81,9 @@ void EditorPropertyRootMotion::_node_assign() {
filters->clear();
TreeItem *root = filters->create_item();
- Map<String, TreeItem *> parenthood;
+ HashMap<String, TreeItem *> parenthood;
- for (Set<String>::Element *E = paths.front(); E; E = E->next()) {
+ for (RBSet<String>::Element *E = paths.front(); E; E = E->next()) {
NodePath path = E->get();
TreeItem *ti = nullptr;
String accum;
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 8d29e04eec..8e33afa3c6 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -235,21 +235,21 @@ class EditorScriptCodeCompletionCache : public ScriptCodeCompletionCache {
Ref<Resource> cache;
};
- Map<String, Cache> cached;
+ HashMap<String, Cache> cached;
public:
uint64_t max_time_cache = 5 * 60 * 1000; //minutes, five
- int max_cache_size = 128;
+ uint32_t max_cache_size = 128;
void cleanup() {
- List<Map<String, Cache>::Element *> to_clean;
+ List<String> to_clean;
- Map<String, Cache>::Element *I = cached.front();
+ HashMap<String, Cache>::Iterator I = cached.begin();
while (I) {
- if ((OS::get_singleton()->get_ticks_msec() - I->get().time_loaded) > max_time_cache) {
- to_clean.push_back(I);
+ if ((OS::get_singleton()->get_ticks_msec() - I->value.time_loaded) > max_time_cache) {
+ to_clean.push_back(I->key);
}
- I = I->next();
+ ++I;
}
while (to_clean.front()) {
@@ -259,34 +259,34 @@ public:
}
virtual Ref<Resource> get_cached_resource(const String &p_path) {
- Map<String, Cache>::Element *E = cached.find(p_path);
+ HashMap<String, Cache>::Iterator E = cached.find(p_path);
if (!E) {
Cache c;
c.cache = ResourceLoader::load(p_path);
E = cached.insert(p_path, c);
}
- E->get().time_loaded = OS::get_singleton()->get_ticks_msec();
+ E->value.time_loaded = OS::get_singleton()->get_ticks_msec();
if (cached.size() > max_cache_size) {
uint64_t older;
- Map<String, Cache>::Element *O = cached.front();
- older = O->get().time_loaded;
- Map<String, Cache>::Element *I = O;
+ HashMap<String, Cache>::Iterator O = cached.begin();
+ older = O->value.time_loaded;
+ HashMap<String, Cache>::Iterator I = O;
while (I) {
- if (I->get().time_loaded < older) {
- older = I->get().time_loaded;
+ if (I->value.time_loaded < older) {
+ older = I->value.time_loaded;
O = I;
}
- I = I->next();
+ ++I;
}
if (O != E) { //should never happen..
- cached.erase(O);
+ cached.remove(O);
}
}
- return E->get().cache;
+ return E->value.cache;
}
virtual ~EditorScriptCodeCompletionCache() {}
@@ -1707,7 +1707,7 @@ void ScriptEditor::notify_script_changed(const Ref<Script> &p_script) {
}
void ScriptEditor::get_breakpoints(List<String> *p_breakpoints) {
- Set<String> loaded_scripts;
+ RBSet<String> loaded_scripts;
for (int i = 0; i < tab_container->get_tab_count(); i++) {
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (!se) {
@@ -1792,7 +1792,7 @@ void ScriptEditor::ensure_select_current() {
_update_selected_editor_menu();
}
-void ScriptEditor::_find_scripts(Node *p_base, Node *p_current, Set<Ref<Script>> &used) {
+void ScriptEditor::_find_scripts(Node *p_base, Node *p_current, RBSet<Ref<Script>> &used) {
if (p_current != p_base && p_current->get_owner() != p_base) {
return;
}
@@ -1972,7 +1972,7 @@ void ScriptEditor::_update_script_names() {
return;
}
- Set<Ref<Script>> used;
+ RBSet<Ref<Script>> used;
Node *edited = EditorNode::get_singleton()->get_edited_scene();
if (edited) {
_find_scripts(edited, edited, used);
@@ -3135,7 +3135,7 @@ void ScriptEditor::set_window_layout(Ref<ConfigFile> p_layout) {
restoring_layout = true;
- Set<String> loaded_scripts;
+ RBSet<String> loaded_scripts;
List<String> extensions;
ResourceLoader::get_recognized_extensions_for_type("Script", &extensions);
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index 41b311f745..35cb24da70 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -415,7 +415,7 @@ class ScriptEditor : public PanelContainer {
void _update_help_overview();
void _help_overview_selected(int p_idx);
- void _find_scripts(Node *p_base, Node *p_current, Set<Ref<Script>> &used);
+ void _find_scripts(Node *p_base, Node *p_current, RBSet<Ref<Script>> &used);
void _tree_changed();
@@ -455,7 +455,7 @@ class ScriptEditor : public PanelContainer {
Ref<Script> _get_current_script();
Array _get_open_scripts() const;
- Set<String> textfile_extensions;
+ RBSet<String> textfile_extensions;
Ref<TextFile> _load_text_file(const String &p_path, Error *r_error) const;
Error _save_text_file(Ref<TextFile> p_text_file, const String &p_path);
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index bed7739239..9c78f3f2e8 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -664,7 +664,7 @@ static Node *_find_node_for_script(Node *p_base, Node *p_current, const Ref<Scri
return nullptr;
}
-static void _find_changed_scripts_for_external_editor(Node *p_base, Node *p_current, Set<Ref<Script>> &r_scripts) {
+static void _find_changed_scripts_for_external_editor(Node *p_base, Node *p_current, RBSet<Ref<Script>> &r_scripts) {
if (p_current->get_owner() != p_base && p_base != p_current) {
return;
}
@@ -686,14 +686,14 @@ void ScriptEditor::_update_modified_scripts_for_external_editor(Ref<Script> p_fo
ERR_FAIL_COND(!get_tree());
- Set<Ref<Script>> scripts;
+ RBSet<Ref<Script>> scripts;
Node *base = get_tree()->get_edited_scene_root();
if (base) {
_find_changed_scripts_for_external_editor(base, base, scripts);
}
- for (Set<Ref<Script>>::Element *E = scripts.front(); E; E = E->next()) {
+ for (RBSet<Ref<Script>>::Element *E = scripts.front(); E; E = E->next()) {
Ref<Script> script = E->get();
if (p_for_script.is_valid() && p_for_script != script) {
@@ -970,7 +970,7 @@ void ScriptTextEditor::_update_connected_methods() {
}
Vector<Node *> nodes = _find_all_node_for_script(base, base, script);
- Set<StringName> methods_found;
+ RBSet<StringName> methods_found;
for (int i = 0; i < nodes.size(); i++) {
List<Connection> connections;
nodes[i]->get_signals_connected_to_this(&connections);
@@ -1371,11 +1371,11 @@ void ScriptTextEditor::add_syntax_highlighter(Ref<EditorSyntaxHighlighter> p_hig
void ScriptTextEditor::set_syntax_highlighter(Ref<EditorSyntaxHighlighter> p_highlighter) {
ERR_FAIL_COND(p_highlighter.is_null());
- Map<String, Ref<EditorSyntaxHighlighter>>::Element *el = highlighters.front();
- while (el != nullptr) {
- int highlighter_index = highlighter_menu->get_item_idx_from_text(el->key());
- highlighter_menu->set_item_checked(highlighter_index, el->value() == p_highlighter);
- el = el->next();
+ HashMap<String, Ref<EditorSyntaxHighlighter>>::Iterator el = highlighters.begin();
+ while (el) {
+ int highlighter_index = highlighter_menu->get_item_idx_from_text(el->key);
+ highlighter_menu->set_item_checked(highlighter_index, el->value == p_highlighter);
+ ++el;
}
CodeEdit *te = code_editor->get_text_editor();
diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h
index b3e0c28bb1..ff13b38832 100644
--- a/editor/plugins/script_text_editor.h
+++ b/editor/plugins/script_text_editor.h
@@ -64,7 +64,7 @@ class ScriptTextEditor : public ScriptEditorBase {
Vector<String> functions;
List<ScriptLanguage::Warning> warnings;
List<ScriptLanguage::ScriptError> errors;
- Set<int> safe_lines;
+ RBSet<int> safe_lines;
List<Connection> missing_connections;
@@ -175,7 +175,7 @@ protected:
void _notification(int p_what);
static void _bind_methods();
- Map<String, Ref<EditorSyntaxHighlighter>> highlighters;
+ HashMap<String, Ref<EditorSyntaxHighlighter>> highlighters;
void _change_syntax_highlighter(int p_idx);
void _edit_option(int p_op);
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index 1bf78cc107..c13d0dc197 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -47,7 +47,7 @@
static bool saved_warnings_enabled = false;
static bool saved_treat_warning_as_errors = false;
-static Map<ShaderWarning::Code, bool> saved_warnings;
+static HashMap<ShaderWarning::Code, bool> saved_warnings;
static uint32_t saved_warning_flags = 0U;
void ShaderTextEditor::_notification(int p_what) {
diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp
index 26a982a091..1ebdf466fe 100644
--- a/editor/plugins/skeleton_3d_editor_plugin.cpp
+++ b/editor/plugins/skeleton_3d_editor_plugin.cpp
@@ -588,7 +588,7 @@ void Skeleton3DEditor::update_joint_tree() {
TreeItem *root = joint_tree->create_item();
- Map<int, TreeItem *> items;
+ HashMap<int, TreeItem *> items;
items.insert(-1, root);
@@ -600,7 +600,7 @@ void Skeleton3DEditor::update_joint_tree() {
bones_to_process.erase(current_bone_idx);
const int parent_idx = skeleton->get_bone_parent(current_bone_idx);
- TreeItem *parent_item = items.find(parent_idx)->get();
+ TreeItem *parent_item = items.find(parent_idx)->value;
TreeItem *joint_item = joint_tree->create_item(parent_item);
items.insert(current_bone_idx, joint_item);
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index 7b6aeb3679..cb8d59dfe4 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -125,7 +125,7 @@ void SpriteFramesEditor::_sheet_preview_draw() {
Color accent = get_theme_color("accent_color", "Editor");
- for (Set<int>::Element *E = frames_selected.front(); E; E = E->next()) {
+ for (RBSet<int>::Element *E = frames_selected.front(); E; E = E->next()) {
const int idx = E->get();
const int x = idx % frame_count.x;
const int y = idx / frame_count.x;
@@ -248,7 +248,7 @@ void SpriteFramesEditor::_sheet_add_frames() {
int fc = frames->get_frame_count(edited_anim);
- for (Set<int>::Element *E = frames_selected.front(); E; E = E->next()) {
+ for (RBSet<int>::Element *E = frames_selected.front(); E; E = E->next()) {
int idx = E->get();
const Point2 frame_coords(idx % frame_count.x, idx / frame_count.x);
diff --git a/editor/plugins/sprite_frames_editor_plugin.h b/editor/plugins/sprite_frames_editor_plugin.h
index 3230228fdd..6f16ff2bd1 100644
--- a/editor/plugins/sprite_frames_editor_plugin.h
+++ b/editor/plugins/sprite_frames_editor_plugin.h
@@ -103,8 +103,8 @@ class SpriteFramesEditor : public HSplitContainer {
Button *split_sheet_zoom_reset = nullptr;
Button *split_sheet_zoom_in = nullptr;
EditorFileDialog *file_split_sheet = nullptr;
- Set<int> frames_selected;
- Set<int> frames_toggled_by_mouse_hover;
+ RBSet<int> frames_selected;
+ RBSet<int> frames_toggled_by_mouse_hover;
int last_frame_selected = 0;
float scale_ratio;
diff --git a/editor/plugins/text_control_editor_plugin.cpp b/editor/plugins/text_control_editor_plugin.cpp
index 4290888e94..2a5faba4a2 100644
--- a/editor/plugins/text_control_editor_plugin.cpp
+++ b/editor/plugins/text_control_editor_plugin.cpp
@@ -92,8 +92,8 @@ void TextControlEditor::_update_fonts_menu() {
}
int id = FONT_INFO_ID;
- for (Map<String, Map<String, String>>::Element *E = fonts.front(); E; E = E->next()) {
- font_list->add_item(E->key(), id++);
+ for (const KeyValue<String, HashMap<String, String>> &E : fonts) {
+ font_list->add_item(E.key, id++);
}
if (font_list->get_item_count() > 1) {
@@ -107,8 +107,8 @@ void TextControlEditor::_update_styles_menu() {
font_style_list->clear();
if ((font_list->get_selected_id() >= FONT_INFO_ID)) {
const String &name = font_list->get_item_text(font_list->get_selected());
- for (Map<String, String>::Element *E = fonts[name].front(); E; E = E->next()) {
- font_style_list->add_item(E->key());
+ for (KeyValue<String, String> &E : fonts[name]) {
+ font_style_list->add_item(E.key);
}
} else if (font_list->get_selected() >= 0) {
font_style_list->add_item("Default");
diff --git a/editor/plugins/text_control_editor_plugin.h b/editor/plugins/text_control_editor_plugin.h
index a475f6eba3..cf069338b6 100644
--- a/editor/plugins/text_control_editor_plugin.h
+++ b/editor/plugins/text_control_editor_plugin.h
@@ -52,7 +52,7 @@ class TextControlEditor : public HBoxContainer {
FONT_INFO_ID = 100,
};
- Map<String, Map<String, String>> fonts;
+ HashMap<String, HashMap<String, String>> fonts;
OptionButton *font_list = nullptr;
SpinBox *font_size_list = nullptr;
diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp
index 97ecc234e6..7ca65c073d 100644
--- a/editor/plugins/text_editor.cpp
+++ b/editor/plugins/text_editor.cpp
@@ -43,11 +43,11 @@ void TextEditor::add_syntax_highlighter(Ref<EditorSyntaxHighlighter> p_highlight
void TextEditor::set_syntax_highlighter(Ref<EditorSyntaxHighlighter> p_highlighter) {
ERR_FAIL_COND(p_highlighter.is_null());
- Map<String, Ref<EditorSyntaxHighlighter>>::Element *el = highlighters.front();
- while (el != nullptr) {
- int highlighter_index = highlighter_menu->get_item_idx_from_text(el->key());
- highlighter_menu->set_item_checked(highlighter_index, el->value() == p_highlighter);
- el = el->next();
+ HashMap<String, Ref<EditorSyntaxHighlighter>>::Iterator el = highlighters.begin();
+ while (el) {
+ int highlighter_index = highlighter_menu->get_item_idx_from_text(el->key);
+ highlighter_menu->set_item_checked(highlighter_index, el->value == p_highlighter);
+ ++el;
}
CodeEdit *te = code_editor->get_text_editor();
diff --git a/editor/plugins/text_editor.h b/editor/plugins/text_editor.h
index 9b6d568382..4f0121da52 100644
--- a/editor/plugins/text_editor.h
+++ b/editor/plugins/text_editor.h
@@ -92,7 +92,7 @@ protected:
void _text_edit_gui_input(const Ref<InputEvent> &ev);
void _prepare_edit_menu();
- Map<String, Ref<EditorSyntaxHighlighter>> highlighters;
+ HashMap<String, Ref<EditorSyntaxHighlighter>> highlighters;
void _change_syntax_highlighter(int p_idx);
void _load_theme_settings();
diff --git a/editor/plugins/texture_region_editor_plugin.h b/editor/plugins/texture_region_editor_plugin.h
index 2493446303..2c4ab72743 100644
--- a/editor/plugins/texture_region_editor_plugin.h
+++ b/editor/plugins/texture_region_editor_plugin.h
@@ -89,7 +89,7 @@ class TextureRegionEditor : public VBoxContainer {
Rect2 rect_prev;
float prev_margin = 0.0f;
int edited_margin;
- Map<RID, List<Rect2>> cache_map;
+ HashMap<RID, List<Rect2>> cache_map;
List<Rect2> autoslice_cache;
bool autoslice_is_dirty;
diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp
index 41a599e933..7b2c7d2a82 100644
--- a/editor/plugins/theme_editor_plugin.cpp
+++ b/editor/plugins/theme_editor_plugin.cpp
@@ -3211,11 +3211,13 @@ void ThemeTypeEditor::_update_stylebox_from_leading() {
edited_theme->get_stylebox_list(edited_type, &names);
List<Ref<StyleBox>> styleboxes;
for (const StringName &E : names) {
- if (E == leading_stylebox.item_name) {
+ Ref<StyleBox> sb = edited_theme->get_stylebox(E, edited_type);
+
+ // Avoid itself, stylebox can be shared between items.
+ if (sb == leading_stylebox.stylebox) {
continue;
}
- Ref<StyleBox> sb = edited_theme->get_stylebox(E, edited_type);
if (sb->get_class() == leading_stylebox.stylebox->get_class()) {
styleboxes.push_back(sb);
}
diff --git a/editor/plugins/theme_editor_plugin.h b/editor/plugins/theme_editor_plugin.h
index 6debf00e90..323cfceb7e 100644
--- a/editor/plugins/theme_editor_plugin.h
+++ b/editor/plugins/theme_editor_plugin.h
@@ -73,7 +73,7 @@ class ThemeItemImportTree : public VBoxContainer {
SELECT_IMPORT_FULL,
};
- Map<ThemeItem, ItemCheckedState> selected_items;
+ RBMap<ThemeItem, ItemCheckedState> selected_items;
LineEdit *import_items_filter = nullptr;
diff --git a/editor/plugins/tiles/atlas_merging_dialog.cpp b/editor/plugins/tiles/atlas_merging_dialog.cpp
index 086588f5a5..e37878ff98 100644
--- a/editor/plugins/tiles/atlas_merging_dialog.cpp
+++ b/editor/plugins/tiles/atlas_merging_dialog.cpp
@@ -62,7 +62,7 @@ void AtlasMergingDialog::_generate_merged(Vector<Ref<TileSetAtlasSource>> p_atla
int line_height = 0;
for (int source_index = 0; source_index < p_atlas_sources.size(); source_index++) {
Ref<TileSetAtlasSource> atlas_source = p_atlas_sources[source_index];
- merged_mapping.push_back(Map<Vector2i, Vector2i>());
+ merged_mapping.push_back(HashMap<Vector2i, Vector2i>());
// Layout the tiles.
Vector2i atlas_size;
diff --git a/editor/plugins/tiles/atlas_merging_dialog.h b/editor/plugins/tiles/atlas_merging_dialog.h
index 9502d93f6b..c54e259594 100644
--- a/editor/plugins/tiles/atlas_merging_dialog.h
+++ b/editor/plugins/tiles/atlas_merging_dialog.h
@@ -46,7 +46,7 @@ private:
int commited_actions_count = 0;
bool delete_original_atlases = true;
Ref<TileSetAtlasSource> merged;
- LocalVector<Map<Vector2i, Vector2i>> merged_mapping;
+ LocalVector<HashMap<Vector2i, Vector2i>> merged_mapping;
Ref<TileSet> tile_set;
UndoRedo *undo_redo = nullptr;
diff --git a/editor/plugins/tiles/tile_atlas_view.cpp b/editor/plugins/tiles/tile_atlas_view.cpp
index 4de2f42fe0..3073c8a7f2 100644
--- a/editor/plugins/tiles/tile_atlas_view.cpp
+++ b/editor/plugins/tiles/tile_atlas_view.cpp
@@ -480,7 +480,7 @@ void TileAtlasView::_update_alternative_tiles_rect_cache() {
// Update the rect.
if (!alternative_tiles_rect_cache.has(tile_id)) {
- alternative_tiles_rect_cache[tile_id] = Map<int, Rect2i>();
+ alternative_tiles_rect_cache[tile_id] = HashMap<int, Rect2i>();
}
alternative_tiles_rect_cache[tile_id][alternative_id] = current;
@@ -494,7 +494,7 @@ void TileAtlasView::_update_alternative_tiles_rect_cache() {
}
Vector3i TileAtlasView::get_alternative_tile_at_pos(const Vector2 p_pos) const {
- for (const KeyValue<Vector2, Map<int, Rect2i>> &E_coords : alternative_tiles_rect_cache) {
+ for (const KeyValue<Vector2, HashMap<int, Rect2i>> &E_coords : alternative_tiles_rect_cache) {
for (const KeyValue<int, Rect2i> &E_alternative : E_coords.value) {
if (E_alternative.value.has_point(p_pos)) {
return Vector3i(E_coords.key.x, E_coords.key.y, E_alternative.key);
diff --git a/editor/plugins/tiles/tile_atlas_view.h b/editor/plugins/tiles/tile_atlas_view.h
index 6e74858b08..ff46b7871f 100644
--- a/editor/plugins/tiles/tile_atlas_view.h
+++ b/editor/plugins/tiles/tile_atlas_view.h
@@ -69,7 +69,7 @@ private:
void _pan_callback(Vector2 p_scroll_vec);
void _zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt);
- Map<Vector2, Map<int, Rect2i>> alternative_tiles_rect_cache;
+ HashMap<Vector2, HashMap<int, Rect2i>> alternative_tiles_rect_cache;
void _update_alternative_tiles_rect_cache();
MarginContainer *margin_container = nullptr;
diff --git a/editor/plugins/tiles/tile_data_editors.cpp b/editor/plugins/tiles/tile_data_editors.cpp
index 70bcd7e39a..eda05b1005 100644
--- a/editor/plugins/tiles/tile_data_editors.cpp
+++ b/editor/plugins/tiles/tile_data_editors.cpp
@@ -862,7 +862,7 @@ Variant TileDataDefaultEditor::_get_value(TileSetAtlasSource *p_tile_set_atlas_s
return tile_data->get(property);
}
-void TileDataDefaultEditor::_setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, Map<TileMapCell, Variant> p_previous_values, Variant p_new_value) {
+void TileDataDefaultEditor::_setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, HashMap<TileMapCell, Variant, TileMapCell> p_previous_values, Variant p_new_value) {
for (const KeyValue<TileMapCell, Variant> &E : p_previous_values) {
Vector2i coords = E.key.get_atlas_coords();
undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/%s", coords.x, coords.y, E.key.alternative_tile, property), E.value);
@@ -882,7 +882,7 @@ void TileDataDefaultEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas_
rect.set_end(p_tile_atlas_view->get_atlas_tile_coords_at_pos(p_transform.affine_inverse().xform(p_canvas_item->get_local_mouse_position())));
rect = rect.abs();
- Set<TileMapCell> edited;
+ RBSet<TileMapCell> edited;
for (int x = rect.get_position().x; x <= rect.get_end().x; x++) {
for (int y = rect.get_position().y; y <= rect.get_end().y; y++) {
Vector2i coords = Vector2i(x, y);
@@ -897,7 +897,7 @@ void TileDataDefaultEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas_
}
}
- for (Set<TileMapCell>::Element *E = edited.front(); E; E = E->next()) {
+ for (RBSet<TileMapCell>::Element *E = edited.front(); E; E = E->next()) {
Vector2i coords = E->get().get_atlas_coords();
p_canvas_item->draw_rect(p_tile_set_atlas_source->get_tile_texture_region(coords), selection_color, false);
}
@@ -1299,7 +1299,7 @@ Variant TileDataOcclusionShapeEditor::_get_value(TileSetAtlasSource *p_tile_set_
return tile_data->get_occluder(occlusion_layer);
}
-void TileDataOcclusionShapeEditor::_setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, Map<TileMapCell, Variant> p_previous_values, Variant p_new_value) {
+void TileDataOcclusionShapeEditor::_setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, HashMap<TileMapCell, Variant, TileMapCell> p_previous_values, Variant p_new_value) {
for (const KeyValue<TileMapCell, Variant> &E : p_previous_values) {
Vector2i coords = E.key.get_atlas_coords();
undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/occlusion_layer_%d/polygon", coords.x, coords.y, E.key.alternative_tile, occlusion_layer), E.value);
@@ -1479,7 +1479,7 @@ Variant TileDataCollisionEditor::_get_value(TileSetAtlasSource *p_tile_set_atlas
return dict;
}
-void TileDataCollisionEditor::_setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, Map<TileMapCell, Variant> p_previous_values, Variant p_new_value) {
+void TileDataCollisionEditor::_setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, HashMap<TileMapCell, Variant, TileMapCell> p_previous_values, Variant p_new_value) {
Array new_array = p_new_value;
for (KeyValue<TileMapCell, Variant> &E : p_previous_values) {
Array old_array = E.value;
@@ -1740,7 +1740,7 @@ void TileDataTerrainsEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas
rect.set_end(p_tile_atlas_view->get_atlas_tile_coords_at_pos(p_transform.affine_inverse().xform(p_canvas_item->get_local_mouse_position())));
rect = rect.abs();
- Set<TileMapCell> edited;
+ RBSet<TileMapCell> edited;
for (int x = rect.get_position().x; x <= rect.get_end().x; x++) {
for (int y = rect.get_position().y; y <= rect.get_end().y; y++) {
Vector2i coords = Vector2i(x, y);
@@ -1755,7 +1755,7 @@ void TileDataTerrainsEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas
}
}
- for (Set<TileMapCell>::Element *E = edited.front(); E; E = E->next()) {
+ for (RBSet<TileMapCell>::Element *E = edited.front(); E; E = E->next()) {
Vector2i coords = E->get().get_atlas_coords();
p_canvas_item->draw_rect(p_tile_set_atlas_source->get_tile_texture_region(coords), selection_color, false);
}
@@ -1770,7 +1770,7 @@ void TileDataTerrainsEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas
rect.set_end(p_tile_atlas_view->get_atlas_tile_coords_at_pos(p_transform.affine_inverse().xform(p_canvas_item->get_local_mouse_position())));
rect = rect.abs();
- Set<TileMapCell> edited;
+ RBSet<TileMapCell> edited;
for (int x = rect.get_position().x; x <= rect.get_end().x; x++) {
for (int y = rect.get_position().y; y <= rect.get_end().y; y++) {
Vector2i coords = Vector2i(x, y);
@@ -1800,7 +1800,7 @@ void TileDataTerrainsEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas
p_canvas_item->draw_set_transform_matrix(p_transform);
- for (Set<TileMapCell>::Element *E = edited.front(); E; E = E->next()) {
+ for (RBSet<TileMapCell>::Element *E = edited.front(); E; E = E->next()) {
Vector2i coords = E->get().get_atlas_coords();
Rect2i texture_region = p_tile_set_atlas_source->get_tile_texture_region(coords);
@@ -2118,7 +2118,7 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t
rect.set_end(p_tile_atlas_view->get_atlas_tile_coords_at_pos(mb->get_position()));
rect = rect.abs();
- Set<TileMapCell> edited;
+ RBSet<TileMapCell> edited;
for (int x = rect.get_position().x; x <= rect.get_end().x; x++) {
for (int y = rect.get_position().y; y <= rect.get_end().y; y++) {
Vector2i coords = Vector2i(x, y);
@@ -2133,7 +2133,7 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t
}
}
undo_redo->create_action(TTR("Painting Terrain Set"));
- for (Set<TileMapCell>::Element *E = edited.front(); E; E = E->next()) {
+ for (RBSet<TileMapCell>::Element *E = edited.front(); E; E = E->next()) {
Vector2i coords = E->get().get_atlas_coords();
TileData *tile_data = p_tile_set_atlas_source->get_tile_data(coords, 0);
undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain_set", coords.x, coords.y, E->get().alternative_tile), tile_data->get_terrain_set());
@@ -2195,7 +2195,7 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t
rect.set_end(p_tile_atlas_view->get_atlas_tile_coords_at_pos(mb->get_position()));
rect = rect.abs();
- Set<TileMapCell> edited;
+ RBSet<TileMapCell> edited;
for (int x = rect.get_position().x; x <= rect.get_end().x; x++) {
for (int y = rect.get_position().y; y <= rect.get_end().y; y++) {
Vector2i coords = Vector2i(x, y);
@@ -2220,7 +2220,7 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t
mouse_pos_rect_polygon.push_back(Vector2(drag_start_pos.x, mb->get_position().y));
undo_redo->create_action(TTR("Painting Terrain"));
- for (Set<TileMapCell>::Element *E = edited.front(); E; E = E->next()) {
+ for (RBSet<TileMapCell>::Element *E = edited.front(); E; E = E->next()) {
Vector2i coords = E->get().get_atlas_coords();
TileData *tile_data = p_tile_set_atlas_source->get_tile_data(coords, 0);
@@ -2571,7 +2571,7 @@ Variant TileDataNavigationEditor::_get_value(TileSetAtlasSource *p_tile_set_atla
return tile_data->get_navigation_polygon(navigation_layer);
}
-void TileDataNavigationEditor::_setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, Map<TileMapCell, Variant> p_previous_values, Variant p_new_value) {
+void TileDataNavigationEditor::_setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, HashMap<TileMapCell, Variant, TileMapCell> p_previous_values, Variant p_new_value) {
for (const KeyValue<TileMapCell, Variant> &E : p_previous_values) {
Vector2i coords = E.key.get_atlas_coords();
undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/navigation_layer_%d/polygon", coords.x, coords.y, E.key.alternative_tile, navigation_layer), E.value);
diff --git a/editor/plugins/tiles/tile_data_editors.h b/editor/plugins/tiles/tile_data_editors.h
index 2c849637f0..f9b8948d0a 100644
--- a/editor/plugins/tiles/tile_data_editors.h
+++ b/editor/plugins/tiles/tile_data_editors.h
@@ -71,7 +71,7 @@ public:
class DummyObject : public Object {
GDCLASS(DummyObject, Object)
private:
- Map<String, Variant> properties;
+ HashMap<String, Variant> properties;
protected:
bool _set(const StringName &p_name, const Variant &p_value);
@@ -206,7 +206,7 @@ private:
DragType drag_type = DRAG_TYPE_NONE;
Vector2 drag_start_pos;
Vector2 drag_last_pos;
- Map<TileMapCell, Variant> drag_modified;
+ HashMap<TileMapCell, Variant, TileMapCell> drag_modified;
Variant drag_painted_value;
void _property_value_changed(StringName p_property, Variant p_value, StringName p_field);
@@ -224,7 +224,7 @@ protected:
virtual void _set_painted_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile);
virtual void _set_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, Variant p_value);
virtual Variant _get_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile);
- virtual void _setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, Map<TileMapCell, Variant> p_previous_values, Variant p_new_value);
+ virtual void _setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, HashMap<TileMapCell, Variant, TileMapCell> p_previous_values, Variant p_new_value);
public:
virtual Control *get_toolbar() override { return toolbar; };
@@ -276,7 +276,7 @@ private:
virtual void _set_painted_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) override;
virtual void _set_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, Variant p_value) override;
virtual Variant _get_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) override;
- virtual void _setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, Map<TileMapCell, Variant> p_previous_values, Variant p_new_value) override;
+ virtual void _setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, HashMap<TileMapCell, Variant, TileMapCell> p_previous_values, Variant p_new_value) override;
protected:
UndoRedo *undo_redo = nullptr;
@@ -301,7 +301,7 @@ class TileDataCollisionEditor : public TileDataDefaultEditor {
// UI
GenericTilePolygonEditor *polygon_editor = nullptr;
DummyObject *dummy_object = memnew(DummyObject);
- Map<StringName, EditorProperty *> property_editors;
+ HashMap<StringName, EditorProperty *> property_editors;
void _property_value_changed(StringName p_property, Variant p_value, StringName p_field);
void _property_selected(StringName p_path, int p_focusable);
@@ -311,7 +311,7 @@ class TileDataCollisionEditor : public TileDataDefaultEditor {
virtual void _set_painted_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) override;
virtual void _set_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, Variant p_value) override;
virtual Variant _get_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) override;
- virtual void _setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, Map<TileMapCell, Variant> p_previous_values, Variant p_new_value) override;
+ virtual void _setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, HashMap<TileMapCell, Variant, TileMapCell> p_previous_values, Variant p_new_value) override;
protected:
UndoRedo *undo_redo = nullptr;
@@ -348,7 +348,7 @@ private:
DragType drag_type = DRAG_TYPE_NONE;
Vector2 drag_start_pos;
Vector2 drag_last_pos;
- Map<TileMapCell, Variant> drag_modified;
+ HashMap<TileMapCell, Variant, TileMapCell> drag_modified;
Variant drag_painted_value;
// UI
@@ -396,7 +396,7 @@ private:
virtual void _set_painted_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) override;
virtual void _set_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, Variant p_value) override;
virtual Variant _get_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) override;
- virtual void _setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, Map<TileMapCell, Variant> p_previous_values, Variant p_new_value) override;
+ virtual void _setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, HashMap<TileMapCell, Variant, TileMapCell> p_previous_values, Variant p_new_value) override;
protected:
UndoRedo *undo_redo = nullptr;
diff --git a/editor/plugins/tiles/tile_map_editor.cpp b/editor/plugins/tiles/tile_map_editor.cpp
index ac90333e1d..12e1f10750 100644
--- a/editor/plugins/tiles/tile_map_editor.cpp
+++ b/editor/plugins/tiles/tile_map_editor.cpp
@@ -501,7 +501,7 @@ bool TileMapEditorTilesPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p
if (!tile_map_selection.is_empty()) {
tile_map_clipboard.instantiate();
TypedArray<Vector2i> coords_array;
- for (Set<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) {
+ for (RBSet<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) {
coords_array.push_back(E->get());
}
tile_map_clipboard = tile_map->get_pattern(tile_map_layer, coords_array);
@@ -511,7 +511,7 @@ bool TileMapEditorTilesPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p
// Delete selected tiles.
if (!tile_map_selection.is_empty()) {
undo_redo->create_action(TTR("Delete tiles"));
- for (Set<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) {
+ for (RBSet<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) {
undo_redo->add_do_method(tile_map, "set_cell", tile_map_layer, E->get(), TileSet::INVALID_SOURCE, TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE);
undo_redo->add_undo_method(tile_map, "set_cell", tile_map_layer, E->get(), tile_map->get_cell_source_id(tile_map_layer, E->get()), tile_map->get_cell_atlas_coords(tile_map_layer, E->get()), tile_map->get_cell_alternative_tile(tile_map_layer, E->get()));
}
@@ -542,7 +542,7 @@ bool TileMapEditorTilesPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p
// Delete selected tiles.
if (!tile_map_selection.is_empty()) {
undo_redo->create_action(TTR("Delete tiles"));
- for (Set<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) {
+ for (RBSet<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) {
undo_redo->add_do_method(tile_map, "set_cell", tile_map_layer, E->get(), TileSet::INVALID_SOURCE, TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE);
undo_redo->add_undo_method(tile_map, "set_cell", tile_map_layer, E->get(), tile_map->get_cell_source_id(tile_map_layer, E->get()), tile_map->get_cell_atlas_coords(tile_map_layer, E->get()), tile_map->get_cell_alternative_tile(tile_map_layer, E->get()));
}
@@ -562,7 +562,7 @@ bool TileMapEditorTilesPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p
switch (drag_type) {
case DRAG_TYPE_PAINT: {
- Map<Vector2i, TileMapCell> to_draw = _draw_line(drag_start_mouse_pos, drag_last_mouse_pos, mpos, drag_erasing);
+ HashMap<Vector2i, TileMapCell> to_draw = _draw_line(drag_start_mouse_pos, drag_last_mouse_pos, mpos, drag_erasing);
for (const KeyValue<Vector2i, TileMapCell> &E : to_draw) {
if (!drag_erasing && E.value.source_id == TileSet::INVALID_SOURCE) {
continue;
@@ -579,7 +579,7 @@ bool TileMapEditorTilesPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p
Vector<Vector2i> line = TileMapEditor::get_line(tile_map, tile_map->world_to_map(drag_last_mouse_pos), tile_map->world_to_map(mpos));
for (int i = 0; i < line.size(); i++) {
if (!drag_modified.has(line[i])) {
- Map<Vector2i, TileMapCell> to_draw = _draw_bucket_fill(line[i], bucket_contiguous_checkbox->is_pressed(), drag_erasing);
+ HashMap<Vector2i, TileMapCell> to_draw = _draw_bucket_fill(line[i], bucket_contiguous_checkbox->is_pressed(), drag_erasing);
for (const KeyValue<Vector2i, TileMapCell> &E : to_draw) {
if (!drag_erasing && E.value.source_id == TileSet::INVALID_SOURCE) {
continue;
@@ -628,7 +628,7 @@ bool TileMapEditorTilesPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p
_update_selection_pattern_from_tilemap_selection(); // Make sure the pattern is up to date before moving.
drag_type = DRAG_TYPE_MOVE;
drag_modified.clear();
- for (Set<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) {
+ for (RBSet<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) {
Vector2i coords = E->get();
drag_modified.insert(coords, tile_map->get_cell(tile_map_layer, coords));
tile_map->set_cell(tile_map_layer, coords, TileSet::INVALID_SOURCE, TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE);
@@ -648,7 +648,7 @@ bool TileMapEditorTilesPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p
drag_type = DRAG_TYPE_PAINT;
drag_start_mouse_pos = mpos;
drag_modified.clear();
- Map<Vector2i, TileMapCell> to_draw = _draw_line(drag_start_mouse_pos, mpos, mpos, drag_erasing);
+ HashMap<Vector2i, TileMapCell> to_draw = _draw_line(drag_start_mouse_pos, mpos, mpos, drag_erasing);
for (const KeyValue<Vector2i, TileMapCell> &E : to_draw) {
if (!drag_erasing && E.value.source_id == TileSet::INVALID_SOURCE) {
continue;
@@ -675,7 +675,7 @@ bool TileMapEditorTilesPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p
Vector<Vector2i> line = TileMapEditor::get_line(tile_map, tile_map->world_to_map(drag_last_mouse_pos), tile_map->world_to_map(mpos));
for (int i = 0; i < line.size(); i++) {
if (!drag_modified.has(line[i])) {
- Map<Vector2i, TileMapCell> to_draw = _draw_bucket_fill(line[i], bucket_contiguous_checkbox->is_pressed(), drag_erasing);
+ HashMap<Vector2i, TileMapCell> to_draw = _draw_bucket_fill(line[i], bucket_contiguous_checkbox->is_pressed(), drag_erasing);
for (const KeyValue<Vector2i, TileMapCell> &E : to_draw) {
if (!drag_erasing && E.value.source_id == TileSet::INVALID_SOURCE) {
continue;
@@ -746,7 +746,7 @@ void TileMapEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p_over
// Handle the preview of the tiles to be placed.
if ((tiles_bottom_panel->is_visible_in_tree() || patterns_bottom_panel->is_visible_in_tree()) && has_mouse) { // Only if the tilemap editor is opened and the viewport is hovered.
- Map<Vector2i, TileMapCell> preview;
+ HashMap<Vector2i, TileMapCell> preview;
Rect2i drawn_grid_rect;
if (drag_type == DRAG_TYPE_PICK) {
@@ -768,7 +768,7 @@ void TileMapEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p_over
// Draw the area being selected.
Rect2i rect = Rect2i(tile_map->world_to_map(drag_start_mouse_pos), tile_map->world_to_map(drag_last_mouse_pos) - tile_map->world_to_map(drag_start_mouse_pos)).abs();
rect.size += Vector2i(1, 1);
- Set<Vector2i> to_draw;
+ RBSet<Vector2i> to_draw;
for (int x = rect.position.x; x < rect.get_end().x; x++) {
for (int y = rect.position.y; y < rect.get_end().y; y++) {
Vector2i coords = Vector2i(x, y);
@@ -785,7 +785,7 @@ void TileMapEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p_over
if (!tile_map_selection.is_empty()) {
top_left = tile_map_selection.front()->get();
}
- for (Set<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) {
+ for (RBSet<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) {
top_left = top_left.min(E->get());
}
Vector2i offset = drag_start_mouse_pos - tile_map->map_to_world(top_left);
@@ -832,7 +832,7 @@ void TileMapEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p_over
// Expand the grid if needed
if (expand_grid && !preview.is_empty()) {
- drawn_grid_rect = Rect2i(preview.front()->key(), Vector2i(1, 1));
+ drawn_grid_rect = Rect2i(preview.begin()->key, Vector2i(1, 1));
for (const KeyValue<Vector2i, TileMapCell> &E : preview) {
drawn_grid_rect.expand_to(E.key);
}
@@ -986,15 +986,15 @@ TileMapCell TileMapEditorTilesPlugin::_pick_random_tile(Ref<TileMapPattern> p_pa
return TileMapCell();
}
-Map<Vector2i, TileMapCell> TileMapEditorTilesPlugin::_draw_line(Vector2 p_start_drag_mouse_pos, Vector2 p_from_mouse_pos, Vector2 p_to_mouse_pos, bool p_erase) {
+HashMap<Vector2i, TileMapCell> TileMapEditorTilesPlugin::_draw_line(Vector2 p_start_drag_mouse_pos, Vector2 p_from_mouse_pos, Vector2 p_to_mouse_pos, bool p_erase) {
TileMap *tile_map = Object::cast_to<TileMap>(ObjectDB::get_instance(tile_map_id));
if (!tile_map) {
- return Map<Vector2i, TileMapCell>();
+ return HashMap<Vector2i, TileMapCell>();
}
Ref<TileSet> tile_set = tile_map->get_tileset();
if (!tile_set.is_valid()) {
- return Map<Vector2i, TileMapCell>();
+ return HashMap<Vector2i, TileMapCell>();
}
// Get or create the pattern.
@@ -1003,7 +1003,7 @@ Map<Vector2i, TileMapCell> TileMapEditorTilesPlugin::_draw_line(Vector2 p_start_
erase_pattern->set_cell(Vector2i(0, 0), TileSet::INVALID_SOURCE, TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE);
Ref<TileMapPattern> pattern = p_erase ? erase_pattern : selection_pattern;
- Map<Vector2i, TileMapCell> output;
+ HashMap<Vector2i, TileMapCell> output;
if (!pattern->is_empty()) {
// Paint the tiles on the tile map.
if (!p_erase && random_tile_toggle->is_pressed()) {
@@ -1035,15 +1035,15 @@ Map<Vector2i, TileMapCell> TileMapEditorTilesPlugin::_draw_line(Vector2 p_start_
return output;
}
-Map<Vector2i, TileMapCell> TileMapEditorTilesPlugin::_draw_rect(Vector2i p_start_cell, Vector2i p_end_cell, bool p_erase) {
+HashMap<Vector2i, TileMapCell> TileMapEditorTilesPlugin::_draw_rect(Vector2i p_start_cell, Vector2i p_end_cell, bool p_erase) {
TileMap *tile_map = Object::cast_to<TileMap>(ObjectDB::get_instance(tile_map_id));
if (!tile_map) {
- return Map<Vector2i, TileMapCell>();
+ return HashMap<Vector2i, TileMapCell>();
}
Ref<TileSet> tile_set = tile_map->get_tileset();
if (!tile_set.is_valid()) {
- return Map<Vector2i, TileMapCell>();
+ return HashMap<Vector2i, TileMapCell>();
}
// Create the rect to draw.
@@ -1056,7 +1056,7 @@ Map<Vector2i, TileMapCell> TileMapEditorTilesPlugin::_draw_rect(Vector2i p_start
erase_pattern->set_cell(Vector2i(0, 0), TileSet::INVALID_SOURCE, TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE);
Ref<TileMapPattern> pattern = p_erase ? erase_pattern : selection_pattern;
- Map<Vector2i, TileMapCell> err_output;
+ HashMap<Vector2i, TileMapCell> err_output;
ERR_FAIL_COND_V(pattern->is_empty(), err_output);
// Compute the offset to align things to the bottom or right.
@@ -1064,7 +1064,7 @@ Map<Vector2i, TileMapCell> TileMapEditorTilesPlugin::_draw_rect(Vector2i p_start
bool valigned_bottom = p_end_cell.y < p_start_cell.y;
Vector2i offset = Vector2i(aligned_right ? -(pattern->get_size().x - (rect.get_size().x % pattern->get_size().x)) : 0, valigned_bottom ? -(pattern->get_size().y - (rect.get_size().y % pattern->get_size().y)) : 0);
- Map<Vector2i, TileMapCell> output;
+ HashMap<Vector2i, TileMapCell> output;
if (!pattern->is_empty()) {
if (!p_erase && random_tile_toggle->is_pressed()) {
// Paint a random tile.
@@ -1094,21 +1094,21 @@ Map<Vector2i, TileMapCell> TileMapEditorTilesPlugin::_draw_rect(Vector2i p_start
return output;
}
-Map<Vector2i, TileMapCell> TileMapEditorTilesPlugin::_draw_bucket_fill(Vector2i p_coords, bool p_contiguous, bool p_erase) {
+HashMap<Vector2i, TileMapCell> TileMapEditorTilesPlugin::_draw_bucket_fill(Vector2i p_coords, bool p_contiguous, bool p_erase) {
TileMap *tile_map = Object::cast_to<TileMap>(ObjectDB::get_instance(tile_map_id));
if (!tile_map) {
- return Map<Vector2i, TileMapCell>();
+ return HashMap<Vector2i, TileMapCell>();
}
if (tile_map_layer < 0) {
- return Map<Vector2i, TileMapCell>();
+ return HashMap<Vector2i, TileMapCell>();
}
- Map<Vector2i, TileMapCell> output;
+ HashMap<Vector2i, TileMapCell> output;
ERR_FAIL_INDEX_V(tile_map_layer, tile_map->get_layers_count(), output);
Ref<TileSet> tile_set = tile_map->get_tileset();
if (!tile_set.is_valid()) {
- return Map<Vector2i, TileMapCell>();
+ return HashMap<Vector2i, TileMapCell>();
}
// Get or create the pattern.
@@ -1128,7 +1128,7 @@ Map<Vector2i, TileMapCell> TileMapEditorTilesPlugin::_draw_bucket_fill(Vector2i
if (p_contiguous) {
// Replace continuous tiles like the source.
- Set<Vector2i> already_checked;
+ RBSet<Vector2i> already_checked;
List<Vector2i> to_check;
to_check.push_back(p_coords);
while (!to_check.is_empty()) {
@@ -1278,7 +1278,7 @@ void TileMapEditorTilesPlugin::_stop_dragging() {
if (!tile_map_selection.is_empty()) {
top_left = tile_map_selection.front()->get();
}
- for (Set<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) {
+ for (RBSet<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) {
top_left = top_left.min(E->get());
}
@@ -1290,7 +1290,7 @@ void TileMapEditorTilesPlugin::_stop_dragging() {
// Build the list of cells to undo.
Vector2i coords;
- Map<Vector2i, TileMapCell> cells_undo;
+ HashMap<Vector2i, TileMapCell> cells_undo;
for (int i = 0; i < selection_used_cells.size(); i++) {
coords = tile_map->map_pattern(top_left, selection_used_cells[i], selection_pattern);
cells_undo[coords] = TileMapCell(drag_modified[coords].source_id, drag_modified[coords].get_atlas_coords(), drag_modified[coords].alternative_tile);
@@ -1299,7 +1299,7 @@ void TileMapEditorTilesPlugin::_stop_dragging() {
}
// Build the list of cells to do.
- Map<Vector2i, TileMapCell> cells_do;
+ HashMap<Vector2i, TileMapCell> cells_do;
for (int i = 0; i < selection_used_cells.size(); i++) {
coords = tile_map->map_pattern(top_left, selection_used_cells[i], selection_pattern);
cells_do[coords] = TileMapCell();
@@ -1311,11 +1311,11 @@ void TileMapEditorTilesPlugin::_stop_dragging() {
// Move the tiles.
undo_redo->create_action(TTR("Move tiles"));
- for (Map<Vector2i, TileMapCell>::Element *E = cells_do.front(); E; E = E->next()) {
- undo_redo->add_do_method(tile_map, "set_cell", tile_map_layer, E->key(), E->get().source_id, E->get().get_atlas_coords(), E->get().alternative_tile);
+ for (const KeyValue<Vector2i, TileMapCell> &E : cells_do) {
+ undo_redo->add_do_method(tile_map, "set_cell", tile_map_layer, E.key, E.value.source_id, E.value.get_atlas_coords(), E.value.alternative_tile);
}
- for (Map<Vector2i, TileMapCell>::Element *E = cells_undo.front(); E; E = E->next()) {
- undo_redo->add_undo_method(tile_map, "set_cell", tile_map_layer, E->key(), E->get().source_id, E->get().get_atlas_coords(), E->get().alternative_tile);
+ for (const KeyValue<Vector2i, TileMapCell> &E : cells_undo) {
+ undo_redo->add_undo_method(tile_map, "set_cell", tile_map_layer, E.key, E.value.source_id, E.value.get_atlas_coords(), E.value.alternative_tile);
}
// Update the selection.
@@ -1378,7 +1378,7 @@ void TileMapEditorTilesPlugin::_stop_dragging() {
undo_redo->commit_action(false);
} break;
case DRAG_TYPE_LINE: {
- Map<Vector2i, TileMapCell> to_draw = _draw_line(drag_start_mouse_pos, drag_start_mouse_pos, mpos, drag_erasing);
+ HashMap<Vector2i, TileMapCell> to_draw = _draw_line(drag_start_mouse_pos, drag_start_mouse_pos, mpos, drag_erasing);
undo_redo->create_action(TTR("Paint tiles"));
for (const KeyValue<Vector2i, TileMapCell> &E : to_draw) {
if (!drag_erasing && E.value.source_id == TileSet::INVALID_SOURCE) {
@@ -1390,7 +1390,7 @@ void TileMapEditorTilesPlugin::_stop_dragging() {
undo_redo->commit_action();
} break;
case DRAG_TYPE_RECT: {
- Map<Vector2i, TileMapCell> to_draw = _draw_rect(tile_map->world_to_map(drag_start_mouse_pos), tile_map->world_to_map(mpos), drag_erasing);
+ HashMap<Vector2i, TileMapCell> to_draw = _draw_rect(tile_map->world_to_map(drag_start_mouse_pos), tile_map->world_to_map(mpos), drag_erasing);
undo_redo->create_action(TTR("Paint tiles"));
for (const KeyValue<Vector2i, TileMapCell> &E : to_draw) {
if (!drag_erasing && E.value.source_id == TileSet::INVALID_SOURCE) {
@@ -1476,7 +1476,7 @@ void TileMapEditorTilesPlugin::_update_fix_selected_and_hovered() {
}
// Selection if needed.
- for (Set<TileMapCell>::Element *E = tile_set_selection.front(); E; E = E->next()) {
+ for (RBSet<TileMapCell>::Element *E = tile_set_selection.front(); E; E = E->next()) {
const TileMapCell *selected = &(E->get());
if (!tile_set->has_source(selected->source_id) ||
!tile_set->get_source(selected->source_id)->has_tile(selected->get_atlas_coords()) ||
@@ -1500,7 +1500,7 @@ void TileMapEditorTilesPlugin::_fix_invalid_tiles_in_tile_map_selection() {
return;
}
- Set<Vector2i> to_remove;
+ RBSet<Vector2i> to_remove;
for (Vector2i selected : tile_map_selection) {
TileMapCell cell = tile_map->get_cell(tile_map_layer, selected);
if (cell.source_id == TileSet::INVALID_SOURCE && cell.get_atlas_coords() == TileSetSource::INVALID_ATLAS_COORDS && cell.alternative_tile == TileSetAtlasSource::INVALID_TILE_ALTERNATIVE) {
@@ -1534,7 +1534,7 @@ void TileMapEditorTilesPlugin::_update_selection_pattern_from_tilemap_selection(
selection_pattern.instantiate();
TypedArray<Vector2i> coords_array;
- for (Set<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) {
+ for (RBSet<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) {
coords_array.push_back(E->get());
}
selection_pattern = tile_map->get_pattern(tile_map_layer, coords_array);
@@ -1558,8 +1558,8 @@ void TileMapEditorTilesPlugin::_update_selection_pattern_from_tileset_tiles_sele
selection_pattern.instantiate();
// Group per source.
- Map<int, List<const TileMapCell *>> per_source;
- for (Set<TileMapCell>::Element *E = tile_set_selection.front(); E; E = E->next()) {
+ HashMap<int, List<const TileMapCell *>> per_source;
+ for (RBSet<TileMapCell>::Element *E = tile_set_selection.front(); E; E = E->next()) {
per_source[E->get().source_id].push_back(&(E->get()));
}
@@ -1568,7 +1568,7 @@ void TileMapEditorTilesPlugin::_update_selection_pattern_from_tileset_tiles_sele
// Per source.
List<const TileMapCell *> unorganized;
Rect2i encompassing_rect_coords;
- Map<Vector2i, const TileMapCell *> organized_pattern;
+ HashMap<Vector2i, const TileMapCell *> organized_pattern;
TileSetSource *source = *tile_set->get_source(E_source.key);
TileSetAtlasSource *atlas_source = Object::cast_to<TileSetAtlasSource>(source);
@@ -1583,12 +1583,12 @@ void TileMapEditorTilesPlugin::_update_selection_pattern_from_tileset_tiles_sele
}
// Compute the encompassing rect for the organized pattern.
- Map<Vector2i, const TileMapCell *>::Element *E_cell = organized_pattern.front();
+ HashMap<Vector2i, const TileMapCell *>::Iterator E_cell = organized_pattern.begin();
if (E_cell) {
- encompassing_rect_coords = Rect2i(E_cell->key(), Vector2i(1, 1));
- for (; E_cell; E_cell = E_cell->next()) {
- encompassing_rect_coords.expand_to(E_cell->key() + Vector2i(1, 1));
- encompassing_rect_coords.expand_to(E_cell->key());
+ encompassing_rect_coords = Rect2i(E_cell->key, Vector2i(1, 1));
+ for (; E_cell; ++E_cell) {
+ encompassing_rect_coords.expand_to(E_cell->key + Vector2i(1, 1));
+ encompassing_rect_coords.expand_to(E_cell->key);
}
}
} else {
@@ -1680,7 +1680,7 @@ void TileMapEditorTilesPlugin::_tile_atlas_control_draw() {
// Draw the selection.
Color grid_color = EditorSettings::get_singleton()->get("editors/tiles_editor/grid_color");
Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0);
- for (Set<TileMapCell>::Element *E = tile_set_selection.front(); E; E = E->next()) {
+ for (RBSet<TileMapCell>::Element *E = tile_set_selection.front(); E; E = E->next()) {
if (E->get().source_id == source_id && E->get().alternative_tile == 0) {
for (int frame = 0; frame < atlas->get_tile_animation_frames_count(E->get().get_atlas_coords()); frame++) {
Color color = selection_color;
@@ -1711,7 +1711,7 @@ void TileMapEditorTilesPlugin::_tile_atlas_control_draw() {
Rect2i region = Rect2i(start_tile, end_tile - start_tile).abs();
region.size += Vector2i(1, 1);
- Set<Vector2i> to_draw;
+ RBSet<Vector2i> to_draw;
for (int x = region.position.x; x < region.get_end().x; x++) {
for (int y = region.position.y; y < region.get_end().y; y++) {
Vector2i tile = atlas->get_tile_at_coords(Vector2i(x, y));
@@ -1721,7 +1721,7 @@ void TileMapEditorTilesPlugin::_tile_atlas_control_draw() {
}
}
Color selection_rect_color = selection_color.lightened(0.2);
- for (Set<Vector2i>::Element *E = to_draw.front(); E; E = E->next()) {
+ for (RBSet<Vector2i>::Element *E = to_draw.front(); E; E = E->next()) {
tile_atlas_control->draw_rect(atlas->get_tile_texture_region(E->get()), selection_rect_color, false);
}
}
@@ -1868,7 +1868,7 @@ void TileMapEditorTilesPlugin::_tile_alternatives_control_draw() {
}
// Draw the selection.
- for (Set<TileMapCell>::Element *E = tile_set_selection.front(); E; E = E->next()) {
+ for (RBSet<TileMapCell>::Element *E = tile_set_selection.front(); E; E = E->next()) {
if (E->get().source_id == source_id && E->get().get_atlas_coords() != TileSetSource::INVALID_ATLAS_COORDS && E->get().alternative_tile > 0) {
Rect2i rect = tile_atlas_view->get_alternative_tile_rect(E->get().get_atlas_coords(), E->get().alternative_tile);
if (rect != Rect2i()) {
@@ -1972,7 +1972,7 @@ void TileMapEditorTilesPlugin::_set_tile_map_selection(const TypedArray<Vector2i
TypedArray<Vector2i> TileMapEditorTilesPlugin::_get_tile_map_selection() const {
TypedArray<Vector2i> output;
- for (Set<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) {
+ for (RBSet<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) {
output.push_back(E->get());
}
return output;
@@ -2321,33 +2321,33 @@ Vector<TileMapEditorPlugin::TabData> TileMapEditorTerrainsPlugin::get_tabs() con
return tabs;
}
-Map<Vector2i, TileMapCell> TileMapEditorTerrainsPlugin::_draw_terrains(const Map<Vector2i, TileSet::TerrainsPattern> &p_to_paint, int p_terrain_set) const {
+HashMap<Vector2i, TileMapCell> TileMapEditorTerrainsPlugin::_draw_terrains(const HashMap<Vector2i, TileSet::TerrainsPattern> &p_to_paint, int p_terrain_set) const {
TileMap *tile_map = Object::cast_to<TileMap>(ObjectDB::get_instance(tile_map_id));
if (!tile_map) {
- return Map<Vector2i, TileMapCell>();
+ return HashMap<Vector2i, TileMapCell>();
}
Ref<TileSet> tile_set = tile_map->get_tileset();
if (!tile_set.is_valid()) {
- return Map<Vector2i, TileMapCell>();
+ return HashMap<Vector2i, TileMapCell>();
}
- Map<Vector2i, TileMapCell> output;
+ HashMap<Vector2i, TileMapCell> output;
// Add the constraints from the added tiles.
- Set<TileMap::TerrainConstraint> added_tiles_constraints_set;
+ RBSet<TileMap::TerrainConstraint> added_tiles_constraints_set;
for (const KeyValue<Vector2i, TileSet::TerrainsPattern> &E_to_paint : p_to_paint) {
Vector2i coords = E_to_paint.key;
TileSet::TerrainsPattern terrains_pattern = E_to_paint.value;
- Set<TileMap::TerrainConstraint> cell_constraints = tile_map->get_terrain_constraints_from_added_tile(coords, p_terrain_set, terrains_pattern);
- for (Set<TileMap::TerrainConstraint>::Element *E = cell_constraints.front(); E; E = E->next()) {
+ RBSet<TileMap::TerrainConstraint> cell_constraints = tile_map->get_terrain_constraints_from_added_tile(coords, p_terrain_set, terrains_pattern);
+ for (RBSet<TileMap::TerrainConstraint>::Element *E = cell_constraints.front(); E; E = E->next()) {
added_tiles_constraints_set.insert(E->get());
}
}
// Build the list of potential tiles to replace.
- Set<Vector2i> potential_to_replace;
+ RBSet<Vector2i> potential_to_replace;
for (const KeyValue<Vector2i, TileSet::TerrainsPattern> &E_to_paint : p_to_paint) {
Vector2i coords = E_to_paint.key;
for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) {
@@ -2361,7 +2361,7 @@ Map<Vector2i, TileMapCell> TileMapEditorTerrainsPlugin::_draw_terrains(const Map
}
// Set of tiles to replace
- Set<Vector2i> to_replace;
+ RBSet<Vector2i> to_replace;
// Add the central tiles to the one to replace.
for (const KeyValue<Vector2i, TileSet::TerrainsPattern> &E_to_paint : p_to_paint) {
@@ -2369,16 +2369,16 @@ Map<Vector2i, TileMapCell> TileMapEditorTerrainsPlugin::_draw_terrains(const Map
}
// Add the constraints from the surroundings of the modified areas.
- Set<TileMap::TerrainConstraint> removed_cells_constraints_set;
+ RBSet<TileMap::TerrainConstraint> removed_cells_constraints_set;
bool to_replace_modified = true;
while (to_replace_modified) {
// Get the constraints from the removed cells.
removed_cells_constraints_set = tile_map->get_terrain_constraints_from_removed_cells_list(tile_map_layer, to_replace, p_terrain_set, false);
// Filter the sources to make sure they are in the potential_to_replace.
- Map<TileMap::TerrainConstraint, Set<Vector2i>> per_constraint_tiles;
- for (Set<TileMap::TerrainConstraint>::Element *E = removed_cells_constraints_set.front(); E; E = E->next()) {
- Map<Vector2i, TileSet::CellNeighbor> sources_of_constraint = E->get().get_overlapping_coords_and_peering_bits();
+ RBMap<TileMap::TerrainConstraint, RBSet<Vector2i>> per_constraint_tiles;
+ for (RBSet<TileMap::TerrainConstraint>::Element *E = removed_cells_constraints_set.front(); E; E = E->next()) {
+ HashMap<Vector2i, TileSet::CellNeighbor> sources_of_constraint = E->get().get_overlapping_coords_and_peering_bits();
for (const KeyValue<Vector2i, TileSet::CellNeighbor> &E_source_tile_of_constraint : sources_of_constraint) {
if (potential_to_replace.has(E_source_tile_of_constraint.key)) {
per_constraint_tiles[E->get()].insert(E_source_tile_of_constraint.key);
@@ -2387,7 +2387,7 @@ Map<Vector2i, TileMapCell> TileMapEditorTerrainsPlugin::_draw_terrains(const Map
}
to_replace_modified = false;
- for (Set<TileMap::TerrainConstraint>::Element *E = added_tiles_constraints_set.front(); E; E = E->next()) {
+ for (RBSet<TileMap::TerrainConstraint>::Element *E = added_tiles_constraints_set.front(); E; E = E->next()) {
TileMap::TerrainConstraint c = E->get();
// Check if we have a conflict in constraints.
if (removed_cells_constraints_set.has(c) && removed_cells_constraints_set.find(c)->get().get_terrain() != c.get_terrain()) {
@@ -2398,7 +2398,7 @@ Map<Vector2i, TileMapCell> TileMapEditorTerrainsPlugin::_draw_terrains(const Map
potential_to_replace.erase(to_add_to_remove);
to_replace.insert(to_add_to_remove);
to_replace_modified = true;
- for (KeyValue<TileMap::TerrainConstraint, Set<Vector2i>> &E_source_tiles_of_constraint : per_constraint_tiles) {
+ for (KeyValue<TileMap::TerrainConstraint, RBSet<Vector2i>> &E_source_tiles_of_constraint : per_constraint_tiles) {
E_source_tiles_of_constraint.value.erase(to_add_to_remove);
}
break;
@@ -2408,8 +2408,8 @@ Map<Vector2i, TileMapCell> TileMapEditorTerrainsPlugin::_draw_terrains(const Map
}
// Combine all constraints together.
- Set<TileMap::TerrainConstraint> constraints = removed_cells_constraints_set;
- for (Set<TileMap::TerrainConstraint>::Element *E = added_tiles_constraints_set.front(); E; E = E->next()) {
+ RBSet<TileMap::TerrainConstraint> constraints = removed_cells_constraints_set;
+ for (RBSet<TileMap::TerrainConstraint>::Element *E = added_tiles_constraints_set.front(); E; E = E->next()) {
constraints.insert(E->get());
}
@@ -2419,7 +2419,7 @@ Map<Vector2i, TileMapCell> TileMapEditorTerrainsPlugin::_draw_terrains(const Map
}
// Run WFC to fill the holes with the constraints.
- Map<Vector2i, TileSet::TerrainsPattern> wfc_output = tile_map->terrain_wave_function_collapse(to_replace, p_terrain_set, constraints);
+ HashMap<Vector2i, TileSet::TerrainsPattern> wfc_output = tile_map->terrain_wave_function_collapse(to_replace, p_terrain_set, constraints);
// Actually paint the tiles.
for (const KeyValue<Vector2i, TileSet::TerrainsPattern> &E_to_paint : p_to_paint) {
@@ -2434,15 +2434,15 @@ Map<Vector2i, TileMapCell> TileMapEditorTerrainsPlugin::_draw_terrains(const Map
return output;
}
-Map<Vector2i, TileMapCell> TileMapEditorTerrainsPlugin::_draw_line(Vector2i p_start_cell, Vector2i p_end_cell, bool p_erase) {
+HashMap<Vector2i, TileMapCell> TileMapEditorTerrainsPlugin::_draw_line(Vector2i p_start_cell, Vector2i p_end_cell, bool p_erase) {
TileMap *tile_map = Object::cast_to<TileMap>(ObjectDB::get_instance(tile_map_id));
if (!tile_map) {
- return Map<Vector2i, TileMapCell>();
+ return HashMap<Vector2i, TileMapCell>();
}
Ref<TileSet> tile_set = tile_map->get_tileset();
if (!tile_set.is_valid()) {
- return Map<Vector2i, TileMapCell>();
+ return HashMap<Vector2i, TileMapCell>();
}
TileSet::TerrainsPattern terrains_pattern;
@@ -2453,22 +2453,22 @@ Map<Vector2i, TileMapCell> TileMapEditorTerrainsPlugin::_draw_line(Vector2i p_st
}
Vector<Vector2i> line = TileMapEditor::get_line(tile_map, p_start_cell, p_end_cell);
- Map<Vector2i, TileSet::TerrainsPattern> to_draw;
+ HashMap<Vector2i, TileSet::TerrainsPattern> to_draw;
for (int i = 0; i < line.size(); i++) {
to_draw[line[i]] = terrains_pattern;
}
return _draw_terrains(to_draw, selected_terrain_set);
}
-Map<Vector2i, TileMapCell> TileMapEditorTerrainsPlugin::_draw_rect(Vector2i p_start_cell, Vector2i p_end_cell, bool p_erase) {
+HashMap<Vector2i, TileMapCell> TileMapEditorTerrainsPlugin::_draw_rect(Vector2i p_start_cell, Vector2i p_end_cell, bool p_erase) {
TileMap *tile_map = Object::cast_to<TileMap>(ObjectDB::get_instance(tile_map_id));
if (!tile_map) {
- return Map<Vector2i, TileMapCell>();
+ return HashMap<Vector2i, TileMapCell>();
}
Ref<TileSet> tile_set = tile_map->get_tileset();
if (!tile_set.is_valid()) {
- return Map<Vector2i, TileMapCell>();
+ return HashMap<Vector2i, TileMapCell>();
}
TileSet::TerrainsPattern terrains_pattern;
@@ -2483,7 +2483,7 @@ Map<Vector2i, TileMapCell> TileMapEditorTerrainsPlugin::_draw_rect(Vector2i p_st
rect.set_end(p_end_cell);
rect = rect.abs();
- Map<Vector2i, TileSet::TerrainsPattern> to_draw;
+ HashMap<Vector2i, TileSet::TerrainsPattern> to_draw;
for (int x = rect.position.x; x <= rect.get_end().x; x++) {
for (int y = rect.position.y; y <= rect.get_end().y; y++) {
to_draw[Vector2i(x, y)] = terrains_pattern;
@@ -2492,15 +2492,15 @@ Map<Vector2i, TileMapCell> TileMapEditorTerrainsPlugin::_draw_rect(Vector2i p_st
return _draw_terrains(to_draw, selected_terrain_set);
}
-Set<Vector2i> TileMapEditorTerrainsPlugin::_get_cells_for_bucket_fill(Vector2i p_coords, bool p_contiguous) {
+RBSet<Vector2i> TileMapEditorTerrainsPlugin::_get_cells_for_bucket_fill(Vector2i p_coords, bool p_contiguous) {
TileMap *tile_map = Object::cast_to<TileMap>(ObjectDB::get_instance(tile_map_id));
if (!tile_map) {
- return Set<Vector2i>();
+ return RBSet<Vector2i>();
}
Ref<TileSet> tile_set = tile_map->get_tileset();
if (!tile_set.is_valid()) {
- return Set<Vector2i>();
+ return RBSet<Vector2i>();
}
TileMapCell source_cell = tile_map->get_cell(tile_map_layer, p_coords);
@@ -2514,7 +2514,7 @@ Set<Vector2i> TileMapEditorTerrainsPlugin::_get_cells_for_bucket_fill(Vector2i p
tile_data = atlas_source->get_tile_data(source_cell.get_atlas_coords(), source_cell.alternative_tile);
}
if (!tile_data) {
- return Set<Vector2i>();
+ return RBSet<Vector2i>();
}
source_pattern = tile_data->get_terrains_pattern();
}
@@ -2525,10 +2525,10 @@ Set<Vector2i> TileMapEditorTerrainsPlugin::_get_cells_for_bucket_fill(Vector2i p
boundaries = tile_map->get_used_rect();
}
- Set<Vector2i> output;
+ RBSet<Vector2i> output;
if (p_contiguous) {
// Replace continuous tiles like the source.
- Set<Vector2i> already_checked;
+ RBSet<Vector2i> already_checked;
List<Vector2i> to_check;
to_check.push_back(p_coords);
while (!to_check.is_empty()) {
@@ -2603,15 +2603,15 @@ Set<Vector2i> TileMapEditorTerrainsPlugin::_get_cells_for_bucket_fill(Vector2i p
return output;
}
-Map<Vector2i, TileMapCell> TileMapEditorTerrainsPlugin::_draw_bucket_fill(Vector2i p_coords, bool p_contiguous, bool p_erase) {
+HashMap<Vector2i, TileMapCell> TileMapEditorTerrainsPlugin::_draw_bucket_fill(Vector2i p_coords, bool p_contiguous, bool p_erase) {
TileMap *tile_map = Object::cast_to<TileMap>(ObjectDB::get_instance(tile_map_id));
if (!tile_map) {
- return Map<Vector2i, TileMapCell>();
+ return HashMap<Vector2i, TileMapCell>();
}
Ref<TileSet> tile_set = tile_map->get_tileset();
if (!tile_set.is_valid()) {
- return Map<Vector2i, TileMapCell>();
+ return HashMap<Vector2i, TileMapCell>();
}
TileSet::TerrainsPattern terrains_pattern;
@@ -2621,8 +2621,8 @@ Map<Vector2i, TileMapCell> TileMapEditorTerrainsPlugin::_draw_bucket_fill(Vector
terrains_pattern = selected_terrains_pattern;
}
- Set<Vector2i> cells_to_draw = _get_cells_for_bucket_fill(p_coords, p_contiguous);
- Map<Vector2i, TileSet::TerrainsPattern> to_draw;
+ RBSet<Vector2i> cells_to_draw = _get_cells_for_bucket_fill(p_coords, p_contiguous);
+ HashMap<Vector2i, TileSet::TerrainsPattern> to_draw;
for (const Vector2i &coords : cells_to_draw) {
to_draw[coords] = terrains_pattern;
}
@@ -2718,7 +2718,7 @@ void TileMapEditorTerrainsPlugin::_stop_dragging() {
undo_redo->commit_action(false);
} break;
case DRAG_TYPE_LINE: {
- Map<Vector2i, TileMapCell> to_draw = _draw_line(tile_map->world_to_map(drag_start_mouse_pos), tile_map->world_to_map(mpos), drag_erasing);
+ HashMap<Vector2i, TileMapCell> to_draw = _draw_line(tile_map->world_to_map(drag_start_mouse_pos), tile_map->world_to_map(mpos), drag_erasing);
undo_redo->create_action(TTR("Paint terrain"));
for (const KeyValue<Vector2i, TileMapCell> &E : to_draw) {
if (!drag_erasing && E.value.source_id == TileSet::INVALID_SOURCE) {
@@ -2730,7 +2730,7 @@ void TileMapEditorTerrainsPlugin::_stop_dragging() {
undo_redo->commit_action();
} break;
case DRAG_TYPE_RECT: {
- Map<Vector2i, TileMapCell> to_draw = _draw_rect(tile_map->world_to_map(drag_start_mouse_pos), tile_map->world_to_map(mpos), drag_erasing);
+ HashMap<Vector2i, TileMapCell> to_draw = _draw_rect(tile_map->world_to_map(drag_start_mouse_pos), tile_map->world_to_map(mpos), drag_erasing);
undo_redo->create_action(TTR("Paint terrain"));
for (const KeyValue<Vector2i, TileMapCell> &E : to_draw) {
if (!drag_erasing && E.value.source_id == TileSet::INVALID_SOURCE) {
@@ -2829,7 +2829,7 @@ bool TileMapEditorTerrainsPlugin::forward_canvas_gui_input(const Ref<InputEvent>
switch (drag_type) {
case DRAG_TYPE_PAINT: {
if (selected_terrain_set >= 0) {
- Map<Vector2i, TileMapCell> to_draw = _draw_line(tile_map->world_to_map(drag_last_mouse_pos), tile_map->world_to_map(mpos), drag_erasing);
+ HashMap<Vector2i, TileMapCell> to_draw = _draw_line(tile_map->world_to_map(drag_last_mouse_pos), tile_map->world_to_map(mpos), drag_erasing);
for (const KeyValue<Vector2i, TileMapCell> &E : to_draw) {
if (!drag_modified.has(E.key)) {
drag_modified[E.key] = tile_map->get_cell(tile_map_layer, E.key);
@@ -2874,7 +2874,7 @@ bool TileMapEditorTerrainsPlugin::forward_canvas_gui_input(const Ref<InputEvent>
drag_modified.clear();
Vector2i cell = tile_map->world_to_map(mpos);
- Map<Vector2i, TileMapCell> to_draw = _draw_line(cell, cell, drag_erasing);
+ HashMap<Vector2i, TileMapCell> to_draw = _draw_line(cell, cell, drag_erasing);
for (const KeyValue<Vector2i, TileMapCell> &E : to_draw) {
drag_modified[E.key] = tile_map->get_cell(tile_map_layer, E.key);
tile_map->set_cell(tile_map_layer, E.key, E.value.source_id, E.value.get_atlas_coords(), E.value.alternative_tile);
@@ -2903,7 +2903,7 @@ bool TileMapEditorTerrainsPlugin::forward_canvas_gui_input(const Ref<InputEvent>
Vector<Vector2i> line = TileMapEditor::get_line(tile_map, tile_map->world_to_map(drag_last_mouse_pos), tile_map->world_to_map(mpos));
for (int i = 0; i < line.size(); i++) {
if (!drag_modified.has(line[i])) {
- Map<Vector2i, TileMapCell> to_draw = _draw_bucket_fill(line[i], bucket_contiguous_checkbox->is_pressed(), drag_erasing);
+ HashMap<Vector2i, TileMapCell> to_draw = _draw_bucket_fill(line[i], bucket_contiguous_checkbox->is_pressed(), drag_erasing);
for (const KeyValue<Vector2i, TileMapCell> &E : to_draw) {
if (!drag_erasing && E.value.source_id == TileSet::INVALID_SOURCE) {
continue;
@@ -2959,7 +2959,7 @@ void TileMapEditorTerrainsPlugin::forward_canvas_draw_over_viewport(Control *p_o
// Handle the preview of the tiles to be placed.
if (main_vbox_container->is_visible_in_tree() && has_mouse) { // Only if the tilemap editor is opened and the viewport is hovered.
- Set<Vector2i> preview;
+ RBSet<Vector2i> preview;
Rect2i drawn_grid_rect;
if (drag_type == DRAG_TYPE_PICK) {
@@ -2996,7 +2996,7 @@ void TileMapEditorTerrainsPlugin::forward_canvas_draw_over_viewport(Control *p_o
rect.set_end(tile_map->world_to_map(drag_last_mouse_pos));
rect = rect.abs();
- Map<Vector2i, TileSet::TerrainsPattern> to_draw;
+ HashMap<Vector2i, TileSet::TerrainsPattern> to_draw;
for (int x = rect.position.x; x <= rect.get_end().x; x++) {
for (int y = rect.position.y; y <= rect.get_end().y; y++) {
preview.insert(Vector2i(x, y));
@@ -3192,9 +3192,9 @@ void TileMapEditorTerrainsPlugin::_update_tiles_list() {
ERR_FAIL_INDEX(selected_terrain_id, tile_set->get_terrains_count(selected_terrain_set));
// Sort the items in a map by the number of corresponding terrains.
- Map<int, Set<TileSet::TerrainsPattern>> sorted;
+ RBMap<int, RBSet<TileSet::TerrainsPattern>> sorted;
- for (Set<TileSet::TerrainsPattern>::Element *E = per_terrain_terrains_patterns[selected_terrain_set][selected_terrain_id].front(); E; E = E->next()) {
+ for (RBSet<TileSet::TerrainsPattern>::Element *E = per_terrain_terrains_patterns[selected_terrain_set][selected_terrain_id].front(); E; E = E->next()) {
// Count the number of matching sides/terrains.
int count = 0;
@@ -3207,8 +3207,8 @@ void TileMapEditorTerrainsPlugin::_update_tiles_list() {
sorted[count].insert(E->get());
}
- for (Map<int, Set<TileSet::TerrainsPattern>>::Element *E_set = sorted.back(); E_set; E_set = E_set->prev()) {
- for (Set<TileSet::TerrainsPattern>::Element *E = E_set->get().front(); E; E = E->next()) {
+ for (RBMap<int, RBSet<TileSet::TerrainsPattern>>::Element *E_set = sorted.back(); E_set; E_set = E_set->prev()) {
+ for (RBSet<TileSet::TerrainsPattern>::Element *E = E_set->get().front(); E; E = E->next()) {
TileSet::TerrainsPattern terrains_pattern = E->get();
// Get the icon.
diff --git a/editor/plugins/tiles/tile_map_editor.h b/editor/plugins/tiles/tile_map_editor.h
index f265052200..7158ebff59 100644
--- a/editor/plugins/tiles/tile_map_editor.h
+++ b/editor/plugins/tiles/tile_map_editor.h
@@ -120,22 +120,22 @@ private:
bool drag_erasing = false;
Vector2 drag_start_mouse_pos;
Vector2 drag_last_mouse_pos;
- Map<Vector2i, TileMapCell> drag_modified;
+ HashMap<Vector2i, TileMapCell> drag_modified;
TileMapCell _pick_random_tile(Ref<TileMapPattern> p_pattern);
- Map<Vector2i, TileMapCell> _draw_line(Vector2 p_start_drag_mouse_pos, Vector2 p_from_mouse_pos, Vector2 p_to_mouse_pos, bool p_erase);
- Map<Vector2i, TileMapCell> _draw_rect(Vector2i p_start_cell, Vector2i p_end_cell, bool p_erase);
- Map<Vector2i, TileMapCell> _draw_bucket_fill(Vector2i p_coords, bool p_contiguous, bool p_erase);
+ HashMap<Vector2i, TileMapCell> _draw_line(Vector2 p_start_drag_mouse_pos, Vector2 p_from_mouse_pos, Vector2 p_to_mouse_pos, bool p_erase);
+ HashMap<Vector2i, TileMapCell> _draw_rect(Vector2i p_start_cell, Vector2i p_end_cell, bool p_erase);
+ HashMap<Vector2i, TileMapCell> _draw_bucket_fill(Vector2i p_coords, bool p_contiguous, bool p_erase);
void _stop_dragging();
///// Selection system. /////
- Set<Vector2i> tile_map_selection;
+ RBSet<Vector2i> tile_map_selection;
Ref<TileMapPattern> tile_map_clipboard;
Ref<TileMapPattern> selection_pattern;
void _set_tile_map_selection(const TypedArray<Vector2i> &p_selection);
TypedArray<Vector2i> _get_tile_map_selection() const;
- Set<TileMapCell> tile_set_selection;
+ RBSet<TileMapCell> tile_set_selection;
void _update_selection_pattern_from_tilemap_selection();
void _update_selection_pattern_from_tileset_tiles_selection();
@@ -265,14 +265,14 @@ private:
bool drag_erasing = false;
Vector2 drag_start_mouse_pos;
Vector2 drag_last_mouse_pos;
- Map<Vector2i, TileMapCell> drag_modified;
+ HashMap<Vector2i, TileMapCell> drag_modified;
// Painting
- Map<Vector2i, TileMapCell> _draw_terrains(const Map<Vector2i, TileSet::TerrainsPattern> &p_to_paint, int p_terrain_set) const;
- Map<Vector2i, TileMapCell> _draw_line(Vector2i p_start_cell, Vector2i p_end_cell, bool p_erase);
- Map<Vector2i, TileMapCell> _draw_rect(Vector2i p_start_cell, Vector2i p_end_cell, bool p_erase);
- Set<Vector2i> _get_cells_for_bucket_fill(Vector2i p_coords, bool p_contiguous);
- Map<Vector2i, TileMapCell> _draw_bucket_fill(Vector2i p_coords, bool p_contiguous, bool p_erase);
+ HashMap<Vector2i, TileMapCell> _draw_terrains(const HashMap<Vector2i, TileSet::TerrainsPattern> &p_to_paint, int p_terrain_set) const;
+ HashMap<Vector2i, TileMapCell> _draw_line(Vector2i p_start_cell, Vector2i p_end_cell, bool p_erase);
+ HashMap<Vector2i, TileMapCell> _draw_rect(Vector2i p_start_cell, Vector2i p_end_cell, bool p_erase);
+ RBSet<Vector2i> _get_cells_for_bucket_fill(Vector2i p_coords, bool p_contiguous);
+ HashMap<Vector2i, TileMapCell> _draw_bucket_fill(Vector2i p_coords, bool p_contiguous, bool p_erase);
void _stop_dragging();
int selected_terrain_set = -1;
@@ -284,7 +284,7 @@ private:
ItemList *terrains_tile_list = nullptr;
// Cache.
- LocalVector<LocalVector<Set<TileSet::TerrainsPattern>>> per_terrain_terrains_patterns;
+ LocalVector<LocalVector<RBSet<TileSet::TerrainsPattern>>> per_terrain_terrains_patterns;
// Update functions.
void _update_terrains_cache();
diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
index 44b18f48fc..dc3fa87565 100644
--- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
+++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
@@ -270,7 +270,7 @@ bool TileSetAtlasSourceEditor::AtlasTileProxyObject::_set(const StringName &p_na
// Other properties.
bool any_valid = false;
- for (Set<TileSelection>::Element *E = tiles.front(); E; E = E->next()) {
+ for (RBSet<TileSelection>::Element *E = tiles.front(); E; E = E->next()) {
const Vector2i &coords = E->get().tile;
const int &alternative = E->get().alternative;
@@ -354,7 +354,7 @@ bool TileSetAtlasSourceEditor::AtlasTileProxyObject::_get(const StringName &p_na
}
}
- for (Set<TileSelection>::Element *E = tiles.front(); E; E = E->next()) {
+ for (RBSet<TileSelection>::Element *E = tiles.front(); E; E = E->next()) {
// Return the first tile with a property matching the name.
// Note: It's a little bit annoying, but the behavior is the same the one in MultiNodeEdit.
const Vector2i &coords = E->get().tile;
@@ -426,10 +426,10 @@ void TileSetAtlasSourceEditor::AtlasTileProxyObject::_get_property_list(List<Pro
int uses = 0;
PropertyInfo property_info;
};
- Map<PropertyId, PLData> usage;
+ RBMap<PropertyId, PLData> usage;
List<PLData *> data_list;
- for (Set<TileSelection>::Element *E = tiles.front(); E; E = E->next()) {
+ for (RBSet<TileSelection>::Element *E = tiles.front(); E; E = E->next()) {
const Vector2i &coords = E->get().tile;
const int &alternative = E->get().alternative;
@@ -439,7 +439,7 @@ void TileSetAtlasSourceEditor::AtlasTileProxyObject::_get_property_list(List<Pro
List<PropertyInfo> list;
tile_data->get_property_list(&list);
- Map<String, int> counts; // Counts the number of time a property appears (useful for groups that may appear more than once)
+ HashMap<String, int> counts; // Counts the number of time a property appears (useful for groups that may appear more than once)
for (List<PropertyInfo>::Element *E_property = list.front(); E_property; E_property = E_property->next()) {
const String &property_string = E_property->get().name;
if (!tile_data->is_allowing_transform() && (property_string == "flip_h" || property_string == "flip_v" || property_string == "transpose")) {
@@ -473,16 +473,16 @@ void TileSetAtlasSourceEditor::AtlasTileProxyObject::_get_property_list(List<Pro
}
}
-void TileSetAtlasSourceEditor::AtlasTileProxyObject::edit(TileSetAtlasSource *p_tile_set_atlas_source, Set<TileSelection> p_tiles) {
+void TileSetAtlasSourceEditor::AtlasTileProxyObject::edit(TileSetAtlasSource *p_tile_set_atlas_source, RBSet<TileSelection> p_tiles) {
ERR_FAIL_COND(!p_tile_set_atlas_source);
ERR_FAIL_COND(p_tiles.is_empty());
- for (Set<TileSelection>::Element *E = p_tiles.front(); E; E = E->next()) {
+ for (RBSet<TileSelection>::Element *E = p_tiles.front(); E; E = E->next()) {
ERR_FAIL_COND(E->get().tile == TileSetSource::INVALID_ATLAS_COORDS);
ERR_FAIL_COND(E->get().alternative < 0);
}
// Disconnect to changes.
- for (Set<TileSelection>::Element *E = tiles.front(); E; E = E->next()) {
+ for (RBSet<TileSelection>::Element *E = tiles.front(); E; E = E->next()) {
const Vector2i &coords = E->get().tile;
const int &alternative = E->get().alternative;
@@ -495,10 +495,10 @@ void TileSetAtlasSourceEditor::AtlasTileProxyObject::edit(TileSetAtlasSource *p_
}
tile_set_atlas_source = p_tile_set_atlas_source;
- tiles = Set<TileSelection>(p_tiles);
+ tiles = RBSet<TileSelection>(p_tiles);
// Connect to changes.
- for (Set<TileSelection>::Element *E = p_tiles.front(); E; E = E->next()) {
+ for (RBSet<TileSelection>::Element *E = p_tiles.front(); E; E = E->next()) {
const Vector2i &coords = E->get().tile;
const int &alternative = E->get().alternative;
@@ -541,7 +541,7 @@ void TileSetAtlasSourceEditor::_update_source_inspector() {
void TileSetAtlasSourceEditor::_update_fix_selected_and_hovered_tiles() {
// Fix selected.
- for (Set<TileSelection>::Element *E = selection.front(); E; E = E->next()) {
+ for (RBSet<TileSelection>::Element *E = selection.front(); E; E = E->next()) {
TileSelection selected = E->get();
if (!tile_set_atlas_source->has_tile(selected.tile) || !tile_set_atlas_source->has_alternative_tile(selected.tile, selected.alternative)) {
selection.erase(E);
@@ -1313,7 +1313,7 @@ void TileSetAtlasSourceEditor::_end_dragging() {
switch (drag_type) {
case DRAG_TYPE_CREATE_TILES:
undo_redo->create_action(TTR("Create tiles"));
- for (Set<Vector2i>::Element *E = drag_modified_tiles.front(); E; E = E->next()) {
+ for (RBSet<Vector2i>::Element *E = drag_modified_tiles.front(); E; E = E->next()) {
undo_redo->add_do_method(tile_set_atlas_source, "create_tile", E->get());
undo_redo->add_undo_method(tile_set_atlas_source, "remove_tile", E->get());
}
@@ -1328,9 +1328,9 @@ void TileSetAtlasSourceEditor::_end_dragging() {
case DRAG_TYPE_REMOVE_TILES: {
List<PropertyInfo> list;
tile_set_atlas_source->get_property_list(&list);
- Map<Vector2i, List<const PropertyInfo *>> per_tile = _group_properties_per_tiles(list, tile_set_atlas_source);
+ HashMap<Vector2i, List<const PropertyInfo *>> per_tile = _group_properties_per_tiles(list, tile_set_atlas_source);
undo_redo->create_action(TTR("Remove tiles"));
- for (Set<Vector2i>::Element *E = drag_modified_tiles.front(); E; E = E->next()) {
+ for (RBSet<Vector2i>::Element *E = drag_modified_tiles.front(); E; E = E->next()) {
Vector2i coords = E->get();
undo_redo->add_do_method(tile_set_atlas_source, "remove_tile", coords);
undo_redo->add_undo_method(tile_set_atlas_source, "create_tile", coords);
@@ -1370,9 +1370,9 @@ void TileSetAtlasSourceEditor::_end_dragging() {
area.set_end((area.get_end() + Vector2i(1, 1)).min(tile_set_atlas_source->get_atlas_grid_size()));
List<PropertyInfo> list;
tile_set_atlas_source->get_property_list(&list);
- Map<Vector2i, List<const PropertyInfo *>> per_tile = _group_properties_per_tiles(list, tile_set_atlas_source);
+ HashMap<Vector2i, List<const PropertyInfo *>> per_tile = _group_properties_per_tiles(list, tile_set_atlas_source);
- Set<Vector2i> to_delete;
+ RBSet<Vector2i> to_delete;
for (int x = area.get_position().x; x < area.get_end().x; x++) {
for (int y = area.get_position().y; y < area.get_end().y; y++) {
Vector2i coords = tile_set_atlas_source->get_tile_at_coords(Vector2i(x, y));
@@ -1384,7 +1384,7 @@ void TileSetAtlasSourceEditor::_end_dragging() {
undo_redo->create_action(TTR("Remove tiles"));
undo_redo->add_do_method(this, "_set_selection_from_array", Array());
- for (Set<Vector2i>::Element *E = to_delete.front(); E; E = E->next()) {
+ for (RBSet<Vector2i>::Element *E = to_delete.front(); E; E = E->next()) {
Vector2i coords = E->get();
undo_redo->add_do_method(tile_set_atlas_source, "remove_tile", coords);
undo_redo->add_undo_method(tile_set_atlas_source, "create_tile", coords);
@@ -1523,9 +1523,9 @@ void TileSetAtlasSourceEditor::_end_dragging() {
tile_atlas_control->set_default_cursor_shape(CURSOR_ARROW);
}
-Map<Vector2i, List<const PropertyInfo *>> TileSetAtlasSourceEditor::_group_properties_per_tiles(const List<PropertyInfo> &r_list, const TileSetAtlasSource *p_atlas) {
+HashMap<Vector2i, List<const PropertyInfo *>> TileSetAtlasSourceEditor::_group_properties_per_tiles(const List<PropertyInfo> &r_list, const TileSetAtlasSource *p_atlas) {
// Group properties per tile.
- Map<Vector2i, List<const PropertyInfo *>> per_tile;
+ HashMap<Vector2i, List<const PropertyInfo *>> per_tile;
for (const List<PropertyInfo>::Element *E_property = r_list.front(); E_property; E_property = E_property->next()) {
Vector<String> components = String(E_property->get().name).split("/", true, 1);
if (components.size() >= 1) {
@@ -1544,12 +1544,12 @@ void TileSetAtlasSourceEditor::_menu_option(int p_option) {
case TILE_DELETE: {
List<PropertyInfo> list;
tile_set_atlas_source->get_property_list(&list);
- Map<Vector2i, List<const PropertyInfo *>> per_tile = _group_properties_per_tiles(list, tile_set_atlas_source);
+ HashMap<Vector2i, List<const PropertyInfo *>> per_tile = _group_properties_per_tiles(list, tile_set_atlas_source);
undo_redo->create_action(TTR("Remove tile"));
// Remove tiles
- Set<Vector2i> removed;
- for (Set<TileSelection>::Element *E = selection.front(); E; E = E->next()) {
+ RBSet<Vector2i> removed;
+ for (RBSet<TileSelection>::Element *E = selection.front(); E; E = E->next()) {
TileSelection selected = E->get();
if (selected.alternative == 0) {
// Remove a tile.
@@ -1569,7 +1569,7 @@ void TileSetAtlasSourceEditor::_menu_option(int p_option) {
}
// Remove alternatives
- for (Set<TileSelection>::Element *E = selection.front(); E; E = E->next()) {
+ for (RBSet<TileSelection>::Element *E = selection.front(); E; E = E->next()) {
TileSelection selected = E->get();
if (selected.alternative > 0 && !removed.has(selected.tile)) {
// Remove an alternative tile.
@@ -1608,7 +1608,7 @@ void TileSetAtlasSourceEditor::_menu_option(int p_option) {
case TILE_CREATE_ALTERNATIVE: {
undo_redo->create_action(TTR("Create tile alternatives"));
Array array;
- for (Set<TileSelection>::Element *E = selection.front(); E; E = E->next()) {
+ for (RBSet<TileSelection>::Element *E = selection.front(); E; E = E->next()) {
if (E->get().alternative == 0) {
int next_id = tile_set_atlas_source->get_next_alternative_tile_id(E->get().tile);
undo_redo->add_do_method(tile_set_atlas_source, "create_alternative_tile", E->get().tile, next_id);
@@ -1658,7 +1658,7 @@ void TileSetAtlasSourceEditor::_set_selection_from_array(Array p_selection) {
Array TileSetAtlasSourceEditor::_get_selection_as_array() {
Array output;
- for (Set<TileSelection>::Element *E = selection.front(); E; E = E->next()) {
+ for (RBSet<TileSelection>::Element *E = selection.front(); E; E = E->next()) {
output.push_back(E->get().tile);
output.push_back(E->get().alternative);
}
@@ -1672,7 +1672,7 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_draw() {
// Draw the selected tile.
if (tools_button_group->get_pressed_button() == tool_select_button) {
- for (Set<TileSelection>::Element *E = selection.front(); E; E = E->next()) {
+ for (RBSet<TileSelection>::Element *E = selection.front(); E; E = E->next()) {
TileSelection selected = E->get();
if (selected.alternative == 0) {
// Draw the rect.
@@ -1722,7 +1722,7 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_draw() {
if (drag_type == DRAG_TYPE_REMOVE_TILES) {
// Draw the tiles to be removed.
- for (Set<Vector2i>::Element *E = drag_modified_tiles.front(); E; E = E->next()) {
+ for (RBSet<Vector2i>::Element *E = drag_modified_tiles.front(); E; E = E->next()) {
for (int frame = 0; frame < tile_set_atlas_source->get_tile_animation_frames_count(E->get()); frame++) {
tile_atlas_control->draw_rect(tile_set_atlas_source->get_tile_texture_region(E->get(), frame), Color(0.0, 0.0, 0.0), false);
}
@@ -1739,7 +1739,7 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_draw() {
color = selection_color.lightened(0.2);
}
- Set<Vector2i> to_paint;
+ RBSet<Vector2i> to_paint;
for (int x = area.get_position().x; x < area.get_end().x; x++) {
for (int y = area.get_position().y; y < area.get_end().y; y++) {
Vector2i coords = tile_set_atlas_source->get_tile_at_coords(Vector2i(x, y));
@@ -1749,7 +1749,7 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_draw() {
}
}
- for (Set<Vector2i>::Element *E = to_paint.front(); E; E = E->next()) {
+ for (RBSet<Vector2i>::Element *E = to_paint.front(); E; E = E->next()) {
Vector2i coords = E->get();
tile_atlas_control->draw_rect(tile_set_atlas_source->get_tile_texture_region(coords), color, false);
}
@@ -1837,7 +1837,7 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_unscaled_draw() {
// Draw the selection on top of other.
if (tools_button_group->get_pressed_button() == tool_select_button) {
- for (Set<TileSelection>::Element *E = selection.front(); E; E = E->next()) {
+ for (RBSet<TileSelection>::Element *E = selection.front(); E; E = E->next()) {
if (E->get().alternative != 0) {
continue;
}
@@ -1962,7 +1962,7 @@ void TileSetAtlasSourceEditor::_tile_alternatives_control_draw() {
}
// Draw selected tile.
- for (Set<TileSelection>::Element *E = selection.front(); E; E = E->next()) {
+ for (RBSet<TileSelection>::Element *E = selection.front(); E; E = E->next()) {
TileSelection selected = E->get();
if (selected.alternative >= 1) {
Rect2i rect = tile_atlas_view->get_alternative_tile_rect(selected.tile, selected.alternative);
@@ -2005,7 +2005,7 @@ void TileSetAtlasSourceEditor::_tile_alternatives_control_unscaled_draw() {
// Draw the selection on top of other.
if (tools_button_group->get_pressed_button() == tool_select_button) {
- for (Set<TileSelection>::Element *E = selection.front(); E; E = E->next()) {
+ for (RBSet<TileSelection>::Element *E = selection.front(); E; E = E->next()) {
if (E->get().alternative == 0) {
continue;
}
@@ -2222,7 +2222,7 @@ void TileSetAtlasSourceEditor::_auto_remove_tiles() {
List<PropertyInfo> list;
tile_set_atlas_source->get_property_list(&list);
- Map<Vector2i, List<const PropertyInfo *>> per_tile = _group_properties_per_tiles(list, tile_set_atlas_source);
+ HashMap<Vector2i, List<const PropertyInfo *>> per_tile = _group_properties_per_tiles(list, tile_set_atlas_source);
for (int i = 0; i < tile_set_atlas_source->get_tiles_count(); i++) {
Vector2i coords = tile_set_atlas_source->get_tile_id(i);
diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.h b/editor/plugins/tiles/tile_set_atlas_source_editor.h
index b26b7edbfa..738fe1044d 100644
--- a/editor/plugins/tiles/tile_set_atlas_source_editor.h
+++ b/editor/plugins/tiles/tile_set_atlas_source_editor.h
@@ -88,7 +88,7 @@ public:
TileSetAtlasSourceEditor *tiles_set_atlas_source_editor = nullptr;
TileSetAtlasSource *tile_set_atlas_source = nullptr;
- Set<TileSelection> tiles = Set<TileSelection>();
+ RBSet<TileSelection> tiles = RBSet<TileSelection>();
protected:
bool _set(const StringName &p_name, const Variant &p_value);
@@ -99,10 +99,10 @@ public:
public:
TileSetAtlasSource *get_edited_tile_set_atlas_source() const { return tile_set_atlas_source; };
- Set<TileSelection> get_edited_tiles() const { return tiles; };
+ RBSet<TileSelection> get_edited_tiles() const { return tiles; };
// Update the proxyed object.
- void edit(TileSetAtlasSource *p_tile_set_atlas_source, Set<TileSelection> p_tiles = Set<TileSelection>());
+ void edit(TileSetAtlasSource *p_tile_set_atlas_source, RBSet<TileSelection> p_tiles = RBSet<TileSelection>());
AtlasTileProxyObject(TileSetAtlasSourceEditor *p_tiles_set_atlas_source_editor) {
tiles_set_atlas_source_editor = p_tiles_set_atlas_source_editor;
@@ -130,7 +130,7 @@ private:
// -- Tile data editors --
String current_property;
Control *current_tile_data_editor_toolbar = nullptr;
- Map<String, TileDataEditor *> tile_data_editors;
+ HashMap<String, TileDataEditor *> tile_data_editors;
TileDataEditor *current_tile_data_editor = nullptr;
void _tile_data_editors_tree_selected();
@@ -182,10 +182,10 @@ private:
Vector2i drag_current_tile;
Rect2i drag_start_tile_shape;
- Set<Vector2i> drag_modified_tiles;
+ RBSet<Vector2i> drag_modified_tiles;
void _end_dragging();
- Map<Vector2i, List<const PropertyInfo *>> _group_properties_per_tiles(const List<PropertyInfo> &r_list, const TileSetAtlasSource *p_atlas);
+ HashMap<Vector2i, List<const PropertyInfo *>> _group_properties_per_tiles(const List<PropertyInfo> &r_list, const TileSetAtlasSource *p_atlas);
// Popup functions.
enum MenuOptions {
@@ -215,7 +215,7 @@ private:
MenuButton *tool_advanced_menu_buttom = nullptr;
// Selection.
- Set<TileSelection> selection;
+ RBSet<TileSelection> selection;
void _set_selection_from_array(Array p_selection);
Array _get_selection_as_array();
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index b0844828df..9ad49e32af 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -148,6 +148,7 @@ void VisualShaderGraphPlugin::show_port_preview(VisualShader::Type p_type, int p
if (links[p_node_id].preview_pos != -1) {
links[p_node_id].graph_node->move_child(vbox, links[p_node_id].preview_pos);
}
+ links[p_node_id].graph_node->set_slot_draw_stylebox(vbox->get_index(), false);
Control *offset = memnew(Control);
offset->set_custom_minimum_size(Size2(0, 5 * EDSCALE));
@@ -324,7 +325,7 @@ void VisualShaderGraphPlugin::make_dirty(bool p_enabled) {
}
void VisualShaderGraphPlugin::register_link(VisualShader::Type p_type, int p_id, VisualShaderNode *p_visual_node, GraphNode *p_graph_node) {
- links.insert(p_id, { p_type, p_visual_node, p_graph_node, p_visual_node->get_output_port_for_preview() != -1, -1, Map<int, InputPort>(), Map<int, Port>(), nullptr, nullptr, nullptr, { nullptr, nullptr, nullptr } });
+ links.insert(p_id, { p_type, p_visual_node, p_graph_node, p_visual_node->get_output_port_for_preview() != -1, -1, HashMap<int, InputPort>(), HashMap<int, Port>(), nullptr, nullptr, nullptr, { nullptr, nullptr, nullptr } });
}
void VisualShaderGraphPlugin::register_output_port(int p_node_id, int p_port, TextureButton *p_button) {
@@ -386,6 +387,14 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id) {
"alpha"
};
+ // Visual shader specific theme for MSDF font.
+ Ref<Theme> vstheme;
+ vstheme.instantiate();
+ Ref<Font> label_font = EditorNode::get_singleton()->get_editor_theme()->get_font("main_msdf", "EditorFonts");
+ vstheme->set_font("font", "Label", label_font);
+ vstheme->set_font("font", "LineEdit", label_font);
+ vstheme->set_font("font", "Button", label_font);
+
Ref<VisualShaderNode> vsnode = visual_shader->get_node(p_type, p_id);
Ref<VisualShaderNodeResizableBase> resizable_node = Object::cast_to<VisualShaderNodeResizableBase>(vsnode.ptr());
@@ -406,8 +415,10 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id) {
custom_node->_set_initialized(true);
}
+ // Create graph node.
GraphNode *node = memnew(GraphNode);
graph->add_child(node);
+ node->set_theme(vstheme);
editor->_update_created_node(node);
register_link(p_type, p_id, vsnode.ptr(), node);
@@ -942,12 +953,12 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id) {
if (vsnode->get_output_port_for_preview() >= 0) {
show_port_preview(p_type, p_id, vsnode->get_output_port_for_preview());
+ } else {
+ offset = memnew(Control);
+ offset->set_custom_minimum_size(Size2(0, 4 * EDSCALE));
+ node->add_child(offset);
}
- offset = memnew(Control);
- offset->set_custom_minimum_size(Size2(0, 4 * EDSCALE));
- node->add_child(offset);
-
String error = vsnode->get_warning(mode, p_type);
if (!error.is_empty()) {
Label *error_label = memnew(Label);
@@ -1359,7 +1370,7 @@ void VisualShaderEditor::_update_options_menu() {
static bool low_driver = ProjectSettings::get_singleton()->get("rendering/driver/driver_name") == "opengl3";
- Map<String, TreeItem *> folders;
+ HashMap<String, TreeItem *> folders;
int current_func = -1;
@@ -1659,7 +1670,7 @@ void VisualShaderEditor::_update_uniforms(bool p_update_refs) {
}
}
-void VisualShaderEditor::_update_uniform_refs(Set<String> &p_deleted_names) {
+void VisualShaderEditor::_update_uniform_refs(RBSet<String> &p_deleted_names) {
for (int i = 0; i < VisualShader::TYPE_MAX; i++) {
VisualShader::Type type = VisualShader::Type(i);
@@ -2277,7 +2288,7 @@ void VisualShaderEditor::_uniform_line_edit_changed(const String &p_text, int p_
undo_redo->add_do_method(this, "_update_uniforms", true);
undo_redo->add_undo_method(this, "_update_uniforms", true);
- Set<String> changed_names;
+ RBSet<String> changed_names;
changed_names.insert(node->get_uniform_name());
_update_uniform_refs(changed_names);
@@ -3097,7 +3108,7 @@ void VisualShaderEditor::_delete_nodes(int p_type, const List<int> &p_nodes) {
}
}
- Set<String> uniform_names;
+ RBSet<String> uniform_names;
for (const int &F : p_nodes) {
Ref<VisualShaderNode> node = visual_shader->get_node(type, F);
@@ -3201,10 +3212,10 @@ void VisualShaderEditor::_convert_constants_to_uniforms(bool p_vice_versa) {
undo_redo->create_action(TTR("Convert Uniform Node(s) To Constant(s)"));
}
- const Set<int> &current_set = p_vice_versa ? selected_uniforms : selected_constants;
- Set<String> deleted_names;
+ const RBSet<int> &current_set = p_vice_versa ? selected_uniforms : selected_constants;
+ RBSet<String> deleted_names;
- for (Set<int>::Element *E = current_set.front(); E; E = E->next()) {
+ for (RBSet<int>::Element *E = current_set.front(); E; E = E->next()) {
int node_id = E->get();
Ref<VisualShaderNode> node = visual_shader->get_node(type_id, node_id);
bool caught = false;
@@ -3771,7 +3782,7 @@ void VisualShaderEditor::_dup_copy_nodes(int p_type, List<CopyItem> &r_items, Li
selection_center.x = 0.0f;
selection_center.y = 0.0f;
- Set<int> nodes;
+ RBSet<int> nodes;
for (int i = 0; i < graph->get_child_count(); i++) {
GraphNode *gn = Object::cast_to<GraphNode>(graph->get_child(i));
@@ -3850,9 +3861,9 @@ void VisualShaderEditor::_dup_paste_nodes(int p_type, List<CopyItem> &r_items, c
int base_id = visual_shader->get_valid_node_id(type);
int id_from = base_id;
- Map<int, int> connection_remap;
- Set<int> unsupported_set;
- Set<int> added_set;
+ HashMap<int, int> connection_remap;
+ RBSet<int> unsupported_set;
+ RBSet<int> added_set;
for (CopyItem &item : r_items) {
if (item.disabled) {
@@ -4652,6 +4663,7 @@ VisualShaderEditor::VisualShaderEditor() {
graph->get_zoom_hbox()->set_h_size_flags(SIZE_EXPAND_FILL);
graph->set_v_size_flags(SIZE_EXPAND_FILL);
graph->set_h_size_flags(SIZE_EXPAND_FILL);
+ graph->set_show_zoom_label(true);
add_child(graph);
graph->set_drag_forwarding(this);
float graph_minimap_opacity = EditorSettings::get_singleton()->get("editors/visual_editors/minimap_opacity");
@@ -4801,7 +4813,7 @@ VisualShaderEditor::VisualShaderEditor() {
///////////////////////////////////////
preview_window = memnew(Window);
- preview_window->set_title(TTR("Generated shader code"));
+ preview_window->set_title(TTR("Generated Shader Code"));
preview_window->set_visible(preview_showed);
preview_window->connect("close_requested", callable_mp(this, &VisualShaderEditor::_preview_close_requested));
preview_window->connect("size_changed", callable_mp(this, &VisualShaderEditor::_preview_size_changed));
@@ -5938,7 +5950,7 @@ public:
}
}
- void setup(Ref<Resource> p_parent_resource, Vector<EditorProperty *> p_properties, const Vector<StringName> &p_names, const Map<StringName, String> &p_overrided_names, Ref<VisualShaderNode> p_node) {
+ void setup(Ref<Resource> p_parent_resource, Vector<EditorProperty *> p_properties, const Vector<StringName> &p_names, const HashMap<StringName, String> &p_overrided_names, Ref<VisualShaderNode> p_node) {
parent_resource = p_parent_resource;
updating = false;
node = p_node;
@@ -6252,7 +6264,8 @@ void VisualShaderNodePortPreview::setup(const Ref<VisualShader> &p_shader, Visua
}
Size2 VisualShaderNodePortPreview::get_minimum_size() const {
- return Size2(100, 100) * EDSCALE;
+ int port_preview_size = EditorSettings::get_singleton()->get("editors/visual_editors/visualshader/port_preview_size");
+ return Size2(port_preview_size, port_preview_size) * EDSCALE;
}
void VisualShaderNodePortPreview::_notification(int p_what) {
diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h
index 540cb709b3..1a3a1d799f 100644
--- a/editor/plugins/visual_shader_editor_plugin.h
+++ b/editor/plugins/visual_shader_editor_plugin.h
@@ -72,8 +72,8 @@ private:
GraphNode *graph_node = nullptr;
bool preview_visible = false;
int preview_pos = 0;
- Map<int, InputPort> input_ports;
- Map<int, Port> output_ports;
+ HashMap<int, InputPort> input_ports;
+ HashMap<int, Port> output_ports;
VBoxContainer *preview_box = nullptr;
LineEdit *uniform_name = nullptr;
CodeEdit *expression_edit = nullptr;
@@ -81,7 +81,7 @@ private:
};
Ref<VisualShader> visual_shader;
- Map<int, Link> links;
+ HashMap<int, Link> links;
List<VisualShader::Connection> connections;
bool dirty = false;
@@ -358,8 +358,8 @@ class VisualShaderEditor : public VBoxContainer {
int from_node = -1;
int from_slot = -1;
- Set<int> selected_constants;
- Set<int> selected_uniforms;
+ RBSet<int> selected_constants;
+ RBSet<int> selected_uniforms;
int selected_comment = -1;
int selected_float_constant = -1;
@@ -468,7 +468,7 @@ class VisualShaderEditor : public VBoxContainer {
bool _is_available(int p_mode);
void _update_created_node(GraphNode *node);
void _update_uniforms(bool p_update_refs);
- void _update_uniform_refs(Set<String> &p_names);
+ void _update_uniform_refs(RBSet<String> &p_names);
void _update_varyings();
void _visibility_changed();