inner shadow
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
## Title: Guda
|
## Title: Guda
|
||||||
## Notes: All-in-one bag and bank addon for World of Warcraft 1.12.1 (Turtle WoW)
|
## Notes: All-in-one bag and bank addon for World of Warcraft 1.12.1 (Turtle WoW)
|
||||||
## Author: Vati
|
## Author: Vati
|
||||||
## Version: 2.0.2
|
## Version: 2.0.3
|
||||||
## SavedVariables: Guda_DB
|
## SavedVariables: Guda_DB
|
||||||
## SavedVariablesPerCharacter: Guda_CharDB
|
## SavedVariablesPerCharacter: Guda_CharDB
|
||||||
|
|
||||||
|
|||||||
+23
-11
@@ -308,37 +308,39 @@ end
|
|||||||
-- Inner Shadow (inset quality glow, GudaBags-inspired)
|
-- Inner Shadow (inset quality glow, GudaBags-inspired)
|
||||||
-- 4 gradient textures along edges colored by item quality
|
-- 4 gradient textures along edges colored by item quality
|
||||||
--=====================================================
|
--=====================================================
|
||||||
local INNER_SHADOW_SIZE = 4
|
local INNER_SHADOW_SIZE = 3
|
||||||
local INNER_SHADOW_ALPHA = 0.5
|
local INNER_SHADOW_ALPHA = 0.5
|
||||||
|
local INNER_SHADOW_INSET = 2 -- Pixels inset from icon edge so glow stays inside the slot
|
||||||
|
|
||||||
-- Create the 4-edge inner shadow textures on a button, anchored to an icon texture
|
-- Create the 4-edge inner shadow textures on a button, anchored to an icon texture
|
||||||
local function CreateInnerShadow(button, anchorTo)
|
local function CreateInnerShadow(button, anchorTo)
|
||||||
local shadow = {}
|
local shadow = {}
|
||||||
|
local inset = INNER_SHADOW_INSET
|
||||||
-- Top edge
|
-- Top edge
|
||||||
shadow.top = button:CreateTexture(nil, "ARTWORK", nil, 1)
|
shadow.top = button:CreateTexture(nil, "ARTWORK", nil, 1)
|
||||||
shadow.top:SetPoint("TOPLEFT", anchorTo, "TOPLEFT", 0, 0)
|
shadow.top:SetPoint("TOPLEFT", anchorTo, "TOPLEFT", inset, -inset)
|
||||||
shadow.top:SetPoint("TOPRIGHT", anchorTo, "TOPRIGHT", 0, 0)
|
shadow.top:SetPoint("TOPRIGHT", anchorTo, "TOPRIGHT", -inset, -inset)
|
||||||
shadow.top:SetHeight(INNER_SHADOW_SIZE)
|
shadow.top:SetHeight(INNER_SHADOW_SIZE)
|
||||||
shadow.top:SetTexture("Interface\\ChatFrame\\ChatFrameBackground")
|
shadow.top:SetTexture("Interface\\ChatFrame\\ChatFrameBackground")
|
||||||
shadow.top:Hide()
|
shadow.top:Hide()
|
||||||
-- Bottom edge
|
-- Bottom edge
|
||||||
shadow.bottom = button:CreateTexture(nil, "ARTWORK", nil, 1)
|
shadow.bottom = button:CreateTexture(nil, "ARTWORK", nil, 1)
|
||||||
shadow.bottom:SetPoint("BOTTOMLEFT", anchorTo, "BOTTOMLEFT", 0, 0)
|
shadow.bottom:SetPoint("BOTTOMLEFT", anchorTo, "BOTTOMLEFT", inset, inset)
|
||||||
shadow.bottom:SetPoint("BOTTOMRIGHT", anchorTo, "BOTTOMRIGHT", 0, 0)
|
shadow.bottom:SetPoint("BOTTOMRIGHT", anchorTo, "BOTTOMRIGHT", -inset, inset)
|
||||||
shadow.bottom:SetHeight(INNER_SHADOW_SIZE)
|
shadow.bottom:SetHeight(INNER_SHADOW_SIZE)
|
||||||
shadow.bottom:SetTexture("Interface\\ChatFrame\\ChatFrameBackground")
|
shadow.bottom:SetTexture("Interface\\ChatFrame\\ChatFrameBackground")
|
||||||
shadow.bottom:Hide()
|
shadow.bottom:Hide()
|
||||||
-- Left edge
|
-- Left edge
|
||||||
shadow.left = button:CreateTexture(nil, "ARTWORK", nil, 1)
|
shadow.left = button:CreateTexture(nil, "ARTWORK", nil, 1)
|
||||||
shadow.left:SetPoint("TOPLEFT", anchorTo, "TOPLEFT", 0, 0)
|
shadow.left:SetPoint("TOPLEFT", anchorTo, "TOPLEFT", inset, -inset)
|
||||||
shadow.left:SetPoint("BOTTOMLEFT", anchorTo, "BOTTOMLEFT", 0, 0)
|
shadow.left:SetPoint("BOTTOMLEFT", anchorTo, "BOTTOMLEFT", inset, inset)
|
||||||
shadow.left:SetWidth(INNER_SHADOW_SIZE)
|
shadow.left:SetWidth(INNER_SHADOW_SIZE)
|
||||||
shadow.left:SetTexture("Interface\\ChatFrame\\ChatFrameBackground")
|
shadow.left:SetTexture("Interface\\ChatFrame\\ChatFrameBackground")
|
||||||
shadow.left:Hide()
|
shadow.left:Hide()
|
||||||
-- Right edge
|
-- Right edge
|
||||||
shadow.right = button:CreateTexture(nil, "ARTWORK", nil, 1)
|
shadow.right = button:CreateTexture(nil, "ARTWORK", nil, 1)
|
||||||
shadow.right:SetPoint("TOPRIGHT", anchorTo, "TOPRIGHT", 0, 0)
|
shadow.right:SetPoint("TOPRIGHT", anchorTo, "TOPRIGHT", -inset, -inset)
|
||||||
shadow.right:SetPoint("BOTTOMRIGHT", anchorTo, "BOTTOMRIGHT", 0, 0)
|
shadow.right:SetPoint("BOTTOMRIGHT", anchorTo, "BOTTOMRIGHT", -inset, inset)
|
||||||
shadow.right:SetWidth(INNER_SHADOW_SIZE)
|
shadow.right:SetWidth(INNER_SHADOW_SIZE)
|
||||||
shadow.right:SetTexture("Interface\\ChatFrame\\ChatFrameBackground")
|
shadow.right:SetTexture("Interface\\ChatFrame\\ChatFrameBackground")
|
||||||
shadow.right:Hide()
|
shadow.right:Hide()
|
||||||
@@ -1141,7 +1143,12 @@ local function UpdateQualityBorder(self, itemQuality, itemLink, bagID, Utils)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
TintSlotBorder(self, r, g, b)
|
TintSlotBorder(self, r, g, b)
|
||||||
ShowInnerShadow(self.innerShadow, r, g, b)
|
-- Only show inner shadow for colored borders, not white (poor/common quality)
|
||||||
|
if r < 0.95 or g < 0.95 or b < 0.95 then
|
||||||
|
ShowInnerShadow(self.innerShadow, r, g, b)
|
||||||
|
else
|
||||||
|
HideInnerShadow(self.innerShadow)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
ResetSlotBorder(self)
|
ResetSlotBorder(self)
|
||||||
HideInnerShadow(self.innerShadow)
|
HideInnerShadow(self.innerShadow)
|
||||||
@@ -1581,7 +1588,12 @@ function Guda_ItemButton_SetItem(self, bagID, slotID, itemData, isBank, otherCha
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
TintSlotBorder(self, r, g, b)
|
TintSlotBorder(self, r, g, b)
|
||||||
ShowInnerShadow(self.innerShadow, r, g, b)
|
-- Only show inner shadow for colored borders, not white
|
||||||
|
if r < 0.95 or g < 0.95 or b < 0.95 then
|
||||||
|
ShowInnerShadow(self.innerShadow, r, g, b)
|
||||||
|
else
|
||||||
|
HideInnerShadow(self.innerShadow)
|
||||||
|
end
|
||||||
borderApplied = true
|
borderApplied = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user