PDA

View Full Version : Is it possibly to have a scrupt create a object by dragging in the viewport?


Darkflame
03-18-2012, 05:32 PM
I'm guessing the answer is "yes" but I need to work with some sort of mouse listener?

I'm learning maxscript at the moment and would like to allow the user to create an object like they do with normal max tools, using the viewpoint and dragging to select the width/length/height. (think how a normal box is made)

Any pointers or links? I tried googleing without too much luck - probably bad keyword choices.

Thanks,

denisT
03-18-2012, 06:33 PM
in max script it calls Scripted Plug-in (see mxs help Scripted Plug-in Clauses)
in most cases it's a scripted Simple Object (see Scripted SimpleObject Plug-ins)
also it might be an extension of some standard class (for example helper)... there is a sample how to extend Dummy with Scripted Helper: http://forums.cgsociety.org/showpost.php?p=7053778&postcount=3

lo
03-18-2012, 07:11 PM
This is of course only necessary if you are actually looking to create your own type of object. for creating existing max objects, you can just use a tool clause in your script.

Darkflame
03-19-2012, 05:25 PM
Thanks.
The dummy example is especially helpful.

My random bookcase generator is almost done now :)

*edit*

A little follow up question:

Is it possible to automatically switch to the modifier tab for the object after its created?
(for further editing/creation options)

In my case the user is creating a box that acts as the placeholder for the bookcase, my rollout has a "Fill" pushbutton that will fill it with books and make the final object (which takes a minute or so)
However, at the moment after the user clicks away after setting the height, the copy of my rollout in the create panel wont pick up the parameters correctly. I'm not sure why this is - maybe because it isnt fully created till the user clicks away?
It does work if the object as selected and the button is pressed from the modifier tab, however. So if I can simply automaticaly move them to that tab it would be helpfull.

Thanks

spacegroo
03-20-2012, 03:42 PM
To change to the modify panel check out the help on Command Panels.

This should do what you need:
setCommandPanelTaskMode #modify

Darkflame
03-23-2012, 12:54 AM
Perfect! Thanks!

CGTalk Moderation
03-23-2012, 12:54 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.