from retail

diffchecked
This commit is contained in:
NoM0Re
2025-01-26 19:24:17 +01:00
parent dcd0f833ac
commit 38533d0e99
7 changed files with 286 additions and 265 deletions
+71 -29
View File
@@ -23,7 +23,8 @@ local function setTextureFunc(textureWidget, texturePath, textureName)
else
local rows, columns, frames, frameWidth, frameHeight, fileWidth, fileHeight = texturePath:match(pattern2)
if rows then
rows, columns, frames, frameWidth, frameHeight, fileWidth, fileHeight = tonumber(rows), tonumber(columns), tonumber(frames), tonumber(frameWidth), tonumber(frameHeight), tonumber(fileWidth), tonumber(fileHeight)
rows, columns, frames, frameWidth, frameHeight, fileWidth, fileHeight
= tonumber(rows), tonumber(columns), tonumber(frames), tonumber(frameWidth), tonumber(frameHeight), tonumber(fileWidth), tonumber(fileHeight)
local frameScaleW = 1
local frameScaleH = 1
if fileWidth > 0 and frameWidth > 0 then
@@ -115,15 +116,14 @@ local function createOptions(id, data)
name = L["Choose"],
order = 2,
func = function()
local path = {}
local paths = {}
for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do
paths[child.id] = path
end
OptionsPrivate.OpenTexturePicker(data, paths, {
local path = {}
local paths = {}
for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do
paths[child.id] = path
end
OptionsPrivate.OpenTexturePicker(data, paths, {
texture = "foregroundTexture",
color = "foregroundColor",
rotation = "rotation",
mirror = "mirror",
blendMode = "blendMode"
}, texture_types, setTextureFunc);
@@ -160,7 +160,9 @@ local function createOptions(id, data)
WeakAuras.UpdateThumbnail(data);
end,
order = 4,
hidden = function() return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) end
hidden = function()
return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture)
end
},
customForegroundColumns = {
type = "input",
@@ -176,7 +178,9 @@ local function createOptions(id, data)
WeakAuras.UpdateThumbnail(data);
end,
order = 5,
hidden = function() return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) end
hidden = function()
return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture)
end
},
customForegroundFrames = {
type = "input",
@@ -192,7 +196,9 @@ local function createOptions(id, data)
WeakAuras.UpdateThumbnail(data);
end,
order = 6,
hidden = function() return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) end
hidden = function()
return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture)
end
},
customForegroundFileWidth = {
type = "input",
@@ -214,7 +220,9 @@ local function createOptions(id, data)
WeakAuras.UpdateThumbnail(data);
end,
order = 7,
hidden = function() return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) end
hidden = function()
return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture)
end
},
customForegroundFileHeight = {
type = "input",
@@ -236,7 +244,9 @@ local function createOptions(id, data)
WeakAuras.UpdateThumbnail(data);
end,
order = 8,
hidden = function() return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) end
hidden = function()
return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture)
end
},
customForegroundFrameWidth = {
type = "input",
@@ -253,7 +263,9 @@ local function createOptions(id, data)
WeakAuras.UpdateThumbnail(data);
end,
order = 9,
hidden = function() return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) end
hidden = function()
return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture)
end
},
customForegroundFrameHeight = {
type = "input",
@@ -270,7 +282,9 @@ local function createOptions(id, data)
WeakAuras.UpdateThumbnail(data);
end,
order = 10,
hidden = function() return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) end
hidden = function()
return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture)
end
},
blendMode = {
type = "select",
@@ -293,7 +307,7 @@ local function createOptions(id, data)
name = L["Animation Start"],
min = 0,
max = 1,
bigStep = 0.01,
--bigStep = 0.01,
order = 13,
isPercent = true
},
@@ -304,7 +318,7 @@ local function createOptions(id, data)
name = L["Animation End"],
min = 0,
max = 1,
bigStep = 0.01,
--bigStep = 0.01,
order = 14,
isPercent = true
},
@@ -418,7 +432,11 @@ local function createOptions(id, data)
WeakAuras.UpdateThumbnail(data);
end,
order = 24,
hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture) end
hidden = function()
return data.sameTexture
or texture_data[data.backgroundTexture]
or textureNameHasData(data.backgroundTexture)
end
},
customBackgroundColumns = {
type = "input",
@@ -434,7 +452,11 @@ local function createOptions(id, data)
WeakAuras.UpdateThumbnail(data);
end,
order = 25,
hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture) end
hidden = function()
return data.sameTexture
or texture_data[data.backgroundTexture]
or textureNameHasData(data.backgroundTexture)
end
},
customBackgroundFrames = {
type = "input",
@@ -450,7 +472,11 @@ local function createOptions(id, data)
WeakAuras.UpdateThumbnail(data);
end,
order = 26,
hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture) end
hidden = function()
return data.sameTexture
or texture_data[data.backgroundTexture]
or textureNameHasData(data.backgroundTexture)
end
},
customBackgroundFileWidth = {
type = "input",
@@ -472,7 +498,9 @@ local function createOptions(id, data)
WeakAuras.UpdateThumbnail(data);
end,
order = 27,
hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture) end
hidden = function()
return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture)
end
},
customBackgroundFileHeight = {
type = "input",
@@ -494,7 +522,9 @@ local function createOptions(id, data)
WeakAuras.UpdateThumbnail(data);
end,
order = 28,
hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture) end
hidden = function()
return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture)
end
},
customBackgroundFrameWidth = {
type = "input",
@@ -511,7 +541,9 @@ local function createOptions(id, data)
WeakAuras.UpdateThumbnail(data);
end,
order = 29,
hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture) end
hidden = function()
return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture)
end
},
customBackgroundFrameHeight = {
type = "input",
@@ -528,7 +560,9 @@ local function createOptions(id, data)
WeakAuras.UpdateThumbnail(data);
end,
order = 30,
hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture) end
hidden = function()
return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture)
end
},
backgroundPercent = {
type = "range",
@@ -610,7 +644,8 @@ local function modifyThumbnail(parent, region, data, fullModify, size)
region.foreground.frameWidth = 0
region.foreground.frameHeight = 0
else
local rows, columns, frames, frameWidth, frameHeight, fileWidth, fileHeight = data.foregroundTexture:match(pattern2)
local rows, columns, frames, frameWidth, frameHeight, fileWidth, fileHeight
= data.foregroundTexture:match(pattern2)
if rows then
local lastFrame = frames - 1;
region.startFrame = floor( (data.startPercent or 0) * lastFrame) + 1;
@@ -639,17 +674,23 @@ local function modifyThumbnail(parent, region, data, fullModify, size)
frame = floor(region.startFrame + (region.endFrame - region.startFrame) * 0.75);
end
local texture = data.foregroundTexture or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\stopmotion";
local texture = data.foregroundTexture or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\StopMotion";
if (region.foreground.rows and region.foreground.columns) then
region.texture:SetTexture(texture);
local frameScaleW, frameScaleH = 1, 1
if region.foreground.fileWidth and region.foreground.frameWidth and region.foreground.fileWidth > 0 and region.foreground.frameWidth > 0 then
if region.foreground.fileWidth and region.foreground.frameWidth
and region.foreground.fileWidth > 0 and region.foreground.frameWidth > 0
then
frameScaleW = (region.foreground.frameWidth * region.foreground.columns) / region.foreground.fileWidth
end
if region.foreground.fileHeight and region.foreground.frameHeight and region.foreground.fileHeight > 0 and region.foreground.frameHeight > 0 then
if region.foreground.fileHeight and region.foreground.frameHeight
and region.foreground.fileHeight > 0 and region.foreground.frameHeight > 0
then
frameScaleH = (region.foreground.frameHeight * region.foreground.rows) / region.foreground.fileHeight
end
setTile(region.texture, frame, region.foreground.rows, region.foreground.columns, frameScaleW, frameScaleH);
region.SetValue = function(self, percent)
@@ -666,7 +707,8 @@ local function modifyThumbnail(parent, region, data, fullModify, size)
end
end
region.texture:SetVertexColor(data.foregroundColor[1], data.foregroundColor[2], data.foregroundColor[3], data.foregroundColor[4]);
region.texture:SetVertexColor(data.foregroundColor[1], data.foregroundColor[2],
data.foregroundColor[3], data.foregroundColor[4]);
region.texture:SetBlendMode(data.blendMode);
region.elapsed = 0;