Download
(4Kb)
Download
Updated: 08-16-18 01:34 PM
Pictures
File Info
Compatibility:
Battle for Azeroth (8.0.1)
Updated:08-16-18 01:34 PM
Created:12-27-08 08:46 PM
Downloads:85,244
Favorites:309
MD5:
Categories:Action Bar Mods, Buff, Debuff, Spell

rButtonTemplate  Popular! (More than 5000 hits)

Version: 800.20180816
by: zork [More]


Intro

rButtonTemplate is a framework to theme Blizzard action, aura and item buttons. It does nothing on its own, needs a theme like rButtonTemplate_Zork.
API documentation
rButtonTemplate API documentation
Quick-Links
rActionBar, rActionBar_Zork, rBuffFrame, rBuffFrame_Zork, rButtonTemplate, rButtonTemplate_Zork
Git
https://github.com/zorker/rothui/tre...ButtonTemplate

Optional Files (20)
File Name
Version
Size
Author
Date
Type
800.20180901
14kB
09-02-18 03:34 AM
Addon
801-2018081101
4kB
08-11-18 04:55 AM
Addon
700.20161004
23kB
10-04-16 06:24 AM
Addon
1.3
80kB
11-29-10 02:09 PM
Addon
1.0
22kB
11-14-10 06:23 PM
Addon
1.2
24kB
11-09-10 02:59 PM
Addon
1.0
3kB
11-05-10 09:22 AM
Addon
rev3
6kB
07-06-10 06:25 PM
Addon
1.0
8kB
04-25-10 01:32 PM
Patch
1.0
2kB
12-06-09 12:47 PM
Addon
1.0
3kB
08-18-09 11:37 AM
Addon
1.0
10kB
07-06-09 12:02 PM
Addon
v1
16kB
06-17-09 06:57 PM
Addon
v1.3
18kB
02-19-09 12:10 PM
Addon
001
21kB
01-23-09 03:24 AM
Addon
1.0
5kB
01-22-09 09:38 AM
Addon
003
6kB
01-20-09 08:16 PM
Patch
001
15kB
01-20-09 03:59 PM
Addon
001
10kB
01-20-09 03:58 PM
Addon
0.1
7kB
01-17-09 10:12 AM
Addon


Post A Reply Comment Options
Unread 08-04-09, 06:56 PM  
kimboslice
A Defias Bandit

Forum posts: 3
File comments: 76
Uploads: 0
Are you going to add support for the new totem bar?
Report comment to moderator  
Reply With Quote
Unread 08-04-09, 12:24 PM  
Ouo
A Murloc Raider
 
Ouo's Avatar

Forum posts: 7
File comments: 13
Uploads: 0
Thanks for the update, you sir are a god!
Report comment to moderator  
Reply With Quote
Unread 08-04-09, 04:18 AM  
Heimdall
A Murloc Raider

Forum posts: 9
File comments: 10
Uploads: 0
Originally posted by zork
Bartender4 is not using the default ActionButtonTemplate, or at least not the default one, so I'm sorry. Dominos works flawlessly though.
Yes you are right, i've tried Dominos this morning and the skin was perfect, thanks.

Regards
Heimdall
Report comment to moderator  
Reply With Quote
Unread 08-03-09, 04:19 PM  
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1740
File comments: 3728
Uploads: 77
Bartender4 is not using the default ActionButtonTemplate, or at least not the default one, so I'm sorry. Dominos works flawlessly though.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
Report comment to moderator  
Reply With Quote
Unread 08-03-09, 12:40 PM  
Heimdall
A Murloc Raider

Forum posts: 9
File comments: 10
Uploads: 0
I can't get this to work, i'm using bartender4 and all i get it buttons covered with a big black square, they're incompatible or am i missing something?

Regards
Report comment to moderator  
Reply With Quote
Unread 08-03-09, 08:52 AM  
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1740
File comments: 3728
Uploads: 77
Tell Blizzard how to do a rangecheck on 120 buttons without any kind of onUpdate script and you win many Internets.

But I got another good idea. I will try to add
Code:
ActionHasRange(self.action)
to the onUpdate func.

The updateUsable func is called on its own event, the onUpdate is rangeCheck only. Thus if the action does not even have a numeric range requirement it does not have to be updated and the function could just "return".

