Thread Tools Display Modes
03-10-10, 02:15 AM   #1
Waverian
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 188
Layout won't load on first login.

As in, Blizzard frames aren't unregistered and my oUF frames don't exist. This only occurs on the very first world enter immediately following a fresh login. A UI reload fixes it. Logging out and then back in (to that character or any other) also fixes it. I've created dozens of layouts at various points in time and just starting experiencing this with my last two layouts, probably since about a week ago.

I have tried some debugging, mostly using a print call in the main body of the lua file as well as my layout function. On the first login, the layout function is never called. The global oUF object does exist at this time.

This occurs with oUF versions 1.3.28 and 1.3.26. I haven't tried others because of the sheer annoyance involved with tracking this bug down.

And that's about all I can think of that's relevant. The layout is relatively simple because of its infancy so I've included it following. Is this some error on my part and/or how can I go about solving this?

Code:
## Interface: 30300
## Title: oUF_Indulgent
## Author: Magss
## Notes: It really is.
## Dependencies: oUF

layout.lua
lua Code:
  1. -- MOVE TO TAGS FILE
  2. local Truncate = function(num)
  3.     if num > 1e6 then
  4.         return format('%.1fM', num / 1e6)
  5.     elseif num > 1e4 then
  6.         return format('%.1fK', num / 1e3)
  7.     end
  8.     return num
  9. end
  10.  
  11. oUF.TagEvents['[Indulgent.CurHP]'] = 'UNIT_HEALTH'
  12. oUF.Tags['[Indulgent.CurHP]'] = function(unit)
  13.     return Truncate(UnitHealth(unit))
  14. end
  15.  
  16. oUF.TagEvents['[Indulgent.PercHP]'] = 'UNIT_HEALTH UNIT_HEALTH_MAX'
  17. oUF.Tags['[Indulgent.PercHP]'] = function(unit)
  18.     local percent = UnitHealth(unit) / UnitHealthMax(unit)
  19.     local r, g, b = oUF.ColorGradient(percent, unpack(oUF.colors.smooth))
  20.     return format('|cff%02x%02x%02x%d%%|r', r * 255, g * 255, b * 255, percent * 100)
  21. end
  22.  
  23. oUF.TagEvents['[Indulgent.Name]'] = 'UNIT_NAME UNIT_FACTION_UPDATE'
  24. oUF.Tags['[Indulgent.Name]'] = function(unit)
  25.     local r, g, b = 1, 1, 1
  26.     if UnitIsPlayer(unit) then
  27.         r, g, b = unpack(oUF.colors.class[select(2, UnitClass(unit))])
  28.     else
  29.         if not UnitIsFriend(unit, 'player') and UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit) then
  30.             r, g, b = unpack(oUF.colors.disconnected)
  31.         else
  32.             if UnitReaction(unit, 'player') then
  33.                 r, g, b = unpack(oUF.colors.reaction[UnitReaction(unit, 'player')])
  34.             end
  35.         end
  36.     end
  37.     return format('|cff%02x%02x%02x%s|r', r * 255, g * 255, b * 255, UnitName(unit))
  38. end
  39. ------------------
  40.  
  41. local Px = 1024 / GetScreenWidth() / GetCVar('UIScale') * .7
  42. local Texture1 = [[Interface\AddOns\oUF_Indulgent\HalF]] -- Health texture
  43. local Texture2 = [[Interface\AddOns\oUF_Indulgent\Ish00]] -- Power and misc. texture
  44. local Backdrop = {bgFile = [[Interface\ChatFrame\ChatFrameBackground]], insets = {left = -Px, right = -Px, top = -Px, bottom = -Px}}
  45.  
  46. local Colors = setmetatable({
  47.     power =  setmetatable({
  48.         MANA = {.38, .4, .72},
  49.         ENERGY = {.72, .72, .38},
  50.         RUNIC_POWER = {.38, .72, .69},
  51.         RAGE = {.72, .38, .38},
  52.     }, {__index = oUF.colors.power})
  53. }, {__index = oUF.colors})
  54.  
  55. local Factory = function(self, unit)
  56.     self:SetAttribute('initial-height', 24)
  57.     self:SetAttribute('initial-width', 180)
  58.    
  59.     self:SetBackdrop(Backdrop)
  60.     self:SetBackdropColor(0, 0, 0)
  61.    
  62.     self.colors = Colors
  63.    
  64.     -- I've created the frames in order of draw layer, from lowest to highest
  65.     -- It's not necessary but I think it improves readability.
  66.     self.Power = CreateFrame('StatusBar', nil, self)
  67.     self.Power.frequentUpdates = true
  68.     self.Power.colorPower = true
  69.     self.Power:SetStatusBarTexture(Texture2)
  70.     self.Power:SetAllPoints()
  71.    
  72.     self.Power.bg = self.Power:CreateTexture(nil, 'BACKGROUND')
  73.     self.Power.bg:SetTexture(Texture2)
  74.     self.Power.bg:SetVertexColor(.4, .4, .4)
  75.     self.Power.bg:SetAllPoints()
  76.    
  77.     self.HealthBackdrop = CreateFrame('Frame', nil, self)
  78.     self.HealthBackdrop:SetFrameLevel(3)
  79.     self.HealthBackdrop:SetBackdrop(Backdrop)
  80.     self.HealthBackdrop:SetBackdropColor(0, 0, 0)
  81.     self.HealthBackdrop:SetPoint('TOPLEFT', Px * 2, -Px * 2)
  82.     self.HealthBackdrop:SetPoint('BOTTOMRIGHT', -Px * 2, Px * 2)
  83.    
  84.     self.Health = CreateFrame('StatusBar', nil, self.HealthBackdrop)
  85.     self.Health:SetStatusBarTexture(Texture1)
  86.     self.Health:SetStatusBarColor(.18, .18, .18)
  87.     self.Health:SetAllPoints()
  88.    
  89.     self.Health.bg = self.Health:CreateTexture(nil, 'BACKGROUND')
  90.     self.Health.bg.multiplier = .5
  91.     self.Health.bg:SetTexture(Texture1)
  92.     self.Health.bg:SetVertexColor(.25, .25, .25)
  93.     self.Health.bg:SetAllPoints()
  94.    
  95.     if unit == 'player' then
  96.    
  97.     elseif unit == 'target' then
  98.         self.Health.perc = self.Health:CreateFontString(nil, 'ARTWORK', 'GameFontNormalLarge')
  99.         self.Health.perc:SetPoint('RIGHT', -1, 1)
  100.         self:Tag(self.Health.perc, '[Indulgent.PercHP]')
  101.    
  102.         self.Header = CreateFrame('Frame', nil, self)
  103.         self.Header:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', 0, Px * 3)
  104.         self.Header:SetPoint('TOPRIGHT', 0, 16)
  105.         self.Header:SetBackdrop(Backdrop)
  106.         self.Header:SetBackdropColor(0, 0, 0)
  107.        
  108.         self.Header.bg = self.Header:CreateTexture(nil, 'LOW')
  109.         self.Header.bg:SetTexture(Texture2)
  110.         self.Header.bg:SetVertexColor(.15, .15, .15)
  111.         self.Header.bg:SetAllPoints()
  112.        
  113.         self.Name = self.Header:CreateFontString(nil, 'ARTWORK', 'GameFontNormalSmall')
  114.         self.Name:SetPoint('LEFT', 2, 1)
  115.         self:Tag(self.Name, '[Indulgent.Name]')
  116.     end
  117. end
  118.  
  119. oUF:RegisterStyle('Indulgent', Factory)
  120. oUF:SetActiveStyle('Indulgent')
  121.  
  122. oUF:Spawn('player', 'oUF_Indulgent_Player'):SetPoint('CENTER', -230, -200)
  123. oUF:Spawn('target', 'oUF_Indulgent_Target'):SetPoint('CENTER', 0, -200)
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Layout won't load on first login.


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