PDA

View Full Version : How do I create a menu in my custom UI(MaxScript)


vij
03-27-2008, 07:09 AM
How do I create a menu in my dialog

I have this:

rollout new "Give me Menu" width: 200 height:100
(
)
createDialog new


How do I get a menu in the UI?

Many thanks
vij

SoLiTuDe
03-27-2008, 11:53 AM
to get started, feel free to go the Help --> Maxscript reference.

You should look up the visual maxscript editor... should give you a great start for creating UI's.

vij
03-27-2008, 11:59 AM
Just to clear things, I asked the Q in the most basic way to keep things simple...

Can anyone point me as to how to be able to create menus in my Dialogs ?
The visual maxscript editor does not list menus...does it. Else I could have checked the generated code to form an understanding of "menu"

SoLiTuDe
03-27-2008, 12:18 PM
Ahhh... well that changes things. So when you say menu, though, what do you mean?

vij
03-27-2008, 12:21 PM
Ahhh... well that changes things. So when you say menu, though, what do you mean?

I need custom menu n menu Items in my basic UI that I posted.
In Mel we have menu and menuItem functions which seamlessly adds menu/menuItems to our custom UIs as below.
http://media3.dropshots.com/photos/361306/20080327/044058.jpg

I am looking for an equivalent maxscript function.


http://www.dropshots.com/vijay_joys#date/2008-03-27/04:40:58

antonv
03-27-2008, 03:10 PM
I am not in front of Max right now but if I remember correctly they are called Submenus. Look in the reference for submenus and RCMenu.

vij
03-28-2008, 06:24 AM
Thanks mate.
Ok, have seen some neat popup menu examples...but how do I get the real menu and menuItem sit on the bar inside my custom UI?

RustyKnight
03-28-2008, 06:41 AM
I don't think you can...

If you are running max 9+ you could try doing a complete dot net implementation...I think that would be the only way right off the top my head... :P

Shane

vij
03-28-2008, 06:45 AM
I don't think you can...

If you are running max 9+ you could try doing a complete dot net implementation...I think that would be the only way right off the top my head... :P

Shane

Can you shed more light on this or point me to some reference.
I am using Max 2008.

RustyKnight
03-28-2008, 07:32 AM
Start with:
DotNet In MAXScript
And when your done with all that, goto
http://msdn2.microsoft.com/en-us/library/ms229335(VS.80).aspx (http://msdn2.microsoft.com/en-us/library/ms229335%28VS.80%29.aspx)

You will need to create your own form and populate it with dotnet controls...

This is not a simple path to follow down and I wish you luck if this is really what you need

Shane

vij
03-28-2008, 07:41 AM
Start with:DotNet In MAXScript
And when your done with all that, goto
http://msdn2.microsoft.com/en-us/library/ms229335(VS.80).aspx (http://msdn2.microsoft.com/en-us/library/ms229335%28VS.80%29.aspx)

You will need to create your own form and populate it with dotnet controls...

This is not a simple path to follow down and I wish you luck if this is really what you need

Shane

Hmm...Thats a whole new world now.

I was fascinated by maxscript and coding in it seemed more fun compared to mel.
Well now it has hit 1 road block for me(not quite... but still...)

Thanks Rusty.

labbejason
03-28-2008, 08:24 AM
Do you mean like this?

http://img297.imageshack.us/img297/708/menuexampleou9.jpg

vij
03-28-2008, 08:29 AM
Do you mean like this?

http://img297.imageshack.us/img297/708/menuexampleou9.jpg

Oh Yes!!!
Please help

labbejason
03-28-2008, 08:41 AM
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!

CreateDialog <Rollout> [<height> <width> <position_x> <position_y>]\

[pos:<Point2>] [width:<integer>] [height:<integer>] \

[bgcolor:<color>] [fgcolor:<color>] \

[bitmap:<bitmap>] {bmpstyle:<bmpstyle> \

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

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
03-28-2008, 09:03 AM
Thanks...Got something going... Will post back if I need more help...

Examples are always welcome though :)
Thanks again
vij

mohsin
03-28-2008, 09:17 AM
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

RustyKnight
03-28-2008, 09:25 AM
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

Zbuffer
03-28-2008, 02:20 PM
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
)

labbejason
03-29-2008, 07:31 AM
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.

RustyKnight
03-30-2008, 04:25 AM
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

labbejason
04-01-2008, 08:25 AM
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!

RustyKnight
04-01-2008, 11:10 PM
Personally, unless you are hell bent on creating plugins, I'd lean towards Python to start with. It will make you far more productive in the shorter term...then when you have a hang on that look into C++...

But it depends on what you want to do

Shane

JHN
04-02-2008, 08:31 AM
Shane, I would love to see to some kind of quickstart tutorial on how to get started with python.. I know there's a lot of material out there and various python distributions.. I would love to see an overview of which packages to install where and maybe a simple example to show how to use and run py in max and for general file purposes. But an example more tailermade to a 3d/max environment would definetly get me started. I use py in motionbuilder, but that's a closed environment with py included. Syntax is not the problem, more the where and how to find the right classes and some best practices.

I don't know if you would be interested in writing such a primer... but I would be very interested, or if you know of such a primer please post it... any recommendations would be welcome... maybe post it in the offical py thread!?

Ramble ramble,
-Johan

RustyKnight
04-02-2008, 10:18 AM
Mate, if I knew python I would love to! I've been playing around with Java and max interaction, and based on some of the ideas from the Python/Max thread, I've had some good success...still only pie in the sky stuff, but have proven it can be done.

The best thing to do is to shoot over to the python/max sticky and start asking questions ;)

Check out the plugin that one of the studios (blur I think) put up, as I think it will give you greater access into phython from within maxscript, simular to the dotnet interfacing as I understand it.

But yeah, lots of packages to chose from...

Maybe we should both have a go at it and see where it takes us!!

Shane

JHN
04-02-2008, 11:07 AM
Of to the py thread then! I would love make an commitment and built some sort off document along the way, but I'm pretty busy with my dayjob and my "freetime" is also very limited these days... Maybe a cgwiki document or something... I'll put up these questions on the py thread.

Thanks,
-Johan

CGTalk Moderation
04-02-2008, 11:07 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.