Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function round(num, idp)
- local mult = 10^(idp or 3)
- return math.floor(num * mult + 0.5) / mult
- end
- function ConvertCFrame(cf, degrees)
- local str = ""
- if round(cf.X) ~= 0 or round(cf.Y) ~= 0 or round(cf.Z) ~= 0 then
- str = ("%s,%s,%s,"):format(round(cf.X), round(cf.Y), round(cf.Z))
- else
- str = "0,0,0,"
- end
- local x, y, z = cf:toEulerAnglesXYZ()
- x, y, z = round(x), round(y), round(z)
- --
- if x ~= 0 or y ~= 0 or z ~= 0 then
- local function AddAngle(n, comma)
- str = str..(n == 0 and n or round(math.deg(n))) .. ','
- end
- AddAngle(x, true)
- AddAngle(y, true)
- AddAngle(z)
- end
- --
- return str
- end
- function SequenceToModule(sequence,p)
- if sequence and sequence:IsA("KeyframeSequence") then
- local source = "\n" .. sequence.Name.."={"
- local function AddLine(text, depth)
- source = source.."\n"..string.rep(" ", depth or 0)..text
- --source = source.."\n"..text
- end
- AddLine("Properties={", 1)
- AddLine("Looping="..tostring(sequence.Loop)..",", 2)
- AddLine("Priority='"..tostring(sequence.Priority.Name).."'", 2)
- AddLine("},", 1)
- AddLine("Keyframes={", 1)
- local function GetPoses(start, depth)
- local depth = depth or 2
- local hidden --= (start.Name == "HumanoidRootPart")
- if hidden then
- depth = depth - 1
- end
- if start:IsA("Pose") and not hidden then
- AddLine('["'..start.Name..'"]={', depth)
- if start.Weight > 0 and ConvertCFrame(start.CFrame, true) then
- AddLine("CF={"..ConvertCFrame(start.CFrame, true).."},", depth + 1)
- if start.EasingDirection.Name ~= Enum.EasingDirection.In.Name then
- AddLine("ED='"..start.EasingDirection.Name.."',", depth + 1)
- end
- if start.EasingStyle.Name ~= Enum.EasingStyle.Linear.Name then
- AddLine("ES='"..start.EasingStyle.Name.."',", depth + 1)
- end
- end
- elseif start:IsA("KeyframeMarker") then
- AddLine('["'..start.Name..'"]={', depth)
- AddLine("Marker="..tostring(true), depth + 1)
- else
- hidden = true
- end
- for _, v in pairs(start:GetChildren()) do
- GetPoses(v, depth + 1)
- end
- if not hidden then
- AddLine('},', depth)
- end
- end
- local added_time = {}
- for _, v in pairs(sequence:GetChildren()) do
- if v:IsA("Keyframe") then
- added_time[v.Time] = 1
- AddLine("['"..round(v.Time).."']={", 2)
- if v.Name ~= 'Keyframe' then
- AddLine("Name='"..v.Name.."',", 3)
- end
- GetPoses(v)
- AddLine("},", 2)
- end
- end
- AddLine("}\n},", 1)
- return source
- end
- end
- local t = ''
- workspace.anims.Folder:ClearAllChildren()
- for i,v in pairs(workspace.anims:GetChildren()) do
- local s = SequenceToModule(v,v.Parent.Folder)
- if s then
- t = t .. s
- end
- end
- t = 'return {' .. t .. '}'
- function add(text,par,asd)
- local modules = {}
- local t = text
- if asd then
- print(#t)
- end
- if #t < 200000 then
- local sourcefile = Instance.new("ModuleScript", par or workspace.anims.Folder)
- sourcefile.Source = t
- sourcefile.Name = "Source"
- table.insert(modules,sourcefile)
- else
- local p = 1
- local c = 1
- repeat
- local sourcefile = Instance.new("ModuleScript", par or workspace.anims.Folder)
- sourcefile.Source = t:sub(p,p+199998)
- sourcefile.Name = "Source" .. c
- table.insert(modules,sourcefile)
- p += 199999
- c += 1
- wait(0.1)
- until p > #t
- end
- warn(#t)
- return modules
- end
- local mods = add(t)
- t = ''
- wait(0.1)
- for i,v in pairs(mods) do
- local data = require(v)
- t = t .. game:GetService("HttpService"):JSONEncode(data)
- v:Destroy()
- wait(0.1)
- end
- add(t,nil,true)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement