Fix [#26475] <instance_material> wrong in COLLADA export.

reported by Juan Linietsky
fix by Imran Syed (freakabcd)

Use material index suffixed to material name to create symbolic name.
This commit is contained in:
Nathan Letwory 2011-03-22 22:51:02 +00:00
parent 60b94886c8
commit de89e78589
2 changed files with 9 additions and 2 deletions

@ -28,6 +28,8 @@
*/
#include <sstream>
#include "COLLADASWPrimitves.h"
#include "COLLADASWSource.h"
#include "COLLADASWVertices.h"
@ -167,7 +169,9 @@ void GeometryExporter::createPolylist(int material_index,
// sets material name
if (ma) {
polylist.setMaterial(translate_id(id_name(ma)));
std::ostringstream ostr;
ostr << translate_id(id_name(ma)) << material_index+1;
polylist.setMaterial(ostr.str());
}
COLLADASW::InputList &til = polylist.getInputList();

@ -29,6 +29,7 @@
#include <string>
#include <sstream>
#include "COLLADASWInstanceMaterial.h"
@ -52,7 +53,9 @@ void InstanceWriter::add_material_bindings(COLLADASW::BindMaterial& bind_materia
if (ma) {
std::string matid(get_material_id(ma));
matid = translate_id(matid);
COLLADASW::InstanceMaterial im(matid, COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, matid));
std::ostringstream ostr;
ostr << translate_id(id_name(ma)) << a+1;
COLLADASW::InstanceMaterial im(ostr.str(), COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, matid));
// create <bind_vertex_input> for each uv layer
Mesh *me = (Mesh*)ob->data;