A Murloc Raider
Join Date: Feb 2007
Posts: 8
|
Raid frames not spawning properly
When I log in or reload, the units in my raid frames spawn all stacked up on top of each other. If I move a player into another group, they all get fixed (this is with only two people in the raid, though; I haven't been able to get more people to help me test things yet).
I found some code from zork for raid frame creation ( http://www.wowinterface.com/forums/s...t=42538&page=2) and implemented it into the layout I've been working on as a learning platform. I know the code worked before I tinkered with it, but I can't figure out where my tinkering went wrong to cause an issue like this. The tinkering I did was to make the frames moveable. The code I use to move them and save their positions works for my other frames such as player, target, pet, party, etc, and it works for the raid frames after doing what I said above to fix them; it's just on the initial load that they're acting weirdly
Lua Code:
--Relevant options ["raid"] = { show = true, anchor = {point = "TOPLEFT", relTo = nil, relPt = "TOPLEFT", xOff = 0, yOff = 0}, hBar = {width = 100, height = 25, classColor = true}, pBar = {width = 100, height = 5}, scale = 1, attributes = { visibility1 = "custom [@raid11,exists] hide;[group:raid] show; hide", visibility2 = "custom [@raid26,exists] hide; [@raid11,exists] show; hide", visibility3 = "custom [@raid26,exists] show; hide", showPlayer = false, showSolo = false, showParty = false, showRaid = true, point = "TOP", yOffset = -10, xoffset = 10, maxColumns = 8, unitsPerColumn = 5, columnSpacing = 10, columnAnchorPoint = "LEFT" }, }
Lua Code:
--Relevant functions lib.moveable = function(frame, style) local locked = ns.db.profile.framesLocked local mover = SqUI.movers[style] if (locked) then frame:SetMovable(false) mover:SetMovable(false) mover:SetResizable(false) mover:RegisterForDrag() mover:SetScript("OnDragStart", nil) mover:SetScript("OnDragStop", nil) if (style == "party") then frame:ClearAllPoints() if (frame:GetName() ~= "SqUIPartyUnitButton1") then frame:SetPoint("TOP", SqUIPartyUnitButton1, "BOTTOM", 0, -50) else frame:SetPoint(mover:GetPoint()) end elseif (style == "raid") then local att = ns.db.profile.frames[style].attributes if (strsub(frame:GetName(), -1) == "1") then frame:SetPoint(mover:GetPoint()) elseif att.columnAnchorPoint == "TOP" then frame:SetPoint("TOPLEFT", frame.prev, "BOTTOMLEFT", 0, att.columnSpacing) elseif att.columnAnchorPoint == "BOTTOM" then frame:SetPoint("BOTTOMLEFT", frame.prev, "TOPLEFT", 0, att.columnSpacing) elseif att.columnAnchorPoint == "LEFT" then frame:SetPoint("TOPLEFT", frame.prev, "TOPRIGHT", att.columnSpacing, 0) else frame:SetPoint("TOPRIGHT", frame.prev, "TOPLEFT", att.columnSpacing, 0) end else frame:ClearAllPoints() frame:SetPoint(mover:GetPoint()) end mover:Hide() else mover:Show() if (style == "party") then if (frame:GetName() ~= "SqUIPartyUnitButton1") then frame:SetPoint("TOP", SqUIPartyUnitButton1, "BOTTOM", 0, -50) else frame:SetAllPoints(mover) end elseif (style == "raid") then local att = ns.db.profile.frames[style].attributes if (strsub(frame:GetName(), -1) == "1") then frame:SetAllPoints(mover) elseif att.columnAnchorPoint == "TOP" then frame:SetPoint("TOPLEFT", frame.prev, "BOTTOMLEFT", 0, att.columnSpacing) elseif att.columnAnchorPoint == "BOTTOM" then frame:SetPoint("BOTTOMLEFT", frame.prev, "TOPLEFT", 0, att.columnSpacing) elseif att.columnAnchorPoint == "LEFT" then frame:SetPoint("TOPLEFT", frame.prev, "TOPRIGHT", att.columnSpacing, 0) else frame:SetPoint("TOPRIGHT", frame.prev, "TOPLEFT", att.columnSpacing, 0) end else frame:SetAllPoints(mover) end frame:SetMovable(true) mover:SetMovable(true) mover:SetResizable(true) mover:EnableMouse(true) mover:RegisterForDrag("LeftButton") mover:SetScript("OnDragStart", function(mover) mover:ClearAllPoints() mover:StartMoving() end) mover:SetScript("OnDragStop", function(mover) mover:StopMovingOrSizing() local point, relTo, relPt, xOff, yOff = mover:GetPoint() local db = ns.db.profile.frames[style].anchor db.point = point db.relTo = "UIParent" db.relPt = relPt db.xOff = xOff db.yOff = yOff end) end end lib.Gen_Mover = function(frame) if (not SqUI.movers[frame.mystyle]) then local mover = CreateFrame("Frame", nil, UIParent) local db = ns.db.profile local anchor = db.frames[frame.mystyle].anchor mover:SetSize(frame.width, frame.height) mover:SetPoint(anchor.point, anchor.relTo, anchor.relPt, anchor.xOff, anchor.yOff) mover:SetBackdrop({ bgFile = db.bgTex, tile = false, tileSize = 0, insets = { left = 0, right = 0, top = 0, bottom = 0 } }) mover:SetBackdropColor(0, .45, 0, .7) mover:SetFrameStrata("HIGH") mover.text = lib.Gen_FontString(mover, nil, db.fontPath, db.fontSize, db.fontOutline) if (frame.mystyle == "party" or frame.mystyle == "raid") then mover.text:SetText(strsub(frame:GetParent():GetName(), 5)..": Move Me") else mover.text:SetText(strsub(frame:GetName(), 5)..": Move Me") end mover.text:SetTextColor(1, 1, 1) mover.text:SetPoint("CENTER", mover, "CENTER") mover.text:SetJustifyH("CENTER") SqUI.movers[frame.mystyle] = mover end end
Lua Code:
--Relevant core code local function CreateRaidStyle(self) local db = ns.db.profile.frames["raid"] self.width = db.hBar.width self.height = db.hBar.height self.mystyle = "raid" self.hptag = "[SqUI:hpraid]" self.hidename = true initHeader(self) self.Health.colorDisconnected = true self.Health.colorClass = db.hBar.classColor self.Health.colorReaction = true self.Health.colorHealth = true self.Health.bg.multiplier = 0.3 self.Power.colorPower = true self.Power.bg.multiplier = 0.3 lib.Gen_Mover(self) lib.moveable(self, self.mystyle) end if db.frames["raid"].show then --die raid panel, die CompactRaidFrameManager:UnregisterAllEvents() CompactRaidFrameManager.Show = CompactRaidFrameManager.Hide CompactRaidFrameManager:Hide() CompactRaidFrameContainer:UnregisterAllEvents() CompactRaidFrameContainer.Show = CompactRaidFrameContainer.Hide CompactRaidFrameContainer:Hide() oUF:RegisterStyle("SqUIRaid", CreateRaidStyle) oUF:SetActiveStyle("SqUIRaid") local anchor = db.frames["raid"].anchor local att = db.frames["raid"].attributes local raid, group, i, j, prev local function getRaidScale(id) if id == 1 then return db.frames["raid"].scale elseif id == 2 then return db.frames["raid"].scale*0.9 else return db.frames["raid"].scale*0.75 end end local function getRaidVisibility(id) if id == 1 then return att.visibility1 elseif id == 2 then return att.visibility2 else return att.visibility3 end end for j = 1, 3 do raid = {} for i = 1, NUM_RAID_GROUPS do group = oUF:SpawnHeader("SqUIRaid"..j.."Group"..i, nil, getRaidVisibility(j), "showPlayer", att.showPlayer, "showSolo", att.showSolo, "showParty", att.showParty, "showRaid", att.showRaid, "point", att.point, "yOffset", att.yOffset, "xOffset", att.xOffset, "columnSpacing", att.columnSpacing, "columnAnchorPoint", att.columnAnchorPoint, "groupFilter", tostring(i), "groupBy", "GROUP", "groupingOrder", "1,2,3,4,5,6,7,8", "sortMethod", "NAME", "maxColumns", att.maxColumns, "unitsPerColumn", att.unitsPerColumn, "oUF-initialConfigFunction", ([[ self:SetHeight(%d) self:SetWidth(%d) ]]):format(db.frames["raid"].hBar.height, db.frames["raid"].hBar.width)) group:SetScale(getRaidScale(j)) if (i == 1) then group:SetPoint(anchor.point, anchor.relTo, anchor.relPt) prev = group:GetName() else group.prev = prev prev = group:GetName() if att.columnAnchorPoint == "TOP" then group:SetPoint("TOPLEFT", group.prev, "BOTTOMLEFT", 0, att.columnSpacing) elseif att.columnAnchorPoint == "BOTTOM" then group:SetPoint("BOTTOMLEFT", group.prev, "TOPLEFT", 0, att.columnSpacing) elseif att.columnAnchorPoint == "LEFT" then group:SetPoint("TOPLEFT", group.prev, "TOPRIGHT", att.columnSpacing, 0) else group:SetPoint("TOPRIGHT", group.prev, "TOPLEFT", att.columnSpacing, 0) end end raid[i] = group end end end
|