06-07-11, 07:27 AM | #1 |
Having problems spawning frames
Hello oUF community!
I've recently begun working on my own oUF layout, and I've encountered a problem: My frames won't show up I started out with oUF_Lily and stripped many of the things away, including castbar, auras and party. This is my code so far. It doesn't produce any errors, but doesn't spawn the frames either. Though if I create a party layout, fx with copy-pasting from oUF_Lily, then the party will show up, but not the player, target, ToT, etc. I'd appreciate it very much, if someone could point me in the right direction. Thanks.
__________________
- We Didn't Start the Flamewar - |
|
06-07-11, 08:08 AM | #2 |
UNIT_HAPPINESS has been removed from the API in 4.1 as well as GetPetHappiness so you can completely remove your UnitSpecific functions and any reference to hapiness, that would give you something like that :
Code:
--[[------------------------------------------------------------------------- Trond A Ekseth grants anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law. ---------------------------------------------------------------------------]] local TEXTURE = [[Interface\AddOns\oUF_Zynix\fer25]] local backdrop = {edgeFile = "Interface\\Buttons\\WHITE8x8", edgeSize = 1, inset = -1} -- Right Click Menu local dropdown = CreateFrame("Frame", "MyAddOnUnitDropDownMenu", UIParent, "UIDropDownMenuTemplate") UIDropDownMenu_Initialize(dropdown, function(self) local unit = self:GetParent().unit if not unit then return end local menu, name, id if UnitIsUnit(unit, "player") then menu = "SELF" elseif UnitIsUnit(unit, "vehicle") then menu = "VEHICLE" elseif UnitIsUnit(unit, "pet") then menu = "PET" elseif UnitIsPlayer(unit) then id = UnitInRaid(unit) if id then menu = "RAID_PLAYER" name = GetRaidRosterInfo(id) elseif UnitInParty(unit) then menu = "PARTY" else menu = "PLAYER" end else menu = "TARGET" name = RAID_TARGET_ICON end if menu then UnitPopup_ShowMenu(self, menu, unit, name, id) end end, "MENU") local menu = function(self) dropdown:SetParent(self) ToggleDropDownMenu(1, nil, dropdown, "cursor", 0, 0) end -- Tags local siValue = function(val) if(val >= 1e6) then return ("%.1f"):format(val / 1e6):gsub("%.", "m") elseif(val >= 1e4) then return ("%.1f"):format(val / 1e3):gsub("%.", "k") else return val end end oUF.Tags["zynix:deficit"] = function(unit) local min, max = UnitHealth(unit), UnitHealthMax(unit) if not UnitIsConnected(unit) then return "OFF" elseif UnitIsDead(unit) or UnitIsGhost(unit) then return "RIP" elseif(min ~= 0 and min ~= max) then return "-" .. siValue(max - min) else return end end oUF.TagEvents["zynix:deficit"] = oUF.TagEvents.missinghp oUF.Tags["zynix:power"] = function(unit) local min, max = UnitPower(unit), UnitPowerMax(unit) if(min == 0 or max == 0 or not UnitIsConnected(unit) or UnitIsDead(unit) or UnitIsGhost(unit) or min == max) then return else return siValue(min) end end oUF.TagEvents["zynix:power"] = oUF.TagEvents.missingpp local updateName = function(self, event, unit) if(self.unit == unit) then local r, g, b, t if(UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit) or not UnitIsConnected(unit)) then r, g, b = .6, .6, .6 elseif(UnitIsPlayer(unit)) then local _, class = UnitClass(unit) t = self.colors.class[class] else t = self.colors.reaction[UnitReaction(unit, "player")] end if(t) then r, g, b = t[1], t[2], t[3] end if(r) then self.Name:SetTextColor(r, g, b) end end end local PostUpdateHealth = function(Health, unit, min, max) if(UnitIsDead(unit) or UnitIsGhost(unit)) then Health:SetValue(0) end Health:SetStatusBarColor(.25, .25, .35) return updateName(Health:GetParent(), "PostUpdateHealth", unit) end local PostUpdatePower = function(Power, unit, min, max) local Health = Power:GetParent().Health if(min == 0 or max == 0 or not UnitIsConnected(unit)) then Power:SetValue(0) Health:SetHeight(22) elseif(UnitIsDead(unit) or UnitIsGhost(unit)) then Power:SetValue(0) Health:SetHeight(22) else Health:SetHeight(20) end end local RAID_TARGET_UPDATE = function(self, event) local index = GetRaidTargetIndex(self.unit) if(index) then self.RIcon:SetText(ICON_LIST[index].."22|t") else self.RIcon:SetText() end end local Shared = function(self, unit, isSingle) self.menu = menu self:SetScript("OnEnter", UnitFrame_OnEnter) self:SetScript("OnLeave", UnitFrame_OnLeave) -- XXX: Change to AnyUp when RegisterAttributeDriver doesn't cause clicks -- to get incorrectly eaten. self:RegisterForClicks"AnyDown" local Health = CreateFrame("StatusBar", nil, self) Health:SetHeight(20) Health:SetStatusBarTexture(TEXTURE) Health:GetStatusBarTexture():SetHorizTile(false) Health.frequentUpdates = true Health:SetPoint"TOP" Health:SetPoint"LEFT" Health:SetPoint"RIGHT" self.Health = Health local HealthBackground = Health:CreateTexture(nil, "BORDER") HealthBackground:SetAllPoints(self) HealthBackground:SetTexture(0, 0, 0, .5) Health.bg = HealthBackground local HealthPoints = Health:CreateFontString(nil, "OVERLAY") HealthPoints:SetPoint("RIGHT", -2, -1) HealthPoints:SetFontObject(GameFontNormalSmall) HealthPoints:SetTextColor(1, 1, 1) self:Tag(HealthPoints, "[zynix:deficit]") Health.value = HealthPoints self.HpBorder = CreateFrame("Frame", nil, Health) self.HpBorder:SetPoint("TOPLEFT", Health, "TOPLEFT", -1, 1) self.HpBorder:SetPoint("BOTTOMRIGHT", Health, "BOTTOMRIGHT", 1, -1) self.HpBorder:SetBackdrop(backdrop) self.HpBorder:SetBackdropBorderColor(0, 0, 0) self.HpBorder:SetFrameLevel(3) local Power = CreateFrame("StatusBar", nil, self) Power:SetHeight(2) Power:SetStatusBarTexture(TEXTURE) Power:GetStatusBarTexture():SetHorizTile(false) Power.frequentUpdates = true Power.colorTapping = true Power.colorClass = true Power.colorReaction = true Power:SetParent(self) Power:SetPoint"LEFT" Power:SetPoint"RIGHT" Power:SetPoint("TOP", Health, "BOTTOM", 0, -1) self.Power = Power local PowerPoints = Power:CreateFontString(nil, "OVERLAY") PowerPoints:SetPoint("RIGHT", HealthPoints, "LEFT", 0, 0) PowerPoints:SetFontObject(GameFontNormalSmall) PowerPoints:SetTextColor(1, 1, 1) self:Tag(PowerPoints, "[zynix:power]") Power.value = PowerPoints self.PpBorder = CreateFrame("Frame", nil, Power) self.PpBorder:SetPoint("TOPLEFT", Power, "TOPLEFT", -1, 1) self.PpBorder:SetPoint("BOTTOMRIGHT", Power, "BOTTOMRIGHT", 1, -1) self.PpBorder:SetBackdrop(backdrop) self.PpBorder:SetBackdropBorderColor(0, 0, 0) self.PpBorder:SetFrameLevel(3) local Leader = self:CreateTexture(nil, "OVERLAY") Leader:SetHeight(16) Leader:SetWidth(16) Leader:SetPoint("BOTTOM", Health, "TOP", 0, -5) self.Leader = Leader local MasterLooter = self:CreateTexture(nil, "OVERLAY") MasterLooter:SetHeight(16) MasterLooter:SetWidth(16) MasterLooter:SetPoint("LEFT", Leader, "RIGHT") self.MasterLooter = MasterLooter local RaidIcon = Health:CreateFontString(nil, "OVERLAY") RaidIcon:SetPoint("LEFT", 2, 4) RaidIcon:SetJustifyH"LEFT" RaidIcon:SetFontObject(GameFontNormalSmall) RaidIcon:SetTextColor(1, 1, 1) self.RIcon = RaidIcon self:RegisterEvent("RAID_TARGET_UPDATE", RAID_TARGET_UPDATE) table.insert(self.__elements, RAID_TARGET_UPDATE) local name = Health:CreateFontString(nil, "OVERLAY") name:SetPoint("LEFT", RaidIcon, "RIGHT", 0, -5) name:SetPoint("RIGHT", PowerPoints, "LEFT") name:SetJustifyH"LEFT" name:SetFontObject(GameFontNormalSmall) name:SetTextColor(1, 1, 1) self.Name = name Health.PostUpdate = PostUpdateHealth Power.PostUpdate = PostUpdatePower end oUF:RegisterStyle("Zynix", Shared) -- A small helper to change the style into a unit specific, if it exists. local spawnHelper = function(self, unit, ...) local object = self:Spawn(unit) object:SetPoint(...) end oUF:Factory(function(self) self:SetActiveStyle"Zynix" spawnHelper(self, "focus", "BOTTOM", 0, 140) spawnHelper(self, "pet", "BOTTOM", 0, 180) spawnHelper(self, "player", "BOTTOM", 0, 220) spawnHelper(self, "target", "BOTTOM", 0, 260) spawnHelper(self, "targettarget", "BOTTOM", 0, 300) end) |
|
06-07-11, 09:42 AM | #3 |
Ahh thanks, though it didn't make my frames spawn, oh well, I'll keep fiddling
Thanks for your help!
__________________
- We Didn't Start the Flamewar - |
|
06-07-11, 11:31 AM | #4 |
You don't give your frames any height/width/size. This is why they don't show up.
__________________
「貴方は1人じゃないよ」 |
|
06-07-11, 04:01 PM | #5 | |
Thanks, Haste
__________________
- We Didn't Start the Flamewar - |
||
WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Having problems spawning frames |
«
Previous Thread
|
Next Thread
»
|
Thread Tools | |
Display Modes | |
|
|