Notifications
Clear all

[Closed] Search a script who use Viewport Drawing Methods

Hello again

It want to have a look to the viewport drawing methods.
Like in the deselect loop tool from RHTools below.

I want to look in the script to learn about it, but the script is encrypted 🙁

Can someone know another maxscript that draw something like here ?

Thanks

9 Replies

hey externe, yeah man you are right, I also want to know about this subject. Information shouldnt be encrypted, otherwise shouldnt be created. I dont know but I never encrypt my scripts, who steals codes these days man.

See ya

Well, it’s nice idea that encrypt your script if you work hard on it… Just an opinion.
Perharps LFShade talk a few about how to obtain that.
I try a few gw.methods… But that crash max :shrug:

yeah that seems right, but I wouldnt let anyone modify and distribute it without my permission. and for example tree maker, that script seems real hard, I mean really. But he gives you the code, if someone has the ability to solve all the content, that will be the first step, which very few people can do, and then if you modify it, you cant distribute it, ask me for example, I cant. then I totally respect to the idea to read or inspire from one script and then totally write a more advanced one with truly different code, one can write something with 1 fn while others can do that thing with 3 fns. And thats why I like the idea of scripting. See the tool (not the code), get the idea, inspire and write yours, and if you stuck or wonder check the original code, just to see what one has written. And then you cant integrate it to yours because of the different working nature of your script. thats what I though. Also I want to ask if its possible to sell scripts: I mean do you know anybody that does this? Maybe a really cool script?

See ya

Here is a practical example:

fn drawBoundingBox theMin theMax =

(

gw.setTransform(Matrix3 1)

lineArrays = #(

#(theMin ,[theMin.x, theMin.y, theMax.z], [theMin.x, theMax.y, theMax.z],[theMin.x, theMax.y, theMin .z]),

#(theMax ,[theMax.x, theMin.y, theMax.z], [theMax.x, theMin.y, theMin.z],[theMax.x, theMax.y, theMin .z]),

#(theMin ,[theMax.x, theMin.y, theMin.z]),

#([theMin.x,theMax.y,theMin.z] ,[theMax.x, theMax.y, theMin.z]),

#([theMin.x,theMax.y,theMax.z] ,[theMax.x, theMax.y, theMax.z]),

#([theMin.x,theMin.y,theMax.z] ,[theMax.x, theMin.y, theMax.z])

)

gw.setColor #line [255,0,0]

for lines in lineArrays do gw.polyline lines true

gw.enlargeUpdateRect #whole

gw.updateScreen()

)

fn drawBBoxesForSelection =

(

for o in selection do drawBoundingBox o.min o.max

)

unregisterRedrawViewsCallback drawBBoxesForSelection

registerRedrawViewsCallback drawBBoxesForSelection

It registers a viewport redraw callback that calls a function to draw a world-oriented red bounding box around the current selection.

To disable again, execute the line

unregisterRedrawViewsCallback drawBBoxesForSelection

Play around with it to see how it works…

thanks bobo, that is cool.

See ya

Your example is terrific ! 😮
Thank you very much.

Well Bobo, I try to disable it.

By executing :
unregisterRedrawViewsCallback drawBBoxesForSelection
in the Maxscript Listener. 2 or 3 times… But it doesn’t work :shrug:

It try to re-execute you script by modify him tlike that ( put in comment the line ) :

… before
fn drawBBoxesForSelection =
(
for o in selection do drawBoundingBox o.min o.max
)
–registerRedrawViewsCallback drawBBoxesForSelection
unregisterRedrawViewsCallback drawBBoxesForSelection

But it doesn’ work too:shrug:

So how to disable it please ?
Thanks

A note about encryption –
I used to do it to hide code that I didn’t consider “ready for the world.” That is, while the code may have been functional, I saw it as awkward and in need of optimization, formatting, etc. I’ve basically stopped encrypting for this reason, because it is foolish. In fact, I re-released many of my scripts in un-encrypted form a long while ago, so most of the scripts on my website are no longer encrypted. That includes the latest incarnation of Loop Select/Deselect, if anyone wants to pick apart how I handled edge detection and highlighting. Better ideas and faster routines are welcome if anyone can supply them

RH

Woohoo, loop/select/deselect is opensource. Really nice news !

Your install system is really nice too ! Can I use it for my scripts by mentioning its source, you ?

Well,… I just install it and throw an eye on you script… Update here and there the routines and now it run 200 times more faster…

I joke Bye