Quantcast
WoWInterface - View Single Post - Help with an Icon and SetAtlas
View Single Post
12-31-20, 10:25 AM   #1
bsmorgan
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 201
Help with an Icon and SetAtlas

In Skillet, the details frame shows the reagents for a recipe using the following XML template

Code:
	<Frame name="SkilletItemTemplate" hidden="false" virtual="true">
		<Size>
			<AbsDimension x="190" y="20"/>
		</Size>
		<Layers>
			<Layer level="OVERLAY">
				<FontString name="$parentText" inherits="GameFontNormalSmall" justifyH="LEFT" justifyV="MIDDLE">
					<Size>
						<AbsDimension x="150" y="16"/>
					</Size>
					<Anchors>
						<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT">
							<Offset>
								<AbsDimension x="54" y="0"/>
							</Offset>
						</Anchor>
					</Anchors>
					<Color r="1" g="1" b="1" a="1"/>
				</FontString>
				<FontString name="$parentCount" inherits="GameFontNormalSmall" justifyH="RIGHT" justifyV="MIDDLE">
					<Size>
						<AbsDimension x="80" y="16"/>
					</Size>
					<Anchors>
						<Anchor point="TOPRIGHT" relativeTo="$parent" relativePoint="TOPRIGHT">
							<Offset>
								<AbsDimension x="0" y="0"/>
							</Offset>
						</Anchor>
					</Anchors>
					<Color r="1" g="1" b="1" a="1"/>
				</FontString>
				<FontString name="$parentNeeded" inherits="GameFontNormalSmall" justifyH="RIGHT" justifyV="MIDDLE">
					<Size>
						<AbsDimension x="34" y="16"/>
					</Size>
					<Anchors>
						<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT">
							<Offset>
								<AbsDimension x="18" y="0"/>
							</Offset>
						</Anchor>
					</Anchors>
				<Color r="1" g="1" b="1" a="1"/>
				</FontString>
			</Layer>
		</Layers>
		<Frames>
			<!-- A button for the icon -->
			<button name="$parentIcon">
				<Size>
					<AbsDimension x="16" y="16"/>
				</Size>
				<Anchors>
					<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT">
						<Offset>
							<AbsDimension x="0" y="-1"/>
						</Offset>
					</Anchor>
				</Anchors>
			</button>
		</Frames>
	</Frame>
In Skillet for required reagents, the $parentIcon is loaded with:

Code:
			texture = GetItemIcon(reagent.reagentID)
			icon:SetNormalTexture(texture)
For optional reagents, Blizzard uses the following:

Code:
				Icon:SetAtlas(hasRequiredSkillRank and "tradeskills-icon-add" or "tradeskills-icon-locked", TextureKitConstants.UseAtlasSize);
I can't use GetItemIcon for an optional reagent at this point because there's no itemID but changing my code to icon:SetAtlas(...) errors saying SetAtlas is undefined.

What do I need to add to (or change in) my template so that I can use SetAtlas as in the Blizzard code?
  Reply With Quote