the importer now produces much more readable XML output
parent
721e922659
commit
804c7ca718
|
@ -181,7 +181,7 @@ class MtsAdjustments:
|
||||||
lamp = obj.data.materials[0].mitsuba_emission
|
lamp = obj.data.materials[0].mitsuba_emission
|
||||||
name = translate_id(obj.data.name)
|
name = translate_id(obj.data.name)
|
||||||
self.out.write('\t<append id="%s-mesh_0">\n' % 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
|
mult = lamp.intensity
|
||||||
self.out.write('\t\t\t<rgb name="intensity" value="%f %f %f"/>\n'
|
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))
|
% (lamp.color.r*mult, lamp.color.g*mult, lamp.color.b*mult))
|
||||||
|
|
|
@ -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,
|
void GeometryConverter::convert(const fs::path &inputFile,
|
||||||
const fs::path &outputDirectory,
|
const fs::path &outputDirectory,
|
||||||
const fs::path &sceneName,
|
const fs::path &sceneName,
|
||||||
|
@ -212,6 +224,7 @@ void GeometryConverter::convert(const fs::path &inputFile,
|
||||||
XMLString::release(&nodeName);
|
XMLString::release(&nodeName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cleanup(doc);
|
||||||
|
|
||||||
DOMLSSerializer *serializer = impl->createLSSerializer();
|
DOMLSSerializer *serializer = impl->createLSSerializer();
|
||||||
DOMConfiguration *serConf = serializer->getDomConfig();
|
DOMConfiguration *serConf = serializer->getDomConfig();
|
||||||
|
|
|
@ -38,7 +38,7 @@ public:
|
||||||
/// When the file contains multiple meshes, this index specifies which one to load
|
/// When the file contains multiple meshes, this index specifies which one to load
|
||||||
int shapeIndex = props.getInteger("shapeIndex", 0);
|
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 */
|
/* Load the geometry */
|
||||||
Log(EInfo, "Loading shape %i from \"%s\" ..", shapeIndex, filePath.leaf().c_str());
|
Log(EInfo, "Loading shape %i from \"%s\" ..", shapeIndex, filePath.leaf().c_str());
|
||||||
|
|
Loading…
Reference in New Issue