export = {}; -- create a new export object -- return label function export:label() return "Pamela"; end -- return category function export:category() return "2D"; end -- return argument list function export:options() groups = {}; for a,actor in magpie.getactors() do for g,group in magpie.getgroups(actor) do table.insert(groups, group); end end return { {"group", "Group", "choice", table.concat(groups, "|")}, {"moho_output_file", "Output File", "output_file", "Pamela files (*.pam)\tAll files (*.*)"} }; end -- perform the export function export:run(from, to, options) -- create an array of all the poses that are being exported poses = magpie.getposes(options.group); -- open output file fd = io.open(options.moho_output_file, "wt"); if (fd == nil) then return string.format("could not open '%s'", options.moho_output_file); end -- write header line to file fd:write("[speech]\n"); -- write data to file oldk = ""; for frame = from, to do k = magpie.getgroupvalue(frame, options.group); if (k ~= nil and oldk ~= k) then fd:write(math.floor(frame*360/magpie.getframerate()) .. ":" .. string.gsub(k, "[^%.]+%.", "") .. "\n"); end oldk = k; -- update progress bar in main window magpie.progress("Exporting...", (frame - from) / (to - from)); end fd:write("\n"); fd:write("\n"); magpie.progress("", 0); -- close progress bar fd:close(); -- close output file end