Thread Tools Display Modes
06-24-15, 02:20 PM   #1
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 275
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!
  Reply With Quote
06-24-15, 02:31 PM   #2
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 275
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

Last edited by Mayron : 06-24-15 at 04:23 PM.
  Reply With Quote
06-24-15, 03:10 PM   #3
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
I don't think any of this are new functions. At least i'm familiar with most of them.
  Reply With Quote
06-24-15, 04:21 PM   #4
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 275
Originally Posted by Resike View Post
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..
  Reply With Quote
06-24-15, 05:03 PM   #5
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
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)

Last edited by Resike : 06-24-15 at 05:14 PM.
  Reply With Quote
06-25-15, 07:28 AM   #6
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 275
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.
  Reply With Quote
06-25-15, 08:39 AM   #7
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by Mayron View Post
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.
  Reply With Quote
06-25-15, 11:41 PM   #8
Miiru
A Flamescale Wyrmkin
 
Miiru's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 138
http://www.wowinterface.com/forums/s...5&postcount=19

__________________
◘◘ Author of MiirGui Texture Pack - [Core] [Blue] [Grey] ◘◘
  Reply With Quote
06-26-15, 03:04 AM   #9
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 275
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!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Cannot SetTexCoord with Masked Texture?


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