Thread Tools Display Modes
04-16-11, 12:15 AM   #21
Aprikot
A Frostmaul Preserver
 
Aprikot's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2010
Posts: 284
Thanks Seerah. It appears the aforementioned frames are childless. Printing GetChildren() against them doesn't return anything, and doing so against their parents doesn't return anything that /framestack didn't already reveal.

What's more confusing to me, is that in running the below code, I expected *all* UI textures to be affected:
Code:
local abc = function()
    for i, v in pairs(_G) do
        if type(v) == "table" then
            local meta = getmetatable(v)
                if meta
		and meta.__index
		and type(meta.__index) == "table"
		and meta.__index.GetTexture
		and v:GetObjectType() == "Texture"
		then		
                    v:SetDesaturated(1)
		    v:SetVertexColor(1, 0, 0)
                end
        end
    end
end
But this hodgepodge is what results (some textures left completely untouched, some desaturated but not recolored ):
Click image for larger version

Name:	WoWScrnShot_041611_000353.jpg
Views:	330
Size:	1.01 MB
ID:	6002 Click image for larger version

Name:	WoWScrnShot_041611_012004.jpg
Views:	329
Size:	1.08 MB
ID:	6003

My total inexperience with global tables aside for a sec , it feels like there is a methodology to solving this that I'm totally missing.

Last edited by Aprikot : 04-16-11 at 01:44 AM. Reason: added pic
  Reply With Quote
04-16-11, 08:39 AM   #22
Aprikot
A Frostmaul Preserver
 
Aprikot's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2010
Posts: 284
Another example (Clock button: \Blizzard_AddOns\Blizzard_TimeManager\Blizzard_TimeManager.xml):

Code:
	<!-- Minimap button to access the TimeManagerButton -->
	<Button name="TimeManagerClockButton" parent="Minimap">
		<Size x="60" y="28"/>
		<Anchors>
			<Anchor point="CENTER">
				<Offset x="0" y="-75"/>
			</Anchor>
		</Anchors>
		<Layers>
			<Layer level="BORDER">
				<Texture <!-- no texture name --> urgency="5" file="Interface\TimeManager\ClockBackground" setAllPoints="true">
					<TexCoords left="0.015625" right="0.8125" top="0.015625" bottom="0.390625"/>
				</Texture>
			</Layer>
			<Layer level="ARTWORK">
				<FontString name="TimeManagerClockTicker" inherits="GameFontHighlightSmall">
					<Anchors>
						<Anchor point="CENTER">
							<Offset x="3" y="1"/>
						</Anchor>
					</Anchors>
				</FontString>
				<Texture name="TimeManagerAlarmFiredTexture" urgency="5" file="Interface\TimeManager\ClockBackground" alphaMode="ADD" hidden="true" setAllPoints="true">
					<TexCoords left="0.015625" right="0.8125" top="0.51625" bottom="0.890625"/>
				</Texture>
			</Layer>
		</Layers>
		<Scripts>
			<OnLoad function="TimeManagerClockButton_OnLoad"/>
			<OnEnter function="TimeManagerClockButton_OnEnter"/>
			<OnLeave function="TimeManagerClockButton_OnLeave"/>
			<OnUpdate function="TimeManagerClockButton_OnUpdate"/>
			<OnClick function="TimeManagerClockButton_OnClick"/>
		</Scripts>
	</Button>
I guess my question is how do you find a texture object when there is no texture name (i.e., is there a default)? Might there be a way to do it backwards by looking up all of the texture objects using a certain texture file (e.g., Interface\TimeManager\ClockBackground)?
  Reply With Quote
04-16-11, 09:04 AM   #23
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Originally Posted by Aprikot View Post
I guess my question is how do you find a texture object when there is no texture name
The way is to iterate everything via GetChildren() and GetRegions() starting with UIParent.
  Reply With Quote
04-16-11, 10:14 AM   #24
Aprikot
A Frostmaul Preserver
 
