diff options
Diffstat (limited to 'source/blender/collada/MaterialExporter.cpp')
-rw-r--r-- | source/blender/collada/MaterialExporter.cpp | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/source/blender/collada/MaterialExporter.cpp b/source/blender/collada/MaterialExporter.cpp index 4aece997f72..6e6cc24be20 100644 --- a/source/blender/collada/MaterialExporter.cpp +++ b/source/blender/collada/MaterialExporter.cpp @@ -38,14 +38,39 @@ MaterialsExporter::MaterialsExporter(COLLADASW::StreamWriter *sw, const ExportSe void MaterialsExporter::exportMaterials(Scene *sce) { - if (hasMaterials(sce)) { - openLibrary(); + if (this->export_settings->export_texture_type == BC_TEXTURE_TYPE_MAT) + { + if (hasMaterials(sce)) { + openLibrary(); - MaterialFunctor mf; - mf.forEachMaterialInExportSet<MaterialsExporter>(sce, *this, this->export_settings->export_set); + MaterialFunctor mf; + mf.forEachMaterialInExportSet<MaterialsExporter>(sce, *this, this->export_settings->export_set); - closeLibrary(); + closeLibrary(); + } } + + else { + std::set<Image *> uv_images = bc_getUVImages(sce, !this->export_settings->active_uv_only); + if (uv_images.size() > 0) { + openLibrary(); + std::set<Image *>::iterator uv_images_iter; + for (uv_images_iter = uv_images.begin(); + uv_images_iter != uv_images.end(); + uv_images_iter++) { + + Image *ima = *uv_images_iter; + std::string matid(id_name(ima)); + + openMaterial(get_material_id_from_id(matid), translate_id(matid)); + std::string efid = translate_id(matid) + "-effect"; + addInstanceEffect(COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, efid)); + closeMaterial(); + } + closeLibrary(); + } + } + } bool MaterialsExporter::hasMaterials(Scene *sce) |