WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Legion Beta archived threads (https://www.wowinterface.com/forums/forumdisplay.php?f=177)
-   -   GetTexture() returns nil on certain texture objects (https://www.wowinterface.com/forums/showthread.php?t=53459)

Ketho 05-18-16 02:22 PM

GetTexture() returns nil on unloaded textures
 
1 Attachment(s)
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

Ketho 05-18-16 02:39 PM

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

lucro 05-18-16 03:33 PM

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()

Ketho 05-18-16 04:21 PM

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


lucro 05-18-16 04:28 PM

Yeah, hopefully it gets changed back to the way it works on live, but that seems the way to go currently.

Predicate 05-18-16 04:57 PM

Seems intentional, I doubt it will be removed. See CVar releaseUITextures: "Release Hidden UI Textures by default"

dssd 07-06-16 09:45 AM

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.

Ketho 07-06-16 10:29 AM

Quote:

Originally Posted by dssd (Post 316213)
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

dssd 07-06-16 10:54 AM

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.

Ketho 07-06-16 11:42 AM

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? :confused:
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


All times are GMT -6. The time now is 03:36 PM.

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