Added "Copy Conditionals" button to the Visibility driver as well
This commit is contained in:
@@ -289,9 +289,14 @@ local directVisCond = {
|
|||||||
nocombat = true,
|
nocombat = true,
|
||||||
mounted = true,
|
mounted = true,
|
||||||
}
|
}
|
||||||
function Bar:InitVisibilityDriver()
|
function Bar:InitVisibilityDriver(returnOnly)
|
||||||
self.hidedriver = {}
|
local tmpDriver
|
||||||
|
if returnOnly then
|
||||||
|
tmpDriver = self.hidedriver
|
||||||
|
else
|
||||||
UnregisterStateDriver(self, 'vis')
|
UnregisterStateDriver(self, 'vis')
|
||||||
|
end
|
||||||
|
self.hidedriver = {}
|
||||||
|
|
||||||
self:SetAttribute("_onstate-vis", [[
|
self:SetAttribute("_onstate-vis", [[
|
||||||
if newstate == "show" or newstate == "fade" then
|
if newstate == "show" or newstate == "fade" then
|
||||||
@@ -302,7 +307,7 @@ function Bar:InitVisibilityDriver()
|
|||||||
end
|
end
|
||||||
]])
|
]])
|
||||||
|
|
||||||
if self.config.visibility.custom then
|
if self.config.visibility.custom and not returnOnly then
|
||||||
table_insert(self.hidedriver, self.config.visibility.customdata or "")
|
table_insert(self.hidedriver, self.config.visibility.customdata or "")
|
||||||
else
|
else
|
||||||
for key, value in pairs(self.config.visibility) do
|
for key, value in pairs(self.config.visibility) do
|
||||||
@@ -328,7 +333,13 @@ function Bar:InitVisibilityDriver()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
table_insert(self.hidedriver, self.config.fadeout and "fade" or "show")
|
table_insert(self.hidedriver, self.config.fadeout and "fade" or "show")
|
||||||
|
|
||||||
|
if not returnOnly then
|
||||||
self:ApplyVisibilityDriver()
|
self:ApplyVisibilityDriver()
|
||||||
|
else
|
||||||
|
self.hidedriver, tmpDriver = tmpDriver, self.hidedriver
|
||||||
|
return table_concat(tmpDriver, ";")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Bar:ApplyVisibilityDriver()
|
function Bar:ApplyVisibilityDriver()
|
||||||
@@ -362,6 +373,11 @@ function Bar:SetVisibilityOption(option, value, arg)
|
|||||||
self:InitVisibilityDriver()
|
self:InitVisibilityDriver()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Bar:CopyCustomConditionals()
|
||||||
|
self.config.visibility.customdata = self:InitVisibilityDriver(true)
|
||||||
|
self:InitVisibilityDriver()
|
||||||
|
end
|
||||||
|
|
||||||
function Bar:Enable()
|
function Bar:Enable()
|
||||||
if not self.disabled then return end
|
if not self.disabled then return end
|
||||||
self.disabled = nil
|
self.disabled = nil
|
||||||
|
|||||||
+28
-2
@@ -64,6 +64,11 @@ do
|
|||||||
local bar = getBar(info[2])
|
local bar = getBar(info[2])
|
||||||
return bar:GetVisibilityOption("custom")
|
return bar:GetVisibilityOption("custom")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function customCopy(info)
|
||||||
|
local bar = getBar(info[2])
|
||||||
|
bar:CopyCustomConditionals()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local _, class = UnitClass("player")
|
local _, class = UnitClass("player")
|
||||||
@@ -210,15 +215,36 @@ function Bar:GetOptionObject()
|
|||||||
hidden = function() return (GetNumShapeshiftForms() < 1) end,
|
hidden = function() return (GetNumShapeshiftForms() < 1) end,
|
||||||
disabled = customEnabled,
|
disabled = customEnabled,
|
||||||
},
|
},
|
||||||
|
customNl = {
|
||||||
|
order = 98,
|
||||||
|
type = "description",
|
||||||
|
name = "\n",
|
||||||
|
},
|
||||||
|
customHeader = {
|
||||||
|
order = 99,
|
||||||
|
type = "header",
|
||||||
|
name = L["Custom Conditionals"],
|
||||||
|
},
|
||||||
custom = {
|
custom = {
|
||||||
order = 100,
|
order = 100,
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = L["Use Custom Condition"],
|
name = L["Use Custom Condition"],
|
||||||
desc = L["Enable the use of a custom condition, disabling all of the above."],
|
desc = L["Enable the use of a custom condition, disabling all of the above."],
|
||||||
width = "full",
|
},
|
||||||
|
customCopy = {
|
||||||
|
order = 101,
|
||||||
|
type = "execute",
|
||||||
|
name = L["Copy Conditionals"],
|
||||||
|
desc = L["Create a copy of the auto-generated conditionals in the custom configuration as a base template."],
|
||||||
|
func = customCopy,
|
||||||
|
},
|
||||||
|
customDesc = {
|
||||||
|
order = 102,
|
||||||
|
type = "description",
|
||||||
|
name = L["Note: Enabling Custom Conditionals will disable all of the above settings!"],
|
||||||
},
|
},
|
||||||
customdata = {
|
customdata = {
|
||||||
order = 101,
|
order = 103,
|
||||||
type = "input",
|
type = "input",
|
||||||
name = L["Custom Conditionals"],
|
name = L["Custom Conditionals"],
|
||||||
desc = L["You can use any macro conditionals in the custom string, using \"show\" and \"hide\" as values.\n\nExample: [combat]hide;show"],
|
desc = L["You can use any macro conditionals in the custom string, using \"show\" and \"hide\" as values.\n\nExample: [combat]hide;show"],
|
||||||
|
|||||||
Reference in New Issue
Block a user