Thread Tools Display Modes
05-01-17, 08:13 PM   #1
guema
A Deviate Faerie Dragon
Join Date: Aug 2016
Posts: 17
MaskTexture : new widget for 7.2

Hello there.

It seems that 7.2 introduced a new widget type who seems to inherrit from Texture : MaskTexture.

As im not really a procoder, im not able to know how to exploit it correctly, but i know that Frame:CreateMaskTexure() exists.

Well i would like to know if someone got infos or anything, because it is potentially a very interesting feature.

Do someone know how sites like wowpedia or wowapi can know the existence of this things ? Thanks.
  Reply With Quote
05-01-17, 11:47 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Used in the artifact power button template:
Code:
<Layer level="OVERLAY" textureSubLevel="2">
	<Texture parentKey="Icon">
		<Anchors>
			<Anchor point="CENTER"/>
		</Anchors>
	</Texture>
</Layer>
<Layer level="OVERLAY" textureSubLevel="1">
	<Texture parentKey="IconDesaturated" desaturated="true">
		<Anchors>
			<Anchor point="TOPLEFT" relativeKey="$parent.Icon" />
			<Anchor point="BOTTOMRIGHT" relativeKey="$parent.Icon" />
		</Anchors>
	</Texture>
	<MaskTexture parentKey="CircleMask" file="Interface\CharacterFrame\TempPortraitAlphaMask" hWrapMode="CLAMPTOBLACKADDITIVE" vWrapMode="CLAMPTOBLACKADDITIVE">
		<Anchors>
			<Anchor point="CENTER"/>
		</Anchors>
		<MaskedTextures>
			<MaskedTexture childKey="Icon"/>
			<MaskedTexture childKey="IconDesaturated"/>
		</MaskedTextures>
	</MaskTexture>
</Layer>
The MaskTexture childKeys point to the two textures created.
The file TempPortraitAlphaMask is just a white circle on transparent background presumably used for creating an overlay mask. I don't use the default artifact power bar so garner from that what you will.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 05-01-17 at 11:56 PM.
  Reply With Quote
05-02-17, 05:10 AM   #3
guema
A Deviate Faerie Dragon
Join Date: Aug 2016
Posts: 17
Thank you very much for this informations, good to know.

How do you find this files ? im not able to locate them even with CASCexplorer
  Reply With Quote
05-02-17, 06:42 AM   #4
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
Isn't this equivalent to
Lua Code:
  1. texture:SetMask([[Interface\CharacterFrame\TempPortraitAlphaMask]])
...except you get an actual reference to the alpha mask?

Curious about the wrap mode, though. Iirc, providing the means of using custom, non-native textures as masks for other things than the minimap was on the to-do list.
__________________

Last edited by MunkDev : 05-02-17 at 06:45 AM.
  Reply With Quote
05-02-17, 06:57 AM   #5
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
That made me remember TheDanW mentioned some stuff about it

https://www.townlong-yak.com/framexm...on.xml/diff#15
https://www.townlong-yak.com/framexm...I.xsd/diff#514

http://infobot.rikers.org/%23wowuidev/20170117.html.gz
http://infobot.rikers.org/%23wowuidev/20170118.html.gz

23:35.12 TheDanW> there's also some new texture masking tech that is considerably better than the current, the masks can be animated or applied to multiple textures without destroying your framerate
23:36.05 TheDanW> there's new texture/line API that will let you modify verts after their anchors have been processed
00:34.16 Stanzilla> TheDanW: does that remove the limitation of not being able to set texcoords when a mask is applied?
00:38.09 Infus> TheDanW: and what kind of animation? that sounds interesting
00:54.52 TheDanW> Stanzilla, Infus: basically a MaskTexture is separate object that behaviors similar to a Texture, it can have all the standard anchors, animations, etc on it, but it doesn't render like a normal texture, instead you apply to Texture object(s) and the MaskTexture will use its texture alpha values to mask out the Texture(s) it's applied to
00:55.30 TheDanW> so, the MaskTexture can have a standard translation animation applied to it, and the mask will move, revealing/masking more of the textures its applied to
00:55.51 TheDanW> other animation types work with it too
00:56.15 TheDanW> since they're separate objects it won't wreak havoc on texcoords you set
00:56.24 Stanzilla> that sounds great
00:56.34 Torhal> Sounds like something you guys added to stop Semlar from being Semlar.
00:56.34 TheDanW> so it works fine with atlases or sliced objects
00:57.42 TheDanW> i'm sure Semlar will break the game with them somehow
00:58.57 Infus> TheDanW: one MaskTexture per Texture, right?
00:59.00 znf> he's probably going to create some sort of root exploit
00:59.24 TheDanW> you can have one mask texture point to multiple textures
01:00.19 Infus> yeah, that's understood. I was asking the reverse. one texture can't have multiple masks?
01:00.20 TheDanW a texture can be masked by up to 3 mask textures
01:00.30 Infus> oh that's interesting
01:00.37 Infus> allows triangles
  Reply With Quote
