- Small mod that uses hooksecurefunctions to edit the textures of the default ActionButtonTemplate.
- does range and mana coloring aswell
- You can use your own textures, just change the ones included inside the media folder.
- Font and font size can be changed too.
- This one is intended to be a ButtonFacade replacement, at least for the ActionButtonTemplate.
- The is no ingame config, its all lua code.
- This can be used with any actionbar mod that uses the default ActionButtonTemplate.
Colors
You can colorize your textures (class-coloring for example). To do that adjust the color variables in the lua code.
If you want the default color of a texture all colors (RGB = red, green, blue) have to be 1 (255/255). If you choose 0 (0/255) the texture will be completly dark.
---------------------------------------
-- CONFIG
---------------------------------------
--TEXTURES
--default border texture
local rb2_normal_texture = "Interface\\AddOns\\rActionButtonStyler\\media\\gloss"
--texture when a button flashs --> button becomes ready
local rb2_flash_texture = "Interface\\AddOns\\rActionButtonStyler\\media\\flash"
--hover textures
local rb2_hover_texture = "Interface\\AddOns\\rActionButtonStyler\\media\\hover"
--texture if you push that button
local rb2_pushed_texture = "Interface\\AddOns\\rActionButtonStyler\\media\\pushed"
--texture that is active when the button is in active state (next melee swing attacks mostly)
local rb2_checked_texture = "Interface\\AddOns\\rActionButtonStyler\\media\\checked"
--texture used for equipped items, this can differ since you may want to apply a different vertexcolor
local rb2_equipped_texture = "Interface\\AddOns\\rActionButtonStyler\\media\\gloss_grey"
--FONT
--the font you want to use for your button texts
local button_font = "Fonts\\FRIZQT__.TTF"
--hide the hotkey? 0/1
local hide_hotkey = 1
--use dominos? 0/1
local use_dominos = 0
--COLORS
--color you want to appy to the standard texture (red, green, blue in RGB)
local color = { r = 0.37, g = 0.3, b = 0.3, }
--want class color? just comment in this:
--local color = RAID_CLASS_COLORS[select(2, UnitClass("player"))]
--color for equipped border texture (red, green, blue in RGB)
local color_equipped = { r = 0, g = 0.5, b = 0, }
--color when out of range
local range_color = { r = 0.8, g = 0.1, b = 0.1, }
--color when out of power (mana)
local mana_color = { r = 0.1, g = 0.3, b = 1, }
--color when button is usable
local usable_color = { r = 1, g = 1, b = 1, }
--color when button is unusable (example revenge not active, since you have not blocked yet)
local unusable_color = { r = 0.4, g = 0.4, b = 0.4, }
-- !!!IMPORTANT!!! - read this before editing the value blow
-- !!!do not set this below 0.1 ever!!!
-- you have 120 actionbuttons on screen (most of you have at 80) and each of them will get updated on this timer in seconds
-- default is 1, it is needed for the rangecheck
-- if you dont want it just set the timer to 999 and the cpu usage will be near zero
-- if you set the timer to 0 it will update all your 120 buttons on every single frame
-- so if you have 120FPS it will call the function 14.400 times a second!
-- if the timer is 1 it will call the function 120 times a second (depends on actionbuttons in screen)
local update_timer = 1
---------------------------------------
-- CONFIG END
---------------------------------------
005
- complete rewrite
- added a config
- biggest change is that I rewrite the default ActionButton onUpdate func now, this improved the performance by a mile
- added dominos support
004-2
- range_indicator fix
004
- updated for 3.1
- included range/mana coloring (thus only 1x hooking the actionbutton onupdate func is needed -> better cpu usage)
003
- classcolored buttons possible (see lua)
- onupdate in again to be able to colorize textures (make sure redrange normaltexture coloring is disabled!)
- new default skin (simplebutton)
002
- fixed the normaltexture bug for stancebars
- removed the onupdate hook for actionbuttons (thx to Neal)
Ok code is done I guess. Currently beta testing. Help me if you want:
Replace the rActionButtonStyler.lua code with the one below.
Code:
--rActionButtonStyler - roth 2009
local _G = _G
---------------------------------------
-- CONFIG
---------------------------------------
--TEXTURES
--default border texture
local rb2_normal_texture = "Interface\\AddOns\\rActionButtonStyler\\media\\gloss"
--texture when a button flashs --> button becomes ready
local rb2_flash_texture = "Interface\\AddOns\\rActionButtonStyler\\media\\flash"
--hover textures
local rb2_hover_texture = "Interface\\AddOns\\rActionButtonStyler\\media\\hover"
--texture if you push that button
local rb2_pushed_texture = "Interface\\AddOns\\rActionButtonStyler\\media\\pushed"
--texture that is active when the button is in active state (next melee swing attacks mostly)
local rb2_checked_texture = "Interface\\AddOns\\rActionButtonStyler\\media\\checked"
--texture used for equipped items, this can differ since you may want to apply a different vertexcolor
local rb2_equipped_texture = "Interface\\AddOns\\rActionButtonStyler\\media\\gloss_grey"
--FONT
--the font you want to use for your button texts
local button_font = "Fonts\\FRIZQT__.TTF"
--hide the hotkey? 0/1
local hide_hotkey = 0
--use dominos? 0/1
local use_dominos = 0
--COLORS
--color you want to appy to the standard texture (red, green, blue in RGB)
local color = { r = 0.37, g = 0.3, b = 0.3, }
--want class color? just comment in this:
--local color = RAID_CLASS_COLORS[select(2, UnitClass("player"))]
--color for equipped border texture (red, green, blue in RGB)
local color_equipped = { r = 0, g = 0.5, b = 0, }
--color when out of range
local range_color = { r = 0.8, g = 0.1, b = 0.1, }
--color when out of power (mana)
local mana_color = { r = 0.1, g = 0.3, b = 1, }
--color when button is usable
local usable_color = { r = 1, g = 1, b = 1, }
--color when button is unusable (example revenge not active, since you have not blocked yet)
local unusable_color = { r = 0.4, g = 0.4, b = 0.4, }
-- !!!IMPORTANT!!! - read this before editing the value blow
-- !!!do not set this below 0.1 ever!!!
-- you have 120 actionbuttons on screen (most of you have at 80) and each of them will get updated on this timer in seconds
-- default is 1, it is needed for the rangecheck
-- if you dont want it just set the timer to 999 and the cpu usage will be near zero
-- if you set the timer to 0 it will update all your 120 buttons on every single frame
-- so if you have 120FPS it will call the function 14.400 times a second!
-- if the timer is 1 it will call the function 120 times a second (depends on actionbuttons in screen)
local update_timer = 1
---------------------------------------
-- CONFIG END
---------------------------------------
-- DO NOT TOUCH ANYTHING BELOW!
---------------------------------------
-- FUNCTIONS
---------------------------------------
--initial style func
local function rActionButtonStyler_AB_style(self)
local action = self.action
local name = self:GetName()
local bu = _G[name]
local ic = _G[name.."Icon"]
local co = _G[name.."Count"]
local bo = _G[name.."Border"]
local ho = _G[name.."HotKey"]
local cd = _G[name.."Cooldown"]
local na = _G[name.."Name"]
local fl = _G[name.."Flash"]
local nt = _G[name.."NormalTexture"]
nt:SetHeight(bu:GetHeight())
nt:SetWidth(bu:GetWidth())
nt:SetPoint("Center", 0, 0)
bo:Hide()
ho:SetFont(button_font, 18, "OUTLINE")
co:SetFont(button_font, 18, "OUTLINE")
na:SetFont(button_font, 12, "OUTLINE")
if hide_hotkey == 1 then
ho:Hide()
end
na:Hide()
fl:SetTexture(rb2_flash_texture)
bu:SetHighlightTexture(rb2_hover_texture)
bu:SetPushedTexture(rb2_pushed_texture)
bu:SetCheckedTexture(rb2_checked_texture)
bu:SetNormalTexture(rb2_normal_texture)
ic:SetTexCoord(0.1,0.9,0.1,0.9)
ic:SetPoint("TOPLEFT", bu, "TOPLEFT", 2, -2)
ic:SetPoint("BOTTOMRIGHT", bu, "BOTTOMRIGHT", -2, 2)
if ( IsEquippedAction(action) ) then
bu:SetNormalTexture(rb2_equipped_texture)
nt:SetVertexColor(color_equipped.r,color_equipped.g,color_equipped.b,1)
else
bu:SetNormalTexture(rb2_normal_texture)
nt:SetVertexColor(color.r,color.g,color.b,1)
end
end
--style pet buttons
local function rActionButtonStyler_AB_stylepet()
for i=1, NUM_PET_ACTION_SLOTS do
local name = "PetActionButton"..i
local bu = _G[name]
local ic = _G[name.."Icon"]
local fl = _G[name.."Flash"]
local nt = _G[name.."NormalTexture2"]
nt:SetHeight(bu:GetHeight())
nt:SetWidth(bu:GetWidth())
nt:SetPoint("Center", 0, 0)
nt:SetVertexColor(color.r,color.g,color.b,1)
fl:SetTexture(rb2_flash_texture)
bu:SetHighlightTexture(rb2_hover_texture)
bu:SetPushedTexture(rb2_pushed_texture)
bu:SetCheckedTexture(rb2_checked_texture)
bu:SetNormalTexture(rb2_normal_texture)
ic:SetTexCoord(0.1,0.9,0.1,0.9)
ic:SetPoint("TOPLEFT", bu, "TOPLEFT", 2, -2)
ic:SetPoint("BOTTOMRIGHT", bu, "BOTTOMRIGHT", -2, 2)
end
end
--style shapeshift buttons
local function rActionButtonStyler_AB_styleshapeshift()
for i=1, NUM_SHAPESHIFT_SLOTS do
local name = "ShapeshiftButton"..i
local bu = _G[name]
local ic = _G[name.."Icon"]
local fl = _G[name.."Flash"]
local nt = _G[name.."NormalTexture"]
nt:ClearAllPoints()
nt:SetPoint("TOPLEFT", bu, "TOPLEFT", 0, 0)
nt:SetPoint("BOTTOMRIGHT", bu, "BOTTOMRIGHT", 0, 0)
nt:SetVertexColor(color.r,color.g,color.b,1)
fl:SetTexture(rb2_flash_texture)
bu:SetHighlightTexture(rb2_hover_texture)
bu:SetPushedTexture(rb2_pushed_texture)
bu:SetCheckedTexture(rb2_checked_texture)
bu:SetNormalTexture(rb2_normal_texture)
ic:SetTexCoord(0.1,0.9,0.1,0.9)
ic:SetPoint("TOPLEFT", bu, "TOPLEFT", 2, -2)
ic:SetPoint("BOTTOMRIGHT", bu, "BOTTOMRIGHT", -2, 2)
end
end
--fix the grid display
--the default function has a bug and once you move a button the alpha stays at 0.5, this gets fixed here
local function rActionButtonStyler_AB_fixgrid(button)
local name = button:GetName()
local action = button.action
local nt = _G[name.."NormalTexture"]
if ( IsEquippedAction(action) ) then
nt:SetVertexColor(color_equipped.r,color_equipped.g,color_equipped.b,1)
else
nt:SetVertexColor(color.r,color.g,color.b,1)
end
end
--update the button colors onUpdateUsable
local function rActionButtonStyler_AB_usable(self)
local name = self:GetName()
local action = self.action
local nt = _G[name.."NormalTexture"]
local icon = _G[name.."Icon"]
if ( IsEquippedAction(action) ) then
nt:SetVertexColor(color_equipped.r,color_equipped.g,color_equipped.b,1)
else
nt:SetVertexColor(color.r,color.g,color.b,1)
end
local isUsable, notEnoughMana = IsUsableAction(action)
if (ActionHasRange(action) and IsActionInRange(action) == 0) then
icon:SetVertexColor(range_color.r,range_color.g,range_color.b,1)
return
elseif (notEnoughMana) then
icon:SetVertexColor(mana_color.r,mana_color.g,mana_color.b,1)
return
elseif (isUsable) then
icon:SetVertexColor(usable_color.r,usable_color.g,usable_color.b,1)
return
else
icon:SetVertexColor(unusable_color.r,unusable_color.g,unusable_color.b,1);
return
end
end
--rewrite of the onupdate func
--much less cpu usage needed
local function rActionButtonStyler_AB_onupdate(self,elapsed)
local t = self.rABS_range
if (not t) then
self.rABS_range = 0
return
end
t = t + elapsed
if (t<update_timer) then
self.rABS_range = t
return
else
self.rABS_range = 0
rActionButtonStyler_AB_usable(self)
end
end
--hotkey func
--is only needed when you want to hide the hotkeys and use the default barmod (Dominos does not need this)
local function rActionButtonStyler_AB_hotkey(self, actionButtonType)
if (not actionButtonType) then
actionButtonType = "ACTIONBUTTON";
end
local hotkey = _G[self:GetName().."HotKey"]
local key = GetBindingKey(actionButtonType..self:GetID()) or GetBindingKey("CLICK "..self:GetName()..":LeftButton");
local text = GetBindingText(key, "KEY_", 1);
hotkey:SetText(text);
hotkey:Hide()
end
---------------------------------------
-- CALLS // HOOKS
---------------------------------------
hooksecurefunc("ActionButton_Update", rActionButtonStyler_AB_style)
hooksecurefunc("ActionButton_UpdateUsable", rActionButtonStyler_AB_usable)
--rewrite default onUpdateFunc, the new one uses much less CPU power
ActionButton_OnUpdate = rActionButtonStyler_AB_onupdate
--fix grid
hooksecurefunc("ActionButton_ShowGrid", rActionButtonStyler_AB_fixgrid)
--call the special func to hide hotkeys after entering combat with the default actionbar
if hide_hotkey == 1 and use_dominos == 0 then
hooksecurefunc("ActionButton_UpdateHotkeys", rActionButtonStyler_AB_hotkey)
end
hooksecurefunc("ShapeshiftBar_OnLoad", rActionButtonStyler_AB_styleshapeshift)
hooksecurefunc("ShapeshiftBar_Update", rActionButtonStyler_AB_styleshapeshift)
hooksecurefunc("ShapeshiftBar_UpdateState", rActionButtonStyler_AB_styleshapeshift)
hooksecurefunc("PetActionBar_Update", rActionButtonStyler_AB_stylepet)
Additionally I am currently working on a workaround for the onUpdate func. The problem is that this function is called so often and you can only hook it. The CPU usage of that function is just insane. If you hook it the CPU usage gets visible. But I think its not possible to fix it only completly disabling the function would do it, but that is not allowed the function is secured.
Hmm...that is interesting. I seem to be allowed to rewrite the Blizzard function. This is good since the old bastard gets simply replaced.
I will release an updated version tomorrow. Went down from 140 to 13 CPU usage...the blizzard function just calls itself to often again. Tested it in combat and still no error messages. Good.
Ok this is easy. Dominos has a own functionality to keep KeyBinds active while in combat. So the rActionButtonStyler_AB_hotkey() function is not needed, thus the function call can be commented out. Additional the initial "hide" of the hotkey needs to be commented out aswell this is in the rActionButtonStyler_AB_style() function.
So for easier use.
Change line 46 from (comment out the initial setup)
Code:
ho:Hide()
to
Code:
--ho:Hide()
and change line 187 from (comment out the function call)
Alright, thanks a lot. Again, I don't mean to sound like an ass hating on your mod - I really like it. Sounds like its out of your control due to blizz api, but range check isn't something I'm really worried about so that will be fine for me.
What pretty much kills any fps are so called "OnUpdate" functions. Those are loops that call themself on a given timer. Whats the problem on this with buttons is that any button on screen has such a OnUpdate function. Normal addons may use 1-2 of these functions but the Blizzard actionbars use this for every button on screen.
When does it get used. One word: "range-check". Everything else on your buttons can be handled by so called events, but the range-check can not.
If you set the timer to high your range check will look kinda laggy. If you set it to low you will kill your fps.
Originally posted by zork
This is no big deal since the performance stays the same since the default function would also be used without any addons. You just could not track it, since it is a Blizzard function.
I'm sure you know what you're talking about, but my experience is different. I keep coming back to your buttonstyler, but if I'm running rbarstyler alone doing an FPS-intensive fight like Algalon everything runs smooth. If I enable rbuttonstyler with no other changes I get a huge FPS hit (~10-12 fps change, which matters a lot in a raid setting like Algalon where there is particles everywhere). If rbuttonstyler using no more cpu than the blizzard function this would no be happening, no? Is it reapplying all texture button textures when any single update happens? ie, one button pushed = highlight = mod updates all buttons? I don't mean to sound like a ui snob and pretty ignorant about how mods work, i just really like this addon but find it unusable due to performance hit, maybe i'm just paranoid and retarded I D K
I am not sure of what you mean, but I am not using questhelper, what I mean is that when you pick up a quest (eg. a daily quest) that needs you to use an item in a certain place, the item icon appears besides the quest being tracked in the track log under your minimap, to avoid wasting time looking for it in the bags. However, everytime I try to click on that button I get that error message.
Hello, I have recently started using this addon, however everytime I click on the quest items that appear right next the quest tracking log, I get the following message "ractionbuttonstyler has been blocked from an action only available to blizzard UI". Anyone knows a fix for this?
note - i found that the setting did not seem to stick, by default the bindings will go back to being hidden regardless and you have to re-open your dominos settings and deselect/select the option again. seeing if i can get this figured out...
you just have to comment out the line that says hotkey:Hide() and put in hotkey:Show() below it, not the whole part that he posted.
I did this while in-game, reloaded ui to pick up the change and then found that I also had to open up the dominos options and deselect/reselect the show bindings box to get them to show.
Originally posted by MoonWitch No clue man, just thought I'd post how I solved the issue. I still have all my textures >.< But that piece of code doesn't affect texturing, only the hotkey display. Perhaps you commented out too much?
I probably did, what exact portion did you comment out?
Originally posted by Qupe So is this a working fix? I tried commenting that section of code out and it did show binding text but it removed the texture from my bars.
No clue man, just thought I'd post how I solved the issue. I still have all my textures >.< But that piece of code doesn't affect texturing, only the hotkey display. Perhaps you commented out too much?