Files
coa-weakauras/WeakAurasOptions/SubRegionOptions/Texture.lua
T
2025-01-27 03:28:33 +01:00

106 lines
2.9 KiB
Lua

if not WeakAuras.IsLibsOK() then return end
local AddonName, OptionsPrivate = ...
local L = WeakAuras.L;
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 options = {
__title = L["Texture %s"]:format(subIndex),
__order = 1,
textureVisible = {
type = "toggle",
width = WeakAuras.doubleWidth,
name = L["Show Texture"],
order = 1,
},
textureTexture = {
type = "input",
width = WeakAuras.doubleWidth - 0.15,
name = L["Texture"],
order = 2,
},
chooseTexture = {
type = "execute",
width = 0.15,
name = L["Choose"],
order = 2,
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 = "textureTexture",
color = "textureColor",
mirror = "textureMirror",
blendMode = "textureBlendMode"
}, OptionsPrivate.Private.texture_types, nil, true)
end,
imageWidth = 24,
imageHeight = 24,
control = "WeakAurasIcon",
image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\browse",
},
textureColor = {
type = "color",
width = WeakAuras.normalWidth,
name = L["Color"],
hasAlpha = true,
order = 3
},
textureDesaturate = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Desaturate"],
order = 4,
},
textureBlendMode = {
type = "select",
width = WeakAuras.normalWidth,
name = L["Blend Mode"],
order = 11,
values = OptionsPrivate.Private.blend_types
},
textureMirror = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Mirror"],
order = 12
},
textureRotate = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Allow Full Rotation"],
order = 13,
},
textureRotation = {
type = "range",
control = "WeakAurasSpinBox",
width = WeakAuras.normalWidth,
name = L["Rotation"],
min = 0,
max = 360,
step = 1,
bigStep = 3,
order = 14,
},
}
OptionsPrivate.commonOptions.PositionOptionsForSubElement(data, options, 15, areaAnchors, pointAnchors)
OptionsPrivate.AddUpDownDeleteDuplicate(options, parentData, index, "subtexture")
return options
end
WeakAuras.RegisterSubRegionOptions("subtexture", createOptions, L["Shows a Texture"]);