cgTantra.com - LEARN INSPIRE GROW
Go Back   cgTantra Forums > Technical > Development and Programming
Development and Programming Discussions on Development of plugins, tools and utilities as well as scripts and languages

Reply
 
Submit Tools Thread Tools
Old 23-12-2010, 11:43 AM   #1
chennaiaras
Novice
 
Join Date: Dec 2010
Posts: 5
Rep Power: 0
chennaiaras is on a distinguished road
Default drop down in maya

Hi all,

I want to have a custom drop down menu in maya, Iam using the version maya2008. I tried to create my own plugin(.mll) for maya.

I did all the steps of installing mayapluginwizard in visual studio 2008 and created a project. A default file of 'mycmdcmd.cpp' is there.

But how to write my own code and build the project and get it loaded in maya. (listing in plugin manager and autoload).

Final thing i require is this :

I need to have the drop down menu 'MyMenu' and if it down there i need to have 'axmesh' command.

Please help me anyone. I am entirely new to Maya world.

regards,
aras
chennaiaras is offline   Reply With Quote
Old 02-01-2011, 08:03 PM   #2
crackerjack
Forum Leader
 
crackerjack's Avatar
 
Join Date: Jan 2009
Location: mumbai
Posts: 220
Rep Power: 5
crackerjack is on a distinguished road
Default

Hi,
If you are looking for a drop down menu with different options, you don't really need to write a plugin to get the job done.You can use even MEL(Maya Embedded Language) to create custom menus and windows.

you can create a custom menu called "MyMenu" using the following command

menu -l "MyMenu" -p MayaWindow -to true MyMenuObj ;

you can add items to the same menu by using

menuItem -l "ItemName" -c "command to execute" menuItemObj;
__________________
regards,
anoop.a.k
http://code-cg.com
http://www.linkedin.com/in/anoopak

Last edited by crackerjack; 02-01-2011 at 09:00 PM.
crackerjack is offline   Reply With Quote
Old 04-01-2011, 11:25 AM   #3
chennaiaras
Novice
 
Join Date: Dec 2010
Posts: 5
Rep Power: 0
chennaiaras is on a distinguished road
Default

Hi crackerjack,

Thanks for the reply.. Let me try this thing.

I want to have 'axmesh' under MyMenu. So, menuItemObj is 'axmesh'.

What shud i substitute for MyMenuobj.

Moreover, where shud i execute these commands.. In the scriptWindow of Maya?..

I need to have this 'Mymenu' automatically whenever i open Maya.

Please clear me these points.

regards,
aras
chennaiaras is offline   Reply With Quote
Old 04-01-2011, 03:43 PM   #4
crackerjack
Forum Leader
 
crackerjack's Avatar
 
Join Date: Jan 2009
Location: mumbai
Posts: 220
Rep Power: 5
crackerjack is on a distinguished road
Default

ofcourse you should be executing those commands in the script editor.If you want the menu to be loaded every time you run maya, then you need to save the script in MyDocuments>maya>version>scripts and also include the line
Code:
source "your script name.mel";
in the userSetup.mel in the same directory.If the script doesn't exist create one and save it in the same path

Code:
global proc myMenu()
{
global string $gMainWindow;
global string $MyMenuObj;
if (`menu -exists $MyMenuObj`)
   {
deleteUI $MyMenuObj;
}
string $name = "My Menu";
$MyMenuObj = `menu -p $gMainWindow -to true -l $name`;
menuItem -p $MyMenuObj -l "axmesh" -c ("your command ");
}
__________________
regards,
anoop.a.k
http://code-cg.com
http://www.linkedin.com/in/anoopak

Last edited by crackerjack; 04-01-2011 at 03:45 PM.
crackerjack is offline   Reply With Quote
Old 05-01-2011, 12:21 PM   #5
chennaiaras
Novice
 
Join Date: Dec 2010
Posts: 5
Rep Power: 0
chennaiaras is on a distinguished road
Default

Hi crackerjack,

I just pasted the script u have given as userSetup.mel and saved it in the scripts folder.

No results. what shud i do?.

regards,
aras
chennaiaras is offline   Reply With Quote
Old 05-01-2011, 04:21 PM   #6
crackerjack
Forum Leader
 
crackerjack's Avatar
 
Join Date: Jan 2009
Location: mumbai
Posts: 220
Rep Power: 5
crackerjack is on a distinguished road
Default

You shouldn't be pasting the script in to userSetup.mel directly.userSetup.mel will contain only the code
Code:
source "your script name";
myMenu();
The actual menu code should be saved in the same path with the "ur script name"
__________________
regards,
anoop.a.k
http://code-cg.com
http://www.linkedin.com/in/anoopak
crackerjack is offline   Reply With Quote
Reply


Thread Tools

Forum Jump

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd. | © 2009 CGTantra | Privacy Policy | All times are GMT +5.5. The time now is 12:21 AM.

Choose Your Color         Facebook              CGTantra Toolbar  Contact Us - cgTantra Home - Archive - Top