View Full Version : Use Maya to Do the Poly Modeling Like 3dsMax Do
A little tricky mel to advance Maya Poly Modeling.
Use Maya to do the Poly Modeling like 3dsMax do.
//MaxLikeSelectMode-MLSM
//MaxLikeSelectMode.mel
//Author:yuyujohn
//yuyujohn@hotmail.com (http:////yuyujohn@hotmail.com)
//ver 1.0.053005
//Usage:Source the mel and do the poly modeling as you did before.
//This mel can keep the selection before you change the selection mode.
//But just use the RMB to do your work and it can only work on poly meshs.
//The mel make you to _Use Maya to Do the Poly Modeling like 3dsMax Do_
global string $MLSMvertex[]={};
global string $MLSMedge[]={};
global string $MLSMface[]={};
global string $MLSMUV[]={};
global int $MLSMseleMark=0;
scriptJob -event "SelectionChanged" "MaxLikeSC";
scriptJob -event "SelectTypeChanged" "MaxLikeSTC";
//Store the selections
global proc MaxLikeSC()
{
global string $MLSMvertex[];
global string $MLSMedge[];
global string $MLSMface[];
global string $MLSMUV[];
global int $MLSMseleMark;
//When the previous mode is NOT the object mode,change the saves
if ($MLSMseleMark!=0)
{
$MLSMseleMark=`MLSMmaskCase`;
$maskSele=`ls -sl`;
switch ($MLSMseleMark)
{
case 0:
break;
case 1:
$MLSMvertex=$maskSele;
break;
case 2:
$MLSMedge=$maskSele;
break;
case 3:
$MLSMface=$maskSele;
break;
case 4:
$MLSMUV=$maskSele;
break;
}
}
}
//Restore the selections
global proc MaxLikeSTC()
{
global string $MLSMvertex[];
global string $MLSMedge[];
global string $MLSMface[];
global string $MLSMUV[];
global int $MLSMseleMark;
$MLSMseleMark=`MLSMmaskCase`;
switch ($MLSMseleMark)
{
case 0:
break;
case 1:
select -r $MLSMvertex;
break;
case 2:
select -r $MLSMedge;
break;
case 3:
select -r $MLSMface;
break;
case 4:
select -r $MLSMUV;
break;
}
}
//Get the selection-mask mode
global proc int MLSMmaskCase()
{
if (`selectType -q -ocm -v`) return 1;
if (`selectType -q -ocm -eg`) return 2;
if (`selectType -q -ocm -fc`) return 3;
if (`selectType -q -ocm -puv`) return 4;
else return 0;
}
|
|
Iconoklast
05-31-2005, 05:28 PM
Hey, this works quite well. I've been meaning to code something like this myself, but I guess you took care of that for me :) Works nice. This won't happen to slow down selection changes on dense meshes, will it? And another thing, you might want to be able to turn it on or off.
I don't think it will slow down more when you are doing your work on dense meshes.For I just use 4 global variables in this MEL and the mel just do a few command during your working.And thank you for your advice.So I do some quick change in my code,then you can turn on/off just by the command do_MLSM 1/0.
//MaxLikeSelectMode-MLSM
//MaxLikeSelectMode.mel
//Author:yuyujohn
//yuyujohn@hotmail.com ("")
//ver 1.0.060105
//Usage:Source the mel,run the do_MLSM 0/1 to turn on/off the function and do the poly modeling as you did before.
//This mel can keep the selection before you change the selection mode.
//But just use the RMB to do your work and it can only work on poly meshs.
//The mel make you to _Use Maya to Do the Poly Modeling like 3dsMax Do_
global string $MLSMvertex[]={};
global string $MLSMedge[]={};
global string $MLSMface[]={};
global string $MLSMUV[]={};
global int $MLSMseleMark=0;
global int $MLSMJob1;
global int $MLSMJob2;
//Store the selections
global proc MaxLikeSC()
{
global string $MLSMvertex[];
global string $MLSMedge[];
global string $MLSMface[];
global string $MLSMUV[];
global int $MLSMseleMark;
//When the previous mode is NOT the object mode,change the saves
if ($MLSMseleMark!=0)
{
$MLSMseleMark=`MLSMmaskCase`;
$maskSele=`ls -sl`;
switch ($MLSMseleMark)
{
case 0:
break;
case 1:
$MLSMvertex=$maskSele;
break;
case 2:
$MLSMedge=$maskSele;
break;
case 3:
$MLSMface=$maskSele;
break;
case 4:
$MLSMUV=$maskSele;
break;
}
}
}
//Restore the selections
global proc MaxLikeSTC()
{
global string $MLSMvertex[];
global string $MLSMedge[];
global string $MLSMface[];
global string $MLSMUV[];
global int $MLSMseleMark;
$MLSMseleMark=`MLSMmaskCase`;
switch ($MLSMseleMark)
{
case 0:
break;
case 1:
select -r $MLSMvertex;
break;
case 2:
select -r $MLSMedge;
break;
case 3:
select -r $MLSMface;
break;
case 4:
select -r $MLSMUV;
break;
}
}
//Get the selection-mask mode
global proc int MLSMmaskCase()
{
if (`selectType -q -ocm -v`) return 1;
if (`selectType -q -ocm -eg`) return 2;
if (`selectType -q -ocm -fc`) return 3;
if (`selectType -q -ocm -puv`) return 4;
else return 0;
}
//Turn on/off the job
global proc do_MLSM(int $MLSMoff)
{
global int $MLSMJob1;
global int $MLSMJob2;
global string $MLSMvertex[];
global string $MLSMedge[];
global string $MLSMface[];
global string $MLSMUV[];
global int $MLSMseleMark;
if ($MLSMoff==0)
{
scriptJob -k $MLSMJob1;
scriptJob -k $MLSMJob2;
clear $MLSMvertex;
clear $MLSMedge;
clear $MLSMface;
clear $MLSMUV;
}
else
{
$MLSMseleMark=`MLSMmaskCase`;
$MLSMJob1=`scriptJob -event "SelectionChanged" "MaxLikeSC"`;
$MLSMJob2=`scriptJob -event "SelectTypeChanged" "MaxLikeSTC"`;
}
}
Haider of Sweden
05-31-2005, 08:04 PM
This is so great, I have been thinking of this a couple of time, and being remind of this feature every time I work with 3dsmax.
All the time, I had to use a QuickSelSet script, just to remember the old selection :)
BUT, cant you make it work with the F-keys?
Iconoklast
06-01-2005, 02:48 AM
It should work with the F keys, but using the F keys clears your selection. What you'll have to do is change the F keys to work the same, but without clearing the selection (it has select -cl; at the end of the code )
The code was based on the the change between selection types.That is if you can change the selection type,it will work.So Use as you like with other keys,but make the selection type change.(A little bug:You can only do the type change in the object mode,the mel can't support the compnent mode.I'll try to kick it out.)
de_tomato
06-01-2005, 02:02 PM
Im really a noob here.. what it actually do? Any tut to show how it work?
OK,I wrote a little Help.Shown blow
http://www.cgtalk.com/attachment.php?attachmentid=72177&stc=1
http://www.cgtalk.com/attachment.php?attachmentid=72181&stc=1
de_tomato
06-02-2005, 04:41 AM
Oh.. thanks for the explanation..
Will try it on later, best of luck with yr next release.
Haider of Sweden
06-02-2005, 08:34 AM
Here are some tips
1. You should change the .. what is it called, global procedure? So that when you type the filename.mel, the option get started
2. it should work like a toggle, so that you wont need 0/1, but instead run it like above, just type the name
3. Oh, put in a print("MaxLikeSelectMode: " + *status*") where the status is on or off
Thanx!
When the type changes, it will call the global procedure definded in the mel.
And I just think about the toggle.I think it not so clear when turn on/off the function, so I just make 0/1 to represent the on/off.And maybe some one like the toggle style,you can make a Hotkey or a shelf button by the mel shown below.It'll do the work.
int $MLSMturns;
if ($MLSMturns==1)
{
$MLSMturns=0;do_MLSM 0;
print "MLSM is now OFF";
}
else {$MLSMturns=1;do_MLSM 1;print "MLSM is now ON";}
Haider of Sweden
06-02-2005, 09:03 AM
DuJ; this requires that I have the code sourced, right?
About sourcing, i dont know if this even takes much memory. I use to put lots of MELs in the userSetup.
1) Does it take any noticable amount mem (sourcing a lot of scripts)?
2) What if I add "source MaxLikeSelectMode.mel" first, in that shelv, before that code you mentioned lastly. I will work, or have you any comments?
1)I don't think it will take much memory.But I don't know it really takes.
2)If you add "source MaxLikeSelectMode.mel" first, you will source the mel again and again when you turn on/off the function.So If you source it twice, it'll double the work.Maybe you can get the same result as you source the mel once, but it is really a waste of computer resouce.That's what I think.
Haider of Sweden
06-02-2005, 10:24 AM
okidoki, then I will source it once.
Thats why I first suggested to make it work without sourcing, and as a toggle.
Some script do it that way, others require sourcing like this one.
CGTalk Moderation
06-02-2005, 10: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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.