From ce62053b9ca782ee80cac80d695b81bfb4440222 Mon Sep 17 00:00:00 2001 From: cignoni Date: Mon, 21 Jul 2008 13:25:32 +0000 Subject: [PATCH] Added correct management of binding material in controller nodes --- wrap/io_trimesh/import_dae.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/wrap/io_trimesh/import_dae.h b/wrap/io_trimesh/import_dae.h index 38dc1c60..4c23a702 100644 --- a/wrap/io_trimesh/import_dae.h +++ b/wrap/io_trimesh/import_dae.h @@ -248,7 +248,7 @@ namespace io { return E_NOERROR; } - static int LoadControllerMesh(OpenMeshType& m, InfoDAE* info, const QDomElement& geo, CallBackPos *cb=0) + static int LoadControllerMesh(OpenMeshType& m, InfoDAE* info, const QDomElement& geo,QMap materialBindingMap, CallBackPos *cb=0) { assert(geo.tagName() == "controller"); QDomNodeList skinList = geo.toElement().elementsByTagName("skin"); @@ -261,7 +261,6 @@ namespace io { QDomNode refNode = findNodeBySpecificAttributeValue(*(info->doc),"geometry","id",geomNode_url); QDomNodeList bindingNodes = skinNode.toElement().elementsByTagName("bind_material"); - QMap materialBindingMap; if( bindingNodes.size()>0) { QDEBUG("** skin node of a controller has a material binding"); GenerateMaterialBinding(skinNode,materialBindingMap); @@ -450,8 +449,16 @@ namespace io { QDEBUG("Found a instance_controller with url '%s'", qPrintable(controllerNode_url)); QDomNode refNode = findNodeBySpecificAttributeValue(*(info->doc),"controller","id",controllerNode_url); + QDomNodeList bindingNodes = instContrNode.toElement().elementsByTagName("bind_material"); + QMap materialBindingMap; + if( bindingNodes.size()>0) { + QDEBUG("** instance_controller node of has a material binding"); + GenerateMaterialBinding(instContrNode,materialBindingMap); + } + OpenMeshType newMesh; - LoadControllerMesh(newMesh, info, refNode.toElement()); + newMesh.face.EnableWedgeTex(); + LoadControllerMesh(newMesh, info, refNode.toElement(),materialBindingMap); tri::UpdatePosition::Matrix(newMesh,curTr); tri::Append::Mesh(m,newMesh); }