Thread Tools Display Modes
08-03-17, 05:48 PM   #1
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
[7.3] MaskTexture affects multiple unrelated textures

I'm using an XML template for my action buttons that contains this MaskTexture object:
Lua Code:
  1. <!-- icon texture -->
  2. <Texture name="$parentIcon" parentKey="icon" file="Interface\ICONS\Ability_BossFelOrcs_Necromancer_Red" desaturated="true"/>
  3.  
  4. <!-- icon mask -->
  5. <MaskTexture name="$parentIconMask" parentKey="Mask" file="Interface\AddOns\ConsolePort\Textures\Button\Mask" hWrapMode="CLAMPTOBLACKADDITIVE" vWrapMode="CLAMPTOBLACKADDITIVE">
  6.     <Anchors>
  7.         <Anchor point="TOPLEFT"/>
  8.         <Anchor point="BOTTOMRIGHT"/>
  9.     </Anchors>
  10.     <MaskedTextures>
  11.         <MaskedTexture childKey="icon"/>
  12.     </MaskedTextures>
  13. </MaskTexture>

This template is used to create button clusters of 4, where 3/4 buttons should have a different mask texture set to them, depending on their orientation.
This is done using 12 different mask textures (since rotation by texture coords doesn't seem to work). Compiled into one image below:



By setting the new texture to the mask in Lua like so:
Lua Code:
  1. button.Mask:SetTexture(newMask)
... I was hoping that this would allow me to change the mask for each button individually.

This is where this strange bug happens, where updating the texture for one mask affects other masks inherited from the same template. This might be related to the fact that these buttons are all created at the same time, and it ends up incorrectly linking one mask to multiple icons instead of linking each individual mask to each individual icon.
Likewise, creating masks in pure Lua and setting child keys manually causes the same problems.

Where the end result is supposed to look something like this:


...it instead ends up looking like this:


As you can see in this screenshot, all L1L2 buttons oriented to the left have the correct mask, one single L2 button has the correct mask (these two masks are the only 2/12 textures that are even present in this screenshot). Everything else is wrong.

I've confirmed that the code to handle all this is correct by dumping mask:GetTexture() for different buttons, which indeed returns the correct texture paths.
Here's a video of this issue in action when the orientation of a cluster is updated.
__________________

Last edited by MunkDev : 08-03-17 at 06:52 PM.
  Reply With Quote
08-03-17, 07:25 PM   #2
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
I put together a little addon that demonstrates this bug by using two separate mask textures to loop through these 12 textures at different intervals. They both update whenever the first mask updates.
Attached Files
File Type: zip MaskTextureBug.zip (16.0 KB, 355 views)
__________________
  Reply With Quote
08-06-17, 09:49 AM   #3
kurapica.igas
A Chromatic Dragonspawn
Join Date: Aug 2011
Posts: 152
I do a test with time delay(forgive me using the Scorpio to skip the delay code), with the second frame and mask created after 2 sec, and third mask created after 4 sec.

For the first time, all the mask's icon use the same spell texture :

Lua Code:
  1. Scorpio "Test" ""
  2.  
  3. function CreateTest(x, y, spell, maskidx)
  4.     local frame = CreateFrame('Frame', nil, UIParent)
  5.     frame:SetPoint("CENTER", x, y)
  6.     frame:SetSize(64, 64)
  7.  
  8.     local icon = frame:CreateTexture()
  9.     local mask = frame:CreateMaskTexture()
  10.     mask:SetAllPoints(icon)
  11.  
  12.     icon:SetAllPoints()
  13.     icon:SetTexture(spell)
  14.  
  15.     icon:AddMaskTexture(mask)
  16.     mask:SetTexture([[Interface\AddOns\MaskTextureBug\Masks\]]..maskidx)
  17.     return mask
  18. end
  19.  
  20. Continue(function()  -- Call as thread
  21.     local mask1 = CreateTest( - 100, 0, 135735, 1)
  22.  
  23.     Wait(2)    -- Wait 2 sec
  24.  
  25.     local mask2 = CreateTest(100, 0, 135735, 5)
  26.     print("Mask1:" .. mask1:GetTexture())
  27.  
  28.     Wait(2)
  29.  
  30.     CreateTest(0, 0, 135735, 10)
  31.     print("Mask1:" .. mask1:GetTexture())
  32.     print("Mask2:" .. mask2:GetTexture())
  33. end)

When the second is created, the first mask's display is also changed, but GetTexture will return the old one. and when the third mask is created, the first and the second mask also changed.

But when I use different spell for the three mask :

Lua Code:
  1. Scorpio "Test" ""
  2.  
  3. function CreateTest(x, y, spell, maskidx)
  4.     local frame = CreateFrame('Frame', nil, UIParent)
  5.     frame:SetPoint("CENTER", x, y)
  6.     frame:SetSize(64, 64)
  7.  
  8.     local icon = frame:CreateTexture()
  9.     local mask = frame:CreateMaskTexture()
  10.     mask:SetAllPoints(icon)
  11.  
  12.     icon:SetAllPoints()
  13.     icon:SetTexture(spell)
  14.  
  15.     icon:AddMaskTexture(mask)
  16.     mask:SetTexture([[Interface\AddOns\MaskTextureBug\Masks\]]..maskidx)
  17.     return mask
  18. end
  19.  
  20. Continue(function()
  21.     CreateTest( - 100, 0, 135735, 1)
  22.  
  23.     Wait(2) -- Wait 2 sec
  24.  
  25.    CreateTest(100, 0, 136096, 5)
  26.  
  27.     Wait(2)
  28.  
  29.     CreateTest(0, 0, 135848, 10)
  30. end)

All works fine. Looks like the mask is attached the texture file directly. Take another interesting example :

Lua Code:
  1. Scorpio "Test" ""
  2.  
  3. function CreateTest(x, y, spell, maskidx)
  4.     local frame = CreateFrame('Frame', nil, UIParent)
  5.     frame:SetPoint("CENTER", x, y)
  6.     frame:SetSize(64, 64)
  7.  
  8.     local icon = frame:CreateTexture()
  9.     local mask = frame:CreateMaskTexture()
  10.     mask:SetAllPoints(icon)
  11.  
  12.     icon:SetAllPoints()
  13.     icon:SetTexture(spell)
  14.  
  15.     icon:AddMaskTexture(mask)
  16.     mask:SetTexture([[Interface\AddOns\MaskTextureBug\Masks\]]..maskidx)
  17.     return mask
  18. end
  19.  
  20. Continue(function()
  21.     CreateTest( - 100, 0, [[Interface\Icons\Ability_ThunderClap]], 1)
  22.  
  23.     Wait(2)    -- Wait 2 sec
  24.  
  25.     CreateTest(100, 0, [[Interface\Icons\Spell_Misc_HellifrePVPHonorHoldFavor]], 2)
  26.  
  27.     Wait(2)    -- Wait 2 sec
  28.  
  29.     CreateTest( 0,  0, [[Interface\Icons\ability_warrior_savageblow]], 3)
  30.  
  31.     Wait(2)    -- Wait 2 sec
  32.  
  33.     CreateTest(- 100, -70, [[Interface\Icons\XP_Icon]], 4)
  34.  
  35.     Wait(2)
  36.  
  37.     CreateTest(100, -70, [[Interface\Icons\INV_Misc_PocketWatch_01]], 5)
  38.  
  39.     Wait(2)
  40.  
  41.     CreateTest(0, -70, [[Interface\Icons\Ability_Rogue_FeignDeath]], 6)
  42.    
  43. end)

The spell and ability's mask will take the same display(should they in the same texture file?), and the xp and inv won't.

All tests are done in 7.2.5, but I think it may be the same in the PTR. Since there is no rules for the bug, maybe using separately texture files can avoid it.
  Reply With Quote
08-06-17, 04:10 PM   #4
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
This bug might be related to traditional texture paths. Using texture database IDs doesn't seem to cause these issues.
__________________

Last edited by MunkDev : 08-06-17 at 04:14 PM.
  Reply With Quote
08-07-17, 12:24 AM   #5
kurapica.igas
A Chromatic Dragonspawn
Join Date: Aug 2011
Posts: 152
In the second example, if replace the 135848 to 136116, the bug still existed. Since it's not a random issue, the mechanism of the masking would be the problem.

Last edited by kurapica.igas : 08-07-17 at 12:30 AM.
  Reply With Quote
08-07-17, 10:12 PM   #6
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
I guess my conclusion was a classic case of false causlity. In the original post, there are at least 2 different masks present for all the small buttons and another mask for the big buttons. No Lua code touches the large round masks because the template has that mask texture by default, so they're unaffected by the bug.
__________________
  Reply With Quote
08-13-17, 09:35 PM   #7
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
Thumbs up

Looks like this bug was fixed in build 24793!
__________________
  Reply With Quote
01-26-18, 12:23 AM   #8
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
This is really awesome btw. :-)
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote
01-26-18, 08:16 AM   #9
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
I poked a dev about this. Didn't i mentioned it's gonna be fixed? Maybe it was in another thread.
  Reply With Quote
01-26-18, 08:53 AM   #10
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
You did. I read it today somewhere.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote

WoWInterface » PTR » PTR UI Bugs » [7.3] MaskTexture affects multiple unrelated 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