Josh Posted Friday at 09:44 PM Posted Friday at 09:44 PM Just copy and paste this code into the console: local file = RequestFile("Open File") if file ~= "" then local mdl = LoadModel(nil, file) if mdl ~= nil then for n = 1, #mdl.kids do local child = Model(mdl.kids[n]) if child ~= nil then child:SetPosition(0,0,0) child:Save(StripExt(file) .. "_limb" .. tostring(n) .. ".mdl") end end end end Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Josh Posted Sunday at 02:40 AM Author Posted Sunday at 02:40 AM Sometimes models will have one or two extra nodes in the hierarchy, in which case you can use this. Adjust as needed: local file = RequestFile("Open File") if file ~= "" then local mdl = LoadModel(nil, file) if mdl ~= nil then mdl = mdl.kids[1]--[[ one level deep ]] mdl = mdl.kids[1]--[[ two levels deep ]] for n = 1, #mdl.kids do local child = Model(mdl.kids[n]) if child ~= nil then child:SetPosition(0,0,0) child:Save(StripExt(file) .. "_limb" .. tostring(n) .. ".mdl") end end end end Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Josh Posted Sunday at 02:42 AM Author Posted Sunday at 02:42 AM Or if you want to use the limb names as the new file names, use this: local file = RequestFile("Open File") if file ~= "" then local mdl = LoadModel(nil, file) if mdl ~= nil then mdl = mdl.kids[1]--[[ one level deep ]] mdl = mdl.kids[1]--[[ two levels deep ]] for n = 1, #mdl.kids do local child = Model(mdl.kids[n]) if child ~= nil then child:SetPosition(0,0,0) child:Save(ExtractDir(file) .. "/" .. child.name .. ".mdl") end end end end Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.