from retail

This commit is contained in:
NoM0Re
2025-01-22 18:23:23 +01:00
parent 23c7da5ea6
commit 674ea9fe1e
10 changed files with 137 additions and 38 deletions
@@ -36,7 +36,7 @@ local function CompareValues(a, b)
end
end
local function GetAll(baseObject, path, property, default)
local function GetAll(baseObject, paths, property, default)
local valueFromPath = OptionsPrivate.Private.ValueFromPath
if not property then
return default
@@ -45,7 +45,7 @@ local function GetAll(baseObject, path, property, default)
local result = default
local first = true
for child in OptionsPrivate.Private.TraverseLeafsOrAura(baseObject) do
local childObject = valueFromPath(child, path)
local childObject = valueFromPath(child, paths[child.id])
if childObject and childObject[property] then
if first then
result = childObject[property]
@@ -60,10 +60,10 @@ local function GetAll(baseObject, path, property, default)
return result
end
local function SetAll(baseObject, path, property, value)
local function SetAll(baseObject, paths, property, value)
local valueFromPath = OptionsPrivate.Private.ValueFromPath
for child in OptionsPrivate.Private.TraverseLeafsOrAura(baseObject) do
local object = valueFromPath(child, path)
local object = valueFromPath(child, paths[child.id])
if object then
object[property] = value
WeakAuras.Add(child)
@@ -163,17 +163,17 @@ local function ConstructTexturePicker(frame)
wipe(group.selectedTextures)
group.selectedTextures[texturePath] = true
SetAll(self.baseObject, self.path, self.properties.texture, texturePath)
SetAll(self.baseObject, self.paths, self.properties.texture, texturePath)
group:UpdateList();
local status = dropdown.status or dropdown.localstatus
dropdown.dropdown:SetText(dropdown.list[status.selected]);
end
function group.Open(self, baseObject, path, properties, textures, SetTextureFunc)
function group.Open(self, baseObject, paths, properties, textures, SetTextureFunc)
local valueFromPath = OptionsPrivate.Private.ValueFromPath
self.baseObject = baseObject
self.path = path
self.paths = paths
self.properties = properties
self.textures = textures;
self.SetTextureFunc = SetTextureFunc
@@ -181,30 +181,32 @@ local function ConstructTexturePicker(frame)
self.selectedTextures = {}
for child in OptionsPrivate.Private.TraverseLeafsOrAura(baseObject) do
local object = valueFromPath(child, path)
local object = valueFromPath(child, paths[child.id])
if object and object[properties.texture] then
self.givenPath[child.id] = object[properties.texture]
self.selectedTextures[object[properties.texture]] = true
local texture = object[properties.texture]
self.givenPath[child.id] = texture
self.selectedTextures[texture] = true
else
self.givenPath[child.id] = ""
end
end
local colorAll = GetAll(baseObject, path, properties.color, {1, 1, 1, 1});
local colorAll = GetAll(baseObject, paths, properties.color, {1, 1, 1, 1});
self.textureData = {
r = colorAll[1] or 1,
g = colorAll[2] or 1,
b = colorAll[3] or 1,
a = colorAll[4] or 1,
rotate = GetAll(baseObject, path, properties.rotate, true),
discrete_rotation = GetAll(baseObject, path, properties.discrete_rotation, 0),
rotation = GetAll(baseObject, path, properties.rotation, 0),
mirror = GetAll(baseObject, path, properties.mirror, false),
blendMode = GetAll(baseObject, path, properties.blendMode, "ADD")
rotate = GetAll(baseObject, paths, properties.rotate, true),
discrete_rotation = GetAll(baseObject, paths, properties.discrete_rotation, 0),
rotation = GetAll(baseObject, paths, properties.rotation, 0),
mirror = GetAll(baseObject, paths, properties.mirror, false),
blendMode = GetAll(baseObject, paths, properties.blendMode, "ADD")
}
frame.window = "texture";
frame:UpdateFrameVisible()
group:UpdateList()
local _, givenPath = next(self.givenPath)
local picked = false;
for categoryName, category in pairs(self.textures) do
if not(picked) then
@@ -234,7 +236,7 @@ local function ConstructTexturePicker(frame)
function group.CancelClose()
local valueFromPath = OptionsPrivate.Private.ValueFromPath
for child in OptionsPrivate.Private.TraverseLeafsOrAura(group.baseObject) do
local childObject = valueFromPath(child, group.path)
local childObject = valueFromPath(child, group.paths[child.id])
if childObject then
childObject[group.properties.texture] = group.givenPath[child.id]
WeakAuras.Add(child);