Prevent multiple clip parts calling SetupBones on the same model

This commit is contained in:
TW1STaL1CKY 2025-02-16 20:40:57 +00:00
parent 4e8eb09f16
commit 4d8e6d8c99

View File

@ -42,7 +42,11 @@ do
-- this fixes clip planes lagging behind when parented to a bone on a model part
local owner = self:GetParentOwner()
if owner:IsValid() and owner.PACPart then
if owner:IsValid() and not owner.pac_clip_bonessetup and owner.PACPart then
-- in case there are multiple clips on one model part, only the first one needs to call SetupBones
self.pac_clip_owner = owner
owner.pac_clip_bonessetup = true
pac.SetupBones(owner)
end
@ -55,6 +59,11 @@ do
local render_PopCustomClipPlane = render.PopCustomClipPlane
function PART:PostOnDraw()
if self.pac_clip_owner then
self.pac_clip_owner.pac_clip_bonessetup = nil
self.pac_clip_owner = nil
end
render_PopCustomClipPlane()
render_EnableClipping(bclip)