fix:T58093 Collada Exporter does not create bind_vertex_input and texcoord attribute
authorGaia Clary <gaia.clary@machinimatrix.org>
Wed, 28 Nov 2018 14:27:11 +0000 (15:27 +0100)
committerGaia Clary <gaia.clary@machinimatrix.org>
Wed, 28 Nov 2018 14:36:09 +0000 (15:36 +0100)
The Collada exporter used MTFACE layers (deprecated) instead of
CD_MLOOPUV layers. In 2.8 the exporter could no longer find the UVMaps
reliably.

source/blender/collada/InstanceWriter.cpp

index 68842596550fde6eee9d66194943e041f46945d5..0c0b1a1565360df2a165046458b2a4ea8ce84f01 100644 (file)
@@ -57,13 +57,14 @@ void InstanceWriter::add_material_bindings(COLLADASW::BindMaterial& bind_materia
 
                        // create <bind_vertex_input> for each uv map
                        Mesh *me = (Mesh *)ob->data;
-                       int totlayer = CustomData_number_of_layers(&me->fdata, CD_MTFACE);
+
+                       int num_layers = CustomData_number_of_layers(&me->ldata, CD_MLOOPUV);
 
                        int map_index = 0;
-                       int active_uv_index = CustomData_get_active_layer_index(&me->fdata, CD_MTFACE) -1;
-                       for (int b = 0; b < totlayer; b++) {
+                       int active_uv_index = CustomData_get_active_layer_index(&me->ldata, CD_MLOOPUV);
+                       for (int b = 0; b < num_layers; b++) {
                                if (!active_uv_only || b == active_uv_index) {
-                                       char *name = bc_CustomData_get_layer_name(&me->fdata, CD_MTFACE, b);
+                                       char *name = bc_CustomData_get_layer_name(&me->ldata, CD_MLOOPUV, b);
                                        im.push_back(COLLADASW::BindVertexInput(name, "TEXCOORD", map_index++));
                                }
                        }