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.cpp54
-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_dynamic_font.cpp7
-rw-r--r--editor/import/resource_importer_imagefont.cpp2
-rw-r--r--editor/import/resource_importer_scene.cpp44
-rw-r--r--editor/import/resource_importer_scene.h2
-rw-r--r--editor/import/resource_importer_texture.cpp8
-rw-r--r--editor/import/scene_import_settings.cpp11
-rw-r--r--editor/import/scene_import_settings.h6
12 files changed, 130 insertions, 49 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..5e203a3e39 100644
--- a/editor/import/dynamic_font_import_settings.cpp
+++ b/editor/import/dynamic_font_import_settings.cpp
@@ -454,7 +454,11 @@ void DynamicFontImportSettings::_add_glyph_range_item(int32_t p_start, int32_t p
void DynamicFontImportSettings::_main_prop_changed(const String &p_edited_property) {
// Update font preview.
- if (p_edited_property == "antialiased") {
+ if (p_edited_property == "face_index") {
+ if (font_preview->get_data_count() > 0) {
+ font_preview->get_data(0)->set_face_index(import_settings_data->get("face_index"));
+ }
+ } else if (p_edited_property == "antialiased") {
if (font_preview->get_data_count() > 0) {
font_preview->get_data(0)->set_antialiased(import_settings_data->get("antialiased"));
}
@@ -547,7 +551,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);
@@ -621,7 +629,7 @@ void DynamicFontImportSettings::_change_text_opts() {
void DynamicFontImportSettings::_glyph_clear() {
selected_glyphs.clear();
- label_glyphs->set_text(TTR("Preloaded glyphs: ") + itos(selected_glyphs.size()));
+ label_glyphs->set_text(TTR("Preloaded glyphs:") + " " + itos(selected_glyphs.size()));
_range_selected();
}
@@ -650,7 +658,7 @@ void DynamicFontImportSettings::_glyph_text_selected() {
}
}
TS->free_rid(text_rid);
- label_glyphs->set_text(TTR("Preloaded glyphs: ") + itos(selected_glyphs.size()));
+ label_glyphs->set_text(TTR("Preloaded glyphs:") + " " + itos(selected_glyphs.size()));
}
_range_selected();
}
@@ -677,7 +685,7 @@ void DynamicFontImportSettings::_glyph_selected() {
item->clear_custom_bg_color(glyph_table->get_selected_column());
}
}
- label_glyphs->set_text(TTR("Preloaded glyphs: ") + itos(selected_glyphs.size()));
+ label_glyphs->set_text(TTR("Preloaded glyphs:") + " " + itos(selected_glyphs.size()));
item = glyph_tree->get_selected();
ERR_FAIL_NULL(item);
@@ -765,7 +773,7 @@ void DynamicFontImportSettings::_edit_range(int32_t p_start, int32_t p_end) {
col = 0;
}
}
- label_glyphs->set_text(TTR("Preloaded glyphs: ") + itos(selected_glyphs.size()));
+ label_glyphs->set_text(TTR("Preloaded glyphs:") + " " + itos(selected_glyphs.size()));
}
bool DynamicFontImportSettings::_char_update(int32_t p_char) {
@@ -832,7 +840,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 +876,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 +907,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);
@@ -929,6 +949,7 @@ void DynamicFontImportSettings::_notification(int p_what) {
void DynamicFontImportSettings::_re_import() {
HashMap<StringName, Variant> main_settings;
+ main_settings["face_index"] = import_settings_data->get("face_index");
main_settings["antialiased"] = import_settings_data->get("antialiased");
main_settings["generate_mipmaps"] = import_settings_data->get("generate_mipmaps");
main_settings["multichannel_signed_distance_field"] = import_settings_data->get("multichannel_signed_distance_field");
@@ -1276,13 +1297,14 @@ void DynamicFontImportSettings::open_settings(const String &p_path) {
}
}
}
- label_glyphs->set_text(TTR("Preloaded glyphs: ") + itos(selected_glyphs.size()));
+ label_glyphs->set_text(TTR("Preloaded glyphs:") + " " + itos(selected_glyphs.size()));
import_settings_data->options = options_general;
inspector_general->edit(import_settings_data.ptr());
import_settings_data->notify_property_list_changed();
if (font_preview->get_data_count() > 0) {
+ font_preview->get_data(0)->set_face_index(import_settings_data->get("face_index"));
font_preview->get_data(0)->set_antialiased(import_settings_data->get("antialiased"));
font_preview->get_data(0)->set_multichannel_signed_distance_field(import_settings_data->get("multichannel_signed_distance_field"));
font_preview->get_data(0)->set_msdf_pixel_range(import_settings_data->get("msdf_pixel_range"));
@@ -1344,6 +1366,7 @@ DynamicFontImportSettings *DynamicFontImportSettings::get_singleton() {
DynamicFontImportSettings::DynamicFontImportSettings() {
singleton = this;
+ options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::INT, "face_index"), 0));
options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::BOOL, "antialiased"), true));
options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::BOOL, "generate_mipmaps"), false));
options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::BOOL, "multichannel_signed_distance_field", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), true));
@@ -1402,6 +1425,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() {
main_pages->set_tab_alignment(TabBar::ALIGNMENT_CENTER);
main_pages->set_v_size_flags(Control::SIZE_EXPAND_FILL);
main_pages->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ main_pages->set_theme_type_variation("TabContainerOdd");
root_vb->add_child(main_pages);
label_warn = memnew(Label);
@@ -1487,7 +1511,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);
@@ -1539,7 +1563,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() {
label_glyphs = memnew(Label);
text_hb->add_child(label_glyphs);
- label_glyphs->set_text(TTR("Preloaded glyphs: ") + itos(0));
+ label_glyphs->set_text(TTR("Preloaded glyphs:") + " " + itos(0));
label_glyphs->set_custom_minimum_size(Size2(50 * EDSCALE, 0));
Button *btn_fill = memnew(Button);
@@ -1639,7 +1663,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 +1691,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 +1719,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_dynamic_font.cpp b/editor/import/resource_importer_dynamic_font.cpp
index 04f6a0b7af..a92b0fe280 100644
--- a/editor/import/resource_importer_dynamic_font.cpp
+++ b/editor/import/resource_importer_dynamic_font.cpp
@@ -50,7 +50,9 @@ void ResourceImporterDynamicFont::get_recognized_extensions(List<String> *p_exte
if (p_extensions) {
#ifdef MODULE_FREETYPE_ENABLED
p_extensions->push_back("ttf");
+ p_extensions->push_back("ttc");
p_extensions->push_back("otf");
+ p_extensions->push_back("otc");
p_extensions->push_back("woff");
p_extensions->push_back("woff2");
p_extensions->push_back("pfb");
@@ -101,6 +103,8 @@ String ResourceImporterDynamicFont::get_preset_name(int p_idx) const {
void ResourceImporterDynamicFont::get_import_options(const String &p_path, List<ImportOption> *r_options, int p_preset) const {
bool msdf = p_preset == PRESET_MSDF;
+ r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "face_index"), 0));
+
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "antialiased"), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "generate_mipmaps"), false));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "multichannel_signed_distance_field", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), (msdf) ? true : false));
@@ -179,6 +183,8 @@ void ResourceImporterDynamicFont::show_advanced_options(const String &p_path) {
Error ResourceImporterDynamicFont::import(const String &p_source_file, const String &p_save_path, const HashMap<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata) {
print_verbose("Importing dynamic font from: " + p_source_file);
+ int face_index = p_options["face_index"];
+
bool antialiased = p_options["antialiased"];
bool generate_mipmaps = p_options["generate_mipmaps"];
bool msdf = p_options["multichannel_signed_distance_field"];
@@ -200,6 +206,7 @@ Error ResourceImporterDynamicFont::import(const String &p_source_file, const Str
Ref<FontData> font;
font.instantiate();
font->set_data(data);
+ font->set_face_index(face_index);
font->set_antialiased(antialiased);
font->set_generate_mipmaps(generate_mipmaps);
font->set_multichannel_signed_distance_field(msdf);
diff --git a/editor/import/resource_importer_imagefont.cpp b/editor/import/resource_importer_imagefont.cpp
index bbcd336575..30c349d0f2 100644
--- a/editor/import/resource_importer_imagefont.cpp
+++ b/editor/import/resource_importer_imagefont.cpp
@@ -107,7 +107,7 @@ Error ResourceImporterImageFont::import(const String &p_source_file, const Strin
Ref<Image> img;
img.instantiate();
Error err = ImageLoader::load_image(p_source_file, img);
- ERR_FAIL_COND_V_MSG(err != OK, ERR_FILE_CANT_READ, TTR("Can't load font texture: ") + "\"" + p_source_file + "\".");
+ ERR_FAIL_COND_V_MSG(err != OK, ERR_FILE_CANT_READ, TTR("Can't load font texture:") + " \"" + p_source_file + "\".");
font->set_texture_image(0, Vector2i(base_size, 0), 0, img);
int count = columns * rows;
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index 647eb1344b..f2975b1d7a 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));
@@ -658,6 +658,44 @@ Node *ResourceImporterScene::_pre_fix_node(Node *p_node, Node *p_root, HashMap<R
}
}
}
+ } else if (_teststr(name, "vehicle")) {
+ if (isroot) {
+ return p_node;
+ }
+
+ Node *owner = p_node->get_owner();
+ Node3D *s = Object::cast_to<Node3D>(p_node);
+ VehicleBody3D *bv = memnew(VehicleBody3D);
+ String n = _fixstr(p_node->get_name(), "vehicle");
+ bv->set_name(n);
+ p_node->replace_by(bv);
+ p_node->set_name(n);
+ bv->add_child(p_node);
+ bv->set_owner(owner);
+ p_node->set_owner(owner);
+ bv->set_transform(s->get_transform());
+ s->set_transform(Transform3D());
+
+ p_node = bv;
+ } else if (_teststr(name, "wheel")) {
+ if (isroot) {
+ return p_node;
+ }
+
+ Node *owner = p_node->get_owner();
+ Node3D *s = Object::cast_to<Node3D>(p_node);
+ VehicleWheel3D *bv = memnew(VehicleWheel3D);
+ String n = _fixstr(p_node->get_name(), "wheel");
+ bv->set_name(n);
+ p_node->replace_by(bv);
+ p_node->set_name(n);
+ bv->add_child(p_node);
+ bv->set_owner(owner);
+ p_node->set_owner(owner);
+ bv->set_transform(s->get_transform());
+ s->set_transform(Transform3D());
+
+ p_node = bv;
} else if (Object::cast_to<ImporterMeshInstance3D>(p_node)) {
//last attempt, maybe collision inside the mesh data
@@ -704,7 +742,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 +2032,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/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp
index 5364b53b57..deb3047864 100644
--- a/editor/import/resource_importer_texture.cpp
+++ b/editor/import/resource_importer_texture.cpp
@@ -104,24 +104,30 @@ void ResourceImporterTexture::update_imports() {
bool changed = false;
if (E.value.flags & MAKE_NORMAL_FLAG && int(cf->get_value("params", "compress/normal_map")) == 0) {
+ print_line(vformat(TTR("%s: Texture detected as used as a normal map in 3D. Enabling red-green texture compression to reduce memory usage (blue channel is discarded)."), String(E.key)));
cf->set_value("params", "compress/normal_map", 1);
changed = true;
}
if (E.value.flags & MAKE_ROUGHNESS_FLAG && int(cf->get_value("params", "roughness/mode")) == 0) {
+ print_line(vformat(TTR("%s: Texture detected as used as a roughness map in 3D. Enabling roughness limiter based on the detected associated normal map at %s."), String(E.key), E.value.normal_path_for_roughness));
cf->set_value("params", "roughness/mode", E.value.channel_for_roughness + 2);
cf->set_value("params", "roughness/src_normal", E.value.normal_path_for_roughness);
changed = true;
}
if (E.value.flags & MAKE_3D_FLAG && bool(cf->get_value("params", "detect_3d/compress_to"))) {
- int compress_to = cf->get_value("params", "detect_3d/compress_to");
+ const int compress_to = cf->get_value("params", "detect_3d/compress_to");
+ String compress_string;
cf->set_value("params", "detect_3d/compress_to", 0);
if (compress_to == 1) {
cf->set_value("params", "compress/mode", COMPRESS_VRAM_COMPRESSED);
+ compress_string = "VRAM Compressed (S3TC/ETC/BPTC)";
} else if (compress_to == 2) {
cf->set_value("params", "compress/mode", COMPRESS_BASIS_UNIVERSAL);
+ compress_string = "Basis Universal";
}
+ print_line(vformat(TTR("%s: Texture detected as used in 3D. Enabling mipmap generation and setting the texture compression mode to %s."), String(E.key), compress_string));
cf->set_value("params", "mipmaps/generate", true);
changed = true;
}
diff --git a/editor/import/scene_import_settings.cpp b/editor/import/scene_import_settings.cpp
index 3c68477564..99d1658405 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);
@@ -1225,6 +1229,7 @@ SceneImportSettings::SceneImportSettings() {
data_mode = memnew(TabContainer);
tree_split->add_child(data_mode);
data_mode->set_custom_minimum_size(Size2(300 * EDSCALE, 0));
+ data_mode->set_theme_type_variation("TabContainerOdd");
property_split = memnew(HSplitContainer);
tree_split->add_child(property_split);
@@ -1331,7 +1336,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);
@@ -1349,7 +1354,7 @@ SceneImportSettings::SceneImportSettings() {
HBoxContainer *extension_hb = memnew(HBoxContainer);
save_path->get_vbox()->add_child(extension_hb);
extension_hb->add_spacer();
- extension_hb->add_child(memnew(Label(TTR("Save Extension: "))));
+ extension_hb->add_child(memnew(Label(TTR("Save Extension:"))));
external_extension_type = memnew(OptionButton);
extension_hb->add_child(external_extension_type);
external_extension_type->add_item(TTR("Text: *.tres"));
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;