Fixed bug that caused models to fail to load when the instance is not named the same as the model

--HG--
extra : convert_revision : svn%3A7752d6cf-9f14-4ad2-affc-04f1e67b81a5/trunk%40180
This commit is contained in:
kearwood
2012-12-07 19:40:09 +00:00
parent 4bec4ee8b2
commit 4b28e36369

View File

@@ -165,7 +165,7 @@ KRNode *KRNode::LoadXML(KRScene &scene, tinyxml2::XMLElement *e) {
if(e->QueryBoolAttribute("faces_camera", &faces_camera) != tinyxml2::XML_SUCCESS) {
faces_camera = false;
}
new_node = new KRInstance(scene, szName, szName, e->Attribute("light_map"), lod_min_coverage, receives_shadow, faces_camera);
new_node = new KRInstance(scene, szName, e->Attribute("mesh_name"), e->Attribute("light_map"), lod_min_coverage, receives_shadow, faces_camera);
} else if(strcmp(szElementName, "bone") == 0) {
new_node = new KRBone(scene, szName);
}
@@ -257,42 +257,42 @@ void KRNode::SetAttribute(node_attribute_type attrib, float v)
{
const float DEGREES_TO_RAD = M_2_PI / 360.0f;
printf("%s - ", m_name.c_str());
//printf("%s - ", m_name.c_str());
switch(attrib) {
case KRENGINE_NODE_ATTRIBUTE_TRANSLATE_X:
printf("translate_x: %f\n", v);
//printf("translate_x: %f\n", v);
setLocalTranslation(KRVector3(v, m_localTranslation.y, m_localTranslation.z));
break;
case KRENGINE_NODE_ATTRIBUTE_TRANSLATE_Y:
printf("translate_y: %f\n", v);
//printf("translate_y: %f\n", v);
setLocalTranslation(KRVector3(m_localTranslation.x, v, m_localTranslation.z));
break;
case KRENGINE_NODE_ATTRIBUTE_TRANSLATE_Z:
printf("translate_z: %f\n", v);
//printf("translate_z: %f\n", v);
setLocalTranslation(KRVector3(m_localTranslation.x, m_localTranslation.y, v));
break;
case KRENGINE_NODE_ATTRIBUTE_SCALE_X:
printf("scale_x: %f\n", v);
//printf("scale_x: %f\n", v);
setLocalScale(KRVector3(v, m_localScale.y, m_localScale.z));
break;
case KRENGINE_NODE_ATTRIBUTE_SCALE_Y:
printf("scale_y: %f\n", v);
//printf("scale_y: %f\n", v);
setLocalScale(KRVector3(m_localScale.x, v, m_localScale.z));
break;
case KRENGINE_NODE_ATTRIBUTE_SCALE_Z:
printf("scale_z: %f\n", v);
//printf("scale_z: %f\n", v);
setLocalScale(KRVector3(m_localScale.x, m_localScale.y, v));
break;
case KRENGINE_NODE_ATTRIBUTE_ROTATE_X:
printf("rotate_x: %f\n", v);
//printf("rotate_x: %f\n", v);
setLocalRotation(KRVector3(v * DEGREES_TO_RAD, m_localRotation.y, m_localRotation.z));
break;
case KRENGINE_NODE_ATTRIBUTE_ROTATE_Y:
printf("rotate_y: %f\n", v);
//printf("rotate_y: %f\n", v);
setLocalRotation(KRVector3(m_localRotation.x, v * DEGREES_TO_RAD, m_localRotation.z));
break;
case KRENGINE_NODE_ATTRIBUTE_ROTATE_Z:
printf("rotate_z: %f\n", v);
//printf("rotate_z: %f\n", v);
setLocalRotation(KRVector3(m_localRotation.x, m_localRotation.y, v * DEGREES_TO_RAD));
break;
}