diff --git a/Libs/DF/definitions.lua b/Libs/DF/definitions.lua index 2f413928..dcbeb084 100644 --- a/Libs/DF/definitions.lua +++ b/Libs/DF/definitions.lua @@ -290,12 +290,13 @@ ---@field CleanTruncateUTF8String fun(self:table, text:string) : string ---@field GetSpellBookSpells fun(self:table) : table, 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 - diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 76f1d8d7..bcf9f973 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -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 diff --git a/Libs/DF/picture.lua b/Libs/DF/picture.lua index 43ed1a64..772ab411 100644 --- a/Libs/DF/picture.lua +++ b/Libs/DF/picture.lua @@ -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 diff --git a/frames/window_breakdown/breakdown_spells_spellframes.lua b/frames/window_breakdown/breakdown_spells_spellframes.lua index 639f4db3..0ed96c4f 100644 --- a/frames/window_breakdown/breakdown_spells_spellframes.lua +++ b/frames/window_breakdown/breakdown_spells_spellframes.lua @@ -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 diff --git a/frames/window_breakdown/window_playerbreakdown_auras.lua b/frames/window_breakdown/window_playerbreakdown_auras.lua index bc2a98d1..c3aa4045 100644 --- a/frames/window_breakdown/window_playerbreakdown_auras.lua +++ b/frames/window_breakdown/window_playerbreakdown_auras.lua @@ -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") diff --git a/frames/window_breakdown/window_playerbreakdown_list.lua b/frames/window_breakdown/window_playerbreakdown_list.lua index 16b7821e..74eda323 100644 --- a/frames/window_breakdown/window_playerbreakdown_list.lua +++ b/frames/window_breakdown/window_playerbreakdown_list.lua @@ -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) diff --git a/images/common-iconmask.png b/images/common-iconmask.png new file mode 100644 index 00000000..8b26fc71 Binary files /dev/null and b/images/common-iconmask.png differ diff --git a/textures.lua b/textures.lua index a36388a6..fcb5ad0f 100644 --- a/textures.lua +++ b/textures.lua @@ -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()