Quantcast Could use a hand with custom actionbars - WoWInterface
Thread Tools Display Modes
07-24-10, 07:23 AM   #1
Schnorki
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Apr 2010
Posts: 14
Could use a hand with custom actionbars

Hey there. I've come across a somewhat annoying little problem regarding the newer version of my custom-made actionbars.

1) actionbars are made from scratch, and the main bar responds to page/possession/vehicle/... changes in regards to the abilities shown
2) the default blizzard bars are removed (hidden, show function cut, all unregistered)

now, the issue is as follows:
i would like to preserve the default keybindings as the bar layout is actually the same. by default, this actually almost works, in that the bindings will generally hit the respective ability that is visible on the new actionbar (since that same ability is also what would be on the default actionbar at that point in time). the problem is however, that upon spec changing and sometimes (yes, only sometimes..odd rly) upon entering a vehicle (really only noticed it with oculus drakes actually) the bindings do not auto-update and the hotkey hence still tries to cast the respective skill occupied by that button prior to spec changing or entering a vehicle.

i figured its a fairly simple problem in that there's probably just some event registered to the default mainactionbar (onupdate would be my guess actually, since hiding alone without unregistering results in the same issues) that would normally take care of adjusting bindings to hit the new ability of reference, and that is merely no longer called due to having effectively removed the default bars.

so my question to you is, does anyone know a) what the needed function would be to update the bindings again and b) where exactly its normally called?
(i'm normally not this terrible at finding stuff myself but i've been pretty damn blind for the past couple days, lol)
  Reply With Quote
07-24-10, 10:52 AM   #2
contramundi
A Chromatic Dragonspawn
 
contramundi's Avatar
AddOn Compiler - Click to view compilations
Join Date: May 2008
Posts: 179
try and poke in the core files from domino's, bartender, etc to see how they manage the action button paging/switching
  Reply With Quote
07-24-10, 11:03 AM   #3
Schnorki
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Apr 2010
Posts: 14
correct me if i'm wrong but last time i checked, i'm fairly certain they both came with custom keybinding, which is pretty much exactly what i'm trying to avoid as i am merely attempting to keep the default bindings working
  Reply With Quote
07-24-10, 11:27 AM   #4
Vrul
A Rage Talon Dragon Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 330
The actual change of which action is associated with an action button is handled via the function ActionButton_UpdateAction. The only way for non-Blizzard code to force a call of that (without taint) is via an action button's OnAttributeChanged script. So you need to make sure that you change a button's attribute (not just set it to the same value).

Looking at your CompactBars.lua and the code directly related to this:
Code:
actionbar:SetAttribute("_onstate-page", [[
	self:SetAttribute("actionpage", tonumber(newstate));
	ActionButtons = newtable( self:GetChildren() );
	for i, button in ipairs( ActionButtons ) do
		button:SetAttribute("touch", nil);
	end
]]);
RegisterStateDriver(actionbar, "page", "[bar:2] 2; [bar:3] 3; [bar:4] 4; [bar:5] 5; [bar:6] 6; [bonusbar:1] 7; [bonusbar:2] 8; [bonusbar:3] 9; [bonusbar:4] 10; [bonusbar:5] 11; 1");
for i = 1, 12 do
	local button = CreateFrame("CheckButton", "snkUI_CompactBarButton"..i, actionbar, "ActionBarButtonTemplate");
	button:SetID(i);
	button:SetAttribute("useparent-actionpage", true);
	button:SetPoint("TOPLEFT", actionbar, 0, 0);
end
I would make the following changes:
Code:
actionbar:SetAttribute("_onstate-page", [[
	newstate = tonumber(newstate)
	for i, button in ipairs( ActionButtons ) do
		button:SetAttribute('actionpage', newstate)
	end
]]);
for i = 1, 12 do
	local button = CreateFrame("CheckButton", "snkUI_CompactBarButton"..i, actionbar, "ActionBarButtonTemplate");
	button:SetID(i);
	button:SetPoint("TOPLEFT", actionbar, 0, 0);
end 
actionbar:Execute([[
	ActionButtons = newtable( self:GetChildren() );
]])
RegisterStateDriver(actionbar, "page", "[bonusbar:5] 11; [bar:2] 2; [bar:3] 3; [bar:4] 4; [bar:5] 5; [bar:6] 6; [bonusbar:1] 7; [bonusbar:2] 8; [bonusbar:3] 9; [bonusbar:4] 10; 1");
Note: I changed the order of a couple things for a reason.
  Reply With Quote
07-24-10, 06:59 PM   #5
Schnorki
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Apr 2010
Posts: 14
the compact bars one is way outdated by now anyways actually

but i'll have a look and see if i can get that working with the new ones
thanks
  Reply With Quote
07-25-10, 08:54 AM   #6
Schnorki
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Apr 2010
Posts: 14
long story short, couldn't get it running like that because the buttons to be updated there are not the ones lacking the action-update (that would be the ones in the mainmenubar that aren't otherwise there anymore).

went with a fairly simple alternate solution (that ends up being a better route anyways rly) instead and just yanked all the bindings off of those and slapped them onto the new bars. works like a charm now.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Could use a hand with custom actionbars

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off