Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions USER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ In game: `/uf wb` opens the Workbench.
The sidebar groups settings under **Unit Frames**, **Cast Bar & Swing Timers**,
**Global Settings**, **Party & Raid** (when ClickGrid is loaded), **Profiles**,
and **Developer Tools** (development builds). **Global Settings** directly exposes
**Fonts**, **Bars, Borders & Backgrounds**, and **Colours**.
**Fonts**, **Bars, Borders & Backgrounds**, **Colours** and **Aura Icons**.

Choose a frame in the sidebar, then a feature such as **Health & Shields**,
**Buffs & Debuffs** or **Indicators & States**. The **Section** selector opens
Expand Down Expand Up @@ -390,7 +390,11 @@ visible when enabled. Changes to existing live icons defer
until combat ends; ClickGrid's fixed aura slots keep the default swipe.
The parent section controls the font, separate duration/stack sizes, and
duration placement below or inside the icon. **Icon frame** styles each
individual icon border. Centre alignment centres the whole aura block;
individual icon border. **Global Settings > Aura Icons** sets these icon
options (time and stack text, debuff colours and glow, icon frame) for every
frame and ClickGrid at once; a frame's own value still wins. The small frames
(pet, target of target, ClickGrid) keep smaller time and stack text, and the
icon row and priority icons keep their own time position. Centre alignment centres the whole aura block;
use offsets to separate groups when placing both on the same side.
**Debuff border colours** customises the full frame tint for magic, curse,
disease, poison, and debuffs without a dispel type. Turn off **Colour debuff
Expand Down
2 changes: 1 addition & 1 deletion UnitFrames/Components/AuraBar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ local LAYOUT_TEMPLATE = "DisableUntrustedLayoutScriptsTemplate"
-- Everything depending on it opts into the forbidden layout aspect.
local schema = ns.Schema.Without(ns.Util.Copy(Auras.schema), { buffs = true, debuffs = true, sharedSide = true, stackFirst = true })
schema = ns.Schema.Override(schema, "enabled", { default = false })
schema = ns.Schema.Override(schema, "durationPosition", { default = "BOTTOM",
schema = ns.Schema.Override(schema, "durationPosition", { default = "BOTTOM", inherit = false,
tooltip = "Below the icon resolves to inside-bottom for this row. Text remains inside the visible strip.",
hint = "Below the icon is shown inside-bottom in this row; the saved choice is retained." })
AuraBar.schema = ns.Schema.Insert(schema, "enabled", {
Expand Down
10 changes: 8 additions & 2 deletions UnitFrames/Components/AuraIcon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ AuraIcon.GLOW_STYLES = { { "halo", "Soft halo" }, { "proc", "Proc flash" } }
local function IsProc(cfg) return cfg.style == "proc" end
local glowSchema = ns.Schema.Override(Glow.schema, "size", { hidden = IsProc })

AuraIcon.schema = {
-- Edited globally as the theme's "auras" group; every aura icon option
-- inherits from there unless a frame sets its own value.
local iconSchema = {
{ key = "showDuration", type = "toggle", label = "Show time left", default = true },
{ key = "durationPosition", type = "select", label = "Time position", values = AuraIcon.DURATION_POSITIONS, default = "below" },
{ key = "durationPosition", type = "select", label = "Time position", values = AuraIcon.DURATION_POSITIONS, default = "CENTER" },
{ key = "durationSize", type = "range", label = "Time text size", min = 6, max = 32, step = 1, default = 10 },
{ key = "showCount", type = "toggle", label = "Show stacks", default = true },
{ key = "countPosition", type = "select", label = "Stack position", values = AuraIcon.TEXT_POSITIONS, default = "BOTTOMRIGHT" },
Expand All @@ -79,6 +81,10 @@ AuraIcon.schema = {
defaults = { size = 8, inset = 1, padding = 2, background = "None" } },
}

local themeSchema
AuraIcon.schema, themeSchema = ns.Schema.Inheriting(iconSchema, "auras.")
ns.Theme.schema[#ns.Theme.schema + 1] = { key = "auras", type = "group", label = "Aura icons", schema = themeSchema }

local dispelCurves = setmetatable({}, { __mode = "k" })
function AuraIcon.DispelColors(cfg, previous)
if previous then
Expand Down
2 changes: 1 addition & 1 deletion UnitFrames/Components/CategoryAuras.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ local insidePositions = {}
for _, position in ipairs(AuraIcon.DURATION_POSITIONS) do
if position[1] ~= "below" then insidePositions[#insidePositions + 1] = ns.Util.Copy(position) end
end
art = ns.Schema.Override(art, "durationPosition", { values = insidePositions, default = "CENTER",
art = ns.Schema.Override(art, "durationPosition", { values = insidePositions, default = "CENTER", inherit = false,
tooltip = "Inside the icon: a lower category's text must not show past a covering icon." })

CategoryAuras.schema = ns.Schema.Concat(
Expand Down
31 changes: 31 additions & 0 deletions UnitFrames/Core/Schema.lua
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,37 @@ function Schema.Override(schema, key, fields)
return out
end

--[[
Splits `schema` for editing in the theme at `prefix` ("auras."). Returns a
copy whose options inherit the theme value at prefix plus their path, and the
schema the theme stores there. Group `defaults` fold into the option defaults,
since a group default would otherwise win over the inherited value. Options
that already inherit another theme value keep it and stay out of the theme
schema, unless a group default replaced it.
]]
function Schema.Inheriting(schema, prefix, overrides)
local inheriting, shared = {}, {}
for _, opt in ipairs(schema) do
local override = overrides and overrides[opt.key]
local copy, themed = Util.Copy(opt), Util.Copy(opt)
if opt.type == "group" then
local groupOverrides = Util.Merge(Util.Copy(opt.defaults or {}), type(override) == "table" and override or {})
copy.schema, themed.schema = Schema.Inheriting(opt.schema, prefix .. opt.key .. ".", groupOverrides)
copy.defaults, themed.defaults = nil, nil
inheriting[#inheriting + 1] = copy
if #themed.schema > 0 then shared[#shared + 1] = themed end
elseif opt.inherit and override == nil then
inheriting[#inheriting + 1] = copy
else
copy.default, copy.inherit = Util.Copy(DefaultFor(opt, overrides)), prefix .. opt.key
themed.default, themed.inherit = Util.Copy(copy.default), nil
inheriting[#inheriting + 1] = copy
shared[#shared + 1] = themed
end
end
return inheriting, shared
end

function Schema.GetValues(opt)
if type(opt.values) == "function" then
return opt.values()
Expand Down
3 changes: 2 additions & 1 deletion UnitFrames/Core/Theme.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
local _, ns = ...

-- Global look shared by every component. Component options with `inherit`
-- read from here unless the component overrides them.
-- read from here unless the component overrides them. AuraIcon appends the
-- "auras" group.
local Theme = {}
ns.Theme = Theme

Expand Down
6 changes: 3 additions & 3 deletions UnitFrames/Units/Definitions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Units.definitions.pet = {
portrait = { defaults = { enabled = false } },
castbar = { defaults = { enabled = false, placement = "bottom", height = 14, border = { enabled = false },
name = { size = 9 }, time = { size = 9 } } },
auras = { defaults = { durationPosition = "CENTER", durationSize = 9, countSize = 8,
auras = { defaults = { durationSize = 9, countSize = 8,
buffs = { max = 6, size = 18 }, debuffs = { max = 6, size = 18 } } },
sample = { name = "Wolf", lastname = "", level = 42, isPlayer = false, creatureType = "Beast", classification = "normal",
reaction = "friendly", healthMax = 6000, health = 3900, heal = 600, absorb = 900, healAbsorb = 0,
Expand Down Expand Up @@ -111,7 +111,7 @@ Units.definitions.targettarget = {
portrait = { defaults = { enabled = false } },
castbar = { defaults = { enabled = false, placement = "bottom", height = 14, border = { enabled = false },
name = { size = 9 }, time = { size = 9 } } },
auras = { defaults = { enabled = false, durationPosition = "CENTER", durationSize = 9, countSize = 8,
auras = { defaults = { enabled = false, durationSize = 9, countSize = 8,
buffs = { max = 8, size = 16 }, debuffs = { max = 8, size = 18 } } },
threat = { defaults = { enabled = false } },
sample = { name = "Arthas", lastname = "Menethil", level = 44, className = "Warrior", class = "WARRIOR", isPlayer = true,
Expand Down Expand Up @@ -241,7 +241,7 @@ local MAIN_STYLE = {
},
portrait = { mode = "3D", gap = 1 },
auras = {
sharedSide = "combined", font = "Roboto Condensed", durationPosition = "CENTER", dispelGlow = { enabled = false },
sharedSide = "combined", font = "Roboto Condensed",
buffs = { gap = 0 }, debuffs = { gap = 0, position = "top" },
},
classification = { anchor = "TOP" },
Expand Down
2 changes: 1 addition & 1 deletion UnitFrames_ClickGrid/Groups/Definitions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ local member = UF.Units:Derive("pet", {
})
-- Replaces the pet's aura defaults as a whole.
member.auras.defaults = {
durationPosition = "CENTER", durationSize = 8, countSize = 8,
durationSize = 8, countSize = 8,
buffs = { enabled = true, filter = UF.Components.Auras.MY_HEALS, maxDuration = 0, max = 4, size = 14, position = "top", gap = 1, alignment = "end" },
debuffs = { enabled = false, sort = "unitDebuff", max = 3, size = 16, position = "bottom", gap = 1 },
}
Expand Down
8 changes: 7 additions & 1 deletion UnitFrames_Workbench/Pages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ local function Location(entry, path)
if entry.id == "theme" then
if root == "minimapIcon" then return "general", "General", "minimap", "Minimap icon" end
if root == "colors" then return "colours", "Colours", "colours", "Colours" end
if root == "auras" then
local group = path:match("^auras%.([^%.]+)")
if group == "border" then return "auraIcons", "Aura icons", "auraFrame", "Icon frame" end
if group:find("^dispel") then return "auraIcons", "Aura icons", "auraDispel", "Debuff colours & glow" end
return "auraIcons", "Aura icons", "auraText", "Time & stacks"
end
if root:find("font") then return "fonts", "Fonts", "fonts", "Fonts" end
return "artwork", "Bars, borders & backgrounds", "artwork", "Bars, borders & backgrounds"
end
Expand Down Expand Up @@ -150,7 +156,7 @@ function Pages.Build(entry, targets)
for index, feature in ipairs(FEATURES) do order["@" .. feature[1]] = index end
table.sort(model.pages, function(a, b)
if entry.id == "theme" then
local themeOrder = { ["@fonts"] = 1, ["@artwork"] = 2, ["@colours"] = 3, ["@general"] = 4 }
local themeOrder = { ["@fonts"] = 1, ["@artwork"] = 2, ["@colours"] = 3, ["@auraIcons"] = 4, ["@general"] = 5 }
return themeOrder[a.id] < themeOrder[b.id]
end
local left, right = order[a.id] or 50, order[b.id] or 50
Expand Down
Loading
Loading