Thread Tools Display Modes
05-18-16, 02:22 PM   #1
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
GetTexture() returns nil on unloaded textures

I've been trying to fix Xinhuan's LargerMacroIconSelection (WowAce)
The license is All Rights Reserved though...

For some reason GetTexture() returns nil on anonymous texture objects?
  • For example, on Legion if I want to get the texture path for the texture below, it returns nil
    While on Live it returns "Interface\\MacroFrame\\MacroPopup-TopLeft"
Blizzard_MacroUI/Blizzard_MacroUI.xml#L330-L335
MacroFrame/MacroPopup-TopLeft.PNG
Code:
<Texture file="Interface\MacroFrame\MacroPopup-TopLeft">
	<Size x="256" y="256"/>
	<Anchors>
		<Anchor point="TOPLEFT"/>
	</Anchors>
</Texture>
Code:
/run UIParentLoadAddOn("Blizzard_MacroUI")
/dump ({MacroPopupFrame:GetRegions()})[1]:GetTexture() -- returns nil on Legion
-----
  • The addon checks for any textures on MacroPopupFrame, and then adds bigger textures.
    It will find the textures, but then it tries to get the non-existing texture paths, so it stops there.
LargerMacroIconSelection.lua#L218-L220
Code:
kids = {MacroPopupFrame:GetRegions()}
Code:
for _, child in ipairs(kids) do
	if child.GetTexture then
		if child:GetTexture() == "Interface\\MacroFrame\\MacroPopup-TopLeft" then
-----
Not sure if this is a bug or not and if it's in the right forum. (I'm a noob with texture stuff)
  • Live:

  • Legion: LargerMacroIconSelection didn't proceed adding the bigger textures
Attached Files
File Type: zip LargerMacroIconSelection-v1.0.3-legionfix1.zip (4.4 KB, 195 views)

Last edited by Ketho : 06-29-16 at 01:00 PM.
 
05-18-16, 02:39 PM   #2
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
Actually, if this is the UI forum for Blizzard then I'd like to move this thread into the AddOn Help & Feedback category. Sorry.

http://www.wowinterface.com/forums/f...play.php?f=155
 
05-18-16, 03:33 PM   #3
lucro
A Murloc Raider
Join Date: May 2016
Posts: 5
Currently, it appears that the texture has to be visible to request the texture and get a result. It's probably getting unloaded when hidden.

Works:
/dump UIParentLoadAddOn("Blizzard_MacroUI"), ShowUIPanel(MacroPopupFrame), ({MacroPopupFrame:GetRegions()})[1]:GetTexture()

Doesn't work:
/dump UIParentLoadAddOn("Blizzard_MacroUI"), ({MacroPopupFrame:GetRegions()})[1]:GetTexture()
 
05-18-16, 04:21 PM   #4
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
Thanks lucro, showing the textures fixed the problem!

I don't know if it already was documented, but the texture paths returned now also included the .blp extension

I'm showing their parent frame MacroPopupFrame and then hiding it again. Is that a good way to go about it?

Followup edit: (June 29) http://www.wowinterface.com/forums/s...ad.php?t=53795

Code:
kids = {MacroPopupFrame:GetRegions()}
-----
MacroPopupFrame:Show() -- Legion: needs to be temporarily visible in order to get the textures

for _, child in ipairs(kids) do
	if child.GetTexture then
		print(child, child:GetTexture())
		if child:GetTexture() == "Interface\\MacroFrame\\MacroPopup-TopLeft.blp" then
			-- ...
		end
	end
end

MacroPopupFrame:Hide() -- hide again

Last edited by Ketho : 07-05-16 at 03:40 AM.
 
05-18-16, 04:28 PM   #5
lucro
A Murloc Raider
Join Date: May 2016
Posts: 5
Yeah, hopefully it gets changed back to the way it works on live, but that seems the way to go currently.
 
05-18-16, 04:57 PM   #6
Predicate
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 18
Seems intentional, I doubt it will be removed. See CVar releaseUITextures: "Release Hidden UI Textures by default"
 
07-06-16, 09:45 AM   #7
dssd
A Fallenroot Satyr
Join Date: May 2016
Posts: 25
In the latest beta build it appears the CVar was removed. The texture paths/ids are now being returned even if the texture is hidden.
 
07-06-16, 10:29 AM   #8
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
Originally Posted by dssd View Post
In the latest beta build it appears the CVar was removed. The texture paths/ids are now being returned even if the texture is hidden.

Oh well, that means a lot less broken addons
It did make some addons more efficient, if they only did stuff at OnShow
 
07-06-16, 10:54 AM   #9
dssd
A Fallenroot Satyr
Join Date: May 2016
Posts: 25
It looks like the textures are still being released on hide. Basically the cvar is always set to 1. We just can't turn it off.
 
07-06-16, 11:42 AM   #10
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
Are you sure? From what quick testing I did, the textures seem to be accessible even when hidden, as if the cvar is always turned off...

afaik normally when releaseUITextures was enabled, Region:IsVisible() should return true, in order to get the texture. For me it actually returns true atm. Is it just me?
Code:
/run for k, v in pairs({GearManagerDialogPopup:GetRegions()}) do if v.GetTexture then print(v:GetTexture(), v:IsShown(), v:IsVisible()) end end


(Edit) You were right, in #wowuidev they said it was fixed so that at least the texture path/fileID returns correctly if released/hidden

Last edited by Ketho : 07-06-16 at 12:26 PM.
 
 

WoWInterface » Site Forums » Archived Beta Forums » Legion Beta archived threads » GetTexture() returns nil on certain texture objects

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