[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21603] branches/soc-2009-chingachgook/ source/blender/collada/DocumentExporter.cpp: Previous commit didn' t fix the material issue, trying again.

Arystanbek Dyussenov arystan.d at gmail.com
Wed Jul 15 21:13:47 CEST 2009


Revision: 21603
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21603
Author:   kazanbas
Date:     2009-07-15 21:13:47 +0200 (Wed, 15 Jul 2009)

Log Message:
-----------
Previous commit didn't fix the material issue, trying again.

Modified Paths:
--------------
    branches/soc-2009-chingachgook/source/blender/collada/DocumentExporter.cpp

Modified: branches/soc-2009-chingachgook/source/blender/collada/DocumentExporter.cpp
===================================================================
--- branches/soc-2009-chingachgook/source/blender/collada/DocumentExporter.cpp	2009-07-15 18:59:49 UTC (rev 21602)
+++ branches/soc-2009-chingachgook/source/blender/collada/DocumentExporter.cpp	2009-07-15 19:13:47 UTC (rev 21603)
@@ -271,7 +271,9 @@
 		// XXX slow		
 		if (ob->totcol) {
 			for(int a = 0; a < ob->totcol; a++)	{
-				createPolylist(true, a, has_uvs, ob, dm, geom_name);
+				// account for NULL materials, this should not normally happen?
+				Material *ma = give_current_material(ob, a + 1);
+				createPolylist(ma != NULL, a, has_uvs, ob, dm, geom_name);
 			}
 		}
 		else {
@@ -598,21 +600,22 @@
 				
 				COLLADASW::BindMaterial& bm = instGeom.getBindMaterial();
 				COLLADASW::InstanceMaterialList& iml = bm.getInstanceMaterialList();
-				std::string matid(id_name(ma));
-				COLLADASW::InstanceMaterial im(matid, COLLADASW::URI
-											   (COLLADABU::Utils::EMPTY_STRING,
-												matid));
+
+				if (ma) {
+					std::string matid(id_name(ma));
+					COLLADASW::InstanceMaterial im(matid, COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, matid));
 				
-				// create <bind_vertex_input> for each uv layer
-				Mesh *me = (Mesh*)ob->data;
-				int totlayer = CustomData_number_of_layers(&me->fdata, CD_MTFACE);
+					// create <bind_vertex_input> for each uv layer
+					Mesh *me = (Mesh*)ob->data;
+					int totlayer = CustomData_number_of_layers(&me->fdata, CD_MTFACE);
 				
-				for (int b = 0; b < totlayer; b++) {
-					char *name = CustomData_get_layer_name(&me->fdata, CD_MTFACE, b);
-					im.push_back(COLLADASW::BindVertexInput(name, "TEXCOORD", b));
+					for (int b = 0; b < totlayer; b++) {
+						char *name = CustomData_get_layer_name(&me->fdata, CD_MTFACE, b);
+						im.push_back(COLLADASW::BindVertexInput(name, "TEXCOORD", b));
+					}
+				
+					iml.push_back(im);
 				}
-				
-				iml.push_back(im);
 			}
 			
 			instGeom.add();





More information about the Bf-blender-cvs mailing list