From 62b27777043f483893069fc8cf30759f4910cedf Mon Sep 17 00:00:00 2001 From: Infus Date: Sun, 28 Mar 2021 18:17:41 +0200 Subject: [PATCH] Progress --- WeakAuras/AuraEnvironment.lua | 1 - .../OptionsFrames/OptionsFrame.lua | 2 +- WeakAurasOptions/TriggerOptions.lua | 2 +- WeakAurasOptions/WeakAurasOptions.lua | 4 ++-- WeakAurasTemplates/TriggerTemplates.lua | 21 ++++++++++--------- WeakAurasTemplates/TriggerTemplatesData.lua | 1 + 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/WeakAuras/AuraEnvironment.lua b/WeakAuras/AuraEnvironment.lua index 5aaa381227..cdca484f84 100644 --- a/WeakAuras/AuraEnvironment.lua +++ b/WeakAuras/AuraEnvironment.lua @@ -358,7 +358,6 @@ local FakeWeakAurasMixin = { Import = true, NewDisplayButton = true, NewAura = true, - OpenTriggerTemplate = true, OpenCodeReview = true, PickDisplay = true, SetMoverSizer = true, diff --git a/WeakAurasOptions/OptionsFrames/OptionsFrame.lua b/WeakAurasOptions/OptionsFrames/OptionsFrame.lua index 1269cd4a89..966ab5dcf2 100644 --- a/WeakAurasOptions/OptionsFrames/OptionsFrame.lua +++ b/WeakAurasOptions/OptionsFrames/OptionsFrame.lua @@ -1088,7 +1088,7 @@ function OptionsPrivate.CreateFrame() button:SetDescription(L["Offer a guided way to create auras for your character"]) button:SetIcon("Interface\\Icons\\INV_Misc_Book_06") button:SetClick(function() - WeakAuras.OpenTriggerTemplate(nil, targetId) + OptionsPrivate.OpenTriggerTemplate(nil, targetId) end) containerScroll:AddChild(button) diff --git a/WeakAurasOptions/TriggerOptions.lua b/WeakAurasOptions/TriggerOptions.lua index b1675567aa..68dea003fe 100644 --- a/WeakAurasOptions/TriggerOptions.lua +++ b/WeakAurasOptions/TriggerOptions.lua @@ -361,7 +361,7 @@ function OptionsPrivate.AddTriggerMetaFunctions(options, data, triggernum) } if (GetAddOnEnableState(UnitName("player"), "WeakAurasTemplates") ~= 0) then options.__applyTemplate = function() - WeakAuras.OpenTriggerTemplate(data) + OptionsPrivate.OpenTriggerTemplate(data) end end end diff --git a/WeakAurasOptions/WeakAurasOptions.lua b/WeakAurasOptions/WeakAurasOptions.lua index 7ffd1a6e71..bcde97162a 100644 --- a/WeakAurasOptions/WeakAurasOptions.lua +++ b/WeakAurasOptions/WeakAurasOptions.lua @@ -1314,7 +1314,7 @@ function WeakAuras.CloseCodeReview(data) frame.codereview:Close(); end -function WeakAuras.OpenTriggerTemplate(data, targetId) +function OptionsPrivate.OpenTriggerTemplate(data, targetId) if not(IsAddOnLoaded("WeakAurasTemplates")) then local loaded, reason = LoadAddOn("WeakAurasTemplates"); if not(loaded) then @@ -1322,7 +1322,7 @@ function WeakAuras.OpenTriggerTemplate(data, targetId) WeakAuras.prettyPrint("Templates could not be loaded, the addon is " .. reason); return; end - frame.newView = WeakAuras.CreateTemplateView(frame); + frame.newView = WeakAuras.CreateTemplateView(OptionsPrivate.Private, frame); end frame.newView.targetId = targetId; frame.newView:Open(data); diff --git a/WeakAurasTemplates/TriggerTemplates.lua b/WeakAurasTemplates/TriggerTemplates.lua index 5046da5b54..c8a86f22ac 100644 --- a/WeakAurasTemplates/TriggerTemplates.lua +++ b/WeakAurasTemplates/TriggerTemplates.lua @@ -1,5 +1,7 @@ -- Special layout for the New Aura Trigger template page +local AddonName, TemplatePrivate = ... + local AceGUI = LibStub("AceGUI-3.0"); local floor, ceil, tinsert = floor, ceil, tinsert; local CreateFrame, UnitClass, UnitRace, GetSpecialization = CreateFrame, UnitClass, UnitRace, GetSpecialization; @@ -51,10 +53,12 @@ local function changes(property, regionType) value = true, property = regionType == "icon" and "sub.1.glow" or "sub.2.glow", }; - -- TODO this doesn't work anymore, needs to be rewritten - --elseif WeakAuras.regionTypes[regionType].default[property] == nil then - -- return nil; - -- This prevented adding those properties if there weren't relevant for a aura type? + end + + -- TODO check that this works + local defaults = TemplatePrivate.Private.GetDefaultsForRegion(regionType, "template") + if defaults[property] == nil then + return nil; elseif property == "cooldownSwipe" then return { value = true, @@ -1169,7 +1173,9 @@ local function subTypesFor(item, regionType) return fallbacks end -function WeakAuras.CreateTemplateView(frame) +function WeakAuras.CreateTemplateView(Private, frame) + TemplatePrivate.Private = Private + local newView = AceGUI:Create("InlineGroup"); newView.frame:SetParent(frame); newView.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 42); @@ -1866,10 +1872,5 @@ function WeakAuras.CreateTemplateView(frame) end end - function WeakAuras.OpenTriggerTemplate(data, targetId) - frame.newView.targetId = targetId; - frame.newView:Open(data); - end - return newView; end diff --git a/WeakAurasTemplates/TriggerTemplatesData.lua b/WeakAurasTemplates/TriggerTemplatesData.lua index e5e411c49f..43a91289b5 100644 --- a/WeakAurasTemplates/TriggerTemplatesData.lua +++ b/WeakAurasTemplates/TriggerTemplatesData.lua @@ -1,3 +1,4 @@ +local AddonName, TemplatePrivate = ... local WeakAuras = WeakAuras local L = WeakAuras.L local GetSpellInfo, tinsert, GetItemInfo, GetSpellDescription, C_Timer, Spell = GetSpellInfo, tinsert, GetItemInfo, GetSpellDescription, C_Timer, Spell