Fixed an issue with icons not showing on classic versions of the game.

This commit is contained in:
Tercio Jose
2024-03-16 12:15:16 -03:00
parent 2421b29665
commit 0b7f4d2abf
8 changed files with 53 additions and 9 deletions
+2 -3
View File
@@ -290,12 +290,13 @@
---@field CleanTruncateUTF8String fun(self:table, text:string) : string
---@field GetSpellBookSpells fun(self:table) : table<string, boolean>, spellid[] return a list of spells from the player spellbook
---@field PreviewTexture fun(self:table, texture:atlasname|texturepath|textureid, left:number?, right:number?, top:number?, bottom:number?) : nil
---@field TableIsAtlas fun(self:table, atlasTale:table) : boolean
---@field SetAtlas fun(self:table, textureObject:texture, atlas:atlasinfo|atlasname, useAtlasSize:boolean?, filterMode:texturefilter?, resetTexCoords:boolean?) : nil
---@field CreateAtlas fun(self:table, file:texturepath|textureid, width:number?, height:number?, leftTexCoord:number?, rightTexCoord:number?, topTexCoord:number?, bottomTexCoord:number?, tilesHorizontally:boolean?, tilesVertically:boolean?, vertexRed:any, vertexGreen:number?, vertexBlue:number?, vertexAlpha:number?, desaturated:boolean?, desaturation:number?, alpha:number) : atlasinfo
---@field ParseTexture fun(self:table, texture:texturepath|textureid|atlasname|atlasinfo, width: number?, height: number?, leftTexCoord: number?, rightTexCoord: number?, topTexCoord: number?, bottomTexCoord: number?, vertexRed:number|string?, vertexGreenvertexRed:number?, vertexBluevertexRed:number?, vertexAlphavertexRed:number?) : any, number?, number?, number?, number?, number?, number?, number?, number?, number?, number?, number?, number?
---@field IsTexture fun(self:table, texture:any, bCheckTextureObject: boolean?) : boolean
---@field CreateAtlasString fun(self:table, atlas:atlasinfo|atlasname, textureHeight:number?, textureWidth:number?) : string
---@field SetMask fun(self:table, texture:texture, maskTexture:atlasname|texturepath|textureid) : nil
---@field SetMask fun(self:table, texture:texture, maskTexture:atlasname|texturepath|textureid|table) : nil
---@field GetClientRegion fun(self:table) : string
---@field GetBestFontPathForLanguage fun(self:table, languageId:string) : string
---@field SetTemplate fun(self:table, frame:uiobject, template:string)
@@ -312,8 +313,6 @@
---@field CreateBorder fun(self:table, parent:frame, alpha1:number?, alpha2:number?, alpha3:number?) : frame
---@field
---@field
---@field
+2 -2
View File
@@ -1,6 +1,6 @@
local dversion = 525
local dversion = 526
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)
@@ -181,7 +181,7 @@ end
---@return boolean
function DF.IsNonRetailWowWithRetailAPI()
local _, _, _, buildInfo = GetBuildInfo()
if (buildInfo < 40000 and buildInfo >= 30401) or (buildInfo < 20000 and buildInfo >= 11404) then
if (buildInfo < 50000 and buildInfo >= 30401) or (buildInfo < 20000 and buildInfo >= 11404) then
return true
end
return false
+31 -1
View File
@@ -694,11 +694,24 @@ function detailsFramework:IsTexture(texture, bCheckTextureObject)
return false
end
---Return if the table passed has the structure of an atlasinfo
---@param self table
---@param atlasTale table
---@return boolean
function detailsFramework:TableIsAtlas(atlasTale)
if (type(atlasTale) == "table") then
if (atlasTale.file or atlasTale.filename) then
return true
end
end
return false
end
---Receives a texture object and a texture to use as mask
---If the mask texture is not created, it will be created and added to a key named MaskTexture
---@param self table
---@param texture texture
---@param maskTexture string|number
---@param maskTexture string|number|table
function detailsFramework:SetMask(texture, maskTexture)
if (not texture.MaskTexture) then
local parent = texture:GetParent()
@@ -707,6 +720,23 @@ function detailsFramework:SetMask(texture, maskTexture)
texture:AddMaskTexture(maskTextureObject)
texture.MaskTexture = maskTextureObject
end
--is this a game texture atlas?
if (type(maskTexture) == "string") then
local isAtlas = C_Texture.GetAtlasInfo(maskTexture)
if (isAtlas) then
texture.MaskTexture:SetAtlas(maskTexture)
return
end
elseif (type(maskTexture) == "table") then
local bIsAtlas = detailsFramework:TableIsAtlas(maskTexture)
if (bIsAtlas) then
detailsFramework:SetAtlas(texture.MaskTexture, maskTexture)
return
end
end
texture.MaskTexture:SetTexture(maskTexture)
end
@@ -1538,7 +1538,7 @@ function spellsTab.CreateSpellBar(self, index) --~spellbar ~spellline ~spell ~cr
local spellIcon = spellIconFrame:CreateTexture("$parentTexture", "overlay")
spellIcon:SetAllPoints()
spellIcon:SetTexCoord(.1, .9, .1, .9)
detailsFramework:SetMask(spellIcon, [[Interface\COMMON\common-iconmask]])
detailsFramework:SetMask(spellIcon, Details:GetTextureAtlas("iconmask"))
spellBar.spellIcon = spellIcon
--create a square frame which is placed at the right side of the line to show which targets for damaged by the spell
@@ -75,7 +75,7 @@ local createAuraTabOnBreakdownWindow = function(tab, frame)
local iconTexture = line:CreateTexture("$parentIcon", "overlay")
iconTexture:SetSize(scroll_line_height -2 , scroll_line_height - 2)
iconTexture:SetAlpha(0.924)
detailsFramework:SetMask(iconTexture, [[Interface\COMMON\common-iconmask]])
detailsFramework:SetMask(iconTexture, Details:GetTextureAtlas("iconmask"))
local nameLabel = line:CreateFontString("$parentName", "overlay", "GameFontNormal")
local uptimeLabel = line:CreateFontString("$parentUptime", "overlay", "GameFontNormal")
@@ -340,7 +340,7 @@ local createPlayerScrollBox = function(breakdownWindowFrame, breakdownSideMenu,
local specIcon = OTTFrame:CreateTexture("$parentSpecIcon", "artwork")
specIcon:SetSize(headerTable[1].width - 1, headerTable[1].width - 1)
specIcon:SetAlpha(0.834)
detailsFramework:SetMask(specIcon, [[Interface\COMMON\common-iconmask]])
detailsFramework:SetMask(specIcon, Details:GetTextureAtlas("iconmask"))
local roleIcon = OTTFrame:CreateTexture("$parentRoleIcon", "overlay")
roleIcon:SetSize((player_line_height-2) / 2, (player_line_height-2) / 2)
Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

+15
View File
@@ -302,6 +302,21 @@ Details.TextureAtlas = {
nativeWidth = 512,
nativeHeight = 512,
},
["iconmask"] = {
file = [[Interface\AddOns\Details\images\common-iconmask.png]],
width = 64,
height = 64,
leftTexCoord = 0,
rightTexCoord = 1,
topTexCoord = 0,
bottomTexCoord = 1,
tilesHorizontally = false,
tilesVertically = false,
nativeWidth = 64,
nativeHeight = 64,
},
}
C_Timer.After(1, function()