fn saveMapping nodeNameArray = ( if nodeNameArray.count > 0 then ( output_name = getSaveFileName caption:"XMM output file" types:"XMM (*.xmm)|*.xmm|All Files (*.*)|*.*|" if output_name != undefined then ( objArray = #() for nam in nodeNameArray do ( obj = getNodeByName nam if obj != undefined then ( append objArray obj ) else ( format ("Couldn't find object called "+nam+"\n") ) ) if objArray.count > 0 do ( output_file = createfile output_name format (""+"\n") to:output_file format ("\t"+""+"\n") to:output_file for obj in objArray do ( -- l1 = ("\t"+""+"\n") -- l2 = ("\t"+""+"\n") -- l3 = ("\t"+""+"\n") -- l4 = ("\t"+""+"\n") -- -- l5 = ("\t"+""+"\n") -- l6 = ("\t"+""+"\n") -- l7 = ("\t"+""+"\n") -- l8 = ("\t"+""+"\n") -- l9 = ("\t"+""+"\n") -- l10= ("\t"+""+"\n") -- format (l1+l2+l3+l4+l5+l6+l7+l8+l9+l10) to:output_file l1 = ("\t"+""+"\n") l2 = ("\t"+""+"\n") format (l1+l2) to:output_file ) format (""+"\n") to:output_file flush output_file close output_file format ("XMM File saved to "+output_name+"\n") ) ) else ( format ("XMM Output file was undefind.\n") ) ) else ( format ("Please select objects to generate mapping for\n") messagebox ("No objects selected. Aborting.") beep:true ) ) fn saveControllers nodeNameArray = ( if nodeNameArray.count > 0 do ( local startParse = timestamp() local output_name = getSaveFileName caption:"XMM output file" types:"XMM (*.xmm)|*.xmm|All Files (*.*)|*.*|" if output_name != undefined then ( local output_file = createfile output_name format ("beginning output\n") format (""+"\n") to:output_file format ("\t"+""+"\n") to:output_file local mainStr = "" for obj in nodeNameArray do ( try( if heapFree < 10000000 do ( heapSize += 100000000 format ("incremented heapSize to "+(heapSize as string)+"\n") ) )catch (Format "Couldnt increase heapsize") -- format ("\t"+""+"\n") to:output_file -- format ("\t\n") to:output_file mainStr = (mainStr+("\t\n")) ) if mainStr != "" do ( format mainStr to:output_file ) format (""+"\n") to:output_file flush output_file close output_file format ("XMM File saved to "+output_name+"\n") endParse = timestamp() format ("Parsing took % seconds\n") ((endParse - startParse) / 1000.0) ) ) ) fn parseXafToFindMapping = ( selectedAnim = undefined if selectedAnim == undefined do ( selectedAnim = getOpenFileName caption:"Pose Animation" types:"Pose Anima (*.xaf)|*.xaf|All Files (*.*)|*.*|" ) if selectedAnim != undefined do ( xmlDoc = XmlDocument() xmlDoc.init() xmlDoc.load selectedAnim local xmlRoot = xmlDoc.document.DocumentElement local startParse = timestamp() -- Parse the XML heapsize = heapsize * 2 local rootNodeElement = xmlRoot.childnodes --print "Beginning Normal XML Parse..." local endParse = timestamp() format ("Parsing childnodes took % seconds\n") ((endParse - startParse) / 1000.0) local nodeNameArray = #() startParse = timestamp() --try and set a big heapsize local one = 1000000 local gig = one * 1000 local elevenGig = gig * 11 -- heapsize = elevenGig rnc = (rootNodeElement.Count - 1 ) for i = 0 to rnc do ( local rootElement = rootNodeElement.itemof(i) try( if heapFree < 10000000 do ( heapSize += 100000000 format ("incremented heapSize to "+(heapSize as string)+"\n") ) )catch (Format "Couldnt increase heapsize") if rootElement.name == "Node" then ( --ok we now need to find a child called Object local childNodeElement = rootElement.childNodes --format ("Parsing "+(childNodeElement.count as string)+" child nodes..."+"\n") local cne = (childNodeElement.count - 1) for obj = 0 to cne do ( local childElement = childNodeElement.itemof(obj) --local thisData = exprCreationData() if childElement.name == "Controller" do ( local cont = childElement.getAttribute "name" if cont != undefined do ( appendIfUnique nodeNameArray cont ) ) ) ) else ( format ("rootElement.name: "+(rootElement.name)+"\n") ) ) format ("nodeNameArray.count: "+(nodeNameArray.count as string)+"\n") -- saveMapping nodeNameArray local endParse = timestamp() format ("Parsing took % seconds\n") ((endParse - startParse) / 1000.0) saveControllers nodeNameArray ) ) parseXafToFindMapping()