Aprikot's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2010
Posts: 284
Originally Posted by Duugu View Post
The way is to iterate everything via GetChildren() and GetRegions() starting with UIParent.
Eeek...is there a method you can recommend?

I'm poking around dev tools for something...I don't presume I'm the first to run into this. I have a "global table" dump in xml format from the api highlighter I use, but not sure how comprehensive it is.

In general, is it normal for some objects to exist outside of framexml & blizz addons, and are there tables other than _G I can/should iterate through?

All for a few silly buttons that most folks hide() anyway.
  Reply With Quote
04-16-11, 05:19 PM   #25
Aprikot
A Frostmaul Preserver
 
Aprikot's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2010
Posts: 284
Code:
print(MinimapZoomOut:GetRegions())
returns
Code:
table: 11877CE8 table:1D55E7B8 table: 1BC89C08 table: 1BC89C30
How does one correlate these hex values to names?
  Reply With Quote
04-16-11, 07:53 PM   #26
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Oops, sorry. Yeah, I meant GetRegions. That's how you get the parts of the clock at least (see PocketPlot).
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
04-17-11, 06:10 AM   #27
Xinhuan
A Chromatic Dragonspawn
 
Xinhuan's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 174
Originally Posted by Aprikot View Post
Code:
print(MinimapZoomOut:GetRegions())
returns
Code:
table: 11877CE8 table:1D55E7B8 table: 1BC89C08 table: 1BC89C30
How does one correlate these hex values to names?
You can't. All you are doing is printing out the memory address of tables (where each Region returned is a Lua table) and that memory address will be different every time you run WoW. Regions are basically Fontstrings and Textures.

All f:GetRegions() does is give you a list of children textures and fontstrings for frame f, and you can operate on them like any other texture or fontstring. If they have a name, then :GetName() would return a string, otherwise nil is returned.

The regions are returned in the order of creation for the frame in question, so look at the XML and start counting, if you want to figure out which region is which texture you want to modify (such as, I want to modify the 2nd created texture of this frame, so use the 2nd return of :GetRegions() on it and call :SetVertexColor() on it.)
__________________
Author of Postal, Omen3, GemHelper, BankItems, WoWEquip, GatherMate, GatherMate2, Routes and Cartographer_Routes

Last edited by Xinhuan : 04-17-11 at 06:12 AM.
  Reply With Quote
04-17-11, 08:45 AM   #28
Aprikot
A Frostmaul Preserver
 
Aprikot's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2010
Posts: 284
Thanks Xinhuan & Seerah for the help (success fir the Zoom Out button texture):
Code:
local zotex = select(1, MinimapZoomOut:GetRegions())
I think I'm going to have a long & fruitful relationship with GetRegions()
  Reply With Quote
04-17-11, 12:24 PM   #29
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
Code:
local zotex = select(1, MinimapZoomOut:GetRegions())
uhm .. isn't that local arg1 = select(1, table) superfluous
  Reply With Quote
04-17-11, 01:21 PM   #30
Aprikot
A Frostmaul Preserver
 
Aprikot's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2010
Posts: 284
Originally Posted by Ketho View Post
Code:
local zotex = select(1, MinimapZoomOut:GetRegions())
uhm .. isn't that local arg1 = select(1, table) superfluous
It is for the zoom button as the first return is the texture I wanted to recolor. I was using select one at a time to see what was what .
  Reply With Quote
05-08-11, 10:48 AM   #31
Aprikot
A Frostmaul Preserver
 
Aprikot's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2010
Posts: 284
Unhappy TotemFrame buttons

Everything I thought I learned in this thread is availing me little in trying to color the TotemFrame button "borders".

I've tried arbitrarily checking args 1-30 (via select()) for both GetRegions() & GetChildren() against each of the TotemFrame* frames shown in the below framestack screenshot (layers 7-10):



