Thread Tools Display Modes
Prev Previous Post   Next Post Next
11-29-20, 09:38 AM   #1
Lybrial
A Flamescale Wyrmkin
AddOn Compiler - Click to view compilations
Join Date: Jan 2010
Posts: 120
MainMenuMicroButton: Override Textures

Hi,

im using the following code to override the micro menu button textures:

Lua Code:
  1. local buttonIndex = {
  2.     [1] = "MainMenuMicroButton",
  3.     [2] = "CharacterMicroButton",
  4.     [3] = "SpellbookMicroButton",
  5.     [4] = "TalentMicroButton",
  6.     [5] = "AchievementMicroButton",
  7.     [6] = "QuestLogMicroButton",
  8.     [7] = "GuildMicroButton",
  9.     [8] = "LFDMicroButton",
  10.     [9] = "EJMicroButton",
  11.     [10] = "CollectionsMicroButton",
  12.     [11] = ((not C_StorePublic.IsEnabled()) and (GetCurrentRegionName() == "CN")) and "HelpMicroButton" or "StoreMicroButton",
  13.     [12] = (C_StorePublic.IsEnabled() and (GetCurrentRegionName() ~= "CN")) and "HelpMicroButton"
  14. }
  15.  
  16. function MicroBlizzard:UpdateButtons()
  17.     TABLES:ForEach(_G.MICRO_BUTTONS, function(i, _)
  18.         local button = _G[buttonIndex[i]]
  19.         local db = self.db.profile.buttons.entries[buttonIndex[i]].texture
  20.  
  21.         button:GetNormalTexture():SetTextureFromDb(db, CORE.VALUES.Button.States.Normal)
  22.         button:GetPushedTexture():SetTextureFromDb(db, CORE.VALUES.Button.States.Pushed)
  23.  
  24.         if (button:GetDisabledTexture()) then
  25.             button:GetDisabledTexture():SetTextureFromDb(db, CORE.VALUES.Button.States.Disabled)
  26.         end
  27.     end)
  28. end
  29.  
  30. local function SetTextureFromDb(frame, texture, type, relative)
  31.     if (frame and texture) then
  32.         if (type == CORE.VALUES.Button.States.Normal) then
  33.             frame:SetInside(relative, texture.normal.offset.x, texture.normal.offset.y);
  34.             frame:SetTexture(texture.normal.texture)
  35.             frame:SetVertexColor(COLORS:Unpack(texture.color.default))
  36.         elseif (type == CORE.VALUES.Button.States.Pushed) then
  37.             frame:SetInside(relative, texture.pushed.offset.x, texture.pushed.offset.y);
  38.             frame:SetTexture(texture.pushed.texture)
  39.             frame:SetVertexColor(COLORS:Unpack(texture.color.accent))
  40.         elseif (type == CORE.VALUES.Button.States.Highlight) then
  41.             frame:SetInside(relative, texture.highlight.offset.x, texture.highlight.offset.y);
  42.             frame:SetTexture(texture.highlight.texture)
  43.             frame:SetVertexColor(COLORS:Unpack(texture.color.accent))
  44.         elseif (type == CORE.VALUES.Button.States.Disabled) then
  45.             frame:SetInside(relative, texture.disabled.offset.x, texture.disabled.offset.y);
  46.             frame:SetTexture(texture.disabled.texture)
  47.             frame:SetVertexColor(COLORS:Unpack(texture.color.disabled))
  48.         end
  49.     end
  50. end

This works for all buttons except the MainMenuMicroButton, See screenshot:

https://ibb.co/pWKHn1N

What is so special about the MainMenuMicroButton that it wont override the textures?

Last edited by Lybrial : 11-29-20 at 09:53 AM.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » MainMenuMicroButton: Override Textures

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off