WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   oUF and Ace Profiles (https://www.wowinterface.com/forums/showthread.php?t=37274)

Lyelu 12-02-10 07:33 AM

oUF and Ace Profiles
 
Hi,
Having an error with oUF layout that has Ace profiles in the config. I have it set up like so:

Code:

Henna = LibStub("AceAddon-3.0"):NewAddon("Henna", "AceConsole-3.0", "AceEvent-3.0")

function Henna:OnInitialize()
    self.db = LibStub("AceDB-3.0"):New("HennaDB", defaults, "Default")
    self.db.RegisterCallback(self, "OnProfileChanged", "UpdateDisplay")
    self.db.RegisterCallback(self, "OnProfileCopied", "UpdateDisplay")
    self.db.RegisterCallback(self, "OnProfileReset", "UpdateDisplay")
    --Options
    LibStub("AceConfig-3.0"):RegisterOptionsTable("Henna-Options", Henna_Options)
    self.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("Henna-Options", "Henna")
    -- Profiles
    LibStub("AceConfig-3.0"):RegisterOptionsTable("Henna-Profiles", LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db))
    self.profilesFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("Henna-Profiles", "Profiles", "Henna") 
end
function Henna:OnEnable() 
    self:SpawnCore()
end
function Henna:UpdateDisplay()
    self:SpawnCore()
end

function Henna:SpawnCore(self)
    oUF:RegisterStyle("HennaPlayer", LayoutPlayer)
    oUF:SetActiveStyle("HennaPlayer")
    oUF:Spawn("player", "oUF_player")
 
    oUF:RegisterStyle("HennaTarget", LayoutTarget)
    oUF:SetActiveStyle("HennaTarget")
    oUF:Spawn("target", "oUF_target")
 
    oUF:RegisterStyle("HennaPet", LayoutPet)
    oUF:SetActiveStyle("HennaPet")
    oUF:Spawn("pet", "oUF_pet")
end

The problem is, when switching profiles, it should not try to re-register the oUF styles, because that makes an error. In oUF.lua, function oUF:RegisterStyle it provokes the error that says "Style already registered."

UpdateDisplay is called when changing profiles. So I removed the line in UpdateDisplay for Spawn Core, but then nothing at all happens. Is there a function I can call to redraw the oUF objects, which is not SpawnCore?

haste 12-02-10 09:06 AM

You have to do some of that updating yourself. The rest you can do through :UpdateAllElements().

Lyelu 12-03-10 11:18 AM

I tried and still end up with two healthbars per unit... What would you suggest that I attach that function to exactly?


All times are GMT -6. The time now is 09:42 PM.

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