I'm now trying to do it via CreateTexture(), and I think there is trouble with the way I'm interpreting TotemFrame.xml:
lua Code:
  1. local frame = CreateFrame("Button", "TotemButtonTemplate", PlayerFrame)
  2. local texture = frame:CreateTexture("$parentIcon", "OVERLAY")
TotemFrame.xml below for reference. I appreciate any help!
xml Code:
  1. <Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
  2. ..\FrameXML\UI.xsd">
  3.     <Script file="TotemFrame.lua"/>
  4.     <Button name="TotemButtonTemplate" virtual="true" hidden="true">
  5.         <Size>
  6.             <AbsDimension x="37" y="37"/>
  7.         </Size>
  8.         <Layers>
  9.             <Layer level="BACKGROUND">
  10.                 <Texture name="$parentBackground" urgency="5" file="Interface\Minimap\UI-Minimap-Background">
  11.                     <Size x="34" y="34"/>
  12.                     <Anchors>
  13.                         <Anchor point="CENTER">
  14.                             <Offset x="0" y="0"/>
  15.                         </Anchor>
  16.                     </Anchors>
  17.                     <Color r="1" g="1" b="1" a="0.6"/>
  18.                 </Texture>
  19.                 <FontString name="$parentDuration" inherits="GameFontNormalSmall" parentKey="duration">
  20.                     <Anchors>
  21.                         <Anchor point="TOP" relativePoint="BOTTOM" relativeTo="$parent">
  22.                             <Offset x="0" y="5"/>
  23.                         </Anchor>
  24.                     </Anchors>
  25.                 </FontString>
  26.             </Layer>
  27.         </Layers>
  28.         <Frames>
  29.             <Frame name="$parentIcon">
  30.                 <Size x="22" y="22"/>
  31.                 <Anchors>
  32.                     <Anchor point="CENTER">
  33.                         <Offset x="0" y="0"/>
  34.                     </Anchor>
  35.                 </Anchors>
  36.                 <Layers>
  37.                     <Layer level="ARTWORK">
  38.                         <Texture name="$parentTexture"/>
  39.                     </Layer>
  40.                 </Layers>
  41.                 <Frames>
  42.                     <Cooldown name="$parentCooldown" inherits="CooldownFrameTemplate" reverse="true"/>
  43.                 </Frames>
  44.             </Frame>
  45.             <Frame>
  46.                 <Size x="38" y="38"/>
  47.                 <Anchors>
  48.                     <Anchor point="CENTER">
  49.                         <Offset x="0" y="0"/>
  50.                     </Anchor>
  51.                 </Anchors>
  52.                 <Layers>
  53.                     <Layer level="OVERLAY">
  54.                         <Texture file="Interface\CharacterFrame\TotemBorder"/>
  55.                     </Layer>
  56.                 </Layers>
  57.                 <Scripts>
  58.                     <OnLoad>
  59.                         self:SetFrameLevel(_G[self:GetParent():GetName().."Icon"]:GetFrameLevel() + 1);
  60.                     </OnLoad>
  61.                 </Scripts>
  62.             </Frame>
  63.         </Frames>
  64.         <Scripts>
  65.             <OnClick>
  66.                 TotemButton_OnClick(self, button, down);
  67.             </OnClick>
  68.             <OnLoad>
  69.                 TotemButton_OnLoad(self);
  70.             </OnLoad>
  71.             <OnEnter>
  72.                 GameTooltip:SetOwner(self, "ANCHOR_BOTTOMRIGHT");
  73.                 GameTooltip:SetTotem(self.slot);
  74.             </OnEnter>
  75.             <OnLeave>
  76.                 GameTooltip:Hide();
  77.             </OnLeave>
  78.         </Scripts>
  79.     </Button>
  80.     <Frame name="TotemFrame" toplevel="true" parent="PlayerFrame" hidden="true">
  81.         <Size>
  82.             <AbsDimension x="128" y="53"/>
  83.         </Size>
  84.         <Anchors>
  85.             <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent">
  86.                 <Offset>
  87.                     <AbsDimension x="99" y="38"/>
  88.                 </Offset>
  89.             </Anchor>
  90.         </Anchors>
  91.         <Frames>
  92.             <Button name="$parentTotem1" inherits="TotemButtonTemplate" id="1">
  93.                 <Anchors>
  94.                     <Anchor point="TOPLEFT">
  95.                         <Offset>
  96.                             <AbsDimension x="0" y="0"/>
  97.                         </Offset>
  98.                     </Anchor>
  99.                 </Anchors>
  100.             </Button>
  101.             <Button name="$parentTotem2" inherits="TotemButtonTemplate" id="2">
  102.                 <Anchors>
  103.                     <Anchor point="LEFT" relativeTo="$parentTotem1" relativePoint="RIGHT">
  104.                         <Offset>
  105.                             <AbsDimension x="-4" y="0"/>
  106.                         </Offset>
  107.                     </Anchor>
  108.                 </Anchors>
  109.             </Button>
  110.             <Button name="$parentTotem3" inherits="TotemButtonTemplate" id="3">
  111.                 <Anchors>
  112.                     <Anchor point="LEFT" relativeTo="$parentTotem2" relativePoint="RIGHT">
  113.                         <Offset>
  114.                             <AbsDimension x="-4" y="0"/>
  115.                         </Offset>
  116.                     </Anchor>
  117.                 </Anchors>
  118.             </Button>
  119.             <Button name="$parentTotem4" inherits="TotemButtonTemplate" id="4">
  120.                 <Anchors>
  121.                     <Anchor point="LEFT" relativeTo="$parentTotem3" relativePoint="RIGHT">
  122.                         <Offset>
  123.                             <AbsDimension x="-4" y="0"/>
  124.                         </Offset>
  125.                     </Anchor>
  126.                 </Anchors>
  127.             </Button>
  128.         </Frames>
  129.         <Scripts>
  130.             <OnLoad function="TotemFrame_OnLoad"/>
  131.             <OnEvent function="TotemFrame_OnEvent"/>
  132.         </Scripts>
  133.     </Frame>
  134. </Ui>
  Reply With Quote
