Hi guys,
I tried adding a visibility state driver to my player unitframe.
I cannot get it to work.
Lua Code:
--show/hide the frame on a given state driver
if cfg.frameVisibility then
frame.frameVisibility = cfg.frameVisibility
frame.frameVisibilityFunc = cfg.frameVisibilityFunc
RegisterStateDriver(frame, cfg.frameVisibilityFunc or "visibility", cfg.frameVisibility)
end
What am I missing?
Wierdly enough if I enter /run oUF_SimplePlayer:Hide() into chat it pops right back up.
I use the following modifier on my actionbar which works just fine:
Lua Code:
frameVisibility = "[combat][modifier][@target,exists] show; hide"
How do I register a custom visibility state driver on oUF unit frames?
I tried adding a seperate state handler frame. The handler is working properly. The show/hide has an effect according to the chat output but the visual effect is not there. The player frame stays visible.
Lua Code:
--show/hide player frame on state change
local player = oUF:Spawn("player", A.."Player")
local frame = CreateFrame("frame",nil,nil,"SecureHandlerStateTemplate")
frame:SetFrameRef("player", player)
frame:SetAttribute("_onstate-combat", [=[
player = self:GetFrameRef("player")
print(newstate,player:GetName())
if newstate == "show" then
player:Show()
print(player:IsShown())
else
player:Hide()
print(player:IsShown())
end
]=])
RegisterStateDriver(frame, "combat", "[target,exists][modifier] show; hide")
I added this:
Lua Code:
hooksecurefunc(player, 'Show', function(self)
print("func call Show",self:GetName(),self:IsShown())
end)
It literally spams my chat with Show calls. What the heck is going on? The same is true for target if I have a target and the hook is applied to target aswell.