*edit* Just tested it. The following function is doing OK.

Code:
  --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
      if(not ActionHasRange(self.action)) then
        return
      end
      rActionButtonStyler_AB_usable(self)
    end
  end
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
Last edited by zork : 08-03-09 at 10:04 AM.
Report comment to moderator  
Reply With Quote
Unread 08-03-09, 05:00 AM  
level12wizard
A Defias Bandit
AddOn Author - Click to view AddOns

Forum posts: 2
File comments: 39
Uploads: 1
Agree with font size being something good for the fluffy config section, although I don't find it necessary, it can help people out.

It's amazing how such a simple thing ends up being the most CPU intensive addon I have, even after the overhaul. The update is fantastic, yet I still wish Blizzard would come up with a better way.
Report comment to moderator  
Reply With Quote
Unread 08-03-09, 04:21 AM  
sakurakira
A Chromatic Dragonspawn
 
sakurakira's Avatar
AddOn Author - Click to view AddOns

Forum posts: 151
File comments: 60
Uploads: 5
Nice update thanks!

I especially like the changes made to color info, and hotkey hide (1/0). I don't quite agree with putting the font size in the "Do not touch" area, as changing those numbers isn't "dangerous." I find the default 18 to be too large for me.

/cheer
__________________
Arise, my champion!
Report comment to moderator  
Reply With Quote
Unread 08-02-09, 04:28 PM  
Caellian
A Frostmaul Preserver
 
Caellian's Avatar

Forum posts: 281
File comments: 252
Uploads: 5
Nice job with the 05
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }
Report comment to moderator  
Reply With Quote
Unread 08-02-09, 04:28 PM  
Dajova
A Wyrmkin Dreamwalker
 
Dajova's Avatar
AddOn Author - Click to view AddOns

Forum posts: 58
File comments: 787
Uploads: 5
Originally posted by zork
Without keybindings yes.
oh lol... stupid me xD well, i play normally without keybindings, so maybe it's just me ^^
__________________
Livestream | Twitter | YouTube
Report comment to moderator  
Reply With Quote
Unread 08-02-09, 01:07 PM  
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1740
File comments: 3728
Uploads: 77
Originally posted by richerich
"- added dominos support"
Strange, it has worked on my Dominos for ages
Without keybindings yes.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
Report comment to moderator  
Reply With Quote
Unread 08-02-09, 10:44 AM  
Rintrah
A Defias Bandit

Forum posts: 2
File comments: 17
Uploads: 0
I'm sorry I hadn't checked into these comments yet to test it out, but it looks like you've got it, great! D/Ling update :>

e: Yeah, the cpu usage is chopped down to a much more acceptable level, I have a feeling that this will no longer cause a noticable hit... thanks a ton for looking into it and improving!

e2: Oh, the addition of update timer to config is also welcome - as I mentioned earlier in the thread, the range updating isn't much important to me as might be with others, and this setting makes a real difference. Also, the class coloring is sweet :>
Last edited by Rintrah : 08-02-09 at 11:30 AM.
Report comment to moderator  
Reply With Quote
Unread 08-02-09, 10:19 AM  
Dajova
A Wyrmkin Dreamwalker
 
Dajova's Avatar
AddOn Author - Click to view AddOns

Forum posts: 58
File comments: 787
Uploads: 5
"- added dominos support"
Strange, it has worked on my Dominos for ages
__________________
Livestream | Twitter | YouTube
Report comment to moderator  
Reply With Quote
Unread 08-01-09, 07:17 AM  
MastaM00
A Kobold Labourer

Forum posts: 0
File comments: 3
Uploads: 0
Did some test passes this morning.

Seems you've nailed it.

Initial UI load/ console reloadui / vehicle possess bar keybinding text all appear properly with no need to manually toggle the binding text dominos toggle.

I'll keep a watch out for any errors in buggrabber but I'm pretty sure this is solid.

Thanks!
Report comment to moderator  
Reply With Quote
Unread 08-01-09, 06:15 AM  
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1740
File comments: 3728
Uploads: 77
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)
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
Last edited by zork : 08-01-09 at 06:16 AM.
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: