Quantcast
StatusTrackingBarManager - WoWInterface
Thread Tools Display Modes
04-30-22, 10:10 AM   #1
Vurse
A Defias Bandit
Join Date: Jan 2022
Posts: 2
StatusTrackingBarManager

Is there a simple code I could add to my addon that prevents the StatusTrackingBar (Honor Bar, EXP Bar, Rep Bar etc, StatusTrackingBarManager controls all of these I believe) from moving the action bars and stance buttons without having to reanchor everything to UI Parent and stuff. I've also tried UnregisterAllEvents which seemed to work but when the bar updated (combat etc) it broke
  Reply With Quote
05-03-22, 12:57 PM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,657
An existing addon ? Probably one of the action bar addons maybe has something. Otherwise ...

Looking at the blizzard code it looks like the MainMenuBar is also doing something to put things back.

https://www.townlong-yak.com/framexm...ainMenuBar.lua
https://www.townlong-yak.com/framexm...ingManager.lua

StatusTrackingManagerMixin:UpdateBarsShown is executed after any statusbar event is triggered
StatusTrackingManagerMixin:LayoutBars(visBars) is called at the end of that function
which calls self:GetParent():OnStatusBarsUpdated() which is MainMenuBarMixin:OnStatusBarsUpdated()
which then calls MainMenuBarMixin:SetPositionForStatusBars()

LayoutBars essentially repositions the bars in line with their parents position which by default is the MainMenuBar. So outside of re-parenting and dealing with any issues arising outside of that you might be able to hook into StatusTrackingManagerMixin:LayoutBar(bar, barWidth, isTopBar, isDouble) and reset the layout of each bar as you wish it to be.

I haven't played with mixin overriding to know if it is possible though.
__________________
  Reply With Quote
05-03-22, 05:18 PM   #3
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,092
Originally Posted by Xrystal View Post
LayoutBars essentially repositions the bars in line with their parents position which by default is the MainMenuBar. So outside of re-parenting and dealing with any issues arising outside of that you might be able to hook into StatusTrackingManagerMixin:LayoutBar(bar, barWidth, isTopBar, isDouble) and reset the layout of each bar as you wish it to be.
Not completely true. The repositioning is further down the line at MainMenuBarMixin:SetPositionForStatusBars(). It queries StatusTrackingBarManager:GetNumberVisibleBars() and sets .yOffset accordingly. UIParent_ManageFramePositions() (frontend for FramePositionDelegate:UIParentManageFramePositions()) reads .yOffset and is the one responsible for moving the frame. This process is susceptible to taint, so manipulating .yOffset will throw errors in combat.

It is possible to stop this by nuking MainMenuBarMixin:SetPositionForStatusBars(). As MainMenuBar is already instantiated, changing MainMenuBarMixin won't do anything. You'll have to modify MainMenuBar:SetPositionForStatusBars() instead.
Code:
 MainMenuBar.SetPositionForStatusBars=function() end;


Note UIParent_ManageFramePositions() will still try to move MainMenuBar whenever any other part of the UI calls it. Since MainMenuBarMixin:SetPositionForStatusBars() would no longer be changing .yOffset, it'll always snap the the same spot. If you want to set your own anchor, the code block at UIParent.lua:3340 allows bypassing this by setting MainMenuBar as user-placed.
Lua Code:
  1. MainMenuBar:SetMovable(true);-- Required for :SetUserPlaced()
  2. MainMenuBar:SetUserPlaced(true);--  Set user-placed flag

While :SetMovable() does allow dragging frames and sizing them, this doesn't happen unless :StartMoving() or :StartSizing() is called. This doesn't happen for MainMenuBar.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 05-03-22 at 05:21 PM.
  Reply With Quote
05-16-22, 06:52 AM   #4
Vurse
A Defias Bandit
Join Date: Jan 2022
Posts: 2
Thank you both for the help, the snippets you provided SDPhantom worked. Thank you so much again I think I was trying to overcomplicate it.. but then again the WoW API is somewhat a mess at least to me. <3

Also this is what I use now and it seems to work perfectly.

Lua Code:
  1. MainMenuBar:SetMovable(true); --Required for :SetUserPlaced()
  2. MainMenuBar:SetUserPlaced(true); --Set user-placed flag
  3. MainMenuBar.SetPositionForStatusBars=function() end;
  4. StatusTrackingBarManager:Hide()
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » StatusTrackingBarManager

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