WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Cannot SetTexCoord with Masked Texture? (https://www.wowinterface.com/forums/showthread.php?t=52405)

Mayron 06-24-15 02:20 PM

Cannot SetTexCoord with Masked Texture?
 
Hi,

I tried using SetTexCoord on a Blizzard texture but I get this Lua error message:
"Cannot set tex coords when texture has mask."

Is this something new with 6.2.0? I can't find a way around this as usually I use wowprogramming.com but think it's outdated. No clue where you can find an updated API/Widgets list of functions.

I tried using this on the new EncounterJournal Suggest frame:

EncounterJournalSuggestFrame.Suggest1.icon

to make it more square shaped like I usually do with circular textures ^^

Thanks for reading!

Mayron 06-24-15 02:31 PM

Silly me, there are new functions for textures. The one I needed had the obvious name "SetMask"

Here is a complete list of functions for the texture widget:

GetVertTile()
SetMask("maskName")
SetHorizTile
GetTexCoord
SetHeight
GetTexture
GetDrawLayer
GetAtlas
IsProtected
CreateAnimationGroup
SetVertTile
GetBlendMode
GetWidth
Hide
GetSize
SetBlendMode
GetNumPoints
GetHorizTile
SetGradient
GetParent
GetName
IsDragging
Show
SetParent
SetWidth
SetNonBlocking()
SetGradientAlpha
SetDesaturated
SetRotation
SetTexCoord
SetToFileData()
GetObjectType
IsMouseOver
IsShown
GetVertexColor
GetLeft
GetRight
SetShown
SetVertexColor
SetAtlas
GetBottom
SetAlpha
SetSize
IsDesaturated
SetPoint
GetNonBlocking
ClearAllPoints
IsVisible
SetAllPoints
SetTexture
GetAlpha
IsObjectType
GetHeight
GetTop
StopAnimating
GetAnimationGroups
GetPoint
CanChangeProtectedState
SetDrawLayer
GetCenter
GetRect
IsForbidden

To get this I just used:
Lua Code:
  1. local TEST_FRAME = CreateFrame("Frame", "TEST_FRAME")
  2. TEST_FRAME.t = TEST_FRAME:CreateTexture(nil, "BACKGROUND")
  3. local mt_table = getmetatable(TEST_FRAME.t).__index;
  4. for key, value in pairs(mt_table) do
  5.     if (type(value) == "function") then
  6.         print(key)
  7.     end
  8. end

Resike 06-24-15 03:10 PM

I don't think any of this are new functions. At least i'm familiar with most of them.

Mayron 06-24-15 04:21 PM

Quote:

Originally Posted by Resike (Post 309371)
I don't think any of this are new functions. At least i'm familiar with most of them.

Ah you could be right! I'm just going blind and couldn't find the SetMask function for some reason..

Resike 06-24-15 05:03 PM

I played some with this, and if you want to replica the same textures then:

Lua Code:
  1. local frame = CreateFrame("Frame", nil, UIParent)
  2. frame:SetPoint("Center", 0, 0)
  3. frame:SetSize(30, 30)
  4.  
  5. local icon = frame:CreateTexture("Texture", "Background")
  6. icon:SetTexture("Interface\\Icons\\Ability_Ambush")
  7. icon:SetMask("Interface\\CharacterFrame\\TempPortraitAlphaMask")
  8. icon:SetAllPoints(frame)
  9.  
  10. local ring = frame:CreateTexture("Texture", "Overlay")
  11. ring:SetAtlas("adventureguide-rewardring")
  12. ring:SetPoint("Center", frame)
  13. ring:SetSize(48, 48)
  14.  
  15. local ringHighlight = frame:CreateTexture("Texture", "Overlay")
  16. ringHighlight:SetAtlas("adventureguide-rewardring")
  17. ringHighlight:SetPoint("Center", frame)
  18. ringHighlight:SetSize(48, 48)
  19. ringHighlight:SetBlendMode("Add")
  20. ringHighlight:SetVertexColor(1, 1, 1, 0.25)
  21.  
  22. frame:SetScript("OnEnter", function(self)
  23.     ringHighlight:Show()
  24. end)
  25.  
  26. frame:SetScript("OnLeave", function(self)
  27.     ringHighlight:Hide()
  28. end)

Mayron 06-25-15 07:28 AM

Interesting stuff. Not completely sure what SetAtlas does but I can sort of understand that it links together a new texture with an already made texture? If so, what is the difference between using a virtual texture and inheriting it with the CreateTexture function and using SetAtlas and giving an XML texture an Atlas? Can't find any documentation about it.

Resike 06-25-15 08:39 AM

Quote:

Originally Posted by Mayron (Post 309395)
Interesting stuff. Not completely sure what SetAtlas does but I can sort of understand that it links together a new texture with an already made texture? If so, what is the difference between using a virtual texture and inheriting it with the CreateTexture function and using SetAtlas and giving an XML texture an Atlas? Can't find any documentation about it.

== Atlas ==

Atlases are textures with mappings onto standard textures that include normalized texture coordinates.

useAtlasSize - Use the actual pixel size of the sub-texture as the in-game rectangle size.

Example:
Code:

<Texture atlas="_Garr_InfoBox-Top" horizTile="true" useAtlasSize="true">
 <Anchors>
 <Anchor point="TOPLEFT" y="7"/>
 <Anchor point="TOPRIGHT" y="7"/>
 </Anchors>
<!--This uses the top-left quarter of this atlas entry, not the top-left quarter of the whole texture-->
 <TexCoords left="0" right="0.5" top="0.0" bottom="0.5"/>
</Texture>

Lua Code:
  1. local filename, width, height, left, right, top, bottom, tilesHoriz, tilesVert = GetAtlasInfo("name")
  2. someTexture:SetAtlas("_Garr_InfoBox-Top");
  3. atlas = someTexture:GetAtlas()

Source: http://us.battle.net/wow/en/forum/topic/13421662064

Sadly a lot of new stuff came with 6.0 are still widely unknown/unused/undocumented.

Miiru 06-25-15 11:41 PM

http://www.wowinterface.com/forums/s...5&postcount=19

:D

Mayron 06-26-15 03:04 AM

Thanks a lot, especially for the kitty tutorial haha
That helped a lot! I am currently using TexCoords the primitive way so will have to use this to my advantage!


All times are GMT -6. The time now is 12:23 PM.

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