Notifications
Clear all

[Closed] scripted plugin, showing 2d text on viewport, and few questions~

Good morning everyone!

I had few questions for all you Maxscript gurus out there, and really appreciate any help or suggestions in advance.

My ultimate goal for now, is to replicate point helper. and to do so, i had few questions i could not find in maxScript helpfile.

drawing or showing text on viewport thats not a poligon or spline

best example is the good old point helper. when you create a point helper, and tick “axis tripod” option, it displays X Y Z, very similar to gw.text, as in its not a spline or poligon, just a text drawn into viewport.

i have been experimenting to figure out the best way to draw things in viewport that is not made with splines or poly.
basically similar to maxScript’s builtin function “Viewport Drawing Methods”.

“Viewport Drawing Methods” can do few things i am trying to achieve, but setting it up, and registering viewport callbacks to keep updating it on viewports are qutie tedious, and has lots of limitations. for example, when you create a poitn helper with axis tripod on, the X Y Z text is shown on all 4 viewports, and when you pan, rotate the view, its always drawn.

Also, had a read through the help file regarding the constant screen size function.
read few posts too, but didn’t seem to get it running smoothly.

Does anybody have a code thats working, they are willing to share?
I would be very appreciated : )

7 Replies
 PEN

To get much fancier then you have already discovered will take a true plugin and not a scripted version. The GW drawing methods are limited and what you see in the help is what you get. I did a viewport drawing tool with them and I had to work with callbacks as well to get it to work. If you are planning on having these running all the time I would suggest against it as it can get slow.

As for extending a helper object for a plugin this can also get slow, it isn’t the scripted plugin that is slow it is helper objects in Max in general that are slow. Consider using geometry plugins instead as those get cached and are very fast. If you want to have a look at reference you can down load this from my site http://www.paulneale.com/scripts/penHelpers/penHelper.htm

I am not sure if my last Master Class from Siggraph 2008 has been released to subscibers already, but in it I proposed among other things the use of Manipulator Plugins as Helpers that can draw custom lines, symbols and text and freely control their color, too.

In short, a Manipulator plugin (like the Slider for example) can appear as a creatable helper and does not have to implement any code to manipulate anything (neither other objects nor itself although it could). Within the body of the Manipulator, you can create gizmo shapes that can derive from meshes, be your own freeform shapes, use several symbols like box, cross etc. and also generate text without the use of gw methods.

Take a look at the Scripted Manipulators topics in the Help and also dissect the Slider Manipulator source code (it is a scripted one, too!).

 PEN

Nice idea Bobo, wish I had time to play with that.

The down side is that manipulators have to be turned on, which the user may not want since manipulators other than your own custom one will also show up. But other than that, they are a great way to get custom gizmos.

3 Replies
(@bobo)
Joined: 11 months ago

Posts: 0

This is absolutely not true.
Manipulator HELPERS are always visible. They are regular Plugin class instances living in the scene as nodes and saved with the scene file – see the Slider Manipulator for an example.

You have to turn on the Manipulate mode only to manipulate them, but if the helper is just there to show stuff (like graphs or text), it doesn’t need to be manipulatable anyway.

 eek
(@eek)
Joined: 11 months ago

Posts: 0

Can you still move them when there not in manipulate mode? I’m at a point too about deciding whether to build simpleObjects plugins or manipulators – i’ve built simpleObjects but they tend to be a pain in the arse when using text with them, so i might veer towards manipulators.

Also, without them being in manip mode, do you have access to and can change any parameters you give them – length, width etc?

(@bobo)
Joined: 11 months ago

Posts: 0

Yes, you can move them. Keep in mind that Slider Manipulator is explicitly programmed to stay in screen space (2D) so it draws differently. Regular 3D space manipulator gizmos are drawn in object space of the node and moving the node will move the gizmo just the way any helper would.

You don’t have MANIPULATOR access to the properties when the manipulate mode is off, but if these properties are exposed to the UI, you can change them through the Modifier panel.