diff --git a/tools/collada/collada.cpp b/tools/collada/collada.cpp index 0d02c32d00e..9962eed1b2e 100644 --- a/tools/collada/collada.cpp +++ b/tools/collada/collada.cpp @@ -378,6 +378,8 @@ void Collada::_parse_material(XMLParser& parser) { Material material; String id=parser.get_attribute_value("id"); + if (parser.has_attribute("name")) + material.name=parser.get_attribute_value("name"); if (state.version params; struct Channel { diff --git a/tools/editor/io_plugins/editor_import_collada.cpp b/tools/editor/io_plugins/editor_import_collada.cpp index 5b4f9960a36..a0f1626b03c 100644 --- a/tools/editor/io_plugins/editor_import_collada.cpp +++ b/tools/editor/io_plugins/editor_import_collada.cpp @@ -341,6 +341,11 @@ Error ColladaImport::_create_material(const String& p_target) { Ref material= memnew( FixedMaterial ); + if (src_mat.name!="") + material->set_name(src_mat.name); + else if (effect.name!="") + material->set_name(effect.name); + // DIFFUSE if (effect.diffuse.texture!="") { @@ -425,6 +430,8 @@ Error ColladaImport::_create_material(const String& p_target) { material->set_parameter(FixedMaterial::PARAM_SPECULAR_EXP,effect.shininess); material->set_flag(Material::FLAG_DOUBLE_SIDED,effect.double_sided); + + material_cache[p_target]=material; return OK; }