Thread Tools Display Modes
04-16-11, 05:11 AM   #1
daylesan
A Fallenroot Satyr
Join Date: Feb 2011
Posts: 22
Unable to change certain nameplate properties

A nameplate frame has 11 regions and 2 child frames (statusbars) associated with it.

I have some code that successfully changes the textures, but can't seem to change the size or anchor points of the regions and child frames.

Is this because the game automatically re-sets the size and anchor point every frame or some non-obvious other thing?
  Reply With Quote
04-16-11, 05:39 AM   #2
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
imho the game sets the anchor points only once.

I just did some quick and dirty tests, and it works as expected. If I do
Code:
region:ClearAllPoints()
region:SetPoint("TOPLEFT", parentframe, "TOPLEFT")
with the nametext region. The default anchor (BOTTOMLEFT) is cleared and the new anchor is set and persists - even if the nameplate is temp. hidden.
Didn't test the other regions, but I would be surprised if this is not the same with these.

[Edit]
So ... this must be a flaw in you code. Please post you code.

Last edited by Duugu : 04-16-11 at 05:42 AM.
  Reply With Quote
04-16-11, 09:18 AM   #3
Saiket
A Chromatic Dragonspawn
 
Saiket's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 154
Quite a few nameplate elements get re-anchored behind the scenes when nameplates are shown. Off the top of my head, level text, the mouseover highlight texture, and name text all get re-anchored OnShow. It's a bit of a black box though, so you'll probably have to experiment with any elements that seem to reset.

One thing to look out for is that some elements don't get reset until the OnUpdate handler that fires immediately after a plate's OnShow. Level texts and castbar uninterruptibility textures are like this, though there may be more that I haven't noticed.

Another thing to be aware of is your "bloattest" cvar. I know for sure it affects if and when parts of nameplate castbars get reset, but it might affect other elements too. I can't remember if it resets elements more when on or off, though.
  Reply With Quote
04-16-11, 10:51 AM   #4
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Originally Posted by Saiket View Post
QuOff the top of my head, level text, the mouseover highlight texture, and name text all get re-anchored OnShow.
Name text definitely isn't re-anchored - at least not at OnShow.
  Reply With Quote
04-16-11, 12:35 PM   #5
daylesan
A Fallenroot Satyr
Join Date: Feb 2011
Posts: 22
Originally Posted by Saiket View Post
One thing to look out for is that some elements don't get reset until the OnUpdate handler that fires immediately after a plate's OnShow. Level texts and castbar uninterruptibility textures are like this, though there may be more that I haven't noticed.
Hooking the OnUpdate script is the way to go then?
  Reply With Quote
04-16-11, 04:38 PM   #6
Saiket
A Chromatic Dragonspawn
 
Saiket's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 154
In my mod, I set the OnUpdate handler during OnShow. My OnUpdate handler then unregisters itself so that it only runs once per OnShow.
  Reply With Quote
04-22-11, 06:12 AM   #7
Goldpaw
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 56
There are currently some changes to nameplates on the PTR. First off, they haven't got 11 regions anymore, they have 8. Some of the regions has been moved into the castbar object, which is the 2nd child of the nameplate.

Secondly, they have names now. NamePlate1, NamePlate2, etc etc. There can be hundreds.

On live realms (4.0.6), I use this little code to get the various regions of the nameplates and their castbars (where f represents the nameplate frame):
lua Code:
  1. f.health, f.cast = f:GetChildren()
  2. f.threat, f.border, f.castborder, f.shield, f.casticon, f.highlight, f.name, f.level, f.bossicon, f.raidicon, f.dragon = f:GetRegions()

On the PTR, I use this:
lua Code:
  1. f.health, f.cast = f:GetChildren()
  2.  
  3. -- patch 4.1
  4. if f:GetName() and strfind(f:GetName(), "NamePlate") then
  5.     -- not 100% sure about the f.castbartexture-thing here. I _think_ it refers to the statusbar texture of the castbar. At least that's what disappeared when I hid it
  6.     f.castbartexture, f.castborder, f.shield, f.casticon = f.cast:GetRegions()
  7.     f.threat, f.border, f.highlight, f.name, f.level, f.bossicon, f.raidicon, f.dragon = f:GetRegions()
  8. else
  9.     f.threat, f.border, f.castborder, f.shield, f.casticon, f.highlight, f.name, f.level, f.bossicon, f.raidicon, f.dragon = f:GetRegions()
  10. end

Last edited by Goldpaw : 04-22-11 at 06:14 AM.
  Reply With Quote
04-22-11, 07:08 AM   #8
Goldpaw
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 56
Originally Posted by daylesan View Post
Hooking the OnUpdate script is the way to go then?
Hooking up to every NamePlate's OnUpdate handler is a terrible way to go, as this would fire off the function for every nameplate, on every Update of the WorldFrame.

I use the nameplate's OnShow and OnHide, as well as the castbars' OnShow, OnSizeChanged and OnValueChanged.

You can dig through it yourself in the modules\nameplates\ folder:
http://wow.curse.com/downloads/wow-a.../guis-gui.aspx
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Unable to change certain nameplate properties

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