Thread Tools Display Modes
07-26-12, 02:31 AM   #1
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,359
Nameplates

Originally Posted by Maul View Post
Not entirely, I turned the taint log off and still had issues until I narrowed down my crash issue to modifying a custom gametooltip (like used for tooltip scanning). I eliminated the modifications as well as the :GetRegion() calls on the custom tooltip and only then did the crashes stop.

And I still crash on a /reload occasionally with the taint log off.
You can add WorldFrame:GetChildren() to the list of things that hard crash the beta client (build 15882)

(typical for nameplate addons looking for nameplates)

Note: Pulled these posts from MoP beta topic as they're no longer MoP specific. - Haleth

Last edited by Haleth : 07-26-12 at 06:05 PM.
 
07-26-12, 07:21 AM   #2
ballagarba
A Fallenroot Satyr
 
ballagarba's Avatar
Join Date: Mar 2009
Posts: 22
Originally Posted by Dridzt View Post
You can add WorldFrame:GetChildren() to the list of things that hard crash the beta client (build 15882)

(typical for nameplate addons looking for nameplates)
In case you didn't know: http://www.wowinterface.com/forums/s...9&postcount=30
 
07-26-12, 07:49 AM   #3
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
You still need to use WorldFrame:GetChildren() to actually iterate through potential frames. Then you can check them by name.

It would be much better if we could hook into the function that creates nameplates, but we don't have access to it.
 
07-26-12, 01:28 PM   #4
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by Haleth View Post
You still need to use WorldFrame:GetChildren() to actually iterate through potential frames. Then you can check them by name.
Actually...
Lua Code:
  1. local index = 1
  2.  
  3. local addon = CreateFrame('Frame')
  4. addon:SetScript('OnUpdate', function()
  5.     while _G['NamePlate' .. index] do
  6.         local frame = _G['NamePlate' .. index]
  7.  
  8.         -- do whatever
  9.  
  10.         index = index + 1
  11.     end
  12. end)
  13. addon:Show()

Last edited by p3lim : 07-26-12 at 03:19 PM.
 
07-26-12, 01:42 PM   #5
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,359
Originally Posted by p3lim View Post
Actually...
That's a simple and clever workaround for the bug actually,
might have to poach it for a couple addons that I've had to keep disabled in beta.

Edit: Scratch that, a while loop won't work sadly, nameplate frames are reused for one so you don't always have a nice collection of sequential frames from 1 to n.
Even if we did have that, it would still need to wrap around to index 1 when it exits the while loop.
It's food for thought definitely...

And another function that hard crashes the client (no addons present) GetDestinationReforgeStats() (build 15882)

Last edited by Dridzt : 07-26-12 at 02:02 PM.
 
07-26-12, 01:46 PM   #6
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
Okay, p3lim, that's clever. Should be quite a bit more efficient
 
07-26-12, 02:25 PM   #7
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by Dridzt View Post
That's a simple and clever workaround for the bug actually,
might have to poach it for a couple addons that I've had to keep disabled in beta.

Edit: Scratch that, a while loop won't work sadly, nameplate frames are reused for one so you don't always have a nice collection of sequential frames from 1 to n.
Even if we did have that, it would still need to wrap around to index 1 when it exits the while loop.
It's food for thought definitely...

Lua Code:
  1. local function Update(self)
  2.     -- do whatever
  3. end
  4.  
  5. local index = 1
  6.  
  7. local addon = CreateFrame('Frame')
  8. addon:SetScript('OnUpdate', function()
  9.     while _G['NamePlate' .. index] do
  10.         local frame = _G['NamePlate' .. index]
  11.         frame:HookScript('OnShow', Update)
  12.  
  13.         Update(frame)
  14.  
  15.         index = index + 1
  16.     end
  17. end)
  18. addon:Show()

Last edited by p3lim : 07-26-12 at 03:19 PM.
 
07-26-12, 04:32 PM   #8
endx7
An Aku'mai Servant
 
endx7's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2005
Posts: 38
Originally Posted by zork View Post
You are sure that you want to update every single name plate on every single frame in the game?
With 40 plates thats 40 updates per frame. At 100fps thats 4000 calls per second.
since index is never reset, it is only nameplates that have never been seen before. Each OnUpdate starts where it left off. If there are no new frames at all, the while loop fails immediately.

The OnShow handler ensures that the next time the frame is reused, we can handle updating the frame again.

Last edited by endx7 : 07-26-12 at 04:40 PM.
 
07-26-12, 04:35 PM   #9
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,359
Originally Posted by zork View Post
You are sure that you want to update every single name plate on every single frame in the game?
With 40 plates thats 40 updates per frame. At 100fps thats 4000 calls per second.

Not sure why you even want to do that. All nameplate stuff can be done with one style function and some hooks. Once a nameplate is styled it can be ignored from that time on.
The discussion originated from the fact that in current MoP beta one of the things that hard crashes the client is calls to WorldFrame:GetChildren() which most nameplate addons use in their nameplate identification functions.

Last edited by Dridzt : 07-26-12 at 04:47 PM.
 
07-26-12, 04:47 PM   #10
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Forget what I wrote.

Btw...Does adding a throttle based on elapsed have any positive results performance-wise?

*edit* Tested...does not work

NamePlate1 is not found. Script stops.

Not sure why you say that checking the WorldFrame crashs the client...I'm doing just that and the client does not crash. Or is that only in combination with the taintlog enabled?



NamePlateIds start at 2xx in my case. Not sure why...it's just what the GetName() spits out.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 07-26-12 at 05:14 PM.
 
