from retail
This commit is contained in:
@@ -4,6 +4,10 @@ local AddonName, OptionsPrivate = ...
|
||||
local L = WeakAuras.L;
|
||||
|
||||
local function createOptions(parentData, data, index, subIndex)
|
||||
local areaAnchors = {}
|
||||
for child in OptionsPrivate.Private.TraverseLeafsOrAura(parentData) do
|
||||
WeakAuras.Mixin(areaAnchors, OptionsPrivate.Private.GetAnchorsForData(child, "area"))
|
||||
end
|
||||
local options = {
|
||||
__title = L["Border %s"]:format(subIndex),
|
||||
__order = 1,
|
||||
@@ -48,12 +52,12 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
softMax = 64,
|
||||
bigStep = 1,
|
||||
},
|
||||
border_anchor = {
|
||||
anchor_area = {
|
||||
type = "select",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Border Anchor"],
|
||||
order = 7,
|
||||
values = OptionsPrivate.Private.aurabar_anchor_areas,
|
||||
values = areaAnchors,
|
||||
hidden = function() return parentData.regionType ~= "aurabar" end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,10 @@ local L = WeakAuras.L;
|
||||
local indentWidth = 0.15
|
||||
|
||||
local function createOptions(parentData, data, index, subIndex)
|
||||
local areaAnchors = {}
|
||||
for child in OptionsPrivate.Private.TraverseLeafsOrAura(parentData) do
|
||||
WeakAuras.Mixin(areaAnchors, OptionsPrivate.Private.GetAnchorsForData(child, "area"))
|
||||
end
|
||||
|
||||
local hiddenGlowExtra = function()
|
||||
return OptionsPrivate.IsCollapsed("glow", "glow", "glowextra" .. index, true);
|
||||
@@ -27,12 +31,12 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
order = 2,
|
||||
values = OptionsPrivate.Private.glow_types,
|
||||
},
|
||||
glow_anchor = {
|
||||
anchor_area = {
|
||||
type = "select",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Glow Anchor"],
|
||||
order = 3,
|
||||
values = OptionsPrivate.Private.aurabar_anchor_areas,
|
||||
values = areaAnchors,
|
||||
hidden = function() return parentData.regionType ~= "aurabar" end
|
||||
},
|
||||
glowExtraDescription = {
|
||||
|
||||
@@ -0,0 +1,350 @@
|
||||
if not WeakAuras.IsLibsOK() then return end
|
||||
---@type string
|
||||
local AddonName = ...
|
||||
---@class OptionsPrivate
|
||||
local OptionsPrivate = select(2, ...)
|
||||
|
||||
local L = WeakAuras.L;
|
||||
|
||||
local texture_types = WeakAuras.StopMotion.texture_types
|
||||
local texture_data = WeakAuras.StopMotion.texture_data
|
||||
local animation_types = WeakAuras.StopMotion.animation_types
|
||||
|
||||
local function createOptions(parentData, data, index, subIndex)
|
||||
|
||||
local pointAnchors = {}
|
||||
local areaAnchors = {}
|
||||
for child in OptionsPrivate.Private.TraverseLeafsOrAura(parentData) do
|
||||
WeakAuras.Mixin(pointAnchors, OptionsPrivate.Private.GetAnchorsForData(child, "point"))
|
||||
WeakAuras.Mixin(areaAnchors, OptionsPrivate.Private.GetAnchorsForData(child, "area"))
|
||||
end
|
||||
|
||||
local textureNameHasData = OptionsPrivate.Private.StopMotionBase.textureNameHasData
|
||||
local setTextureFunc = OptionsPrivate.Private.StopMotionBase.setTextureFunc
|
||||
local options = {
|
||||
__title = L["Stop Motion %s"]:format(subIndex),
|
||||
__order = 1,
|
||||
stopmotionVisible = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.doubleWidth,
|
||||
name = L["Show Stop Motion"],
|
||||
order = 1,
|
||||
},
|
||||
stopmotionTexture = {
|
||||
type = "input",
|
||||
width = WeakAuras.doubleWidth - 0.15,
|
||||
name = L["Texture"],
|
||||
order = 2,
|
||||
},
|
||||
chooseTexture = {
|
||||
type = "execute",
|
||||
width = 0.15,
|
||||
name = L["Choose"],
|
||||
order = 3,
|
||||
func = function()
|
||||
local path = { "subRegions", index }
|
||||
local paths = {}
|
||||
for child in OptionsPrivate.Private.TraverseLeafsOrAura(parentData) do
|
||||
paths[child.id] = path
|
||||
end
|
||||
OptionsPrivate.OpenTexturePicker(parentData, paths, {
|
||||
texture = "stopmotionTexture",
|
||||
color = "stopmotionColor",
|
||||
blendMode = "stopmotionBlendMode"
|
||||
}, texture_types, setTextureFunc)
|
||||
end,
|
||||
imageWidth = 24,
|
||||
imageHeight = 24,
|
||||
control = "WeakAurasIcon",
|
||||
image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\browse",
|
||||
},
|
||||
stopmotionColor = {
|
||||
type = "color",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Color"],
|
||||
hasAlpha = true,
|
||||
order = 4
|
||||
},
|
||||
stopmotionDesaturate = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Desaturate"],
|
||||
order = 5,
|
||||
},
|
||||
customRows = {
|
||||
type = "input",
|
||||
width = WeakAuras.doubleWidth / 3,
|
||||
name = L["Rows"],
|
||||
validate = WeakAuras.ValidateNumeric,
|
||||
get = function()
|
||||
return data.customRows and tostring(data.customRows) or "";
|
||||
end,
|
||||
set = function(info, v)
|
||||
data.customRows = v and tonumber(v) or 0
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
end,
|
||||
order = 6,
|
||||
hidden = function()
|
||||
return texture_data[data.stopmotionTexture] or textureNameHasData(data.stopmotionTexture)
|
||||
end
|
||||
},
|
||||
customColumns = {
|
||||
type = "input",
|
||||
width = WeakAuras.doubleWidth / 3,
|
||||
name = L["Columns"],
|
||||
validate = WeakAuras.ValidateNumeric,
|
||||
get = function()
|
||||
return data.customColumns and tostring(data.customColumns) or "";
|
||||
end,
|
||||
set = function(info, v)
|
||||
data.customColumns = v and tonumber(v) or 0
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
end,
|
||||
order = 7,
|
||||
hidden = function()
|
||||
return texture_data[data.stopmotionTexture] or textureNameHasData(data.stopmotionTexture)
|
||||
end
|
||||
},
|
||||
customFrames = {
|
||||
type = "input",
|
||||
width = WeakAuras.doubleWidth / 3,
|
||||
name = L["Frame Count"],
|
||||
validate = WeakAuras.ValidateNumeric,
|
||||
get = function()
|
||||
return data.customFrames and tostring(data.customFrames) or "";
|
||||
end,
|
||||
set = function(info, v)
|
||||
data.customFrames = v and tonumber(v) or 0
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
end,
|
||||
order = 8,
|
||||
hidden = function()
|
||||
return texture_data[data.stopmotionTexture] or textureNameHasData(data.stopmotionTexture)
|
||||
end
|
||||
},
|
||||
customFileWidth = {
|
||||
type = "input",
|
||||
width = WeakAuras.normalWidth / 2,
|
||||
name = L["File Width"],
|
||||
desc = L["Must be a power of 2"],
|
||||
validate = function(info, val)
|
||||
if val ~= nil and val ~= "" and (not tonumber(val) or tonumber(val) >= 2^31 or math.frexp(val) ~= 0.5) then
|
||||
return false;
|
||||
end
|
||||
return true
|
||||
end,
|
||||
get = function()
|
||||
return data.customFileWidth and tostring(data.customFileWidth) or "";
|
||||
end,
|
||||
set = function(info, v)
|
||||
data.customFileWidth = v and tonumber(v) or 0
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
end,
|
||||
order = 9,
|
||||
hidden = function()
|
||||
return texture_data[data.stopmotionTexture] or textureNameHasData(data.stopmotionTexture)
|
||||
end
|
||||
},
|
||||
customFileHeight = {
|
||||
type = "input",
|
||||
width = WeakAuras.normalWidth / 2,
|
||||
name = L["File Height"],
|
||||
desc = L["Must be a power of 2"],
|
||||
validate = function(info, val)
|
||||
if val ~= nil and val ~= "" and (not tonumber(val) or tonumber(val) >= 2^31 or math.frexp(val) ~= 0.5) then
|
||||
return false;
|
||||
end
|
||||
return true
|
||||
end,
|
||||
get = function()
|
||||
return data.customFileHeight and tostring(data.customFileHeight) or "";
|
||||
end,
|
||||
set = function(info, v)
|
||||
data.customFileHeight = v and tonumber(v) or 0
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
end,
|
||||
order = 10,
|
||||
hidden = function()
|
||||
return texture_data[data.stopmotionTexture] or textureNameHasData(data.stopmotionTexture)
|
||||
end
|
||||
},
|
||||
customFrameWidth = {
|
||||
type = "input",
|
||||
width = WeakAuras.normalWidth / 2,
|
||||
name = L["Frame Width"],
|
||||
validate = WeakAuras.ValidateNumeric,
|
||||
desc = L["Can set to 0 if Columns * Width equal File Width"],
|
||||
get = function()
|
||||
return data.customFrameWidth and tostring(data.customFrameWidth) or "";
|
||||
end,
|
||||
set = function(info, v)
|
||||
data.customFrameWidth = v and tonumber(v) or 0
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
end,
|
||||
order = 11,
|
||||
hidden = function()
|
||||
return texture_data[data.stopmotionTexture] or textureNameHasData(data.stopmotionTexture)
|
||||
end
|
||||
},
|
||||
customFrameHeight = {
|
||||
type = "input",
|
||||
width = WeakAuras.normalWidth / 2,
|
||||
name = L["Frame Height"],
|
||||
validate = WeakAuras.ValidateNumeric,
|
||||
desc = L["Can set to 0 if Rows * Height equal File Height"],
|
||||
get = function()
|
||||
return data.customFrameHeight and tostring(data.customFrameHeight) or "";
|
||||
end,
|
||||
set = function(info, v)
|
||||
data.customFrameHeight = v and tonumber(v) or 0
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
end,
|
||||
order = 12,
|
||||
hidden = function()
|
||||
return texture_data[data.stopmotionTexture] or textureNameHasData(data.stopmotionTexture)
|
||||
end
|
||||
},
|
||||
stopmotionBlendMode = {
|
||||
type = "select",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Blend Mode"],
|
||||
order = 13,
|
||||
values = OptionsPrivate.Private.blend_types
|
||||
},
|
||||
animationType = {
|
||||
type = "select",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Animation Mode"],
|
||||
order = 14,
|
||||
values = animation_types
|
||||
},
|
||||
|
||||
progress_source = {
|
||||
type = "select",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Progress Source"],
|
||||
order = 15,
|
||||
control = "WeakAurasTwoColumnDropdown",
|
||||
values = OptionsPrivate.Private.GetProgressSourcesForUi(parentData, true),
|
||||
get = function(info)
|
||||
return OptionsPrivate.Private.GetProgressValueConstant(data.progressSources or {-2, ""})
|
||||
end,
|
||||
set = function(info, value)
|
||||
if value then
|
||||
data.progressSources = data.progressSources or {}
|
||||
-- Copy only trigger + property
|
||||
data.progressSources[1] = value[1]
|
||||
data.progressSources[2] = value[2]
|
||||
else
|
||||
data.progressSources = nil
|
||||
end
|
||||
WeakAuras.Add(parentData)
|
||||
end,
|
||||
hidden = function()
|
||||
return not(data.animationType == "progress")
|
||||
end
|
||||
},
|
||||
|
||||
progress_source_space = {
|
||||
type = "description",
|
||||
name = "",
|
||||
order = 16,
|
||||
width = WeakAuras.normalWidth,
|
||||
hidden = function()
|
||||
return not(data.animationType == "progress")
|
||||
end
|
||||
},
|
||||
|
||||
startPercent = {
|
||||
type = "range",
|
||||
control = "WeakAurasSpinBox",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Animation Start"],
|
||||
min = 0,
|
||||
max = 1,
|
||||
--bigStep = 0.01,
|
||||
order = 17,
|
||||
isPercent = true
|
||||
},
|
||||
endPercent = {
|
||||
type = "range",
|
||||
control = "WeakAurasSpinBox",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Animation End"],
|
||||
min = 0,
|
||||
max = 1,
|
||||
--bigStep = 0.01,
|
||||
order = 18,
|
||||
isPercent = true
|
||||
},
|
||||
|
||||
inverse = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Inverse"],
|
||||
order = 19
|
||||
},
|
||||
|
||||
frameRate = {
|
||||
type = "range",
|
||||
control = "WeakAurasSpinBox",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Frame Rate"],
|
||||
min = 3,
|
||||
max = 120,
|
||||
step = 1,
|
||||
bigStep = 3,
|
||||
order = 20,
|
||||
disabled = function() return data.animationType == "progress" end;
|
||||
},
|
||||
|
||||
-- Anchor settings added below
|
||||
|
||||
barModelClip = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Clipped by Foreground"],
|
||||
order = 27,
|
||||
hidden = function()
|
||||
return not (parentData.regionType == "aurabar"
|
||||
and data.anchor_mode == "area"
|
||||
and data.anchor_area == "fg")
|
||||
end
|
||||
},
|
||||
|
||||
scale = {
|
||||
type = "range",
|
||||
control = "WeakAurasSpinBox",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Scale Factor"],
|
||||
order = 28,
|
||||
softMin = 0.5,
|
||||
softMax = 3,
|
||||
step = 0.1,
|
||||
hidden = function()
|
||||
if parentData.regionType == "aurabar"
|
||||
and data.anchorMode == "area"
|
||||
and data.anchor_area == "fg"
|
||||
and data.barModelClip
|
||||
then
|
||||
return true
|
||||
end
|
||||
return data.anchor_mode ~= "area"
|
||||
end
|
||||
},
|
||||
}
|
||||
|
||||
OptionsPrivate.commonOptions.PositionOptionsForSubElement(data, options, 21, areaAnchors, pointAnchors)
|
||||
OptionsPrivate.AddUpDownDeleteDuplicate(options, parentData, index, "substopmotion")
|
||||
|
||||
return options
|
||||
end
|
||||
|
||||
WeakAuras.RegisterSubRegionOptions("substopmotion", createOptions, L["Shows a Stop Moption"]);
|
||||
@@ -23,6 +23,37 @@ local function AdjustConditions(data, replacements)
|
||||
end
|
||||
end
|
||||
|
||||
local function ReplacePrefix(hay, replacements)
|
||||
for old, new in pairs(replacements) do
|
||||
if hay:sub(1, #old) == old then
|
||||
return new .. hay:sub(#old + 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function AdjustAnchors(data, replacements)
|
||||
if not data.subRegions then
|
||||
return
|
||||
end
|
||||
|
||||
for _, subRegionData in ipairs(data.subRegions) do
|
||||
local anchor_area = subRegionData.anchor_area
|
||||
if anchor_area then
|
||||
local replaced = ReplacePrefix(anchor_area, replacements)
|
||||
if replaced then
|
||||
subRegionData.anchor_area = replaced
|
||||
end
|
||||
end
|
||||
local anchor_point = subRegionData.anchor_point
|
||||
if anchor_point then
|
||||
local replaced = ReplacePrefix(anchor_point, replacements)
|
||||
if replaced then
|
||||
subRegionData.anchor_point = replaced
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function OptionsPrivate.DeleteSubRegion(data, index, regionType)
|
||||
if not data.subRegions then
|
||||
return
|
||||
@@ -39,6 +70,7 @@ function OptionsPrivate.DeleteSubRegion(data, index, regionType)
|
||||
end
|
||||
|
||||
AdjustConditions(data, replacements);
|
||||
AdjustAnchors(data, replacements)
|
||||
|
||||
WeakAuras.Add(data)
|
||||
OptionsPrivate.ClearOptions(data.id)
|
||||
@@ -58,6 +90,7 @@ function OptionsPrivate.MoveSubRegionUp(data, index, regionType)
|
||||
}
|
||||
|
||||
AdjustConditions(data, replacements);
|
||||
AdjustAnchors(data, replacements)
|
||||
|
||||
WeakAuras.Add(data)
|
||||
OptionsPrivate.ClearOptions(data.id)
|
||||
@@ -77,6 +110,7 @@ function OptionsPrivate.MoveSubRegionDown(data, index, regionType)
|
||||
}
|
||||
|
||||
AdjustConditions(data, replacements);
|
||||
AdjustAnchors(data, replacements)
|
||||
|
||||
WeakAuras.Add(data)
|
||||
OptionsPrivate.ClearOptions(data.id)
|
||||
@@ -95,7 +129,8 @@ function OptionsPrivate.DuplicateSubRegion(data, index, regionType)
|
||||
for i = index + 1, #data.subRegions do
|
||||
replacements["sub." .. i .. "."] = "sub." .. (i + 1) .. "."
|
||||
end
|
||||
AdjustConditions(data, replacements);
|
||||
AdjustConditions(data, replacements)
|
||||
AdjustAnchors(data, replacements)
|
||||
|
||||
WeakAuras.Add(data)
|
||||
OptionsPrivate.ClearOptions(data.id)
|
||||
|
||||
@@ -302,7 +302,7 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
control = "WeakAurasExpandSmall",
|
||||
name = function()
|
||||
local selfPoint = data.text_selfPoint ~= "AUTO" and self_point_types[data.text_selfPoint]
|
||||
local anchorPoint = anchors[data.text_anchorPoint or "CENTER"] or anchors["CENTER"]
|
||||
local anchorPoint = anchors[data.anchor_point or "CENTER"] or anchors["CENTER"]
|
||||
|
||||
local xOffset = data.text_anchorXOffset or 0
|
||||
local yOffset = data.text_anchorYOffset or 0
|
||||
@@ -364,7 +364,7 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
hidden = hiddenFunction
|
||||
}
|
||||
|
||||
options.text_anchorPoint = {
|
||||
options.anchor_point = {
|
||||
type = "select",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = function()
|
||||
|
||||
@@ -315,4 +315,19 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
return options
|
||||
end
|
||||
|
||||
WeakAuras.RegisterSubRegionOptions("subtick", createOptions, L["Places a tick on the bar"]);
|
||||
local getAnchors = function(data)
|
||||
local anchors = {}
|
||||
for i in ipairs(data.tick_placements) do
|
||||
anchors["tick."..i] = {
|
||||
display = L["Tick Center %s"]:format(i),
|
||||
type = "point"
|
||||
}
|
||||
anchors["tickarea."..i] = {
|
||||
display = L["Tick Area %s"]:format(i),
|
||||
type = "area"
|
||||
}
|
||||
end
|
||||
return anchors
|
||||
end
|
||||
|
||||
WeakAuras.RegisterSubRegionOptions("subtick", createOptions, L["Places a tick on the bar"], getAnchors)
|
||||
|
||||
Reference in New Issue
Block a user