#include "XmlExporter.h" #include #include #include "exporterTools.h" using std::string; using boost::property_tree::ptree; void XmlExporter::exportAnimation(const boost::filesystem::path& inputFilePath, const JoiningContinuousTimeline& animation, const ShapeSet& targetShapeSet, std::ostream& outputStream) { ptree tree; // Add metadata tree.put("rhubarbResult.metadata.soundFile", inputFilePath.string()); tree.put("rhubarbResult.metadata.duration", formatDuration(animation.getRange().getDuration())); // Add mouth cues for (auto& timedShape : dummyShapeIfEmpty(animation, targetShapeSet)) { ptree& mouthCueElement = tree.add("rhubarbResult.mouthCues.mouthCue", timedShape.getValue()); mouthCueElement.put(".start", formatDuration(timedShape.getStart())); mouthCueElement.put(".end", formatDuration(timedShape.getEnd())); } #if BOOST_VERSION < 105600 // Support legacy syntax using writer_setting = boost::property_tree::xml_writer_settings; #else using writer_setting = boost::property_tree::xml_writer_settings; #endif write_xml(outputStream, tree, writer_setting(' ', 2)); }