the importer now produces much more readable XML output

metadata
Wenzel Jakob 2010-11-22 08:29:55 +01:00
parent 721e922659
commit 804c7ca718
3 changed files with 15 additions and 2 deletions

View File

@ -181,7 +181,7 @@ class MtsAdjustments:
lamp = obj.data.materials[0].mitsuba_emission
name = translate_id(obj.data.name)
self.out.write('\t<append id="%s-mesh_0">\n' % name)
self.out.write('\t\t<luminaire type="area">\n')
self.out.write('\t\t<luminaire id="%s-emission" type="area">\n' % name)
mult = lamp.intensity
self.out.write('\t\t\t<rgb name="intensity" value="%f %f %f"/>\n'
% (lamp.color.r*mult, lamp.color.g*mult, lamp.color.b*mult))

View File

@ -82,6 +82,18 @@ void createNodeMap(DOMNode *node, std::map<std::string, DOMNode *> &nodes) {
}
}
void cleanup(DOMNode *node) {
DOMNode *child = node->getFirstChild();
while (child) {
DOMNode *next = child->getNextSibling();
if (child->getNodeType() == DOMNode::TEXT_NODE)
node->removeChild(child);
else
cleanup(child);
child = next;
}
}
void GeometryConverter::convert(const fs::path &inputFile,
const fs::path &outputDirectory,
const fs::path &sceneName,
@ -212,6 +224,7 @@ void GeometryConverter::convert(const fs::path &inputFile,
XMLString::release(&nodeName);
}
}
cleanup(doc);
DOMLSSerializer *serializer = impl->createLSSerializer();
DOMConfiguration *serConf = serializer->getDomConfig();

View File

@ -38,7 +38,7 @@ public:
/// When the file contains multiple meshes, this index specifies which one to load
int shapeIndex = props.getInteger("shapeIndex", 0);
m_name = filePath.stem();
m_name = (props.getID() != "unnamed") ? props.getID() : formatString("%s@%i", filePath.stem().c_str(), shapeIndex);
/* Load the geometry */
Log(EInfo, "Loading shape %i from \"%s\" ..", shapeIndex, filePath.leaf().c_str());