From 5eb2db89f7364bd3af43783be630c159fbf35343 Mon Sep 17 00:00:00 2001 From: NoM0Re <1629787+NoM0Re@users.noreply.github.com> Date: Sun, 18 Jan 2026 21:05:07 +0100 Subject: [PATCH] (fix/texture): Desaturate state lost on SetTexture Fixes #93 Also normalize SetDesaturated calls to use booleans instead of numeric flags. (cherry picked from commit 47dce3a9d5ba23c170f002b323a11ed2a5c5e206) --- WeakAuras/BaseRegions/Texture.lua | 31 ++++++++++++++++++++++++------- WeakAuras/RegionTypes/AuraBar.lua | 2 +- WeakAuras/RegionTypes/Icon.lua | 2 +- WeakAuras/RegionTypes/Texture.lua | 1 + 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/WeakAuras/BaseRegions/Texture.lua b/WeakAuras/BaseRegions/Texture.lua index 6e67b79..9614ad2 100644 --- a/WeakAuras/BaseRegions/Texture.lua +++ b/WeakAuras/BaseRegions/Texture.lua @@ -99,18 +99,35 @@ local funcs = { end } +local function setDesaturated(self, desaturated, ...) + self.isDesaturated = desaturated and 1 or 0 + return self._SetDesaturated(self, desaturated, ...) +end + +local function setTexture(self, ...) + local apply = self._SetTexture(self, ...) + if self.isDesaturated ~= nil then + self._SetDesaturated(self, self.isDesaturated == 1) + end + return apply +end + function Private.TextureBase.create(frame) - local base = {} + local base = {} - for funcName, func in pairs(funcs) do - base[funcName] = func - end + for funcName, func in pairs(funcs) do + base[funcName] = func + end - local texture = frame:CreateTexture() + local texture = frame:CreateTexture() + texture._SetDesaturated = texture.SetDesaturated + texture._SetTexture = texture.SetTexture + texture.SetDesaturated = setDesaturated + texture.SetTexture = setTexture - base.texture = texture + base.texture = texture - return base + return base end function Private.TextureBase.modify(base, options) diff --git a/WeakAuras/RegionTypes/AuraBar.lua b/WeakAuras/RegionTypes/AuraBar.lua index c95f3ae..b8bd197 100644 --- a/WeakAuras/RegionTypes/AuraBar.lua +++ b/WeakAuras/RegionTypes/AuraBar.lua @@ -1140,7 +1140,7 @@ end local function setTexture(self, ...) local apply = self._SetTexture(self, ...) if self.isDesaturated ~= nil then - self:_SetDesaturated(self.isDesaturated) + self:_SetDesaturated(self.isDesaturated == 1) end return apply end diff --git a/WeakAuras/RegionTypes/Icon.lua b/WeakAuras/RegionTypes/Icon.lua index 19221bd..bf55754 100644 --- a/WeakAuras/RegionTypes/Icon.lua +++ b/WeakAuras/RegionTypes/Icon.lua @@ -199,7 +199,7 @@ end local function setTexture(self, ...) local apply = self._SetTexture(self, ...) if self.isDesaturated ~= nil then - self:_SetDesaturated(self.isDesaturated) + self:_SetDesaturated(self.isDesaturated == 1) end return apply end diff --git a/WeakAuras/RegionTypes/Texture.lua b/WeakAuras/RegionTypes/Texture.lua index ac8dcd5..b6bcf6b 100644 --- a/WeakAuras/RegionTypes/Texture.lua +++ b/WeakAuras/RegionTypes/Texture.lua @@ -11,6 +11,7 @@ local default = { height = 200, color = {1, 1, 1, 1}, blendMode = "BLEND", + textureWrapMode = "CLAMPTOBLACKADDITIVE", rotation = 0, mirror = false, rotate = false,