Thread Tools Display Modes
02-24-10, 09:14 PM   #1
jojoza
A Murloc Raider
Join Date: Oct 2008
Posts: 5
Hiding nameplates

I'm trying to write an addon which would hide UI and nameplates and take a screenshot.

To hide nameplates, I use SetUIVisibility(). The problem:

Code:
SetUIVisibility(0)
hides nameplates,

Code:
SetUIVisibility(0);
Screenshot();
does not hide nameplates.
  Reply With Quote
02-24-10, 09:25 PM   #2
Waverian
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 188
I'm assuming problem is mostly like that you're executing the two at the exact same time. This means that it's taking the screenshot before the nameplates are actually hidden. Try using an OnUpdate function to delay the screenshot by a half second or so.
  Reply With Quote
02-24-10, 10:32 PM   #3
jojoza
A Murloc Raider
Join Date: Oct 2008
Posts: 5
Which OnUpdate? That OnUpdate which fires every time screen is drawn?

Last edited by jojoza : 02-24-10 at 10:39 PM.
  Reply With Quote
02-24-10, 10:50 PM   #4
Waverian
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 188
Yes. Hidden frames don't call their OnUpdate script so you can use them to create a single-call delay on your screenshot.

Code:
local f = CreateFrame'Frame'
local last, throttle = 0, .5
f:SetScript('OnUpdate', function(self, elapsed)
	last = last + elapsed
	if last >= throttle then
		Screenshot()
	
		last = 0
		f:Hide()
	end
end)
Then just do

Code:
SetUIVisibility(0)
f:Show()
  Reply With Quote
02-24-10, 11:14 PM   #5
jojoza
A Murloc Raider
Join Date: Oct 2008
Posts: 5
It worked! Thank you very much!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Hiding nameplates


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