WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Legion Beta archived threads (https://www.wowinterface.com/forums/forumdisplay.php?f=177)
-   -   Disable releaseUITextures cvar (https://www.wowinterface.com/forums/showthread.php?t=53795)

Ketho 06-29-16 01:39 PM

Disable releaseUITextures cvar
 
This is kind of a follow-up to this thread: GetTexture() returns nil on unloaded textures

I've been trying to update LargerMacroIconSelection for the Equipment Manager icons too, but you have to show the parent frame(s) first in order to get the textures
  • At first I tried showing and hiding it, but then it would give an error
    Lua Code:
    1. CharacterFrame:Show()
    2. GearManagerDialogPopup:Show()
    3.  
    4. for _, child in ipairs(regions) do
    5.     if child.GetTexture then
    6.         if child:GetTexture() == "Interface\\MacroFrame\\MacroPopup-TopLeft.blp" then
    7.             -- dostuff
    8.         end
    9.     end
    10. end
    11.  
    12. CharacterFrame:Hide()
    13. GearManagerDialogPopup:Hide()
    Code:

    Message: ..\FrameXML\CharacterFrame.lua line 191:
      attempt to perform arithmetic on a nil value

    _
  • Then I tried ToggleCharacter("PaperDollFrame"), but it would throw errors on login

    Lua Code:
    1. ToggleCharacter("PaperDollFrame")
    2. GearManagerDialogPopup:Show()
    3.  
    4. for _, child in ipairs(regions) do
    5.     if child.GetTexture then
    6.         if child:GetTexture() == "Interface\\MacroFrame\\MacroPopup-TopLeft.blp" then
    7.             -- dostuff
    8.         end
    9.     end
    10. end
    11.  
    12. ToggleCharacter("PaperDollFrame")
    13. GearManagerDialogPopup:Hide()
    Code:

    Message: ..\FrameXML\PaperDollFrame.lua line 1727:
      Usage: GetSpecializationRole(specIndex[, isInspect[, isPet]])

    _
  • Now that I fail to work around it, my last resort is to just disable the releaseUITextures CVar
    But since Blizzard wants UI textures to be freed up when not visible, can I get away with doing that?

    Would the increase in memory (or any performance hit) be significant?
    Lua Code:
    1. if GetCVar("releaseUITextures") == "1" then
    2.     SetCVar("releaseUITextures", 0)
    3.     -- ask the user if they want to do a /reload
    4.     -- for releaseUITextures to be properly disabled, so we can grab our textures
    5. end

* I haven't yet checked into setting it up once the GearManagerDialogPopup is actually being shown, instead of at player login. Maybe that will also work...

Ketho 06-29-16 11:35 PM

Quote:

Originally Posted by Ketho (Post 316070)
* I haven't yet checked into setting it up once the GearManagerDialogPopup is actually being shown, instead of at player login. Maybe that will also work...

... and that worked. I guess you have to use more hooks as a workaround :(

But I honestly wonder if it's considered acceptable to just disable releaseUITextures

Completely useless snippet:
Lua Code:
  1. local f = CreateFrame("Frame")
  2. local active = {}
  3.  
  4. function f:SetHook(sf)
  5.     local popup = sf:GetParent()
  6.     popup:HookScript("OnShow", function()
  7.         if active[sf] then
  8.             return
  9.         else
  10.             self:Init(sf)
  11.             active[sf] = true
  12.         end
  13.     end)
  14. end
  15.  
  16. function f:OnEvent(event, addon)
  17.     if addon == "LargerMacroIconSelection" then
  18.         self:SetHook(GearManagerDialogPopupScrollFrame)
  19.     elseif addon == "Blizzard_MacroUI" then
  20.         self:SetHook(MacroPopupScrollFrame)
  21.     end
  22. end
  23.  
  24. f:RegisterEvent("ADDON_LOADED")
  25. f:SetScript("OnEvent", f.OnEvent)

Gello 06-30-16 03:15 AM

imho addons should not change any cvar unless the purpose of the addon is to change those settings (turning something on/off) or a feature absolutely requires it (such as scriptProfile).

When addons take it upon themselves to tweak underlying console settings, it can affect the behavior of the UI or other addons that aren't related. Maybe that's an intended effect and in that case it's okay. Otherwsie imho it's better to exhaust all possible alternatives first, even if it means a little extra code to avoid taking a shortcut through the user's system settings. Like in your situation as a last resort I would've just built a separate dialog to replace the default's; it would not be a great deal of code and it would be a lot kinder to the user than tinkering with their system settings.

It's also neat and tidy when all traces of an addon are gone when an addon is disabled. It's messy when there's lingering stuff left over. And for this new cvar, which is not really related to the addon's purpose, the user would've likely forgetten all about that dialog asking about the cvar and it'd still be disabled for them for many years afterwards.

Another workaround for not being able to rely on GetTexture is to hook the SetTexture method on the texture.

Ketho 06-30-16 06:04 AM

Quote:

Originally Posted by Gello (Post 316079)
imho addons should not change any cvar unless the purpose of the addon is to change those settings (turning something on/off) or a feature absolutely requires it (such as scriptProfile).


Okay, I understand it can be a pain to find out why suddenly a cvar had changed after using some addon. Will try to keep my hands off that cvar and work around it

syncrow 06-30-16 03:31 PM

fixed my EMS for legion, and also came up with hooking:OnShow

Nevcairiel 07-06-16 11:59 AM

Note that releaseUITextures was removed in a recent beta build and defaults to "on".
The bug that caused texture filenames to not be returned on hidden textures has however been fixed, and that informaiton is now always available.


All times are GMT -6. The time now is 02:13 AM.

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