[Bf-blender-cvs] [c027be3189d] blender2.8: Fix broken collada from recent merge rBb83b6afe5572ae29b4ad105dd8001c3343e2205b.

Bastien Montagne noreply at git.blender.org
Thu Dec 14 20:26:27 CET 2017


Commit: c027be3189d22b691e72b90fbe7bbdbbcb6d75a9
Author: Bastien Montagne
Date:   Thu Dec 14 20:25:26 2017 +0100
Branches: blender2.8
https://developer.blender.org/rBc027be3189d22b691e72b90fbe7bbdbbcb6d75a9

Fix broken collada from recent merge rBb83b6afe5572ae29b4ad105dd8001c3343e2205b.

Please make minimal checks on what you do when merging!

===================================================================

M	source/blender/collada/GeometryExporter.cpp

===================================================================

diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp
index c0d3c947ac1..8dbee607b01 100644
--- a/source/blender/collada/GeometryExporter.cpp
+++ b/source/blender/collada/GeometryExporter.cpp
@@ -421,186 +421,6 @@ void GeometryExporter::createPolylist(short material_index,
 	polylist.finish();
 }
 
-void GeometryExporter::createPolylists(std::set<Image *> uv_images,
-	bool has_uvs,
-	bool has_color,
-	Object *ob,
-	Mesh *me,
-	std::string& geom_id,
-	std::vector<BCPolygonNormalsIndices>& norind)
-{
-	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 imageid(id_name(ima));
-		createPolylist(imageid, has_uvs,
-			has_color,
-			ob,
-			me,
-			geom_id,
-			norind);
-	}
-
-	/* We msut add an additional collector for the case when 
-	 * some parts of the object are not textured at all.
-	 * The next call creates a polylist for all untextured polygons
-	 */
-
-	createPolylist("", has_uvs,
-		has_color,
-		ob,
-		me,
-		geom_id,
-		norind);
-
-}
-
-/* ===========================================================================
- * Export Meshes with UV Textures (export as materials, see also in 
- * effectExporter and MaterialExporter)
- * 
- * If imageid is the empty string, then collect only untextured polygons
- * =========================================================================== */ 
-void GeometryExporter::createPolylist(std::string imageid,
-	bool has_uvs,
-	bool has_color,
-	Object *ob,
-	Mesh *me,
-	std::string& geom_id,
-	std::vector<BCPolygonNormalsIndices>& norind)
-{
-
-	MPoly *mpolys = me->mpoly;
-	MLoop *mloops = me->mloop;
-	MTexPoly *mtpolys = me->mtpoly;
-
-	int totpolys = me->totpoly;
-
-	// <vcount>
-	int i;
-	int faces_in_polylist = 0;
-	std::vector<unsigned long> vcount_list;
-	bool is_triangulated = true;
-	// count faces with this material
-	for (i = 0; i < totpolys; i++) {
-		MTexPoly *tp = &mtpolys[i];
-		MPoly *p = &mpolys[i];
-
-		std::string tpageid = (tp->tpage) ? id_name(tp->tpage):"";
-		if (tpageid == imageid) {
-			faces_in_polylist++;
-			vcount_list.push_back(p->totloop);
-			if (p->totloop != 3) {
-				is_triangulated = false;
-			}
-		}
-	}
-
-	// no faces using this imageid
-	if (faces_in_polylist == 0) {
-		if (imageid != "")
-			fprintf(stderr, "%s: Image %s is not used.\n", id_name(ob).c_str(), imageid.c_str());
-		return;
-	}
-
-	COLLADASW::PrimitivesBase *facelist = getFacelist(is_triangulated, mSW);
-
-	// sets count attribute in <polylist>
-	facelist->setCount(faces_in_polylist);
-
-	if (imageid != "") {
-		// sets material name
-		std::string material_id = get_material_id_from_id(imageid);
-		std::ostringstream ostr;
-		ostr << translate_id(material_id);
-		facelist->setMaterial(ostr.str());
-	}
-	COLLADASW::InputList &til = facelist->getInputList();
-
-	// creates <input> in <polylist> for vertices 
-	COLLADASW::Input input1(COLLADASW::InputSemantic::VERTEX, getUrlBySemantics(geom_id, COLLADASW::InputSemantic::VERTEX), 0);
-
-	// creates <input> in <polylist> for normals
-	COLLADASW::Input input2(COLLADASW::InputSemantic::NORMAL, getUrlBySemantics(geom_id, COLLADASW::InputSemantic::NORMAL), 1);
-
-	til.push_back(input1);
-	til.push_back(input2);
-
-	// if mesh has uv coords writes <input> for TEXCOORD
-	int num_layers = CustomData_number_of_layers(&me->fdata, CD_MTFACE);
-	int active_uv_index = CustomData_get_active_layer_index(&me->fdata, CD_MTFACE) - 1;
-	for (i = 0; i < num_layers; i++) {
-		if (!this->export_settings->active_uv_only || i == active_uv_index) {
-
-			std::string uv_name(bc_get_uvlayer_name(me, i));
-			std::string effective_id = geom_id; // (uv_name == "") ? geom_id : uv_name;
-			std::string layer_id = makeTexcoordSourceId(
-				effective_id,
-				i, this->export_settings->active_uv_only);
-
-			/* Note: the third parameter denotes the offset of TEXCOORD in polylist elements
-			For now this is always 2 (This may change sometime/maybe)
-			*/
-			COLLADASW::Input input3(COLLADASW::InputSemantic::TEXCOORD,
-				makeUrl(layer_id),
-				2, // this is only until we have optimized UV sets
-				(this->export_settings->active_uv_only) ? 0 : i  // only_active_uv exported -> we have only one set
-				);
-			til.push_back(input3);
-		}
-	}
-
-	int totlayer_mcol = CustomData_number_of_layers(&me->ldata, CD_MLOOPCOL);
-	if (totlayer_mcol > 0) {
-		int map_index = 0;
-
-		for (int a = 0; a < totlayer_mcol; a++) {
-			char *layer_name = bc_CustomData_get_layer_name(&me->ldata, CD_MLOOPCOL, a);
-			COLLADASW::Input input4(COLLADASW::InputSemantic::COLOR,
-				makeUrl(makeVertexColorSourceId(geom_id, layer_name)),
-				(has_uvs) ? 3 : 2,  // all color layers have same index order
-				map_index           // set number equals color map index
-				);
-			til.push_back(input4);
-			map_index++;
-		}
-	}
-
-	// performs the actual writing
-	prepareToAppendValues(is_triangulated, facelist, vcount_list);
-
-	// <p>
-	int texindex = 0;
-	for (i = 0; i < totpolys; i++) {
-		MTexPoly *tp = &mtpolys[i];
-		MPoly *p = &mpolys[i];
-		int loop_count = p->totloop;
-		std::string tpageid = (tp->tpage) ? id_name(tp->tpage) : "";
-		if (tpageid == imageid) {
-			MLoop *l = &mloops[p->loopstart];
-			BCPolygonNormalsIndices normal_indices = norind[i];
-
-			for (int j = 0; j < loop_count; j++) {
-				facelist->appendValues(l[j].v);
-				facelist->appendValues(normal_indices[j]);
-				if (has_uvs)
-					facelist->appendValues(texindex + j);
-
-				if (has_color)
-					facelist->appendValues(texindex + j);
-			}
-		}
-
-		texindex += loop_count;
-	}
-
-	finishList(is_triangulated, facelist);
-	delete facelist;
-}
-
 // creates <source> for positions
 void GeometryExporter::createVertsSource(std::string geom_id, Mesh *me)
 {



More information about the Bf-blender-cvs mailing list