View Full Version : displaying text overlays in the viewport (floating on objects)
Aearon 10-12-2005, 03:37 PM hi guys,
is there anyway to display floating text above an object using maxscript? (see example image)
http://www.kaistavginski.de/files/webstuff/textOverlay.gif
|
|
j-man
10-12-2005, 04:27 PM
Hi Aeron,
Search for gw.text
Cheers,
J¬
antonv
10-12-2005, 05:49 PM
This is a piece of code that Bobo showed at this year's Siggraph MaxScript class. I think this is exaclty what you need:
unRegisterRedrawViewsCallback showObjectNames
fn showObjectNames=
(
gw.setTransform(Matrix3 1)
for o in objects where not o.isHidden do
(
gw.text o.pos (o.name) color:yellow
gw.text (o.pos+[0,0,-2]) (o.pos as string) color:yellow
)
gw.enlargeUpdateRect #whole
gw.updateScreen()
)
registerRedrawViewsCallback showObjectNames
showObjectNames()
I've already used it to make a script that shows the name and coordinates of some objects in the scene. It saves a lot of time when doing camera tracking.
This is a piece of code that Bobo showed at this year's Siggraph MaxScript class. I think this is exaclty what you need:
To make it a single line, you can also replace the code lines
gw.text o.pos (o.name) color:yellow
gw.text (o.pos+[0,0,-2]) (o.pos as string) color:yellow
with
gw.text o.pos (o as string) color:yellow
because the MXS object signature shows both the class, the name and the position of the object...
stuh505
10-12-2005, 09:34 PM
Cool, these "gw" functions open up a lot of new possibilities...
Aearon
10-12-2005, 10:29 PM
thanks for the help guys,
there's a problem though: when i execute the script the text is sometimes displayed, sometimes not at all. when it is displayed at first, it disappears when i pan the viewport or do anything else the causes a redraw
am i missing something?
stuh505
10-12-2005, 10:39 PM
they didn't disappear when I moved around the viewport, although they were very flickery...I am not sure why they would have such a poor redraw rate since I have a quadro 3000, unless they are all getting slowly interpreted through max
Aearon
10-12-2005, 10:46 PM
i have a quadro 3000 as well
i just tested with various drivers... opengl and maxtreme work great, directx: nada
stuh505
10-12-2005, 11:15 PM
The question is why were you using directx in the first place?
The question is why were you using directx in the first place?
Because DX cached meshes are several dozen times faster? ;)
Of course, if you have MAXtreme, performance should be similar.
CGTalk Moderation
10-13-2005, 12:45 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.