From e21207784a6c5df27747c54cdd3662cbb25bc35e Mon Sep 17 00:00:00 2001 From: Artur Morozov Date: Mon, 4 Mar 2019 15:54:31 +0300 Subject: [PATCH] api: update StripTextures add layer argument fix hide argument --- api/ui-widgets.lua | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/api/ui-widgets.lua b/api/ui-widgets.lua index e27180fb..b7b22f5d 100644 --- a/api/ui-widgets.lua +++ b/api/ui-widgets.lua @@ -391,13 +391,20 @@ end -- [ StripTextures ] -- Strips all textures off a frame. --- 'frame' [frame] the frame that should be stripped. -function pfUI.api.StripTextures(frame, hide) - for i,v in ipairs({frame:GetRegions()}) do +-- 'frame' [frame] the frame that should be stripped. +-- 'layer' [string] texture layer. +function pfUI.api.StripTextures(frame, hide, layer) + for _,v in ipairs({frame:GetRegions()}) do if v.SetTexture then - v:SetTexture(nil) - if hide then - v:Hide() + local check = true + if layer and v:GetDrawLayer() ~= layer then check = false end + + if check then + if hide then + v:Hide() + else + v:SetTexture(nil) + end end end end