diff options
author | Juan Linietsky <reduzio@gmail.com> | 2014-06-28 09:50:20 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2014-06-28 09:50:20 -0300 |
commit | 8ffc113b7094c5ba7971aaa65dae4131130acef3 (patch) | |
tree | e94474295e25da49a6d6987b01b6cbd0028b068e | |
parent | 2af2a84a03fd707cfa4c682aff34d722343d8985 (diff) |
Missing name on collada-imported materials
-rw-r--r-- | tools/collada/collada.cpp | 5 | ||||
-rw-r--r-- | tools/collada/collada.h | 2 | ||||
-rw-r--r-- | tools/editor/io_plugins/editor_import_collada.cpp | 7 |
3 files changed, 14 insertions, 0 deletions
diff --git a/tools/collada/collada.cpp b/tools/collada/collada.cpp index 0d02c32d00..9962eed1b2 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<State::Version(1,4,0)) { /* <1.4 */ @@ -775,9 +777,12 @@ void Collada::_parse_effect(XMLParser& parser) { String id=parser.get_attribute_value("id"); Effect effect; + if (parser.has_attribute("name")) + effect.name=parser.get_attribute_value("name"); _parse_effect_material(parser,effect,id); + state.effect_map[id]=effect; COLLADA_PRINT("Effect ID:"+id); diff --git a/tools/collada/collada.h b/tools/collada/collada.h index f54e8a59ff..69ed05beba 100644 --- a/tools/collada/collada.h +++ b/tools/collada/collada.h @@ -53,12 +53,14 @@ public: struct Material { + String name; String instance_effect; }; struct Effect { + String name; Map<String, Variant> params; struct Channel { diff --git a/tools/editor/io_plugins/editor_import_collada.cpp b/tools/editor/io_plugins/editor_import_collada.cpp index 5b4f9960a3..a0f1626b03 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<FixedMaterial> 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; } |