Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaia Clary <gaia.clary@machinimatrix.org>2012-06-22 20:16:58 +0400
committerGaia Clary <gaia.clary@machinimatrix.org>2012-06-22 20:16:58 +0400
commitadf3a5e33229633be9b3ea3639a1baa6596ec7ff (patch)
tree7bfe447274b86e9d91c4952b5bf765827b365ecf /source/blender/collada/GeometryExporter.cpp
parent257283e030792157d24c2cd7846a92de9572b846 (diff)
Collada: (Export) Added export of surface textures, and control over exported uv layers
Diffstat (limited to 'source/blender/collada/GeometryExporter.cpp')
-rw-r--r--source/blender/collada/GeometryExporter.cpp54
1 files changed, 30 insertions, 24 deletions
diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp
index baa20ab07b7..c3d1106b288 100644
--- a/source/blender/collada/GeometryExporter.cpp
+++ b/source/blender/collada/GeometryExporter.cpp
@@ -261,8 +261,9 @@ void GeometryExporter::createPolylist(short material_index,
// sets material name
if (ma) {
+ std::string material_id = get_material_id(ma);
std::ostringstream ostr;
- ostr << translate_id(id_name(ma));
+ ostr << translate_id(material_id);
polylist.setMaterial(ostr.str());
}
@@ -436,33 +437,38 @@ void GeometryExporter::createTexcoordsSource(std::string geom_id, Mesh *me)
// write <source> for each layer
// each <source> will get id like meshName + "map-channel-1"
+ int map_index = 0;
+ int active_uv_index = CustomData_get_active_layer_index(&me->fdata, CD_MTFACE)-1;
for (int a = 0; a < num_layers; a++) {
- MTFace *tface = (MTFace *)CustomData_get_layer_n(&me->fdata, CD_MTFACE, a);
- // char *name = CustomData_get_layer_name(&me->fdata, CD_MTFACE, a);
-
- COLLADASW::FloatSourceF source(mSW);
- std::string layer_id = makeTexcoordSourceId(geom_id, a);
- source.setId(layer_id);
- source.setArrayId(layer_id + ARRAY_ID_SUFFIX);
-
- source.setAccessorCount(totuv);
- source.setAccessorStride(2);
- COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
- param.push_back("S");
- param.push_back("T");
-
- source.prepareToAppendValues();
-
- for (i = 0; i < totfaces; i++) {
- MFace *f = &mfaces[i];
+
+ if (!this->export_settings->active_uv_only || a == active_uv_index) {
+ MTFace *tface = (MTFace *)CustomData_get_layer_n(&me->fdata, CD_MTFACE, a);
+ // char *name = CustomData_get_layer_name(&me->fdata, CD_MTFACE, a);
- for (int j = 0; j < (f->v4 == 0 ? 3 : 4); j++) {
- source.appendValues(tface[i].uv[j][0],
- tface[i].uv[j][1]);
+ COLLADASW::FloatSourceF source(mSW);
+ std::string layer_id = makeTexcoordSourceId(geom_id, map_index++);
+ source.setId(layer_id);
+ source.setArrayId(layer_id + ARRAY_ID_SUFFIX);
+
+ source.setAccessorCount(totuv);
+ source.setAccessorStride(2);
+ COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
+ param.push_back("S");
+ param.push_back("T");
+
+ source.prepareToAppendValues();
+
+ for (i = 0; i < totfaces; i++) {
+ MFace *f = &mfaces[i];
+
+ for (int j = 0; j < (f->v4 == 0 ? 3 : 4); j++) {
+ source.appendValues(tface[i].uv[j][0],
+ tface[i].uv[j][1]);
+ }
}
+
+ source.finish();
}
-
- source.finish();
}
}