Thread Tools Display Modes
Prev Previous Post   Next Post Next
09-14-18, 03:35 AM   #1
LudiusMaximus
A Rage Talon Dragon Guard
 
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 320
Altering texture instead of covering it with new texture?

I have a frame with a texture that is defined in xml:

Code:
<CheckButton name="BagnonReagentbankToggleTemplate" inherits="BagnonMenuCheckButtonTemplate" virtual="true">
  <Layers>
    <Layer level="BACKGROUND">
      <Texture file="Interface\Icons\Achievement_GuildPerk_BountifulBags"/>
    </Layer>
  </Layers>
</CheckButton>

Under certain circumstances, I want to change this texture in my lua code:

Code:
function ReagentbankToggle:Update()
  if (not IsReagentBankUnlocked()) then
    local tex = self:CreateTexture(nil, "OVERLAY")
    tex:SetAllPoints()
    tex:SetTexture('Interface/Icons/Achievement_GuildPerk_BountifulBags');
    tex:SetVertexColor(1,0.1,0.1)
  end
end

But this solution always draws a new Texture on top of the others. With \fstack I can see them becoming more and more with every Update(). Isn't there a way to just alter the already existing texture? Or at least delete the old one before creating the new one?

My problem might just be that I don't know how to get a handle for the old texture into a variable...
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Altering texture instead of covering it with new texture?

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