Put text in the viewport corner


#1

Hey there!

I’m trying to put text in a corner of a viewport in the viewer axis, on top of everything.
I have the orientation but I don’t know how to get the position and the drawOnTop thing working.

Here’s what I have:
hGrid = text size:20 text:“Text!”
hGrid.rotation = (getViewTM()).rotation


#2

use registerRedrawViewsCallback


#3

All I got is:
– Error occurred in anonymous codeblock; filename: ; position: 4; line: 2
– Runtime error: registerRedrawViewsCallback() expected function, got: undefined
– MAXScript callstack:
– thread data: threadID:12376


– [stack level: 0]
– In anonymous codeblock; filename: ; position: 76; line: 4
– Locals:
– Externals:
– GW_displayText: Global:GW_displayText : undefined
– viewport_switch_trigger: Global:viewport_switch_trigger : undefined


– [stack level: 1]
– called from top-level

Note: I’m trying to put the text in the corner and on top of everything in order to put text on viewport preview. Do you think it’s the way?


#4

Open new maxscript and paste the code from the topic that @Serejah showed you. Then hit Evaluate All and it will work.