WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   MaskTexture : new widget for 7.2 (https://www.wowinterface.com/forums/showthread.php?t=55368)

guema 05-01-17 08:13 PM

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.

Fizzlemizz 05-01-17 11:47 PM

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.

guema 05-02-17 05:10 AM

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

MunkDev 05-02-17 06:42 AM

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.

Ketho 05-02-17 06:57 AM

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

Quote:

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

Fizzlemizz 05-02-17 10:25 AM

Quote:

Originally Posted by guema (Post 323190)
How do you find this files ? im not able to locate them even with CASCexplorer

See this article.

MunkDev 05-02-17 03:19 PM

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. :)

guema 05-06-17 09:09 AM

Quote:

Originally Posted by Fizzlemizz (Post 323194)
See this article.

Thank you very much =D

zork 05-10-17 06:49 AM

This sounds awesome.

MunkDev 05-10-17 05:27 PM

Any idea how to set the child keys in pure Lua? Doesn't seem to have a function for it.

Fizzlemizz 05-10-17 06:26 PM

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.

lightspark 05-11-17 12:51 AM

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.

Quote:

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

StormFX 05-13-17 12:57 PM

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. :p

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.

MunkDev 05-13-17 01:57 PM

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:

lightspark 05-13-17 02:24 PM

You can use your own texture as a mask too o_O

MunkDev 05-13-17 08:28 PM

Quote:

Originally Posted by lightspark (Post 323373)
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

lightspark 05-13-17 09:41 PM

Quote:

Originally Posted by MunkDev (Post 323377)
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 :D 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..

Resike 05-14-17 03:53 AM

Quote:

Originally Posted by lightspark (Post 323313)
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?

lightspark 05-14-17 03:55 AM

Quote:

Originally Posted by Resike (Post 323380)
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.

Resike 05-14-17 07:27 AM

Quote:

Originally Posted by lightspark (Post 323381)
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.


All times are GMT -6. The time now is 05:18 PM.

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