Skins
r19
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 require at least a basic understanding of LUA syntax. If you have no experience with LUA, you can always do some reading. It's also recommended that you read this image guide, as you'll need that information when creating your images.
Tip: You can download the ButtonFacade: Developer package when it's available to help with getting started.
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.
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 basic 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, the second argument is the table containing the skin data and the third argument is a boolean of whether or not to overwrite an existing skin of the same name.
Layers Types
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.
Predefined Layers
ButtonFacade uses predefined layers to apply skins. The following is a list of all available layers in order from bottom (first) to top (last):
- 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: <nowiki>path/to/file</nowiki>.
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:
<pre style="font-family:'Courier New', Courier, monospace;margin:20px 0;min-height:0px;height:auto;">Template = "Sample", Normal = { Texture = Path/To/New/Texture },</pre>
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.
Facts
- Date created
- 13 Jun 2009