WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   PTR UI Bugs (https://www.wowinterface.com/forums/forumdisplay.php?f=176)
-   -   [7.3] MaskTexture affects multiple unrelated textures (https://www.wowinterface.com/forums/showthread.php?t=55620)

MunkDev 08-03-17 05:48 PM

[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.

MunkDev 08-03-17 07:25 PM

1 Attachment(s)
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.

kurapica.igas 08-06-17 09:49 AM

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.

MunkDev 08-06-17 04:10 PM

This bug might be related to traditional texture paths. Using texture database IDs doesn't seem to cause these issues.

kurapica.igas 08-07-17 12:24 AM

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.

MunkDev 08-07-17 10:12 PM

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.

MunkDev 08-13-17 09:35 PM

Looks like this bug was fixed in build 24793!

zork 01-26-18 12:23 AM

This is really awesome btw. :-)

Resike 01-26-18 08:16 AM

I poked a dev about this. Didn't i mentioned it's gonna be fixed? Maybe it was in another thread.

zork 01-26-18 08:53 AM

You did. I read it today somewhere.


All times are GMT -6. The time now is 03:04 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI