Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
 
(Added return value section and a workaround due to a bug introduced in patch 4.0.)
 
Line 1: Line 1:
{{policies}}
+
{{widgetmethod}}
  +
Changes the texture of a texture object.
{{policy|shortcut=WW:IMP}}
 
  +
texture:SetTexture("filename"[, tile]);
{{clrl}}
 
  +
texture:SetTexture(r, g, b[, a]);
   
  +
==Arguments==
== Uploading images ==
 
  +
'''filename [,tile]'''
* Always upload images for display to the wiki. That way we don't steal bandwidth from others, and it makes the image links more reliable.
 
  +
:; filename : String - Name of the texture image. Images may be in BLP or TGA format, and must have power-of-two dimensions up to 1024 pixels. TGA images may have 8, 24, or 32 bits per pixel for grayscale, RGB, and RGBA images respectively; RLE is supported.
* However, WoWWiki is not an image hosting service. Any images uploaded must be for use ''on WoWWiki''. See [[WoWWiki:Bandwidth theft]].
 
  +
:; tile : Boolean flag - Tile the image if the coordinates set using [[API Texture SetTexCoord|Texture:SetTexCoord]] exceed the 0.0-1.0 range.
* '''Note that datamined pictures of unannounced content or exploited pictures of unfinished areas are not allowed.'''
 
* "Model viewer" images of content which is accessible in-game are okay, but high-quality in-game screenshots obtained from the live or test clients (without exploiting) are preferred. See [[WW:DNP]].
 
   
  +
'''r, g, b, a'''
=== Icons ===
 
  +
:; r : Number (0.0 to 1.0) - Red component.
Nearly all game icons are already in the wiki! Don't upload new ones unless you're certain it's not already in here.
 
  +
:; g : Number (0.0 to 1.0) - Green component.
  +
:; b: Number (0.0 to 1.0) - Blue component.
  +
:; a : Number (0.0 to 1.0) - Alpha component (1.0 is opaque, 0.0 is transparent). The default value is 1.0.
   
  +
==Returns==
* See [[WoWWiki:WoW Icons]] for a listing of all icons already in the wiki.
 
* Use the [[WoWWiki:Image guidelines/PNG|PNG]] file format for icons. It allows the corners to be transparent, and doesn't mangle the colorspace like [[WoWWiki:Image guidelines/GIF|GIF]] does.
 
* Name icons in all lowercase and according to their in-game name. See [[WoWWiki:WoW Icons/Icon List]].
 
* Categorize your uploaded icons in one or more sub categories of [[:Category:WoW Icons]]
 
   
  +
Prior to patch 4.0, this would return nil if the texture could not be loaded and 1 if the texture was successfully loaded. This appears to now be broken and will always return 1 even upon failure.
== Link your source/copyright information ==
 
  +
A workaround for finding out if the texture was loaded successfully is to immediately call [[API_Texture_GetTexture|Texture:GetTexture]] after loading, which will return nil if the texture failed to load.
* When uploading, select the '''licensing tag''' that best-matches where you sourced your image from. Nearly all screenshots from WoW have a specific option (like NPC, zone, mount, etc...). Unlicensed images are subject to [[WW:SD|speedy deletion]].
 
* Please add the '''source''' of an image in the summary section when uploading, or later on by visiting the image page and choosing 'edit this page'.
 
* Fan art images should always be marked as such, especially when used in an article, and they should not take precedence over official artwork.
 
* See also: [[WoWWiki:Images_policy/Licensing|Licensing options]]
 
   
  +
==Description==
== Model viewer screenshots ==
 
  +
Can be used to either set the texture file, or to change the RGB fill of a texture. Pass it one string to change the texture file, or pass it three numbers to set the RGB. The only place I've seen this used to change the color is within the inline script of a ColorSelect object.
While we do not refuse images from [[WoWWiki:Images policy/3D model software|model viewers]], such as [[WoW Model Viewer]], we generally strongly discourage them in favor of in-game screenshots. The only exceptions to this are for very generic images, such as creature type profiles and armor sets - but only if the images are very high quality and follow the rest of the image guidelines. In borderline cases it is generally left to an admin to make the final decision.
 
   
  +
==Notes==
*Please note if you do decide to upload images from the model viewers it is best to make the background [[WoWWiki:Image_guidelines#Transparency|transparent]] (PNG) and ensure the result is [[wikipedia:anti-aliasing|anti-aliased]] (one method is to take a large image and resize it down). Alternatively, please set the background color (before taking a screenshot) to the default WoWWiki background color, which is <code>[Hue 160, Sat 0, Lum 48]</code>, <code>[Red 51, Blue 51, Green 51]</code> or <code>[Hex #333]</code>.
 
  +
* If no image is shown, the game will not find image files that did not exist when it was started, you may need to restart the game for the texture to appear.
 
  +
* The texture has to be cleared or set to solid colour, or anyway changed away from the current file, before tiling can be changed. Hence the following code will fail:
*Pictures of unannounced content (i.e. content not released by [[Blizzard Entertainment|Blizzard]]) are again '''not allowed'''.
 
  +
texture:SetTexture("image.tga",true)
 
  +
texture:SetTexture("image.tga",false)
== Naming ==
 
* Name your image so it's relevant for the content it's showing. (example: Garrosh Hellscream.jpg)
 
** Try to use spaces or have the file name match its content. (example: Druid at Stormwind Park.jpg)
 
* Do '''NOT''' upload images using WoW's default screenshot name. (example: WoWScrnShot 030508 223206.jpg)
 
** Also, if you copy an image from a database site (such as Wowhead) do '''NOT''' upload those images using the number they give them. (example: 142683.jpg)
 
 
== Image abandonment ==
 
There may come a time when you no longer want an image that you have uploaded for your personal user page. If this happens, please do not just remove the image from your page to be forgotten about, help keep WoWWiki clean of these unused image by marking the ones you abandon with <code><nowiki>{{Speedydelete|Image abandoned|~~~~}}</nowiki></code>.
 
 
==See also==
 
*[[WoWWiki:Image guidelines|Image guidelines]]
 

Revision as of 18:54, 21 March 2011

Changes the texture of a texture object.

texture:SetTexture("filename"[, tile]);
texture:SetTexture(r, g, b[, a]);

Arguments

filename [,tile]

filename
String - Name of the texture image. Images may be in BLP or TGA format, and must have power-of-two dimensions up to 1024 pixels. TGA images may have 8, 24, or 32 bits per pixel for grayscale, RGB, and RGBA images respectively; RLE is supported.
tile
Boolean flag - Tile the image if the coordinates set using Texture:SetTexCoord exceed the 0.0-1.0 range.

r, g, b, a

r
Number (0.0 to 1.0) - Red component.
g
Number (0.0 to 1.0) - Green component.
b
Number (0.0 to 1.0) - Blue component.
a
Number (0.0 to 1.0) - Alpha component (1.0 is opaque, 0.0 is transparent). The default value is 1.0.

Returns

Prior to patch 4.0, this would return nil if the texture could not be loaded and 1 if the texture was successfully loaded. This appears to now be broken and will always return 1 even upon failure. A workaround for finding out if the texture was loaded successfully is to immediately call Texture:GetTexture after loading, which will return nil if the texture failed to load.

Description

Can be used to either set the texture file, or to change the RGB fill of a texture. Pass it one string to change the texture file, or pass it three numbers to set the RGB. The only place I've seen this used to change the color is within the inline script of a ColorSelect object.

Notes

  • If no image is shown, the game will not find image files that did not exist when it was started, you may need to restart the game for the texture to appear.
  • The texture has to be cleared or set to solid colour, or anyway changed away from the current file, before tiling can be changed. Hence the following code will fail:
texture:SetTexture("image.tga",true)
texture:SetTexture("image.tga",false)