WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   manage default Blizzard UI (https://www.wowinterface.com/forums/showthread.php?t=57047)

gmarco 03-10-19 04:12 AM

manage default Blizzard UI
 
Hi all,

a friend of mine which plays with plain Blizzard UI have asked me if I can arrange it better without too many addons.

So I started working on it mainly removing elements and using some custom textures.

Everyting is almost done but I have some iussue I am not able to solve.

I starting creating a frame:

Lua Code:
  1. local frame = CreateFrame("Frame")
  2. frame:RegisterEvent("ADDON_LOADED")
  3. frame:RegisterEvent("PLAYER_ENTERING_WORLD")
  4. frame:SetScript("OnEvent", function(self, event, arg1)
  5.  
  6. -- [...]
  7.  
  8.     if event == "PLAYER_ENTERING_WORLD" then
  9.  
  10.     -- here I begin to remove / hide or setalpha(0) various part of UI ...


1) I am trying to remove the PVPIcon from the Player, Target (and optionally party) but it seems to me that this icon as an "immutable" flag and don't want to disappears :)

I have used:
Lua Code:
  1. PartyMemberFrame1PVPIcon:SetAlpha(0)
  2. PartyMemberFrame2PVPIcon:SetAlpha(0)
  3. PartyMemberFrame3PVPIcon:SetAlpha(0)
  4. PartyMemberFrame4PVPIcon:SetAlpha(0)
  5. FocusFrameTextureFramePVPIcon:SetAlpha(0)
  6. TargetFrameTextureFramePVPIcon:SetAlpha(0)
  7. PlayerPVPIcon:SetAlpha(0)
  8. PlayerPVPTimerText:SetAlpha(0)

Also used from the chat with something like:
/run PlayerPVPIcon:SetAlpha(0)

Seems to not work. (I have tried also with :Hide() ) The icon remain there :(
The frame name is right (I got it with /fstack).

(only the PlayerPVPTimerText:SetAlpha(0) seems to work)

2) Second iussue is:
I am not able to:

Lua Code:
  1. MultiBarRight:SetScale(0.7)
  2. MultiBarLeft:SetScale(0.7)

... even if this works nicely from console:
/run MultiBarLeft:SetScale(0.7)

But this works ONLY IF the bar is visible and enable / disable it from ESC --> Interface --> ActionBars make the scale back to default of 1.


If I use something found on this forum:
https://www.wowinterface.com/forums/...ad.php?t=56469

Lua Code:
  1. hooksecurefunc(MultiBarRight, "SetScale", function(self, scale)
  2.     self:SetScale(0.7)
  3. end)
  4.  
  5. hooksecurefunc(MultiBarLeft, "SetScale", function(self, scale)
  6.     self:SetScale(0.7)
  7. end)


The bars are properly scaled but they produce errors in doing this:

Lua Code:
  1. 5x C stack overflow
  2. [C]: in function `SetScale'
  3. gmTweaks\core.lua:499: in function <gmTweaks\core.lua:498>
  4. [C]: in function `SetScale'
  5. gmTweaks\core.lua:499: in function <gmTweaks\core.lua:498>
  6. [C]: in function `SetScale'
  7. gmTweaks\core.lua:499: in function <gmTweaks\core.lua:498>
  8. [C]: in function `SetScale'
  9. gmTweaks\core.lua:499: in function <gmTweaks\core.lua:498>
  10. [C]: in function `SetScale'
  11. gmTweaks\core.lua:499: in function <gmTweaks\core.lua:498>
  12. [C]: in function `SetScale'
  13. gmTweaks\core.lua:499: in function <gmTweaks\core.lua:498>
  14. ...
  15. gmTweaks\core.lua:499: in function <gmTweaks\core.lua:498>
  16. [C]: in function `SetScale'
  17. gmTweaks\core.lua:499: in function <gmTweaks\core.lua:498>
  18. [C]: in function `SetScale'
  19. gmTweaks\core.lua:499: in function <gmTweaks\core.lua:498>
  20. [C]: in function `SetScale'
  21. FrameXML\MultiActionBars.lua:85: in function `MultiActionBar_Update'
  22. FrameXML\InterfaceOptionsPanels.lua:1184: in function `InterfaceOptions_UpdateMultiActionBars'
  23. [string "*:OnLoad"]:4: in function `setFunc'
  24. FrameXML\InterfaceOptionsPanels.lua:1154: in function <FrameXML\InterfaceOptionsPanels.lua:1147>
  25.  
  26. Locals:
  27. (*temporary) = MultiBarRight {
  28.  0 = <userdata>
  29.  SetScale = <function> defined =[C]:-1
  30.  slideOut = <unnamed> {
  31.  }
  32. }
  33. (*temporary) = 0.700000
  34. (*temporary) = <function> defined =[C]:-1
  35. (*temporary) = MultiBarRight {
  36.  0 = <userdata>
  37.  SetScale = <function> defined =[C]:-1
  38.  slideOut = <unnamed> {
  39.  }
  40. }
  41. (*temporary) = 0.700000
  42.  = <function> defined =[C]:-1
  43.  = <function> defined @gmTweaks\core.lua:498

In the forum thread Seerah pointed out the problem could be better analyzed here:
https://www.wowinterface.com/forums/...ad.php?t=56445

But unfortunately I was unable to understand the solution :(
Can someone please explain it simpler :)

Thanks all.

Fizzlemizz 03-10-19 08:44 AM

You shouldn't need to create a frame and wait for an event as these frames are created/placed before addons are loaded.

Something like:
Lua Code:
  1. local function MoveIt(frame)
  2.     frame:ClearAllPoints()
  3.     frame:SetPoint("BOTTOMRIGHT", UIParent, "TOPRIGHT", -10, 10)
  4. end
  5. MoveIt(PlayerPVPIcon)
  6. MoveIt(FocusFrameTextureFramePVPIcon)
  7. MoveIt(TargetFrameTextureFramePVPIcon)
  8. for i= 1, 4 do
  9.     MoveIt(_G["PartyMemberFrame"..i.."PVPIcon"])
  10. end
  11. MultiBarRight:SetScale(0.7)
  12. MultiBarRight.SetScale = function() end
  13. MultiBarLeft:SetScale(0.7)
  14. MultiBarLeft.SetScale = function() end

gmarco 03-10-19 10:18 AM

Hi Fizzlemizz,

thanks so much for your reply.

The problem 2) was solved using your code.
The MultiBarRight and MultiBarLeft are now ok :)


