WoW:XML/BackdropTemplate: Difference between revisions

m
Move page script moved page XML/BackdropTemplate to WoW:XML/BackdropTemplate without leaving a redirect
m (Move page script moved page XML/BackdropTemplate to WoW:XML/BackdropTemplate without leaving a redirect)
 
(24 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{uixmltemp}}
{{uixmltemp}}
[[XML/BackdropTemplate|BackdropTemplate]] is a [[XML templates|template]] that helps create a Frame backdrop in the WoW UI.  
[[XML/BackdropTemplate|BackdropTemplate]] is a [[XML templates|template]] that helps create a Frame backdrop in the WoW UI. See also the old style [[XML/Backdrop]] element.


== Inheritance ==
== Inheritance ==
Line 19: Line 19:
</KeyValues>
</KeyValues>
</pre>
</pre>
== Example ==
<pre>
<Frame name="MyFrame" inherits="BackdropTemplate">
<KeyValues>
<KeyValue key="backdropInfo" value="BACKDROP_DIALOG_32_32" type="global" />
</KeyValues>
</Frame>
</pre>
This example loads a Frame named MyFrame with a simple BackdropTemplate style backdrop.


== Configuration ==
== Configuration ==
; KeyValue pairs:
=== KeyValue pairs ===
''on the Frame inheriting BackdropTemplate''
''on the Frame inheriting BackdropTemplate''
* backdropInfo (global, backdropInfo table name) - the main backdrop configuration table, using 'type' 'global' with a string 'value' that's the name of a global Lua 'backdropInfo' table. Can use one of the many WoW predefined 'backdropInfo' default tables, like BACKDROP_DIALOG_32_32.
* backdropInfo (global, backdropInfo table name) - the main backdrop configuration table, using 'type' 'global' with a string 'value' that's the name of a global Lua 'backdropInfo' table. Can use one of the many WoW predefined 'backdropInfo' default tables, like BACKDROP_DIALOG_32_32.
Line 27: Line 37:
<KeyValue key="backdropInfo" value="BACKDROP_DIALOG_32_32" type="global" />
<KeyValue key="backdropInfo" value="BACKDROP_DIALOG_32_32" type="global" />
</pre>
</pre>
* backdropColor (global, color table name) - global RGB color constant. default none. Used to set backdrop background vertex color values, set on load by BackdropTemplate SetBackdropColor(r, g, b, a) which uses SetVertexColor(r, g, b, a or 1) on the background texture, if any. If no background texture is defined, then has no effect.
* backdropColor (global, color table name) - global RGB color constant. default 1, 1, 1. Used to set backdrop background vertex color values, set on load by BackdropTemplate SetBackdropColor(r, g, b, a) which uses SetVertexColor(r, g, b, a or 1) on the background texture, if any. If no background texture is defined, then has no effect.
* backdropColorAlpha (number) - 0 to 1. default 1. used to override alpha for the backdrop background texture, set on load by BackdropTemplate SetBackdropColor(r, g, b, a) which uses SetVertexColor(r, g, b, a or 1) on the background texture, if any. If no background texture is defined, then has no effect.
* backdropColorAlpha (number) - 0 to 1. default 1. used to override alpha for the backdrop background texture, set on load by BackdropTemplate SetBackdropColor(r, g, b, a) which uses SetVertexColor(r, g, b, a or 1) on the background texture, if any. If no background texture is defined, then has no effect.
<pre>
<pre>
Line 33: Line 43:
<KeyValue key="backdropColorAlpha" value="0.9" type="number"/>
<KeyValue key="backdropColorAlpha" value="0.9" type="number"/>
</pre>
</pre>
* backdropBorderColor (global, color table name) - global RGB color constant. default none. Used to set backdrop border vertex color values, set on load by BackdropTemplate SetBackdropBorderColor(r, g, b, a) which uses SetVertexColor(r, g, b, a or 1) on the edge textures, if any. If no edge texture is defined, then has no effect.
* backdropBorderColor (global, color table name) - global RGB color constant. default 1, 1, 1. Used to set backdrop border vertex color values, set on load by BackdropTemplate SetBackdropBorderColor(r, g, b, a) which uses SetVertexColor(r, g, b, a or 1) on the edge textures, if any. If no edge texture is defined, then has no effect.
* backdropBorderColorAlpha (number) - 0 to 1. default 1. used to override alpha for the backdrop border texture, set on load by BackdropTemplate SetBackdropBorderColor(r, g, b, a) which uses SetVertexColor(r, g, b, a or 1) on the edge textures, if any. If no edge texture is defined, then has no effect.
* backdropBorderColorAlpha (number) - 0 to 1. default 1. used to override alpha for the backdrop border texture, set on load by BackdropTemplate SetBackdropBorderColor(r, g, b, a) which uses SetVertexColor(r, g, b, a or 1) on the edge textures, if any. If no edge texture is defined, then has no effect.
<pre>
<pre>
Line 45: Line 55:
</pre>
</pre>


