PDA

View Full Version : Viewport drawing methods


j_dexx
10-30-2005, 06:23 PM
Greetings. i wrote a small script that displays the object name, above the object in the viewport, its executed by a button i scripted in a masxscript utility. The problem is, every time the viewport is redrawn (ie, when i do anything!), i lose my text. How can i, or is it even possible, to have the text consistently redrawn, without having to press the button again?

This is the code im using at the moment:
fn drawtext =
(
for obj in $ do
(
objname = obj.name
objpos = obj.pos
gw.setTransform(Matrix3 1)
newpos = gw.htranspoint objpos
gw.hText newpos objname color:red
--update the viewport
gw.enlargeUpdateRect #whole
gw.updatescreen()
)
)

The script itself i'm doing just for fun, but it is handy to know which objects are which, without having to select them :)

Bobo
10-30-2005, 07:41 PM
Greetings. i wrote a small script that displays the object name, above the object in the viewport, its executed by a button i scripted in a masxscript utility. The problem is, every time the viewport is redrawn (ie, when i do anything!), i lose my text. How can i, or is it even possible, to have the text consistently redrawn, without having to press the button again?

This is the code im using at the moment:
fn drawtext =
(
for obj in $ do
(
objname = obj.name
objpos = obj.pos
gw.setTransform(Matrix3 1)
newpos = gw.htranspoint objpos
gw.hText newpos objname color:red
--update the viewport
gw.enlargeUpdateRect #whole
gw.updatescreen()
)
)

The script itself i'm doing just for fun, but it is handy to know which objects are which, without having to select them :)


Take a look at registerRedrawViewsCallback()
Also check out the Polygon counter shipping with max (select geometry object and press key 7 to display as overlay in the viewport - it uses the same technique)

antonv
10-30-2005, 09:56 PM
This has been discussed before in here. Check this thread: http://forums.cgsociety.org/showthread.php?t=285095

Thanks.

CGTalk Moderation
10-30-2005, 09:56 PM
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.