CurseForge and Overwolf are joining forces!
Awesome More Information
  • 0

    posted a message on Grid — compact party/raid unit frames
    Quote from Phanx
    What version number are you using? If you are using the latest beta version, you may want to try rolling back to the last release version.


    Yes, the beta version is automatic. The release version is manual. We probably need a version with both options. Although there are options that can improve the automatic like hiding groups where everyone is in a different zone for raids that have sitting groups.
    Posted in: Grid & Grid2
  • 0

    posted a message on Grid — compact party/raid unit frames
    I checked in some code to the repository to improve the autolayout code, updated the ToC, and fixed one bug with showPets, although pets are still not working properly. It is an open repository, so hopefully you guys don't mind code checkins. The packager is set to only package beta and release versions.

    I need to work on pets more to see if I can figure out what is wrong, but the autolayout bugs were making Grid very difficult to use.

    This autolayout code when grid is in show by group mode and the players is in a raid will show as many groups as necessary to show all groups with an online player (if a group only has offline players it will not be shown). It adds events to handle when players are moved groups.

    The following is a diff from 1748 in the repository.

    Index: Grid.toc
    ===================================================================
    --- Grid.toc    (revision 1748)
    +++ Grid.toc    (working copy)
    @@ -1,4 +1,4 @@
    -## Interface: 60000
    +## Interface: 60200
     ## Version: @project-version@
     ## X-ReleaseDate: "$Date$"
    
    Index: Layout.lua
    ===================================================================
    --- Layout.lua  (revision 1748)
    +++ Layout.lua  (working copy)
    @@ -572,6 +572,8 @@
    
            self:RegisterBucketMessage("Grid_UpdateLayoutSize", 0.2, "PartyMembersCh
    anged")
            self:RegisterMessage("Grid_RosterUpdated", "PartyMembersChanged")
    +       self:RegisterEvent("PARTY_MEMBERS_CHANGED", "PartyMembersChanged")
    +       self:RegisterEvent("GROUP_ROSTER_UPDATE", "PartyMembersChanged")
    
            self:RegisterMessage("Grid_EnteringCombat", "EnteringOrLeavingCombat")
            self:RegisterMessage("Grid_LeavingCombat", "EnteringOrLeavingCombat")
    @@ -1032,6 +1034,9 @@
    
            local unitSpacing, layoutPadding = p.unitSpacing, p.layoutPadding * 2
    
    +       -- Update layouts with new size
    +       GridLayout:GetModule("GridLayoutManager"):UpdateLayouts()
    +
            for i = 1, #self.layoutGroups do
                    local layoutGroup = self.layoutGroups[i]
                    if layoutGroup:IsVisible() then
    @@ -1225,4 +1230,4 @@
    
            --GridLayout:Debug("/gridlayout", width, height)
            GridLayout:FakeSize(width, height)
    -end
    \ No newline at end of file
    +end
    Index: Layouts.lua
    ===================================================================
    --- Layouts.lua (revision 1748)
    +++ Layouts.lua (working copy)
    @@ -87,7 +87,7 @@
    
     --------------------------------------------------------------------------------
    
    -local lastNumGroups, lastGroupFilter, lastShowPets
    +local lastNumGroups, lastUsedGroups, lastShowPets
    
     local function AddPetGroup(t, numGroups, groupFilter)
            t = t or {}
    @@ -113,14 +113,14 @@
                    t.groupingOrder = nil
                    layout[i] = t
            end
    +       for i = numGroups + 1, #layout do
    +               layout[i] = nil
    +       end
            if showPets then
                    local i = numGroups + 1
    -               layout[i] = AddPetGroup(layout[i], numGroups, groupFilter)
    +               layout[i] = AddPetGroup(layout[i], numGroups, tostring(i))
                    numGroups = i
            end
    -       for i = numGroups + 1, #layout do
    -               layout[i] = nil
    -       end
     end
    
     local function UpdateMergedGroups(layout, numGroups, showPets)
    @@ -136,6 +136,43 @@
            end
     end
    +-- These are the number of groups actually used
    +local function UpdateNumGroups()
    +       local groupType, maxPlayers = Roster:GetPartyState()
    +       local usedGroups = {}
    +       local numGroups = 0
    +       local realGroups = 1
    +
    +       if groupType == "raid" then
    +               if maxPlayers then
    +                       numGroups = ceil(maxPlayers / 5)
    +               else
    +                       numGroups = 1
    +               end
    +
    +               for i = 1, 8 do
    +                       usedGroups[i] = false
    +               end
    +               for i = 1, GetNumGroupMembers(), 1 do
    +                       local name, _, subgroup, _, _, _, _, online = GetRaidRosterInfo(i);
    +                       -- If the highest group only has offline players it will not be shown
    +                       if name and online then
    +                               usedGroups[subgroup] = true
    +                       end
    +               end
    +               for i = 1, 8 do
    +                       if usedGroups[i] and i > realGroups then
    +                               -- realGroups = numGroups + 1
    +                               realGroups = i
    +                       end
    +               end
    +       else
    +               numGroups = 1
    +       end
    +       return numGroups, realGroups
    +end
    +
    +
     function Manager:UpdateLayouts(event)
            self:Debug("UpdateLayouts", event)
    
    @@ -143,19 +180,29 @@
            local showPets = Layout.db.profile.showPets -- Show Pets
            local splitGroups = Layout.db.profile.splitGroups -- Keep Groups Together
    
    -       local numGroups, groupFilter = ceil(maxPlayers / 5), "1"
    -       for i = 2, numGroups do
    -               groupFilter = groupFilter .. "," .. i
    +       -- local numGroups, groupFilter = ceil(maxPlayers / 5), "1"
    +       -- for i = 2, numGroups do
    +       --      groupFilter = groupFilter .. "," .. i
    +       -- end
    +       local numGroups = 1
    +       local usedGroups = 1
    +
    +       if groupType == "raid" then
    +               numGroups, usedGroups = UpdateNumGroups()
    +       elseif maxPlayers then
    +               numGroups = ceil(maxPlayers / 5)
    +               usedGroups = numGroups
            end
    
    -       self:Debug("maxPlayers", maxPlayers, "numGroups", numGroups, "groupFilter", groupFilter, "showPets", showPets, "splitGroups", splitGroups)
    +       self:Debug("maxPlayers", maxPlayers, "numGroups", numGroups, "usedGroups", usedGroups, "showPets", showPets, "splitGroups", splitGroups)
    
    -       if lastNumGroups == numGroups and lastShowPets == showPets then
    +       if lastNumGroups == numGroups and lastUsedGroups == usedGroups and lastShowPets == showPets then
                    self:Debug("no changes necessary")
                    return
            end
            lastNumGroups = numGroups
    +       lastUsedGroups = usedGroups
            lastShowPets = showPets
    
            -- Update class and role layouts
    @@ -168,8 +215,9 @@
            end
    
            -- Update group layout
    -       UpdateSplitGroups(Layouts.ByGroup,     numGroups, showPets)
    +       UpdateSplitGroups(Layouts.ByGroup,     usedGroups, showPets)
    
            -- Apply changes
            Layout:ReloadLayout()
     end
    +
    Posted in: Grid & Grid2
  • To post a comment, please or register a new account.