collada: change image export: export either UV Textures or Materials. This
avoids wrong texture data when multiple objects are exported. Note: This commit might possiblyt not work fully. The full feature is added with the next commit)
This commit is contained in:
@@ -38,14 +38,41 @@ 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();
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
// Temporary discarded (to keep consistent commits)
|
||||
else if (this->export_settings->export_texture_type == BC_TEXTURE_TYPE_UV)
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool MaterialsExporter::hasMaterials(Scene *sce)
|
||||
|
||||
Reference in New Issue
Block a user