summaryrefslogtreecommitdiff
path: root/editor/import
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-07-03 10:51:40 +0200
committerGitHub <noreply@github.com>2022-07-03 10:51:40 +0200
commit6f024546341fa53eccdafff39e5095979e346c72 (patch)
treed5aeed4949b93beda7446460e4e41cda8e85aeef /editor/import
parent602b27c074305e56a19df5c84694d290f44fe180 (diff)
parenta73b0f165e531fe27c2b09d1d33f946c9bc88bd4 (diff)
Merge pull request #59834 from trollodel/advanced_import_fix
Fix some bugs in the advanced scene import
Diffstat (limited to 'editor/import')
-rw-r--r--editor/import/scene_import_settings.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/editor/import/scene_import_settings.cpp b/editor/import/scene_import_settings.cpp
index af145c22b4..8ae05f046e 100644
--- a/editor/import/scene_import_settings.cpp
+++ b/editor/import/scene_import_settings.cpp
@@ -135,6 +135,12 @@ void SceneImportSettings::_fill_material(Tree *p_tree, const Ref<Material> &p_ma
String import_id;
bool has_import_id = false;
+ bool created = false;
+ if (!material_set.has(p_material)) {
+ material_set.insert(p_material);
+ created = true;
+ }
+
if (p_material->has_meta("import_id")) {
import_id = p_material->get_meta("import_id");
has_import_id = true;
@@ -142,7 +148,7 @@ void SceneImportSettings::_fill_material(Tree *p_tree, const Ref<Material> &p_ma
import_id = p_material->get_name();
has_import_id = true;
} else {
- import_id = "@MATERIAL:" + itos(material_set.size());
+ import_id = "@MATERIAL:" + itos(material_set.size() - 1);
}
if (!material_map.has(import_id)) {
@@ -160,14 +166,12 @@ void SceneImportSettings::_fill_material(Tree *p_tree, const Ref<Material> &p_ma
Ref<Texture2D> icon = get_theme_icon(SNAME("StandardMaterial3D"), SNAME("EditorIcons"));
TreeItem *item = p_tree->create_item(p_parent);
- item->set_text(0, p_material->get_name());
- item->set_icon(0, icon);
-
- bool created = false;
- if (!material_set.has(p_material)) {
- material_set.insert(p_material);
- created = true;
+ if (p_material->get_name().is_empty()) {
+ item->set_text(0, TTR("<Unnamed Material>"));
+ } else {
+ item->set_text(0, p_material->get_name());
}
+ item->set_icon(0, icon);
item->set_meta("type", "Material");
item->set_meta("import_id", import_id);
@@ -606,6 +610,9 @@ void SceneImportSettings::open_settings(const String &p_path, bool p_for_animati
_update_view_gizmos();
_update_camera();
+ // Start with the root item (Scene) selected.
+ scene_tree->get_root()->select(0);
+
if (p_for_animation) {
set_title(vformat(TTR("Advanced Import Settings for AnimationLibrary '%s'"), base_path.get_file()));
} else {