WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   MainMenuBar glitches (https://www.wowinterface.com/forums/showthread.php?t=58650)

yess 03-26-21 12:22 PM

MainMenuBar glitches
 
I am trying to move the MainMenuBar above a libdatabroker display (ChocolateBar).

But the MainMenuBar is constantly reset somewhere in Blizzards code. Now I know that I can avoid this by setting it to user placed:

Code:

MainMenuBar:SetUserPlaced(true)
but that causes the MainMenuBar become non intractable after leaving a vehicle during combat.

I have tried to set it back to not user placed when entering a vehicle to avoid this (as does TitanPanel) but its still glitching sometimes if I enter a vehicle several times during a combat. Probably because UNIT_ENTERING_VEHICLE / UNIT_EXITED_VEHICLE also triggers PLAYER_REGEN_DISABLED and PLAYER_REGEN_DISABLED despite a continuous combat situation...

Has anyone more insight on what is going on with the MainMenuBar's placement in the first place? And why is it non clickable if SetUserPlaced is still true when entering/leaving a vehicle?

Seerah 03-26-21 12:28 PM

Doesn't ChocolateBar have this built in by using the Jostle library?

Tim 03-26-21 01:42 PM

Quote:

Originally Posted by yess (Post 338701)
I am trying to move the MainMenuBar above a libdatabroker display (ChocolateBar).

But the MainMenuBar is constantly reset somewhere in Blizzards code. Now I know that I can avoid this by setting it to user placed



Try also adding this:
Code:

        MainMenuBar:SetMovable(true)
        MainMenuBar.ignoreFramePositionManager = true


Xrystal 03-26-21 03:55 PM

nUI hooks into various functions after Blizzard does its stuff to move things back to where we want them.

-- Reparent, move and allow user placement changes made here
hooksecurefunc("UpdateMicroButtonsParent",....)

-- Used for scaling buttons to our chosen size
hooksecurefunc("MoveMicroButtons", ...)

-- Used to adjust placement of the arrow tip added to "MicroButtons" info system
hooksecurefunc(HelpTip,"Show",....)

Not sure if any of them will help you with what you want to do but you never know.

yess 03-26-21 04:41 PM

Quote:

Originally Posted by Seerah (Post 338702)
Doesn't ChocolateBar have this built in by using the Jostle library?

It used to, I tried to maintain it since 2016, but eventually I stopped because I did to not want to cause glitches for others using the lib.

Quote:

Originally Posted by Tim (Post 338703)
Try also adding this:
Code:

        MainMenuBar:SetMovable(true)
        MainMenuBar.ignoreFramePositionManager = true


Thanks I will try that!

Quote:

Originally Posted by Xrystal (Post 338705)
nUI hooks into various functions after Blizzard does its stuff to move things back to where we want them.

-- Reparent, move and allow user placement changes made here
hooksecurefunc("UpdateMicroButtonsParent",....)

-- Used for scaling buttons to our chosen size
hooksecurefunc("MoveMicroButtons", ...)

-- Used to adjust placement of the arrow tip added to "MicroButtons" info system
hooksecurefunc(HelpTip,"Show",....)

Not sure if any of them will help you with what you want to do but you never know.

Thanks I will look into this and nUI :)

yess 03-28-21 04:16 PM

Code:

MainMenuBar.ignoreFramePositionManager = true
did not help much unfortunately. The MainMenuBar would still be reset constantly.

The glithc with the MainMenuBar not being clickable was that when I call

Code:

MainMenuBar:SetUserPlaced(true)
Blizzards code then does not properly set the MainMenuBar after leaving a vehicle but it is shown, as not clickable. MainMenuBar:GetRight() returns nil then. Maybe it is still hidden. I actually can fix it with setting its points.

Code:

