ButtonFacade/Skins
From WowAce Wiki
Contents |
Getting Started
The purpose of this guide is to make creating your own button button "skin" as easy as possible. Since a skin's settings are formatted in a LUA table, this guide will assume at least a basic understanding of LUA syntax. If not, you can always do some reading. It's also recommended that you have a decent image-editing application. If you don't have one, I recommend you check out GIMP, which is free.
If this is your first button skin, you can download the ButtonFacade_Template to start with. This is just a basic skin that's an exact duplicate of the "Dream Layout" skin included with ButtonFacade.
The Skin Forum is a good source of ideas and help.
Now that you have the tools, it's time to move on to what makes up a skin.
Introduction
A skin is composed of "layers" of textures, colors and text overlays. A layer is simply a container for whatever object happens to reside in it. Each layer has a specific set of attributes that define how the game draws that layer and its contents.
Note: You can find a list of predefined layers and attributes further into this guide.
Coding A Skin
As was mentioned previously, a skin is simply a LUA table that defines the layers and their contents. The format is quite simple when broken down to its basical components, as you can see in the following example.
LibButtonFacade:AddSkin("Skin Name",{
-- Skin data start.
Layer = {
Attribute = value,
},
-- Skin data end.
},true)
The :AddSkin() function does all the work once the appropriate layers and their attributes are set. The first argument is the name of the skin and the second argument is a boolean of whether or not to overwrite an existing skin of the same name.
Layers
There are three types of layer that make up a skin:
- Texture Layer: Displays a texture using the given attributes. All textures layers must have a texture path set.
- Model Layer: Displays a predefined animation. In most cases, the texture path should never be changed from the default Blizzard animation.
- Text Layer: Displays text overlays such as item count, macro name, etc.
ButtonFacade uses predefined layers to apply skins. The following is a list of all available layers in order from bottom (first) to top (last) and their associated attributes.
Backdrop
Texture Layer
The bottom-most layer. Uses standard texture attributes.
Icon
Texture Layer
Spell or skill icon for the button.
Flash
Texture layer
Combat/attack indicator.
Cooldown
Model Layer
Cool-down animation.
AutoCast
Model Layer
Auto-cast animation. Only used on square buttons.
Normal
Texture Layer
The "border" or "normal" texture for the button.
Pushed
Texture Layer
Texture for the "pushed" state. Replaces the "normal" texture unless the "Static" attribute is set to "true".
Border
Texture Layer
Layer for the "equipped" state.
Disabled
Texture Layer
Texture for the "disabled" state. Replaces the "normal" texture unless the "Static" attribute is set to "true".
Checked
Texture Layer
Highlight layer for active skills, stances, etc.
AutoCastable
Texture Layer
Texture marking its auto-cast property.
Highlight
Texture Layer
Highlight layer for mouse-overs.
Gloss
Texture Layer
"Gloss" or "glaze" layer.
HotKey
Text Layer
Text for the hot key.
Count
Text Layer
Text for the item count.
Name
Text Layer
Text for the macro name.
Attributes
A layer's attributes define how that layer is drawn on the screen. The following is a list of available attributes.
Hide
Whether or not the layer is hidden. Available for all layers. If a layer is to be unused, this should be the only attribute that should be set (to "true") for that layer.
Width
The width of the layer in pixels. Available for all layers.
Height
The height of the layer in pixels. Available for all layers.
Scale
The scale of the layer. Available for all layers
OffsetX
Horizontal offset in pixels. Available for all layers
OffsetY
Vertical offset in pixels. Available for all layers
Red
The amount of red affecting the layer. Only available for the Normal layer. Defaults to 1.0.
Green
The amount of red affecting the layer. Only available for the Normal layer. Defaults to 1.0.
Blue
The amount of red affecting the layer. Only available for the Normal layer. Defaults to 1.0.
Alpha
The amount of red affecting the layer. Only available for the Normal layer. Defaults to 1.0.
Texture
The path to the texture. Available for texture layers only. Required.
TexCoords
Texture coorinates. Availabe for texture layers only. Defaults to {0,1,0,1}
Blend Mode
The blending mode of the layer. Available for texture layers only. Modes are:
- BLEND - Blends according to alpha channel.
- DISABLE - No blending.
- ALPHAKEY - Blends according to 1-bit alpha channel.
- ADD - Alpha, additive.
- MOD - No alpha, multiplicative.
Static
When set to "true", prevents the Normal layer from being replaced by the Checked and Disabled layers. Only available for the Normal layer.
Other Notes
- Paths should be formated like: [[path/to/file]].
Templates
As of revision 70461, a skin author can now specify an existing skin to use as a template. This "copy" will retain all the settings of the copied skin except for those specified in the skin data. For example:
Template = "Sample",
Normal = {
Texture = [[Path/To/New/Texture]]
},
Would copy the "Sample" skin and replace its "Normal" texture with the new one.
Note: The replacement is done at the layer level so one has to specify all of the new attributes for that layer.