05-02-17, 10:25 AM   #6
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Originally Posted by guema View Post
How do you find this files ? im not able to locate them even with CASCexplorer
See this article.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
05-02-17, 03:19 PM   #7
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
For me personally, this is a great change. I was expecting texture masking to be reworked at some point, because it sporadically causes 'script ran too long' errors in combat when applying new textures to an already masked entity.

I had to essentially create four different textures for each modifier state in use and manipulate their alpha values (hiding / showing textures causes them to be redrawn), and overlay them on my controller action bars, just to minimise the amount of frame rate drops and sporadic errors due to an icon change in combat. I can probably remove all the code I wrote to circumvent this issue.

While round action buttons were entirely possible before, this could also allow for some pretty interesting shapes and techniques for UI designers that were not possible previously.
__________________
  Reply With Quote
05-06-17, 09:09 AM   #8
guema
A Deviate Faerie Dragon
Join Date: Aug 2016
Posts: 17
Originally Posted by Fizzlemizz View Post
See this article.
Thank you very much =D
  Reply With Quote
05-10-17, 06:49 AM   #9
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
This sounds awesome.
__________________
| 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
05-10-17, 05:27 PM   #10
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
Any idea how to set the child keys in pure Lua? Doesn't seem to have a function for it.
__________________
  Reply With Quote
05-10-17, 06:26 PM   #11
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Code:
frame:CreateMaskTexture("Name", "Texture", childKey)
From very limited testing ie. don't take it as gospel but a string in the third parameter creates a "Node not found" error:

I'm not sure how using this it can be set for more than childKey texture.

There don't seem to be any WrapMode methods or they're called something else completely.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 05-10-17 at 06:50 PM.
  Reply With Quote
05-11-17, 12:51 AM   #12
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 341
All Texture objects now have texture:AddMaskTexture(mask) and texture:RemoveMaskTexture(mask) methods.

Moreover, texture:SetTexture(...) received some upgrades, 2nd and 3rd args can be used to set hWrapMode and vWrapMode.

Originally Posted by TheDanW
ls-: if you use a bool for the 2nd/3rd args then true is equivalent to "REPEAT" otherwise it defaults to "CLAMP"; there's 6 wrap modes that can be set as a string though
CLAMP, REPEAT, CLAMPTOBLACK, CLAMPTOBLACKADDITIVE, CLAMPTOWHITE, MIRROR
So that's what you wanna do:
Lua Code:
  1. local mask = UIParent:CreateMaskTexture()
  2. mask:SetTexture("Interface\\CHARACTERFRAME\\TempPortraitAlphaMask", "CLAMPTOBLACKADDITIVE", "CLAMPTOBLACKADDITIVE")
  3. mask:SetSize(128, 128)
  4. mask:SetPoint("CENTER")
  5.  
  6. local texture = UIParent:CreateTexture(nil, "ARTWORK")
  7. texture:SetColorTexture(0, 1, 1)
  8. texture:SetSize(128, 128)
  9. texture:SetPoint("CENTER")
  10. texture:AddMaskTexture(mask)

IIRC, each texture can have upto 3 masks applied.

Sadly, it can't be used w/ statusbar:GetStatusBarTexture(), that's kinda StatusBar bug, the only workaround is to make real status bar texture transparent and create your own texture to replace it.