But the damn icon of the problem 1) don't want to go away :)


Also by console it doesn't work.

Any ideas ?

Thanks so much.

Fizzlemizz 03-10-19 11:58 AM

Code:

PlayerPrestigePortrait:SetAlpha(0)
PlayerPrestigeBadge:SetAlpha(0)
TargetFrameTextureFramePrestigePortrait:SetAlpha(0)
TargetFrameTextureFramePrestigeBadge:SetAlpha(0)

frameTextureFramePrestigePortrait and frameTextureFramePrestigeBadge can be used for other target frames (ToT, Focus etc)

I'm not sure which party frame icon(s) you mean.

gmarco 03-10-19 01:50 PM

Hi Fizzlemizz,

At the end the problem was easier than I thought and thanks to your input I succeded in remove the very ugly PVP Icons and others goodies :)

Probably when I used /fstack I missed some frames, because now a "simple":

Lua Code:
  1. -- Remove PVP Icon
  2. PlayerPVPIcon:SetAlpha(0)
  3. PlayerPVPTimerText:SetAlpha(0)
  4. PlayerPrestigePortrait:SetAlpha(0)
  5. PlayerPrestigeBadge:SetAlpha(0)
  6.  
  7. TargetFrameTextureFramePVPIcon:SetAlpha(0)
  8. TargetFrameTextureFramePrestigePortrait:SetAlpha(0)
  9. TargetFrameTextureFramePrestigeBadge:SetAlpha(0)
  10.  
  11. FocusFrameTextureFramePVPIcon:SetAlpha(0)
  12. FocusFrameTextureFramePrestigePortrait:SetAlpha(0)
  13. FocusFrameTextureFramePrestigeBadge:SetAlpha(0)
  14.  
  15. for i= 1, 4 do
  16.     _G["PartyMemberFrame"..i.."PVPIcon"]:SetAlpha(0)
  17. end

Seems to work :)

P.s.
But it is better for this kind of skinning use Hide() or SetAlpha(0) ?

Thanks again for the help.
It is much appreciated.

