diff --git a/WeakAuras/GenericTrigger.lua b/WeakAuras/GenericTrigger.lua index ba0324d..d1324f4 100644 --- a/WeakAuras/GenericTrigger.lua +++ b/WeakAuras/GenericTrigger.lua @@ -1563,11 +1563,11 @@ function GenericTrigger.Add(data, region) else tinsert(trigger_events, event) end - if trigger.custom_type == "status" or trigger.custom_type == "stateupdate" then - force_events = data.information.forceEvents or "STATUS" - end end end + if trigger.custom_type == "status" or trigger.custom_type == "stateupdate" then + force_events = data.information.forceEvents or "STATUS" + end if (trigger.custom_type == "stateupdate") then statesParameter = "full"; end diff --git a/WeakAuras/RegionTypes/AuraBar.lua b/WeakAuras/RegionTypes/AuraBar.lua index ecba5ea..9dddf53 100644 --- a/WeakAuras/RegionTypes/AuraBar.lua +++ b/WeakAuras/RegionTypes/AuraBar.lua @@ -961,7 +961,7 @@ local funcs = { orientVertical(self); end end, - UpdateEffectiveOrientation = function(self) + UpdateEffectiveOrientation = function(self, force) local orientation = self.orientation if self.flipX then @@ -979,7 +979,7 @@ local funcs = { end end - if orientation ~= self.effectiveOrientation then + if orientation ~= self.effectiveOrientation or force then self.effectiveOrientation = orientation self:ReOrient() end @@ -1339,7 +1339,7 @@ local function modify(parent, region, data) self:SetHeight(self.bar.totalHeight); icon:SetHeight(self.bar.iconHeight); - region:UpdateEffectiveOrientation() + region:UpdateEffectiveOrientation(true) end -- region:Scale(1.0, 1.0); if data.smoothProgress then diff --git a/WeakAuras/RegionTypes/DynamicGroup.lua b/WeakAuras/RegionTypes/DynamicGroup.lua index a7e5d77..1f0dd06 100644 --- a/WeakAuras/RegionTypes/DynamicGroup.lua +++ b/WeakAuras/RegionTypes/DynamicGroup.lua @@ -1335,12 +1335,15 @@ local function modify(parent, region, data) self.currentWidth = width self.currentHeight = height - local regionLeft = region:GetLeft() - local regionBottom = region:GetBottom() - self.background:SetPoint("BOTTOMLEFT", region, "BOTTOMLEFT", minX + -1 * data.borderOffset - regionLeft, - minY + -1 * data.borderOffset - regionBottom) - self.background:SetPoint("TOPRIGHT", region, "BOTTOMLEFT", maxX + data.borderOffset - regionLeft, - maxY + data.borderOffset - regionBottom) + if data.border and not data.useAnchorPerUnit then + local regionLeft = SafeGetPos(region, region.GetLeft) or minX + local regionBottom = SafeGetPos(region, region.GetBottom) or minY + if regionLeft and regionBottom then + self.background:ClearAllPoints() + self.background:SetPoint("BOTTOMLEFT", region, "BOTTOMLEFT", minX + -1 * data.borderOffset - regionLeft, minY + -1 * data.borderOffset - regionBottom) + self.background:SetPoint("TOPRIGHT", region, "BOTTOMLEFT", maxX + data.borderOffset - regionLeft, maxY + data.borderOffset - regionBottom) + end + end else self:Hide() end diff --git a/WeakAuras/RegionTypes/Model.lua b/WeakAuras/RegionTypes/Model.lua index 508b224..b543eac 100644 --- a/WeakAuras/RegionTypes/Model.lua +++ b/WeakAuras/RegionTypes/Model.lua @@ -282,7 +282,7 @@ do Private.StartProfileSystem("model"); for id, data in pairs(Private.regions) do Private.StartProfileAura(id); - if data.region.toShow then + if data.region and data.region.toShow then if (data.regionType == "model") then data.region:PreShow(); end diff --git a/WeakAuras/WeakAuras.lua b/WeakAuras/WeakAuras.lua index d3384ff..e54b9d8 100644 --- a/WeakAuras/WeakAuras.lua +++ b/WeakAuras/WeakAuras.lua @@ -1114,7 +1114,7 @@ function Private.Login(initialTime, takeNewSnapshots) loginFinished = true -- Tell Dynamic Groups that we are done with login for _, region in pairs(Private.regions) do - if (region.region.RunDelayedActions) then + if (region.region and region.region.RunDelayedActions) then region.region:RunDelayedActions(); end end @@ -1281,7 +1281,7 @@ end function Private.PauseAllDynamicGroups() local suspended = {} for id, region in pairs(Private.regions) do - if (region.region.Suspend) then + if (region.region and region.region.Suspend) then region.region:Suspend(); tinsert(suspended, id) end @@ -1587,7 +1587,9 @@ function Private.Resume() local suspended = Private.PauseAllDynamicGroups() for id, region in pairs(Private.regions) do - region.region:Collapse(); + if region.region then + region.region:Collapse(); + end end for id, cloneList in pairs(clones) do @@ -1723,7 +1725,7 @@ function WeakAuras.Delete(data) end end - if Private.regions[id] then + if Private.regions[id] and Private.regions[id].region then Private.regions[id].region:Collapse() Private.CancelAnimation(Private.regions[id].region, true, true, true, true, true, true) @@ -1804,7 +1806,7 @@ function WeakAuras.Rename(data, newid) UIDtoID[data.uid] = newid Private.regions[newid] = Private.regions[oldid]; Private.regions[oldid] = nil; - if Private.regions[newid] then + if Private.regions[newid] and Private.regions[newid].region then Private.regions[newid].region.id = newid end if(clones[oldid]) then @@ -2238,7 +2240,7 @@ function Private.AddMany(tbl, takeSnapshots) for data in pairs(groups) do if data.type == "dynamicgroup" then - if Private.regions[data.id] then + if Private.regions[data.id] and Private.regions[data.id].region then Private.regions[data.id].region:ReloadControlledChildren() end else @@ -3206,7 +3208,7 @@ function Private.HandleGlowAction(actions, region) if WeakAuras.GetData(frame_name) then Private.EnsureRegion(frame_name) end - if Private.regions[frame_name] then + if Private.regions[frame_name] and Private.regions[frame_name].region then glow_frame = Private.regions[frame_name].region should_glow_frame = true end @@ -3596,12 +3598,14 @@ local DisplayTimes = {}; function WeakAuras.ProfileDisplays(all) UpdateAddOnCPUUsage(); for id, regionData in pairs(Private.regions) do - local DisplayTime = GetFrameCPUUsage(regionData.region, true); - DisplayTimes[id] = DisplayTimes[id] or 0; - if(all or DisplayTime > DisplayTimes[id]) then - print("|cFFFF0000"..id.."|r -", DisplayTime, "-", DisplayTime - DisplayTimes[id]); + if regionData.region then + local DisplayTime = GetFrameCPUUsage(regionData.region, true); + DisplayTimes[id] = DisplayTimes[id] or 0; + if(all or DisplayTime > DisplayTimes[id]) then + print("|cFFFF0000"..id.."|r -", DisplayTime, "-", DisplayTime - DisplayTimes[id]); + end + DisplayTimes[id] = DisplayTime; end - DisplayTimes[id] = DisplayTime; end end @@ -4161,7 +4165,7 @@ function Private.UpdatedTriggerState(id) for _, clone in pairs(clones[id]) do clone:Collapse() end - if Private.regions[id] then + if Private.regions[id] and Private.regions[id].region then Private.regions[id].region:Collapse() end elseif (show and oldShow) then -- Already shown, update regions @@ -4172,7 +4176,7 @@ function Private.UpdatedTriggerState(id) end end if (not activeTriggerState[""] or not activeTriggerState[""].show) then - if Private.regions[id] then + if Private.regions[id] and Private.regions[id].region then Private.regions[id].region:Collapse() end end @@ -4938,10 +4942,16 @@ local function tryAnchorAgain() local region = WeakAuras.GetRegion(id); if (data and region) then local parent = WeakAurasFrame; - if (data.parent and WeakAuras.GetData(data.parent) and Private.EnsureRegion(data.parent)) then - parent = Private.regions[data.parent].region; + local parentData + if data.parent then + parentData = WeakAuras.GetData(data.parent) + if parentData and Private.EnsureRegion(data.parent) then + parent = Private.regions[data.parent].region + end + end + if not parentData or parentData.regionType ~= "dynamicgroup" then + Private.AnchorFrame(data, region, parent) end - Private.AnchorFrame(data, region, parent); end end end @@ -5027,7 +5037,7 @@ local function GetAnchorFrame(data, region, parent) end end - if(Private.regions[frame_name]) then + if Private.regions[frame_name] and Private.regions[frame_name].region then return Private.regions[frame_name].region; end postponeAnchor(id); diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasTextureButton.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasTextureButton.lua index 6d58a2a..9d784f2 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasTextureButton.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasTextureButton.lua @@ -33,6 +33,7 @@ local methods = { self.texture:SetTexture(texturePath); self.texture.path = texturePath; self.texture.name = name; + self.texture:SetSize(120, 120); end, ["ChangeTexture"] = function(self, r, g, b, a, rotate, discrete_rotation, rotation, mirror, blendMode) local ulx,uly , llx,lly , urx,ury , lrx,lry; @@ -107,8 +108,8 @@ local function Constructor() button:SetHighlightTexture(highlighttexture); local texture = button:CreateTexture(nil, "OVERLAY"); - texture:SetPoint("BOTTOMLEFT", button, 4, 4); - texture:SetPoint("TOPRIGHT", button, -4, -4); + texture:SetPoint("CENTER") + texture:SetSize(120, 120) button:SetScript("OnEnter", function() Show_Tooltip(button, texture.name, texture.path:gsub("\\", "\n")) end); button:SetScript("OnLeave", Hide_Tooltip); diff --git a/WeakAurasOptions/InformationOptions.lua b/WeakAurasOptions/InformationOptions.lua index 8f8ff5b..ff0bb37 100644 --- a/WeakAurasOptions/InformationOptions.lua +++ b/WeakAurasOptions/InformationOptions.lua @@ -313,13 +313,20 @@ function OptionsPrivate.GetInformationOptions(data) local sameDebugLog = true local commonDebugLog local debugLogDesc = "" - for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do - local effectiveDebugLog = child.information.debugLog and true or false - debugLogDesc = debugLogDesc .. "|cFFE0E000"..child.id..": |r".. (effectiveDebugLog and "true" or "false") .. "\n" - if commonDebugLog == nil then - commonDebugLog = effectiveDebugLog - elseif effectiveDebugLog ~= commonDebugLog then - sameDebugLog = false + + if isGroup and not isTmpGroup then + sameDebugLog = true + commonDebugLog = data.information.debugLog and true or false + else + for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do + --- @type boolean + local effectiveDebugLog = child.information.debugLog and true or false + debugLogDesc = debugLogDesc .. "|cFFE0E000"..child.id..": |r".. (effectiveDebugLog and "true" or "false") .. "\n" + if commonDebugLog == nil then + commonDebugLog = effectiveDebugLog + elseif effectiveDebugLog ~= commonDebugLog then + sameDebugLog = false + end end end args.debugLogToggle = { @@ -332,10 +339,15 @@ function OptionsPrivate.GetInformationOptions(data) return sameDebugLog and commonDebugLog end, set = function(info, v) - for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do - child.information.debugLog = v - WeakAuras.Add(child) - OptionsPrivate.ClearOptions(child.id) + if isGroup and not isTmpGroup then + data.information.debugLog = v + WeakAuras.Add(data) + else + for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do + child.information.debugLog = v + WeakAuras.Add(child) + OptionsPrivate.ClearOptions(child.id) + end end WeakAuras.ClearAndUpdateOptions(data.id) end @@ -350,18 +362,32 @@ function OptionsPrivate.GetInformationOptions(data) func = function() local fullMessage = L["WeakAuras %s on WoW %s"]:format(WeakAuras.versionString, WeakAuras.BuildInfo) .. "\n\n" local haveLogs = false - for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do - local auraLog = OptionsPrivate.Private.DebugLog.GetLogs(child.uid) + if isGroup and not isTmpGroup then + local auraLog = OptionsPrivate.Private.DebugLog.GetLogs(data.uid) if auraLog then haveLogs = true - fullMessage = fullMessage .. L["Aura: '%s'"]:format(child.id) - local version = child.semver or child.version + fullMessage = fullMessage .. L["Aura: '%s'"]:format(data.id) + local version = data.semver or data.version if (version) then fullMessage = fullMessage .. "\n" .. L["Version: %s"]:format(version) end fullMessage = fullMessage .. "\n" .. L["Debug Log:"] .. "\n" .. auraLog .. "\n\n" end + else + for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do + local auraLog = OptionsPrivate.Private.DebugLog.GetLogs(child.uid) + if auraLog then + haveLogs = true + fullMessage = fullMessage .. L["Aura: '%s'"]:format(child.id) + local version = child.semver or child.version + if (version) then + fullMessage = fullMessage .. "\n" .. L["Version: %s"]:format(version) + end + fullMessage = fullMessage .. "\n" .. L["Debug Log:"] .. "\n" .. auraLog .. "\n\n" + end + end end + if haveLogs then OptionsPrivate.OpenDebugLog(fullMessage) else @@ -376,8 +402,12 @@ function OptionsPrivate.GetInformationOptions(data) width = WeakAuras.normalWidth, order = order, func = function() - for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do - OptionsPrivate.Private.DebugLog.Clear(child.uid) + if isGroup and not isTmpGroup then + OptionsPrivate.Private.DebugLog.Clear(data.uid) + else + for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do + OptionsPrivate.Private.DebugLog.Clear(child.uid) + end end end } diff --git a/WeakAurasOptions/OptionsFrames/FrameChooser.lua b/WeakAurasOptions/OptionsFrames/FrameChooser.lua index 039338e..f1daa70 100644 --- a/WeakAurasOptions/OptionsFrames/FrameChooser.lua +++ b/WeakAurasOptions/OptionsFrames/FrameChooser.lua @@ -51,7 +51,7 @@ function OptionsPrivate.StartFrameChooser(data, path) focusName = nil; local focusIsGroup = false; for id, regionData in pairs(OptionsPrivate.Private.regions) do - if(regionData.region:IsVisible() and MouseIsOver(regionData.region)) then + if(regionData.region and regionData.region:IsVisible() and MouseIsOver(regionData.region)) then local isGroup = regionData.regionType == "group" or regionData.regionType == "dynamicgroup"; if (not focusName or (not isGroup and focusIsGroup)) then focus = regionData.region; diff --git a/WeakAurasOptions/OptionsFrames/MoverSizer.lua b/WeakAurasOptions/OptionsFrames/MoverSizer.lua index e076260..3219a1c 100644 --- a/WeakAurasOptions/OptionsFrames/MoverSizer.lua +++ b/WeakAurasOptions/OptionsFrames/MoverSizer.lua @@ -634,7 +634,7 @@ local function ConstructMoverSizer(parent) data.yOffset = dY / scale end region:ResetPosition() - WeakAuras.Add(data, nil, true) + WeakAuras.Add(data) WeakAuras.UpdateThumbnail(data) local xOff, yOff mover.selfPoint, mover.anchor, mover.anchorPoint, xOff, yOff = region:GetPoint(1) diff --git a/WeakAurasOptions/OptionsFrames/OptionsFrame.lua b/WeakAurasOptions/OptionsFrames/OptionsFrame.lua index bc33f2b..f721f03 100644 --- a/WeakAurasOptions/OptionsFrames/OptionsFrame.lua +++ b/WeakAurasOptions/OptionsFrames/OptionsFrame.lua @@ -138,12 +138,14 @@ function OptionsPrivate.CreateFrame() for id, data in pairs(OptionsPrivate.Private.regions) do - data.region:Collapse() - data.region:OptionsClosed() - if OptionsPrivate.Private.clones[id] then - for _, cloneRegion in pairs(OptionsPrivate.Private.clones[id]) do - cloneRegion:Collapse() - cloneRegion:OptionsClosed() + if data.region then + data.region:Collapse() + data.region:OptionsClosed() + if OptionsPrivate.Private.clones[id] then + for _, cloneRegion in pairs(OptionsPrivate.Private.clones[id]) do + cloneRegion:Collapse() + cloneRegion:OptionsClosed() + end end end end diff --git a/WeakAurasOptions/OptionsFrames/Update.lua b/WeakAurasOptions/OptionsFrames/Update.lua index 00975ea..bba4db8 100644 --- a/WeakAurasOptions/OptionsFrames/Update.lua +++ b/WeakAurasOptions/OptionsFrames/Update.lua @@ -182,15 +182,15 @@ local function recurseUpdate(data, chunk) end end -local ignoredForDiffChecking -- Needs to be created lazily -local function RecurseDiff(ours, theirs) +local function RecurseDiff(ours, theirs, ignoredForDiffChecking) local diff, seen, same = {}, {}, true for key, ourVal in pairs(ours) do - if not ignoredForDiffChecking[key] then + if type(ignoredForDiffChecking) ~= table or ignoredForDiffChecking[key] ~= true then seen[key] = true local theirVal = theirs[key] if type(ourVal) == "table" and type(theirVal) == "table" then - local diffVal = RecurseDiff(ourVal, theirVal) + local diffVal = RecurseDiff(ourVal, theirVal, + type(ignoredForDiffChecking) == table and ignoredForDiffChecking[key] or nil) if diffVal then diff[key] = diffVal same = false @@ -207,7 +207,7 @@ local function RecurseDiff(ours, theirs) end end for key, theirVal in pairs(theirs) do - if not seen[key] and not ignoredForDiffChecking[key] then + if not seen[key] and (type(ignoredForDiffChecking) ~= table or ignoredForDiffChecking[key] ~= true) then diff[key] = theirVal same = false end @@ -243,15 +243,13 @@ local function DebugPrintDiff(diff) end local function Diff(ours, theirs) - if not ignoredForDiffChecking then - ignoredForDiffChecking = WeakAuras.Mixin({}, OptionsPrivate.Private.internal_fields, - OptionsPrivate.Private.non_transmissable_fields) - end + local ignoredForDiffChecking = WeakAuras.Mixin({}, OptionsPrivate.Private.internal_fields, + OptionsPrivate.Private.non_transmissable_fields) -- generates a diff which WeakAuras.Update can use local debug = false if not ours or not theirs then return end - local diff = RecurseDiff(ours, theirs) + local diff = RecurseDiff(ours, theirs, ignoredForDiffChecking) if diff then if debug then DebugPrintDiff(diff, ours.id, theirs.id) diff --git a/WeakAurasOptions/WeakAurasOptions.lua b/WeakAurasOptions/WeakAurasOptions.lua index 59266d5..7dff8f9 100644 --- a/WeakAurasOptions/WeakAurasOptions.lua +++ b/WeakAurasOptions/WeakAurasOptions.lua @@ -906,7 +906,7 @@ function OptionsPrivate.ConvertDisplay(data, newType) local visibility = displayButtons[id]:GetVisibility(); displayButtons[id]:PriorityHide(2); - if OptionsPrivate.Private.regions[id] then + if OptionsPrivate.Private.regions[id] and OptionsPrivate.Private.regions[id].region then OptionsPrivate.Private.regions[id].region:Collapse() end OptionsPrivate.Private.CollapseAllClones(id);