mirror of
https://github.com/CapsAdmin/pac3.git
synced 2025-03-04 03:03:01 -05:00
make "free children" actually work
since it was erroring most of the time. not sure why it's aborting early, but it works somewhat
This commit is contained in:
parent
7ff355c47c
commit
f9bbbb8606
@ -301,17 +301,29 @@ pace.AddTool(L"scale this and children", function(part, suboption)
|
||||
end)
|
||||
|
||||
pace.AddTool(L"free children from part" ,function(part, suboption)
|
||||
if part:IsValid() then
|
||||
local grandparent = part:GetParent()
|
||||
local parent = part
|
||||
for _, child in ipairs(parent:GetChildren()) do
|
||||
child:SetAngles(child.Angles + parent.Angles)
|
||||
child:SetPosition(child.Position + parent.Position)
|
||||
child:SetAngleOffset(child.AngleOffset + parent.AngleOffset)
|
||||
child:SetPositionOffset(child.PositionOffset + parent.PositionOffset)
|
||||
child:SetParent(grandparent)
|
||||
end
|
||||
local children = part.Children
|
||||
if #children == 0 then
|
||||
Derma_Message(L"this part has no children...", L"free children from part", "ok")
|
||||
return
|
||||
end
|
||||
Derma_Query(L"this process cannot be undone, are you sure?", L"free children from part", L"yes", function()
|
||||
if part:IsValid() then
|
||||
local grandparent = part:GetParent()
|
||||
if grandparent == NULL then
|
||||
grandparent = part:GetRootPart()
|
||||
end
|
||||
local parent = part
|
||||
for _, child in ipairs(children) do
|
||||
if child.BaseName ~= "base" and parent.BaseName ~= "base" then
|
||||
child:SetAngles(child.Angles + parent.Angles)
|
||||
child:SetPosition(child.Position + parent.Position)
|
||||
child:SetAngleOffset(child.AngleOffset + parent.AngleOffset)
|
||||
child:SetPositionOffset(child.PositionOffset + parent.PositionOffset)
|
||||
end
|
||||
child:SetParent(grandparent)
|
||||
end
|
||||
end
|
||||
end, L"no", function() end)
|
||||
end)
|
||||
|
||||
pace.AddTool(L"square model scales...", function(part, suboption)
|
||||
@ -790,4 +802,4 @@ pace.AddTool(L"copy from faceposer tool", function(part, suboption)
|
||||
flex:SetWeight(weight)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
Loading…
Reference in New Issue
Block a user