MCPcopy Create free account
hub / github.com/OGRECave/ogre / exportSkeleton

Method exportSkeleton

Tools/XMLConverter/src/OgreXMLSkeletonSerializer.cpp:387–444  ·  view source on GitHub ↗

---------------------------------------------------------------------

Source from the content-addressed store, hash-verified

385
386 //---------------------------------------------------------------------
387 void XMLSkeletonSerializer::exportSkeleton(const Skeleton* pSkeleton,
388 const String& filename)
389 {
390
391 LogManager::getSingleton().logMessage("XMLSkeletonSerializer writing "
392 " skeleton data to " + filename + "...");
393
394 pugi::xml_document mXMLDoc;
395 pugi::xml_node rootNode = mXMLDoc.append_child("skeleton");
396
397 LogManager::getSingleton().logMessage("Populating DOM...");
398
399
400 // Write main skeleton data
401 LogManager::getSingleton().logMessage("Exporting bones..");
402 writeSkeleton(pSkeleton, rootNode);
403 LogManager::getSingleton().logMessage("Bones exported.");
404
405 // Write all animations
406 unsigned short numAnims = pSkeleton->getNumAnimations();
407 String msg = "Exporting animations, count=" + StringConverter::toString(numAnims);
408 LogManager::getSingleton().logMessage(msg);
409
410 pugi::xml_node animsNode = rootNode.append_child("animations");
411
412 for (unsigned short i = 0; i < numAnims; ++i)
413 {
414 Animation* pAnim = pSkeleton->getAnimation(i);
415 msg = "Exporting animation: " + pAnim->getName();
416 LogManager::getSingleton().logMessage(msg);
417 writeAnimation(animsNode, pAnim);
418 LogManager::getSingleton().logMessage("Animation exported.");
419
420 }
421
422 // Write links
423 if (!pSkeleton->getLinkedSkeletonAnimationSources().empty())
424 {
425 LogManager::getSingleton().logMessage("Exporting animation links.");
426 pugi::xml_node linksNode = rootNode.append_child("animationlinks");
427 for(const auto& link : pSkeleton->getLinkedSkeletonAnimationSources())
428 {
429 writeSkeletonAnimationLink(linksNode, link);
430 }
431 }
432
433 LogManager::getSingleton().logMessage("DOM populated, writing XML file..");
434
435 // Write out to a file
436 if(! mXMLDoc.save_file(filename.c_str()) )
437 {
438 LogManager::getSingleton().logMessage("XMLSkeletonSerializer failed writing the XML file.", LML_CRITICAL);
439 }
440 else
441 {
442 LogManager::getSingleton().logMessage("XMLSkeletonSerializer export successful.");
443 }
444 }

Callers 10

TEST_FFunction · 0.45
XMLToBinaryFunction · 0.45
skeletonToXMLFunction · 0.45
OnOgreMeshExportMenuFunction · 0.45
exportBonesMethod · 0.45
writeOgreBinaryMethod · 0.45
doExportSkeletonMethod · 0.45
mainFunction · 0.45

Calls 6

toStringFunction · 0.50
logMessageMethod · 0.45
getNumAnimationsMethod · 0.45
getAnimationMethod · 0.45
getNameMethod · 0.45
emptyMethod · 0.45

Tested by 1

TEST_FFunction · 0.36