MainMenuBar:SetPoints(...
But only after combat ends of course, so that is not a fix.

Anyway, the fix I came up with was to set SetUserPlaced back to false when entering a vehicle. And if in combat then wait until end of combat before moving the MainMenuBar and setting SetUserPlaced to true again.

What I missed though is that that I used the event UNIT_ENTERING_VEHICLE to set SetUserPlaced(false). But that is too early because PLAYER_REGEN_ENABLED is triggered after that despite still in combat and I had that hocked to call SetUserPlaced(true) again.... :D

Xrystal 03-28-21 05:50 PM

If you want to catch changes to combat mode to apply settings before combat then I would use PLAYER_REGEN_DISABLED and then reverse it out on PLAYER_REGEN_ENABLED.

I use these to stop interactions during combat that players may be tempted to do or to minimise/hide non combat windows during combat. PLAYER_REGEN_DISABLED may trigger after UNIT_ENTERING_VEHICLE or before. Similarly PLAYER_REGEN_ENABLED may trigger before UNIT_EXITING_VEHICLE or after.

Not too much helpful but they may be events you hadn't considered before.

Taudier 03-29-21 03:06 AM

this question came many times, here is an addon https://www.wowinterface.com/downloa...inMenuBar.html

yess 03-29-21 08:24 AM

Quote:

Originally Posted by Xrystal (Post 338717)
If you want to catch changes to combat mode to apply settings before combat

No that is not what I want.

Quote:

Originally Posted by Xrystal (Post 338717)
PLAYER_REGEN_DISABLED may trigger after UNIT_ENTERING_VEHICLE or before. Similarly PLAYER_REGEN_ENABLED may trigger before UNIT_EXITING_VEHICLE or after.

You misunderstood. Yes these events can fire after you entered and vehicle if your combat status changes.
The interesting part is that they trigger EVERY time when you enter a vehicle DURING a combat situation.

So the sequence of of the events when entering a vehicle is:

Player not in combat:
UNIT_ENTERING_VEHICLE
UNIT_ENTERED_VEHICLE

Player pulls and after that enters a vehicle:

PLAYER_REGEN_DISABLED <-- player pulled
UNIT_ENTERING_VEHICLE
PLAYER_REGEN_ENABLED --> this here caused my function MoveAndLockMainMenuBar() (called by a timer), to occasionally set MainMenuBar:SetUserPlaced(true) as InCombatLockDown() and UnitInVehicle("Player") booth returns false! In this stage!
PLAYER_REGEN_DISABLED
UNIT_ENTERED_VEHICLE
...
UNIT_EXITING_VEHICLE
... --blizzards code repositions the MainMenuBar and it breaks due to MainMenuBar:SetUserPlaced(true)
UNIT_EXITED_VEHICLE
PLAYER_REGEN_ENABLED (combat actually ended and we are not in a vehicle) --> MoveAndLockMainMenuBar()

Quote:

Originally Posted by Xrystal (Post 338717)
Not too much helpful but they may be events you hadn't considered before.

Yeah, I ended up using UNIT_EXITING_VEHICLE to unlock the action bar:

Code:

function ChocolateBar:UNIT_EXITING_VEHICLE()
        MainMenuBar:SetMovable(true)
        MainMenuBar:SetUserPlaced(false)
        MainMenuBar:SetMovable(false)
end

-- between these events blizzards code will reposition the MainMenuBar
-- and as SetUserPlaced is false, it will not break

function ChocolateBar:UNIT_EXITED_VEHICLE()
        -- MoveAndLockMainMenuBar()
        -- this will schedule the repositioning and check every n seconds if combat has ended and it is save to move the bar again
        self:Refresh(MainMenuBar, PlayerFrame)
end

The downside is that until combat ends the action bar (MainMenuBar) will continue to be positioned wrong (bottom at the screen above the bottom ChocolateBar).

Easy fix for my initial problem but what a headache to find this out

yess 03-29-21 08:25 AM

Quote:

Originally Posted by Taudier (Post 338719)
this question came many times, here is an addon https://www.wowinterface.com/downloa...inMenuBar.html

Not sure what this does. I do not understand the description of that mod.


All times are GMT -6. The time now is 04:27 PM.

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