; 'backdropInfo' table options:
=== 'backdropInfo' table options ===
''which must be defined outside of FrameXML in Lua''
''which must be defined outside of FrameXML in Lua''
* bgFile (string) - the resource path to the backdrop background texture
* bgFile (string) - the resource path to the backdrop background texture
Line 62: Line 72:
** left (number) - bottom edge inset amount toward the top
** left (number) - bottom edge inset amount toward the top


backdropInfo requirements:
=== config details ===
 
User defined 'backdropInfo' requirements:
* The backdropInfo table requires one, or both, of 'edgeFile' or 'bgFile', or will be ignored, and the backdrop will not be created.
* The backdropInfo table requires one, or both, of 'edgeFile' or 'bgFile', or will be ignored, and the backdrop will not be created.
<pre>
BACKDROP_DIALOG_32_32 = {
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
tile = true,
tileEdge = true,
tileSize = 32,
edgeSize = 32,
insets = { left = 11, right = 12, top = 12, bottom = 11 },
};
</pre>
* If using a user created backdropInfo table, it must be created before the Frame loads, so must be created in Lua in a lua file that loads first, before the file XML is loaded.


user defined color table requirements:
User defined color table requirements:
* 'color table', or color constant, must be created with CreateColor(r, g, b, a) which creates a ColorMixin instance. BackdropTemplate will try to call GetRGB on the table and expect an 'r, g, b, a =' return.
* A 'color table', or color constant, must be created with CreateColor(r, g, b, a) which creates a ColorMixin instance. BackdropTemplate will try to call GetRGB on the table and expects an 'r, g, b =' return.
<pre>
<pre lang='lua'>
PAPER_FRAME_DARK_COLOR = CreateColor(0.25, 0.1484375, 0.02);
PURE_RED_COLOR = CreateColor(0.8, 0, 0);
<pre/>
PAPER_FRAME_DARK_COLOR = CreateColor(0.25, 0.1484375, 0.02)
</pre>
* The color constant must be created before the Frame loads, so must be created before the file XML is loaded in Lua, just like the 'backdropInfo' does.
* The color constant must be created before the Frame loads, so must be created before the file XML is loaded in Lua, just like the 'backdropInfo' does.


== Notes ==
== Notes ==
* The BackdropTemplate template directly replaced the older [[XML/Backdrop]] [[XML types|type]] in WoW Retail patch 9.0.1, but still worked in Classic and Era.
* The BackdropTemplate template directly replaced the older [[XML/Backdrop]] [[XML types|type]] in WoW Retail patch 9.0.1, but still worked in Classic and Era. With this patch the old-style [[XML/Backdrop]] element no longer worked in retail.
* In Classic and Classic Era patch 2.5.3 and patch 1.14.0 respectively, BackdropTemplate template also replaced Backdrop element, when the version 9 engine was adopted.
* In Classic and Classic Era patch 2.5.3 and patch 1.14.0 respectively, BackdropTemplate template also replaced Backdrop element, when the version 9 engine was adopted. With this patch the old-style Backdrop element no longer worked in any version of WoW.
 
== See also ==
* [[XML/Backdrop]]
Anonymous user