There's some bugs w/ MaskTextures too, for instance, if you're using mask textures w/ SmoothStatusBar mixin or oUF_Smooth or any sort of status bar "smoothing" technique, it'll take some time till mask is reapplied. I already reported this bug w/ sample code and stuff... Dan said that he kinda found the reason why it's happening, so it should be fixed in next PTR build, probably, I'll ask him today...

Said bug in action o_O


There's a way to crash client by passing "bad" args to frame:CreateMaskTexture(...), but I also reported this issue.

And Infus reported some other bug, I don't remember what T_T
__________________

Last edited by lightspark : 05-11-17 at 03:55 AM.
  Reply With Quote
05-13-17, 12:57 PM   #13
StormFX
A Flamescale Wyrmkin
 
StormFX's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 109
I've implemented this feature into the next version of Masque, but only for the Icon layer. This should allow skin authors to make better circular skins. I suppose you could make any shape you wanted, but you'd have to create your own spell alerts, etc. The basic circular one I did was a pain in the ass and I really can't be bothered to make more.

I'm not going to bother implementing it for the other layers because those are usually custom textures anyhow and authors should utilize the alpha channel rather than a mask. That is, unless animated masks turn out to be an easily-implemented and interesting prospect.

As for the masks themselves, from what I can tell the engine uses the alpha channel of the texture so the RGB values shouldn't matter. In many cases, skins that use the same "overlay" texture for the flash, pushed, etc, can simply use that texture's alpha as the mask for the icon.
  Reply With Quote
05-13-17, 01:57 PM   #14
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
If anyone wants to make circular action buttons, I recommend using this texture as mask instead of the portrait mask traditionally used by the UI for circular masks.
Code:
Interface\Minimap\UI-Minimap-Background
It has a subtle feather effect on the edge and completely removes the burnt in square action slot on the older icon textures:
__________________
  Reply With Quote
05-13-17, 02:24 PM   #15
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 341
You can use your own texture as a mask too o_O
__________________

Last edited by lightspark : 05-13-17 at 02:27 PM.
  Reply With Quote
05-13-17, 08:28 PM   #16
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
Originally Posted by lightspark View Post
You can use your own texture as a mask too o_O
Wait.. really? Seems like that should have come up in the conversation Ketho quoted. Cool beans. ;o
__________________
  Reply With Quote
05-13-17, 09:41 PM   #17
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 341
Originally Posted by MunkDev View Post
Wait.. really? Seems like that should have come up in the conversation Ketho quoted. Cool beans. ;o
Yeah, that's the first thing I tested But your mask should be a separate texture, you can't "cut" it via mask:SetTexCoord(...). Last time I tested it SetTexCoord had no effect on mask texture, I'm not sure if it's a bug or intended though..
__________________

Last edited by lightspark : 05-13-17 at 09:44 PM.
  Reply With Quote
05-14-17, 03:53 AM   #18
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by lightspark View Post
There's some bugs w/ MaskTextures too, for instance, if you're using mask textures w/ SmoothStatusBar mixin or oUF_Smooth or any sort of status bar "smoothing" technique, it'll take some time till mask is reapplied. I already reported this bug w/ sample code and stuff... Dan said that he kinda found the reason why it's happening, so it should be fixed in next PTR build, probably, I'll ask him today...

There's a way to crash client by passing "bad" args to frame:CreateMaskTexture(...), but I also reported this issue.

And Infus reported some other bug, I don't remember what T_T
Where can you report bugs if you don't have an US account and it doesnt get trashed?
  Reply With Quote
05-14-17, 03:55 AM   #19
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 341
Originally Posted by Resike View Post
Where can you report bugs if you don't have an US account and where it doesnt get trashed?
IRC, #wowuidev on irc.freenode.net. We have TheDanW there, he's a UI dev from Blizzard and he's quite active during working days.
__________________

Last edited by lightspark : 05-14-17 at 04:02 AM.
  Reply With Quote
05-14-17, 07:27 AM   #20
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by lightspark View Post
IRC, #wowuidev on irc.freenode.net. We have TheDanW there, he's a UI dev from Blizzard and he's quite active during working days.
Time to dump my bigass wowbug.txt compilation.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » MaskTexture : new widget for 7.2

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