Well I managed to get this working. Based on investigation the best way was to set up a bar just for vehicleui use as no amount of changing the code in nUI worked.
With this set up to display when having a vehicleui and the main action bar displayed otherwise seems to work.
The quest shows an empty bar at first and then updates the buttons with the information party way through the flight. This picks up that change and lets the buttons know and sets the appropriate texture via Blizzards Frame template functionality.
Now, in this scenario combat isn't an issue from what I can see, but what if it was, I guess I'll have to find a toon that needs to do the vashjir vision quest chain as I think that was a similar setup .. to 1. see if that now works and 2. whether the combat situation in that quest chain causes an issue... but, bowing to your superior knowledge of the secure section of addons Vrul, would any of this have an issue in combat ? If so, how the hell do actionbar addons deal with this apart from the one or two that gave up and just turned on the blizzard override bar rofl. Thanks in advance again
Lua Code:
------------------------------------------------------
--[[ Bar Setup ]]--
------------------------------------------------------
local barFrame = CreateFrame("Frame","XBar_Vehicle", UIParent, "SecureHandlerStateTemplate, SecureHandlerAttributeTemplate")
local background = barFrame:CreateTexture("$parent_Background", "BACKGROUND")
background:SetColorTexture(0,0,0,0.5)
background:SetAllPoints()
barFrame:SetWidth(51 * 12)
barFrame:SetHeight(51)
barFrame:SetPoint("CENTER")
------------------------------------------------------
--[[ Button Setup ]]--
------------------------------------------------------
barFrame.Buttons = {}
for i = 1,NUM_ACTIONBAR_BUTTONS do
local btn = CreateFrame("CheckButton", "$parent_Button"..i, barFrame, "SecureActionButtonTemplate,ActionBarButtonTemplate")
btn:SetWidth(50)
btn:SetHeight(50)
if i == 1 then
btn:SetPoint("LEFT",5,0)
else
btn:SetPoint("LEFT", "$parent_Button"..i - 1, "RIGHT", 1,0)
end
local page = GetVehicleBarIndex()
local action = i + ((page - 1) * NUM_ACTIONBAR_BUTTONS)
btn:SetAttribute("type", "action")
btn:SetAttribute("action", action)
btn:SetAttribute("useparent-actionpage", true);
btn.NormalTexture:Hide()
btn:Show()
barFrame.Buttons[i] = btn
end
------------------------------------------------------
--[[ Secure Stuff ]]--
------------------------------------------------------
barFrame:SetAttribute("_onattributechanged",[[ -- self, name, value
if name == "updatebar" then
local page = GetVehicleBarIndex()
if HasVehicleActionBar() then
local buttons = newtable(self:GetChildren())
for i,v in ipairs(buttons) do
local action = i + ((page - 1) * 12)
v:SetAttribute("action",action)
end
end
end
]])
barFrame:SetAttribute('_onstate-actionpage', [[
self:SetAttribute('actionpage', GetVehicleBarIndex())
]])
RegisterStateDriver(barFrame, "visibility", "[vehicleui] show; hide")
RegisterStateDriver(barFrame, "page", "[vehicleui] 12; 1")
barFrame:Execute(barFrame:GetAttribute('_onstate-actionpage'))
OverrideActionBarLeaveFrameLeaveButton:SetParent( barFrame );
OverrideActionBarLeaveFrameLeaveButton:SetAllPoints( barFrame.Buttons[12] );
RegisterStateDriver( OverrideActionBarLeaveFrameLeaveButton, "visibility", "[vehicleui][@vehicle, exists] show; hide" );
------------------------------------------------------
--[[ Event Control ]]--
------------------------------------------------------
local function onEvent(self,event,...)
local args = {...}
if event == "UPDATE_VEHICLE_ACTIONBAR" then
barFrame:SetAttribute("updatebar")
end
end
barFrame:SetScript("OnEvent", onEvent)
barFrame:RegisterEvent("UPDATE_VEHICLE_ACTIONBAR")