07-26-12, 05:14 PM   #11
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by zork View Post
NamePlate1 is not found. Script stops.
NamePlateIds start at 2xx in my case. Not sure why...it's just what the GetName() spits out.
The reason is because you did /reloads, and the game keeps continuing from where it left off before you did.
Unlike most frames, the nameplates are written (or wrapped) in C, and will not reload like the rest of the UI does.

Here is a way to counter this:
Lua Code:
  1. local function Update(self)
  2.     -- do whatever
  3. end
  4.  
  5. local index = 1
  6. local fresh = true
  7.  
  8. local addon = CreateFrame('Frame')
  9. addon:SetScript('OnUpdate', function()
  10.     while _G['NamePlate' .. index] or fresh do
  11.         local frame = _G['NamePlate' .. index]
  12.         if(frame) then
  13.             fresh = false
  14.  
  15.             frame:HookScript('OnShow', Update)
  16.  
  17.             Update(frame)
  18.         end
  19.  
  20.         index = index + 1
  21.     end
  22. end)
  23. addon:Show()

Last edited by p3lim : 07-26-12 at 05:23 PM.
 
07-26-12, 05:49 PM   #12
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,359
Wouldn't that loop run 'forever' and keep bumping index if you happen to reload in an area with no nameplates?

Last edited by Dridzt : 07-26-12 at 05:51 PM.
 
07-26-12, 06:09 PM   #13
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
I'd still prefer to limit the while loop to run only, say, 10 times per second, rather than every new frame. Comparing two numbers (to check if enough time has elapsed) is likely far more efficient CPU-wise than looking up a frame in _G.

Btw, I pulled these posts from the MoP topic.

Last edited by Haleth : 07-26-12 at 06:18 PM. Reason: Misread
 
07-26-12, 06:12 PM   #14
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by Dridzt View Post
Wouldn't that loop run 'forever' and keep bumping index if you happen to reload in an area with no nameplates?
It would indeed.

A possible solution instead of the previous would be using a combination of an event and function that only works on a login (not reload) to reset a SV containing a variable that is set on PLAYER_LOGOUT to keep counting properly.

It would lead into a monstrosity though.

Last edited by p3lim : 07-26-12 at 06:14 PM.
 
07-26-12, 06:13 PM   #15
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by Haleth View Post
I'd still prefer to limit the while loop to run only, say, 10 times per second, rather than every new frame. Comparing two numbers (to check if enough time has elapsed) is likely far more efficient CPU-wise than looking up a frame in _G.
That is not desireable, as it would leave a (possibly) big gap where a nameplate would look like default.
 
07-26-12, 06:22 PM   #16
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
Perhaps we should just request on the official forums that they add a better way for addons to do this. Since it's handled outside of lua, perhaps there could be an event like NAMEPLATE_CREATED, passing the frame as a parameter.

They listened to the request for new macro conditionals. Worth a shot, or?
 
07-26-12, 06:23 PM   #17
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by Haleth View Post
Perhaps we should just request on the official forums that they add a better way for addons to do this. Since it's handled outside of lua, perhaps there could be an event like NAMEPLATE_CREATED, passing the frame as a parameter.

They listened to the request for new macro conditionals. Worth a shot, or?
Go for it, I don't have access to the US forums.
Also, frame name or id would be enough, don't think they'd go for passing the whole frame table.

Remember, I am not trying to replace the current method we are using, this is just a temporary thing to work around the issues on the beta client, and perhaps find something nice while we're at it.

I agree that the nameplates should be easier to do anything with, but blizzard is avoiding showing the code, most likely to counter potential bots.

Last edited by p3lim : 07-26-12 at 06:54 PM.
 
07-26-12, 08:11 PM   #18
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Here we go, PLAYER_LOGOUT event saving the last index to a savedvariable, two OnUpdate scripts iterating either a new index or the savedvariable, and either of them shuts down the savedvariable one.

Lua Code:
  1. local index = 1
  2.  
  3. local backup = CreateFrame'Frame'
  4. backup:SetScript('OnUpdate', function(self)
  5.     if(not SomeCleverVariableName) then return end
  6.  
  7.     if(_G['NamePlate' .. SomeCleverVariableName]) then
  8.         self:Hide()
  9.  
  10.         index = SomeCleverVariableName
  11.         SomeCleverVariableName = nil
  12.     end
  13. end)
  14.  
  15. local iterate = CreateFrame'Frame'
  16. iterate:SetScript('OnUpdate', function()
  17.     while(_G['NamePlate' .. index]) do
  18.         local frame = _G['NamePlate' .. index]
  19.         frame:HookScript('OnShow', Update)
  20.         backup:Hide()
  21.  
  22.         Update(frame)
  23.  
  24.         index = index + 1
  25.     end
  26. end)
  27.  
  28. iterate:RegisterEvent'PLAYER_LOGOUT'
  29. iterate:SetScript('OnEvent', function()
  30.     SomeCleverVariableName = index + 1
  31. end)

Last edited by p3lim : 07-26-12 at 09:42 PM.
 
07-27-12, 09:26 AM   #19
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Also, move this to the proper MoP discussion sub-forum, as it is not related to live clients.
 
07-27-12, 06:14 PM   #20
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
Originally Posted by p3lim View Post
Go for it, I don't have access to the US forums.
Also, frame name or id would be enough, don't think they'd go for passing the whole frame table.
Some spontaneous ideas, should anyone put together a formal proposal to Blizzard; NAMEPLATE_SHOW(index), GetNumNameplates(), GetNameplate(index). Possibly additional events for _CREATE and _UPDATED, and/or an argument indicating a new frame was created.
__________________
Grab your sword and fight the Horde!
 
 

WoWInterface » Site Forums » Archived Beta Forums » MoP Beta archived threads » Nameplates

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