Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions editor/import/3d/resource_importer_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1521,6 +1521,11 @@ Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, HashMap<
if (mat.is_valid()) {
String mat_id = mat->get_meta("import_id", mat->get_name());

if (mat_id.is_empty() && mat->has_meta("unique_id")) {
mat_id = mat->get_meta("unique_id");
mat->remove_meta("unique_id");
}

if (!mat_id.is_empty() && p_material_data.has(mat_id)) {
Dictionary matdata = p_material_data[mat_id];
{
Expand Down
2 changes: 2 additions & 0 deletions editor/import/3d/scene_import_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ void SceneImportSettingsDialog::_fill_material(Tree *p_tree, const Ref<Material>
} else if (!p_material->get_name().is_empty()) {
import_id = p_material->get_name();
has_import_id = true;
} else if (p_material->has_meta("unique_id")) {
import_id = p_material->get_meta("unique_id");
} else if (unnamed_material_name_map.has(p_material)) {
import_id = unnamed_material_name_map[p_material];
} else {
Expand Down
1 change: 1 addition & 0 deletions modules/gltf/gltf_document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3779,6 +3779,7 @@ Error GLTFDocument::_parse_meshes(Ref<GLTFState> p_state) {
} else {
Ref<StandardMaterial3D> mat3d;
mat3d.instantiate();
mat3d->set_meta("unique_id", vformat("%s@%s", import_mesh->get_name(), itos(j)));
if (has_vertex_color) {
mat3d->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
}
Expand Down