summaryrefslogtreecommitdiff
path: root/editor/import
diff options
context:
space:
mode:
Diffstat (limited to 'editor/import')
-rw-r--r--editor/import/collada.cpp10
-rw-r--r--editor/import/collada.h2
-rw-r--r--editor/import/dynamic_font_import_settings.cpp32
-rw-r--r--editor/import/dynamic_font_import_settings.h9
-rw-r--r--editor/import/editor_import_collada.cpp24
-rw-r--r--editor/import/resource_importer_scene.cpp6
-rw-r--r--editor/import/resource_importer_scene.h2
-rw-r--r--editor/import/scene_import_settings.cpp8
-rw-r--r--editor/import/scene_import_settings.h6
9 files changed, 60 insertions, 39 deletions
diff --git a/editor/import/collada.cpp b/editor/import/collada.cpp
index 71b5ddc216..f4d19fe8b6 100644
--- a/editor/import/collada.cpp
+++ b/editor/import/collada.cpp
@@ -2029,7 +2029,7 @@ void Collada::_merge_skeletons(VisualScene *p_vscene, Node *p_node) {
NodeGeometry *gnode = static_cast<NodeGeometry *>(p_node);
if (gnode->controller) {
// recount skeletons used
- RBSet<NodeSkeleton *> skeletons;
+ HashSet<NodeSkeleton *> skeletons;
for (int i = 0; i < gnode->skeletons.size(); i++) {
String nodeid = gnode->skeletons[i];
@@ -2049,11 +2049,11 @@ void Collada::_merge_skeletons(VisualScene *p_vscene, Node *p_node) {
if (skeletons.size() > 1) {
//do the merger!!
- RBSet<NodeSkeleton *>::Element *E = skeletons.front();
- NodeSkeleton *base = E->get();
+ HashSet<NodeSkeleton *>::Iterator E = skeletons.begin();
+ NodeSkeleton *base = *E;
- for (E = E->next(); E; E = E->next()) {
- NodeSkeleton *merged = E->get();
+ for (++E; E; ++E) {
+ NodeSkeleton *merged = *E;
_remove_node(p_vscene, merged);
for (int i = 0; i < merged->children.size(); i++) {
_joint_set_owner(merged->children[i], base);
diff --git a/editor/import/collada.h b/editor/import/collada.h
index 6ac6181769..f1d9c5593f 100644
--- a/editor/import/collada.h
+++ b/editor/import/collada.h
@@ -493,7 +493,7 @@ public:
HashMap<String, VisualScene> visual_scene_map;
HashMap<String, Node *> scene_map;
- RBSet<String> idref_joints;
+ HashSet<String> idref_joints;
HashMap<String, String> sid_to_node_map;
//RBMap<String,NodeJoint*> bone_map;
diff --git a/editor/import/dynamic_font_import_settings.cpp b/editor/import/dynamic_font_import_settings.cpp
index 815366b279..e546f01205 100644
--- a/editor/import/dynamic_font_import_settings.cpp
+++ b/editor/import/dynamic_font_import_settings.cpp
@@ -547,7 +547,11 @@ void DynamicFontImportSettings::_variation_selected() {
}
}
-void DynamicFontImportSettings::_variation_remove(Object *p_item, int p_column, int p_id) {
+void DynamicFontImportSettings::_variation_remove(Object *p_item, int p_column, int p_id, MouseButton p_button) {
+ if (p_button != MouseButton::LEFT) {
+ return;
+ }
+
TreeItem *vars_item = (TreeItem *)p_item;
ERR_FAIL_NULL(vars_item);
@@ -832,7 +836,11 @@ void DynamicFontImportSettings::_lang_add_item(const String &p_locale) {
lang_item->set_button_color(2, 0, Color(1, 1, 1, 0.75));
}
-void DynamicFontImportSettings::_lang_remove(Object *p_item, int p_column, int p_id) {
+void DynamicFontImportSettings::_lang_remove(Object *p_item, int p_column, int p_id, MouseButton p_button) {
+ if (p_button != MouseButton::LEFT) {
+ return;
+ }
+
TreeItem *lang_item = (TreeItem *)p_item;
ERR_FAIL_NULL(lang_item);
@@ -864,7 +872,11 @@ void DynamicFontImportSettings::_ot_add_item(int p_option) {
ot_item->set_button_color(2, 0, Color(1, 1, 1, 0.75));
}
-void DynamicFontImportSettings::_ot_remove(Object *p_item, int p_column, int p_id) {
+void DynamicFontImportSettings::_ot_remove(Object *p_item, int p_column, int p_id, MouseButton p_button) {
+ if (p_button != MouseButton::LEFT) {
+ return;
+ }
+
TreeItem *ot_item = (TreeItem *)p_item;
ERR_FAIL_NULL(ot_item);
@@ -891,7 +903,11 @@ void DynamicFontImportSettings::_script_add_item(int p_option) {
script_item->set_button_color(2, 0, Color(1, 1, 1, 0.75));
}
-void DynamicFontImportSettings::_script_remove(Object *p_item, int p_column, int p_id) {
+void DynamicFontImportSettings::_script_remove(Object *p_item, int p_column, int p_id, MouseButton p_button) {
+ if (p_button != MouseButton::LEFT) {
+ return;
+ }
+
TreeItem *script_item = (TreeItem *)p_item;
ERR_FAIL_NULL(script_item);
@@ -1487,7 +1503,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() {
vars_list->set_column_expand(1, false);
vars_list->set_column_custom_minimum_width(1, 50 * EDSCALE);
vars_list->connect("item_selected", callable_mp(this, &DynamicFontImportSettings::_variation_selected));
- vars_list->connect("button_pressed", callable_mp(this, &DynamicFontImportSettings::_variation_remove));
+ vars_list->connect("button_clicked", callable_mp(this, &DynamicFontImportSettings::_variation_remove));
vars_list->set_v_size_flags(Control::SIZE_EXPAND_FILL);
inspector_vars = memnew(EditorInspector);
@@ -1639,7 +1655,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() {
lang_list->set_column_custom_minimum_width(1, 80 * EDSCALE);
lang_list->set_column_expand(2, false);
lang_list->set_column_custom_minimum_width(2, 50 * EDSCALE);
- lang_list->connect("button_pressed", callable_mp(this, &DynamicFontImportSettings::_lang_remove));
+ lang_list->connect("button_clicked", callable_mp(this, &DynamicFontImportSettings::_lang_remove));
lang_list->set_v_size_flags(Control::SIZE_EXPAND_FILL);
HBoxContainer *hb_script = memnew(HBoxContainer);
@@ -1667,7 +1683,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() {
script_list->set_column_custom_minimum_width(1, 80 * EDSCALE);
script_list->set_column_expand(2, false);
script_list->set_column_custom_minimum_width(2, 50 * EDSCALE);
- script_list->connect("button_pressed", callable_mp(this, &DynamicFontImportSettings::_script_remove));
+ script_list->connect("button_clicked", callable_mp(this, &DynamicFontImportSettings::_script_remove));
script_list->set_v_size_flags(Control::SIZE_EXPAND_FILL);
HBoxContainer *hb_ot = memnew(HBoxContainer);
@@ -1695,7 +1711,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() {
ot_list->set_column_custom_minimum_width(1, 80 * EDSCALE);
ot_list->set_column_expand(2, false);
ot_list->set_column_custom_minimum_width(2, 50 * EDSCALE);
- ot_list->connect("button_pressed", callable_mp(this, &DynamicFontImportSettings::_ot_remove));
+ ot_list->connect("button_clicked", callable_mp(this, &DynamicFontImportSettings::_ot_remove));
ot_list->set_v_size_flags(Control::SIZE_EXPAND_FILL);
// Common
diff --git a/editor/import/dynamic_font_import_settings.h b/editor/import/dynamic_font_import_settings.h
index 4e2135a13c..ba75c98057 100644
--- a/editor/import/dynamic_font_import_settings.h
+++ b/editor/import/dynamic_font_import_settings.h
@@ -33,6 +33,7 @@
#include "editor/import/resource_importer_dynamic_font.h"
+#include "core/templates/rb_set.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/item_list.h"
#include "scene/gui/option_button.h"
@@ -90,7 +91,7 @@ class DynamicFontImportSettings : public ConfirmationDialog {
void _variation_add();
void _variation_selected();
- void _variation_remove(Object *p_item, int p_column, int p_id);
+ void _variation_remove(Object *p_item, int p_column, int p_id, MouseButton p_button);
void _variation_changed(const String &p_edited_property);
void _variations_validate();
@@ -144,15 +145,15 @@ class DynamicFontImportSettings : public ConfirmationDialog {
void _lang_add();
void _lang_add_item(const String &p_locale);
- void _lang_remove(Object *p_item, int p_column, int p_id);
+ void _lang_remove(Object *p_item, int p_column, int p_id, MouseButton p_button);
void _script_add();
void _script_add_item(int p_option);
- void _script_remove(Object *p_item, int p_column, int p_id);
+ void _script_remove(Object *p_item, int p_column, int p_id, MouseButton p_button);
void _ot_add();
void _ot_add_item(int p_option);
- void _ot_remove(Object *p_item, int p_column, int p_id);
+ void _ot_remove(Object *p_item, int p_column, int p_id, MouseButton p_button);
// Common
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index 8ee47cb6f4..8d44329022 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -76,12 +76,12 @@ struct ColladaImport {
HashMap<Skeleton3D *, HashMap<String, int>> skeleton_bone_map;
- RBSet<String> valid_animated_nodes;
+ HashSet<String> valid_animated_nodes;
Vector<int> valid_animated_properties;
HashMap<String, bool> bones_with_animation;
- RBSet<String> mesh_unique_names;
- RBSet<String> material_unique_names;
+ HashSet<String> mesh_unique_names;
+ HashSet<String> material_unique_names;
Error _populate_skeleton(Skeleton3D *p_skeleton, Collada::Node *p_node, int &r_bone, int p_parent);
Error _create_scene_skeletons(Collada::Node *p_node);
@@ -94,7 +94,7 @@ struct ColladaImport {
void create_animation(int p_clip, bool p_import_value_tracks);
void create_animations(bool p_import_value_tracks);
- RBSet<String> tracks_in_clips;
+ HashSet<String> tracks_in_clips;
Vector<String> missing_textures;
void _pre_process_lights(Collada::Node *p_node);
@@ -875,8 +875,8 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ImporterMesh> &p
Vector<Collada::Vertex> vertex_array; //there we go, vertex array
vertex_array.resize(vertex_set.size());
- for (RBSet<Collada::Vertex>::Element *F = vertex_set.front(); F; F = F->next()) {
- vertex_array.write[F->get().idx] = F->get();
+ for (const Collada::Vertex &F : vertex_set) {
+ vertex_array.write[F.idx] = F;
}
if (has_weights) {
@@ -1452,7 +1452,7 @@ void ColladaImport::create_animation(int p_clip, bool p_import_value_tracks) {
//main anim
}
- RBSet<int> track_filter;
+ HashSet<int> track_filter;
if (p_clip == -1) {
for (int i = 0; i < collada.state.animation_clips.size(); i++) {
@@ -1507,14 +1507,14 @@ void ColladaImport::create_animation(int p_clip, bool p_import_value_tracks) {
bool tracks_found = false;
- for (RBSet<String>::Element *E = valid_animated_nodes.front(); E; E = E->next()) {
+ for (const String &E : valid_animated_nodes) {
// take snapshots
- if (!collada.state.scene_map.has(E->get())) {
+ if (!collada.state.scene_map.has(E)) {
continue;
}
- NodeMap &nm = node_map[E->get()];
+ NodeMap &nm = node_map[E];
String path = scene->get_path_to(nm.node);
if (nm.bone >= 0) {
@@ -1525,7 +1525,7 @@ void ColladaImport::create_animation(int p_clip, bool p_import_value_tracks) {
bool found_anim = false;
- Collada::Node *cn = collada.state.scene_map[E->get()];
+ Collada::Node *cn = collada.state.scene_map[E];
if (cn->ignore_anim) {
continue;
}
@@ -1665,7 +1665,7 @@ void ColladaImport::create_animation(int p_clip, bool p_import_value_tracks) {
if (nm.bone >= 0) {
if (found_anim) {
- bones_with_animation[E->get()] = true;
+ bones_with_animation[E] = true;
}
}
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index 647eb1344b..80230bc316 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -466,7 +466,7 @@ Node *ResourceImporterScene::_pre_fix_node(Node *p_node, Node *p_root, HashMap<R
static const char *loop_strings[loop_string_count] = { "loop_mode", "loop", "cycle" };
for (int i = 0; i < loop_string_count; i++) {
if (_teststr(animname, loop_strings[i])) {
- anim->set_loop_mode(Animation::LoopMode::LOOP_LINEAR);
+ anim->set_loop_mode(Animation::LOOP_LINEAR);
animname = _fixstr(animname, loop_strings[i]);
Ref<AnimationLibrary> library = ap->get_animation_library(ap->find_animation_library(anim));
@@ -704,7 +704,7 @@ Node *ResourceImporterScene::_pre_fix_node(Node *p_node, Node *p_root, HashMap<R
return p_node;
}
-Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, HashMap<Ref<ImporterMesh>, Vector<Ref<Shape3D>>> &collision_map, Pair<PackedVector3Array, PackedInt32Array> &r_occluder_arrays, RBSet<Ref<ImporterMesh>> &r_scanned_meshes, const Dictionary &p_node_data, const Dictionary &p_material_data, const Dictionary &p_animation_data, float p_animation_fps) {
+Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, HashMap<Ref<ImporterMesh>, Vector<Ref<Shape3D>>> &collision_map, Pair<PackedVector3Array, PackedInt32Array> &r_occluder_arrays, HashSet<Ref<ImporterMesh>> &r_scanned_meshes, const Dictionary &p_node_data, const Dictionary &p_material_data, const Dictionary &p_animation_data, float p_animation_fps) {
// children first
for (int i = 0; i < p_node->get_child_count(); i++) {
Node *r = _post_fix_node(p_node->get_child(i), p_root, collision_map, r_occluder_arrays, r_scanned_meshes, p_node_data, p_material_data, p_animation_data, p_animation_fps);
@@ -1994,7 +1994,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
animation_data = subresources["animations"];
}
- RBSet<Ref<ImporterMesh>> scanned_meshes;
+ HashSet<Ref<ImporterMesh>> scanned_meshes;
HashMap<Ref<ImporterMesh>, Vector<Ref<Shape3D>>> collision_map;
Pair<PackedVector3Array, PackedInt32Array> occluder_arrays;
List<Pair<NodePath, Node *>> node_renames;
diff --git a/editor/import/resource_importer_scene.h b/editor/import/resource_importer_scene.h
index 92bd267216..16cf3d651d 100644
--- a/editor/import/resource_importer_scene.h
+++ b/editor/import/resource_importer_scene.h
@@ -272,7 +272,7 @@ public:
virtual int get_import_order() const override { return ResourceImporter::IMPORT_ORDER_SCENE; }
Node *_pre_fix_node(Node *p_node, Node *p_root, HashMap<Ref<ImporterMesh>, Vector<Ref<Shape3D>>> &r_collision_map, Pair<PackedVector3Array, PackedInt32Array> *r_occluder_arrays, List<Pair<NodePath, Node *>> &r_node_renames);
- Node *_post_fix_node(Node *p_node, Node *p_root, HashMap<Ref<ImporterMesh>, Vector<Ref<Shape3D>>> &collision_map, Pair<PackedVector3Array, PackedInt32Array> &r_occluder_arrays, RBSet<Ref<ImporterMesh>> &r_scanned_meshes, const Dictionary &p_node_data, const Dictionary &p_material_data, const Dictionary &p_animation_data, float p_animation_fps);
+ Node *_post_fix_node(Node *p_node, Node *p_root, HashMap<Ref<ImporterMesh>, Vector<Ref<Shape3D>>> &collision_map, Pair<PackedVector3Array, PackedInt32Array> &r_occluder_arrays, HashSet<Ref<ImporterMesh>> &r_scanned_meshes, const Dictionary &p_node_data, const Dictionary &p_material_data, const Dictionary &p_animation_data, float p_animation_fps);
Ref<Animation> _save_animation_to_file(Ref<Animation> anim, bool p_save_to_file, String p_save_to_path, bool p_keep_custom_tracks);
void _create_clips(AnimationPlayer *anim, const Array &p_clips, bool p_bake_all);
diff --git a/editor/import/scene_import_settings.cpp b/editor/import/scene_import_settings.cpp
index 3c68477564..83dff30dfa 100644
--- a/editor/import/scene_import_settings.cpp
+++ b/editor/import/scene_import_settings.cpp
@@ -969,7 +969,11 @@ void SceneImportSettings::_save_path_changed(const String &p_path) {
}
}
-void SceneImportSettings::_browse_save_callback(Object *p_item, int p_column, int p_id) {
+void SceneImportSettings::_browse_save_callback(Object *p_item, int p_column, int p_id, MouseButton p_button) {
+ if (p_button != MouseButton::LEFT) {
+ return;
+ }
+
TreeItem *item = Object::cast_to<TreeItem>(p_item);
String path = item->get_text(1);
@@ -1331,7 +1335,7 @@ SceneImportSettings::SceneImportSettings() {
add_child(external_paths);
external_path_tree = memnew(Tree);
external_paths->add_child(external_path_tree);
- external_path_tree->connect("button_pressed", callable_mp(this, &SceneImportSettings::_browse_save_callback));
+ external_path_tree->connect("button_clicked", callable_mp(this, &SceneImportSettings::_browse_save_callback));
external_paths->connect("confirmed", callable_mp(this, &SceneImportSettings::_save_dir_confirm));
external_path_tree->set_columns(3);
external_path_tree->set_column_titles_visible(true);
diff --git a/editor/import/scene_import_settings.h b/editor/import/scene_import_settings.h
index cbd105045a..81d13166ab 100644
--- a/editor/import/scene_import_settings.h
+++ b/editor/import/scene_import_settings.h
@@ -139,8 +139,8 @@ class SceneImportSettings : public ConfirmationDialog {
void _fill_animation(Tree *p_tree, const Ref<Animation> &p_anim, const String &p_name, TreeItem *p_parent);
void _fill_scene(Node *p_node, TreeItem *p_parent_item);
- RBSet<Ref<Mesh>> mesh_set;
- RBSet<Ref<Material>> material_set;
+ HashSet<Ref<Mesh>> mesh_set;
+ HashSet<Ref<Material>> material_set;
String selected_type;
String selected_id;
@@ -182,7 +182,7 @@ class SceneImportSettings : public ConfirmationDialog {
TreeItem *save_path_item = nullptr;
void _save_path_changed(const String &p_path);
- void _browse_save_callback(Object *p_item, int p_column, int p_id);
+ void _browse_save_callback(Object *p_item, int p_column, int p_id, MouseButton p_button);
void _save_dir_confirm();
Dictionary base_subresource_settings;