from retail

This commit is contained in:
NoM0Re
2025-01-26 21:24:18 +01:00
parent 1793d7ac19
commit f9bf9c3c16
25 changed files with 1467 additions and 500 deletions
+6 -3
View File
@@ -13,7 +13,7 @@ local default = function(parentType)
border_size = 2,
}
if parentType == "aurabar" then
options["border_anchor"] = "bar"
options["anchor_area"] = "bar"
end
return options
end
@@ -48,8 +48,6 @@ end
local function modify(parent, region, parentData, data, first)
region:SetParent(parent)
parent:AnchorSubRegion(region, "area", parentData.regionType == "aurabar" and data.border_anchor, nil, data.border_offset, data.border_offset)
local edgeFile = SharedMedia:Fetch("border", data.border_edge)
if edgeFile and edgeFile ~= "" then
region:SetBackdrop({
@@ -76,6 +74,11 @@ local function modify(parent, region, parentData, data, first)
end
region:SetVisible(data.border_visible)
region.Anchor = function()
parent:AnchorSubRegion(region, "area", parentData.regionType == "aurabar" and data.anchor_area or nil,
nil, data.border_offset, data.border_offset)
end
end
local function supports(regionType)
+10 -8
View File
@@ -22,7 +22,7 @@ local default = function(parentType)
}
if parentType == "aurabar" then
options["glowType"] = "Pixel"
options["glow_anchor"] = "bar"
options["anchor_area"] = "bar"
end
return options
end
@@ -314,12 +314,6 @@ end
local function modify(parent, region, parentData, data, first)
region:SetParent(parent)
region.parentRegionType = parentData.regionType
if parentData.regionType == "aurabar" then
parent:AnchorSubRegion(region, "area", data.glow_anchor)
else
parent:AnchorSubRegion(region, "area", data.glowType == "buttonOverlay" and "region")
end
region.parent = parent
region.parentType = parentData.regionType
@@ -338,6 +332,14 @@ local function modify(parent, region, parentData, data, first)
region:SetVisible(data.glow)
region:SetScript("OnSizeChanged", region.UpdateSize)
region.Anchor = function()
if parentData.regionType == "aurabar" then
parent:AnchorSubRegion(region, "area", data.anchor_area)
else
parent:AnchorSubRegion(region, "area", (data.glowType == "buttonOverlay" or data.glowType == "Proc") and "region")
end
end
end
-- This is used by the templates to add glow
@@ -357,7 +359,7 @@ function Private.getDefaultGlow(regionType)
glowBorder = false,
glowXOffset = 0,
glowYOffset = 0,
glow_anchor = "bar"
anchor_area = "bar"
}
else
return {
+277
View File
@@ -0,0 +1,277 @@
if not WeakAuras.IsLibsOK() then return end
local AddonName, Private = ...
local L = WeakAuras.L
local default = function(parentType)
local defaults = {
stopmotionVisible = true,
barModelClip = true,
stopmotionTexture = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\StopMotion",
stopmotionDesaturate = false,
stopmotionColor = {1, 1, 1, 1},
stopmotionBlendMode = "BLEND",
startPercent = 0,
endPercent = 1,
frameRate = 15,
animationType = "loop",
inverse = false,
customFrames = 0,
customRows = 16,
customColumns = 16,
customFileWidth = 0,
customFileHeight = 0,
customFrameWidth = 0,
customFrameHeight = 0,
anchor_mode = "area",
self_point = "CENTER",
anchor_point = "CENTER",
width = 32,
height = 32,
scale = 1,
progressSources = {-2, ""},
}
if IsAddOnLoaded("WeakAurasStopMotion") then
defaults.stopmotionTexture = "Interface\\AddOns\\WeakAurasStopMotion\\Textures\\IconOverlays\\ArcReactor"
defaults.frameRate = 30
defaults.scale = 3
end
if parentType == "aurabar" then
defaults.anchor_area = "bar"
else
defaults.anchor_area = "ALL"
end
return defaults
end
local properties = {
stopmotionVisible = {
display = L["Visibility"],
setter = "SetVisible",
type = "bool",
defaultProperty = true
},
stopmotionDesaturate = {
display = L["Desaturate"],
setter = "SetDesaturated",
type = "bool",
},
stopmotionColor = {
display = L["Color"],
setter = "SetColor",
type = "color"
},
}
local funcs = {
OnSizeChanged = function(self)
local w, h = self:GetSize()
self.stopMotion:SetSize(w * self.scale, h * self.scale)
end,
SetDesaturated = function(self, b)
self.stopMotion:SetDesaturated(b)
end,
SetColor = function(self, ...)
self.stopMotion:SetColor(...)
end,
}
local TimedFuncs = {
SetVisible = function(self, visible)
self.visible = visible
if visible then
self:Show()
self.stopMotion:SetStartTime(GetTime())
self.FrameTick = function()
self.stopMotion:TimedUpdate()
end
self.parent.subRegionEvents:AddSubscriber("FrameTick", self)
else
self:Hide()
self.FrameTick = nil
self.parent.subRegionEvents:RemoveSubscriber("FrameTick", self)
end
end,
Update = function(self) end,
}
local ProgressFuncs = {
UpdateFrameTick = function(self)
if self.visible and self.progressData.progressType == "timed" and not self.progressData.paused then
if not self.FrameTick then
self.FrameTick = self.UpdateFrame
self.parent.subRegionEvents:AddSubscriber("FrameTick", self)
end
else
if self.FrameTick then
self.FrameTick = nil
self.parent.subRegionEvents:RemoveSubscriber("FrameTick", self)
end
end
end,
SetVisible = function(self, visible)
self.visible = visible
if visible then
self:Show()
else
self:Hide()
end
self:UpdateFrame()
self:UpdateFrameTick()
end,
UpdateFrame = function(self)
if self.visible then
local progressData = self.progressData
if progressData.progressType == "static" then
local progress = 0
if progressData.total ~= 0 then
progress = progressData.value / progressData.total
end
self.stopMotion:SetProgress(progress)
elseif progressData.progressType == "timed" then
if progressData.paused then
local remaining = self.progressData.remaining
local progress = 1 - (remaining / self.progressData.duration)
self.stopMotion:SetProgress(progress)
else
local remaining = self.progressData.expirationTime - GetTime()
local progress = 1 - (remaining / self.progressData.duration)
self.stopMotion:SetProgress(progress)
end
end
end
end,
Update = function(self, state, states)
Private.UpdateProgressFrom(self.progressData, self.progressSource, {}, state, states, self.parent)
self:UpdateFrame()
self:UpdateFrameTick()
end,
}
local function create()
local region = CreateFrame("Frame", nil, UIParent)
--region:SetFlattensRenderLayers(true)
for k, v in pairs(funcs) do
region[k] = v
end
region.stopMotion = Private.StopMotionBase.create(region, "ARTWORK")
region.progressData = {}
return region
end
local function onAcquire(subRegion)
subRegion:Show()
end
local function onRelease(subRegion)
subRegion:Hide()
end
local function modify(parent, region, parentData, data, first)
region.parent = parent
region:SetParent(parent)
region.scale = data.scale or 1
region.Anchor = nil
if parentData.regionType == "aurabar"
and data.anchor_mode == "area"
and data.anchor_area == "fg"
and data.barModelClip
then
-- Special anchoring for clipping !
region:SetScript("OnSizeChanged", nil)
region:ClearAllPoints()
region:SetAllPoints(parent.bar.fgFrame)
region.stopMotion:ClearAllPoints()
region.stopMotion:SetAllPoints(region.parent.bar)
else
local arg1 = data.anchor_mode == "point" and data.anchor_point or data.anchor_area
local arg2 = data.anchor_mode == "point" and data.self_point or nil
if data.anchor_mode == "area" and data.scale ~= 1 then
-- Extra Scale mode
region.stopMotion:ClearAllPoints()
region.stopMotion:SetPoint("CENTER", region, "CENTER")
region:SetScript("OnSizeChanged", region.OnSizeChanged)
region:OnSizeChanged()
else
if data.anchor_mode == "point" then
region:SetSize(data.width or 0, data.height or 0)
end
region.stopMotion:ClearAllPoints()
region.stopMotion:SetAllPoints(region)
region:SetScript("OnSizeChanged", nil)
end
region.Anchor = function()
region:ClearAllPoints()
parent:AnchorSubRegion(region, data.anchor_mode, arg1, arg2, data.xOffset, data.yOffset)
if data.anchor_mode == "area" and data.scale ~= 1 then
region:OnSizeChanged()
end
end
end
Private.StopMotionBase.modify(region.stopMotion, {
blendMode = data.stopmotionBlendMode,
frameRate = data.frameRate,
inverseDirection = data.inverse,
animationType = data.animationType,
texture = data.stopmotionTexture,
startPercent = data.startPercent,
endPercent = data.endPercent,
customFrames = data.customFrames,
customRows = data.customRows,
customColumns = data.customColumns,
customFileWidth = data.customFileWidth,
customFileHeight = data.customFileHeight,
customFrameWidth = data.customFrameWidth,
customFrameHeight = data.customFrameHeight,
})
region.progressSource = Private.AddProgressSourceMetaData(parentData, data.progressSources or {-2, ""})
region.FrameTick = nil
if data.animationType == "loop" or data.animationType == "bounce" or data.animationType == "once" then
region.Update = TimedFuncs.Update
region.SetVisible = TimedFuncs.SetVisible
region.UpdateFrameTick = nil
region.UpdateFrame = nil
parent.subRegionEvents:RemoveSubscriber("Update", region)
else
region.Update = ProgressFuncs.Update
region.SetVisible = ProgressFuncs.SetVisible
region.UpdateFrameTick = ProgressFuncs.UpdateFrameTick
region.UpdateFrame = ProgressFuncs.UpdateFrame
parent.subRegionEvents:AddSubscriber("Update", region)
end
region:SetVisible(data.stopmotionVisible)
region:SetDesaturated(data.stopmotionDesaturate)
end
local function supports(regionType)
return regionType == "texture"
or regionType == "progresstexture"
or regionType == "icon"
or regionType == "aurabar"
or regionType == "text"
end
WeakAuras.RegisterSubRegionType("substopmotion", L["Stop Motion"], supports, create, modify, onAcquire, onRelease, default, nil, properties)
+15 -15
View File
@@ -22,7 +22,7 @@ local default = function(parentType)
text_justify = "CENTER",
text_selfPoint = "AUTO",
text_anchorPoint = "CENTER",
anchor_point = "CENTER",
anchorXOffset = 0,
anchorYOffset = 0,
@@ -46,7 +46,7 @@ local default = function(parentType)
text_justify = "CENTER",
text_selfPoint = "AUTO",
text_anchorPoint = parentType == "aurabar" and "INNER_RIGHT" or "BOTTOMLEFT",
anchor_point = parentType == "aurabar" and "INNER_RIGHT" or "BOTTOMLEFT",
anchorXOffset = 0,
anchorYOffset = 0,
@@ -256,7 +256,7 @@ local function modify(parent, region, parentData, data, first)
if text:GetFont() then
text:SetText(WeakAuras.ReplaceRaidMarkerSymbols(textStr))
end
region:UpdateAnchor()
region:Anchor()
end
end
@@ -340,7 +340,7 @@ local function modify(parent, region, parentData, data, first)
region.text:SetFont(fontPath, size < 33 and size or 33, data.text_fontType);
end
region.text:SetTextHeight(size)
region:UpdateAnchor();
region:Anchor();
end
function region:SetVisible(visible)
@@ -367,7 +367,7 @@ local function modify(parent, region, parentData, data, first)
local selfPoint = data.text_selfPoint
if selfPoint == "AUTO" then
if parentData.regionType == "icon" then
local anchorPoint = data.text_anchorPoint or "CENTER"
local anchorPoint = data.anchor_point or "CENTER"
if anchorPoint:sub(1, 6) == "INNER_" then
selfPoint = anchorPoint:sub(7)
elseif anchorPoint:sub(1, 6) == "OUTER_" then
@@ -377,7 +377,7 @@ local function modify(parent, region, parentData, data, first)
selfPoint = "CENTER"
end
elseif parentData.regionType == "aurabar" then
selfPoint = data.text_anchorPoint or "CENTER"
selfPoint = data.anchor_point or "CENTER"
if selfPoint:sub(1, 5) == "ICON_" then
selfPoint = selfPoint:sub(6)
elseif selfPoint:sub(1, 6) == "INNER_" then
@@ -385,15 +385,16 @@ local function modify(parent, region, parentData, data, first)
end
selfPoint = Private.point_types[selfPoint] and selfPoint or "CENTER"
else
selfPoint = Private.inverse_point_types[data.text_anchorPoint or "CENTER"] or "CENTER"
selfPoint = Private.inverse_point_types[data.anchor_point or "CENTER"] or "CENTER"
end
end
region.text_anchorXOffset = data.text_anchorXOffset
region.text_anchorYOffset = data.text_anchorYOffset
region.UpdateAnchor = function(self)
parent:AnchorSubRegion(text, "point", selfPoint, data.text_anchorPoint, self.text_anchorXOffset or 0, self.text_anchorYOffset or 0)
region.Anchor = function(self)
parent:AnchorSubRegion(text, "point", data.anchor_point, selfPoint,
self.text_anchorXOffset or 0, self.text_anchorYOffset or 0)
end
region.SetXOffset = function(self, xOffset)
@@ -401,7 +402,7 @@ local function modify(parent, region, parentData, data, first)
return
end
self.text_anchorXOffset = xOffset
self:UpdateAnchor()
self:Anchor()
end
region.SetYOffset = function(self, yOffset)
@@ -409,12 +410,11 @@ local function modify(parent, region, parentData, data, first)
return
end
self.text_anchorYOffset = yOffset
self:UpdateAnchor()
self:Anchor()
end
region:Color(data.text_color[1], data.text_color[2], data.text_color[3], data.text_color[4]);
region:SetVisible(data.text_visible)
region:UpdateAnchor()
end
local function addDefaultsForNewAura(data)
@@ -430,7 +430,7 @@ local function addDefaultsForNewAura(data)
text_visible = true,
text_selfPoint = "AUTO",
text_anchorPoint = "INNER_LEFT",
anchor_point = "INNER_LEFT",
anchorXOffset = 0,
anchorYOffset = 0,
@@ -450,7 +450,7 @@ local function addDefaultsForNewAura(data)
text_visible = true,
text_selfPoint = "AUTO",
text_anchorPoint = "INNER_RIGHT",
anchor_point = "INNER_RIGHT",
anchorXOffset = 0,
anchorYOffset = 0,
@@ -470,7 +470,7 @@ local function addDefaultsForNewAura(data)
text_visible = true,
text_selfPoint = "AUTO",
text_anchorPoint = "INNER_BOTTOMRIGHT",
anchor_point = "INNER_BOTTOMRIGHT",
anchorXOffset = 0,
anchorYOffset = 0,
+24 -1
View File
@@ -443,6 +443,28 @@ local funcs = {
end
self.use_texture = use
self:UpdateTexture()
end,
AnchorSubRegion = function(self, subRegion, anchorType, anchorPoint, subRegionPoint, anchorXOffset, anchorYOffset)
subRegion:ClearAllPoints()
if anchorType == "point" then
local xOffset = anchorXOffset or 0
local yOffset = anchorYOffset or 0
subRegionPoint = Private.point_types[subRegionPoint] and subRegionPoint or "CENTER"
local tickIndex = tonumber(anchorPoint:sub(6))
local anchorTo = tickIndex and self.ticks[tickIndex] or nil
if anchorTo then
subRegion:SetPoint(subRegionPoint, anchorTo, "CENTER", xOffset, yOffset)
end
else
local tickIndex = tonumber(anchorPoint:sub(10))
local anchorTo = tickIndex and self.ticks[tickIndex] or nil
local xOffset = anchorXOffset or 0
local yOffset = anchorYOffset or 0
if anchorTo then
subRegion:SetPoint("BOTTOMLEFT", anchorTo, "BOTTOMLEFT", -xOffset, -yOffset)
subRegion:SetPoint("TOPRIGHT", anchorTo, "TOPRIGHT", xOffset, yOffset)
end
end
end
}
@@ -483,7 +505,7 @@ local function modify(parent, region, parentData, data, first)
if region.ticks[i] == nil then
local texture = region:CreateTexture()
texture:SetDrawLayer("ARTWORK", 3)
texture:SetAllPoints(region)
texture:SetAllPoints()
region.ticks[i] = texture
end
end
@@ -520,6 +542,7 @@ local function modify(parent, region, parentData, data, first)
region:SetTickRotation(data.tick_rotation)
region:SetTickMirror(data.tick_mirror)
region:UpdateTickPlacement()
region:UpdateTickSize()
parent.subRegionEvents:AddSubscriber("Update", region)