Fizzlemizz 03-10-19 02:55 PM

The game tends to show/hide these elements as required so using SetAlpha means you don't have to worry about doing anything when this happens. That and they aren't clickable frames. If the game resets their alpha at any stage, then you might have to re-think the approach.

gmarco 03-13-19 12:32 AM

Hi again,

I need help again trying to understand an error that I got because I am unable to find why it happens.

I got this when I am in combat and something changes in the ObjectiveTracker:

Lua Code:
  1. 1x [ADDON_ACTION_BLOCKED] AddOn 'gmSimpleUI' tried to call the protected function 'VerticalMultiBarsContainer:SetSize()'.
  2. !BugGrabber\BugGrabber.lua:519: in function <!BugGrabber\BugGrabber.lua:519>
  3. [C]: in function `SetSize'
  4. FrameXML\MultiActionBars.lua:89: in function `MultiActionBar_Update'
  5. FrameXML\ActionBarController.lua:169: in function `ValidateActionBarTransition'
  6. FrameXML\ActionBarController.lua:137: in function `ActionBarController_UpdateAll'
  7. FrameXML\ActionBarController.lua:62: in function <FrameXML\ActionBarController.lua:51>
  8.  
  9. Locals:
  10. InCombatSkipped

But I don't use:

VerticalMultiBarsContainer:SetSize()

in any place.

I use only:
Lua Code:
  1. MultiBarRight:SetScale(0.8)
  2. MultiBarRight.SetScale = function() end
  3.  
  4. MultiBarLeft:SetScale(0.8)
  5. MultiBarLeft.SetScale = function() end

as Fizzlemizz suggests and it works great.

I think the error is related to the anchor and combat ... but I was unable to fix it.

Any Help ?
Thanks

Terenna 03-13-19 03:46 AM

It's not that you're tainting the :SetSize, it's that you're tainting SetScale()

The following code is found within MultiActionBar_Update()

Lua Code:
  1. local scale = 1;
  2.     if ( contentHeight > availableSpace ) then
  3.       scale = availableSpace / contentHeight;
  4.     end
  5.     MultiBarRight:SetScale(scale);
  6.     if ( showLeft ) then
  7.       MultiBarLeft:SetScale(scale);
  8.     end
  9.     VerticalMultiBarsContainer:SetSize(contentWidth * scale, contentHeight * scale)

The game tries to MultiBarRight:SetScale(), but you've set it to nil. So the game knows something is tainted. The very next function it calls is VerticalMultiBarsContainer:SetSize() which throws the taint error.

Try

Lua Code:
  1. MultiBarRight:hookscript('SetScale', function()
  2.      if MultiBarRight:GetScale() ~= 0.8 then
  3.           MultiBarRight:SetScale(0.8)
  4.      end
  5. end)

You might want to try and print debug that hookscript, GetScale may not return exactly 0.8, it may return like 0.799999999999 or something stupid. You might want to do

if MultiBarRight:GetScale() > 0.81 then MultiBarRight:SetScale(0.8) end

gmarco 03-13-19 01:34 PM

Hi,

Thanks very much for your answer ...

I have used :

Lua Code:
  1. MultiBarRight:HookScript('SetScale', function()
  2.     if MultiBarRight:GetScale() ~= 0.8 then
  3.         MultiBarRight:SetScale(0.8)
  4.     end
  5. end)


but unfortunately I got:

Lua Code:
  1. 1x gmSimpleUI\core.lua:52: MultiBarRight doesn't have a "SetScale" script
  2. [C]: in function `HookScript'
  3. gmSimpleUI\core.lua:52: in main chunk
  4.  
  5. Locals:
  6. (*temporary) = MultiBarRight {
  7.  0 = <userdata>
  8.  slideOut = <unnamed> {
  9.  }
  10. }
  11. (*temporary) = "SetScale"
  12. (*temporary) = <function> defined @gmSimpleUI\core.lua:52


I miss something ?

Thanks :)

Terenna 03-13-19 03:22 PM

try:

Lua Code:
  1. MultiBarRight:HookScript('OnSizeChanged', function()
  2.     if MultiBarRight:GetScale() > 0.81 then
  3.         MultiBarRight:SetScale(0.8)
  4.     end
  5. end)


All times are GMT -6. The time now is 05:36 AM.

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