Notifications
Clear all

[Closed] How do I create a menu in my custom UI(MaxScript)

Do you mean like this?

 vij

Oh Yes!!!
Please help

I didn’t have to use DotNet for this. Maybe I’ll whip up an example for you tomorrow whenever I find the time (pretty late right now).

As for now, check out RCmenus and createDialog in the MAXscript reference. Notice ‘menu’ below!

[left]CreateDialog <Rollout> [<height> <width> <position_x> <position_y>][/left]

[left][pos:<Point2>] [width:<integer>] [height:<integer>] [/left]

[left][bgcolor:<color>] [fgcolor:<color>] [/left]

[left][bitmap:<bitmap>] {bmpstyle:<bmpstyle> [/left]

[left][menu:<RCMenu>] [style:<array>] [modal:<boolean>] \ [escapeEnable:<boolean>] [lockHeight:<boolean>] [lockWidth: <boolean>][/left]

I definitly need to start checking out more dotNet though, Shane! I’ve only scratched the surface of it, and I can already see the crazy stuff it’s capable of doing.

 vij

Thanks…Got something going… Will post back if I need more help…

Examples are always welcome though
Thanks again
vij

macroscript myMacro category:“MenuExample”
(
rcMenu myMenu
(
subMenu “File”
(
menuItem New_File “New”
menuItem Open_File “Open”
)
)
on New_File picked do
(
–enter the event here
)
rollout new_rollout “New Rollout”
(
)
createdialog new_rollout width:200 height:200 menu:myMenu
)

Now assign a key to Customize–>Customize User Interface–>Category=MenuExample –> myMacro and you get a dialog with a menu

labbejason, I was sure it couldn’t be done, so nice to be proven wrong!

I was also thinking that you might be able to straddle a dotnet menu bar across the top of the form…but this works so much better…

Shane

Hi,
Here is an example:

 (
 try(destroyDialog test_Rol) catch()
 global test_Rol
 
 RCmenu TopMenu
 (
  subMenu "File"
  (
   menuItem m1_1 "Open..."
   menuItem m1_2 "Save"
   separator sep1
   menuItem m1_3 "Exit"
  )
  
  subMenu "Edit"
  (
   menuItem m2_1 "Copy"
   menuItem m2_2 "Cut"
   menuItem m2_3 "Paste"
  )
  
  on m1_1 picked do ()
  on m1_2 picked do ()
  on m1_3 picked do (destroyDialog test_Rol)
  on m2_1 picked do ()
  on m2_2 picked do ()
  on m2_3 picked do ()
 )
 
 rollout test_Rol "Menu Test"
 (
  button b1 "Button 1"
 )
 
 createdialog test_Rol menu:TopMenu
)

Glad to see it’s working out for you.

I would imagine you get alot more flexibility with dotNet, no? The problem with me and dotNet is that I never know when I should use it. MAXscript’s given me all the control I wanted so far or I always find work arounds, so there wasn’t much reason to dig further. I’m actually thinking of just learning a third party language instead. Do you think C++ would be better over Python, Shane? I guess it really depends what I want to use it for.

It really depends on your needs are and what you want to achieve. I think C++ is a great language, but it does carry a lot of baggage from C which can give you a lot of head aches, but as a low level language it carries a lot of power.

The problem here is with plugins. Each plugin is written (or more precisily, compiled) for a specific version of max, which can be a real pain if you are working in a studio running mutiple verions and builds of max.

Something like .net (this includes c++) has the benifit of (in our case) been compiled once and deployed…but that adds an additional library file that needs to copied…deploying max scripts is fun enough as is ;), but brings with it the power of .net (lots of UI, SQL, file handerling, date and time, XML and a whole bunch of other stuff)

Python is also a great language and has a lot of 3rd party plugins and libaries, which can be a real headache when you first start learning a lanuage. I hate read tutorials where the first page is telling you what you need to download and install in order to get this to work…on top of the core package…to not really do anything special…but that’s just me.

Ok, lots of talk but what is the correct choice? If you’ve only every dabbled in maxscript, I’d strongly encourage you to look at python. It is just simpler to learn then say something like C++ (or even C#…just) and has a wealth of support not only here but in other programs, maya and deadline (v3, remoured) come to mind as well as a host of others. I tend to get the feeling a lot more applications will be moving to it for their scripting support in time as the industry sways in that direction.

It also supports OO, but is not a pure OO language (like java) which can help the transision…although, personally, I prefer a OO language, but that’s just me.

I really think you need to take a look at what type of work you are doing right now and what type of work you intend to be doing in the future. If you simply want to “improve” the functionality of your scripts in max, I’d suggest comming to grips with dotnet as it stands in maxscript and get use to using it, is simply a great means to expand the scripting langauge without needing to actually do any work.

If you want to extend the functionality of max, but maxscript does not provide enough adequte support for what you want to do, then C++ is really you’r own choice for the time been, as this is what the plugin architecture is written in (and support is given for).

If you want to expand you applications functionality, then things like dotnet and python should be on the top of your list, depending on how you want to do it. While I know you can download a Python plugin for max, python is still restricted to a basic COM model, which restricts the type of data you can send between the applications (note: I’ve not used the python plugin so I am probably wrong on this part)…

Dotnet support currently is stronger as it was built into the applicaiton and has native maxscript support (I’m sure the python plugin does to…but that’s off topic) and can easily be extended to included custom assemblies if you want.

Still a lot of talk…Short list

  1. Python – easier to learn, quicker up-time
  2. C# – Easy to learn, maybe not as quick up-time
  3. C++ – Harder to learn, more power and grunt

I hope that makes some kind of sense and helps a little. You really need to decided what is going to serve you the best not only in the short term, but the long term as well. The worst position you can get your self into is – “I can do this in X, but it’s going to take some work and require some hacks”…better to say “I’d like to do it in X, but Y can do it better”

Shane

Oh boy, you put me in a real pickle! It’s either Python or C++, but I’m leaning towards Python. I got a lot of digging around ahead of me. Thanks Shane!

Page 2 / 3