PDA

View Full Version : Help on a very basic MaxScript command


Hooch
10-29-2006, 11:05 PM
I'm just learning how to do stuff with maxScript,
so far I have been able to do a very basic rollout
here's the code:

rollout myRollout "Polygons" width:184 height:544
(

button btn1 "Box" pos:[8,16] width:160 height:38


on btn1 pressed do
(

box ()



)
)
myFloater = newrolloutfloater "Tools" 200 600

addrollout myRollout myFloater


it's working fine, but I want to be able to dock this window or rollout to the max UI.
but I can't find the missing command.

I hope some of you guys know the solution for this.

Thanks anyway for taken the time to read this post. :)

Hooch.

ypuech
10-29-2006, 11:49 PM
Hi Hooch,

You can use macroscripts in order to be able to connect a menu or a toolbar with your script.

macroScript Tools category:"hooch"
(
rollout myRollout "Polygons" width:184 height:544
(
button btn1 "Box" pos:[8,16] width:160 height:38

on btn1 pressed do
(
box ()
)
)

myFloater = newrolloutfloater "Tools" 200 600
addrollout myRollout myFloater
)

Save this code as a ".mcr" file and run it.

After, in order to assign this script to a menu or toolbar you need to go to Customize User Interface dialog. Choose "Toolbars" or "Menus" tab page, select "Hooch" in "Category" list, drag the "Tools" label in "Action" window and drop it to a toolbar in the UI or a menu in the tree view.

To know more about using macroscripts please refer to "Defining MacroScripts" section in MAXScript Reference.

Hooch
10-30-2006, 01:06 AM
ypuech: thanks for your reply, but that's not what I meant,

What I need is to be able to dock this menu as it is in the right side of the max UI

Bobo
10-30-2006, 04:40 AM
(
global myRollout
try(cui.UnRegisterDialogBar myRollout)catch()
try(destroyDialog myRollout)catch()
rollout myRollout "Polygons" width:184 height:544
(
button btn1 "Box" pos:[8,16] width:160 height:38
on btn1 pressed do
(
box ()
)
)
createDialog myRollout
cui.RegisterDialogBar myRollout style:#(#cui_dock_right, #cui_dock_left, #cui_floatable)
cui.DockDialogBar myRollout #cui_dock_right
)



It is a good idea to give the dialog a longer, unique name.
Also, only dialogs can be docked, not floaters. If you need multiple rollouts in your UI, use sub-rollouts...

Hooch
10-30-2006, 05:43 AM
thanks a lot Bobo!
Some how I knew you where gonna answer this one. :thumbsup:

ypuech
10-30-2006, 08:24 AM
Thanks Bobo for the answer. I did not know that it was possible to do that.

CGTalk Moderation
10-30-2006, 08:24 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.