05-08-11, 12:37 PM   #32
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
You cannot overwrite an XML template by creating a Button in Lua using the same name. Instead, to replace the texture, you would use the absolute name of the texture and modify that:

Code:
local texture1 = TotemFrameTotem1IconTexture
local texture2 = TotemFrameTotem2IconTexture
local texture3 = TotemFrameTotem3IconTexture
local texture4 = TotemFrameTotem4IconTexture

texture1:SetTexture(path_to_image)
texture2:SetTexture(path_to_image)
texture3:SetTexture(path_to_image)
texture4:SetTexture(path_to_image)
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
05-08-11, 01:39 PM   #33
Aprikot
A Frostmaul Preserver
 
Aprikot's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2010
Posts: 284
My goal is identification of the texture object(s) being used for the button borders.

TotemFrame.xml does specify hierarchy for TotemFrameTotem1IconTexture for example ($parentTotem1 $parentIcon $parentTexture -- colored below), whereas the border texture appears nameless, and resides in its own nameless frame.



Code:
 
            <Frame>
                <Size x="38" y="38"/>
                <Anchors>
                    <Anchor point="CENTER">
                        <Offset x="0" y="0"/>
                    </Anchor>
                </Anchors>
                <Layers>
                    <Layer level="OVERLAY">
                        <Texture file="Interface\CharacterFrame\TotemBorder"/>
                    </Layer>
                </Layers>
                <Scripts>
                    <OnLoad>
                        self:SetFrameLevel(_G[self:GetParent():GetName().."Icon"]:GetFrameLevel() + 1);
                    </OnLoad>
                </Scripts>
            </Frame>
This is what led me to go the GetRegions() route (unsuccessfully thus far). The Lua in my previous post is one of many grasping at straws attempts at capturing the nameless texture.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » FrameXML $parent

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off