View Single Post
# 1 10-04-2017 , 05:26 PM
Skalman's Avatar
Registered User
Join Date: Apr 2012
Posts: 293

MEL line SelectToggleMode; not working

So I made a MEL-script, and when I made the script everything worked fine. When I later on switched to another maya scene (after saving the script), and I ran the script on a model, I noticed that it was in vertex-mode (it should end in object-mode), and did some spooky things to the model that it wasnt supposed to do.. I looked at what was going on and basicly every time i had the line "SelectToggleMode;", it'd ignore it (the line works if i run it separately). No wonder it made a mess. So now I've saved out a few diffrent parts of the script, so i'll do the SelectToggleMode; manually, and continue on with the script until it encounters another SelectToggleMode;. Which is annoying. I'd like it to work, but I really have no idea why this particilar line wouldn't work for me. Its kind of annoying. Do any of you know a sulotion to this? A line that does the same function maybe? I dont really have time to investigate more on this, since im going to use this script on all my models for the project im in (the script creates 1 group with a high-poly version, a cage-version and the original model, aswell as another group with the exploded high-poly&cage&LP). Itd be easier to get the script working in 1 click instead of having to go through 6 clicks every time i want to do this operation




You can try it out yourself if you want. Just select an object and run the script

Code:
//1st in group = Low-poly
//2nd in group = High-poly
//3rd in group = Cage

Group;
PickWalkDown;
duplicate -rr;
duplicate -rr;
PolySelectConvert 3;
TransformAlongNormal;
setAttr "polyMoveVertex2.localTranslate" -type double3 0 0 60.975944 ;
SelectToggleMode;
PickWalkLeft;
polySmooth  -mth 0 -sdt 0 -ovb 2 -ofb 0 -ofc 0 -ost 1 -ocr 0 -dv 1 -bnr 0 -c 1 -kb 1 -ksb 1 -khe 1 -kt 1 -kmb 2 -suv 1 -peh 0 -sl 1 -dpe 1 -ps 0.1 -ro 1 -ch 1;
CompleteCurrentTool;
SelectToggleMode;
toggleSelMode;
HideManipulators;
PickWalkUp;
PickWalkDown;
rename Lowpoly;
PickWalkRight;
rename Highpoly;
PickWalkRight;
rename Cage;
PickWalkUp;
PickWalkDown;



Duplicate -rr;
Group;
PickWalkDown;
//NEW GROUP (EXPLODE-GROUP)

SeparatePolygon;

PickWalkUp;
PickWalkDown;
move -r 0 0 -10000 ;
PickWalkRight;
move -r 0 0 -20000 ;
PickWalkRight;
move -r 0 0 -30000 ;
PickWalkRight;
move -r 0 0 -40000 ;
PickWalkRight;
move -r 0 0 -50000 ;
PickWalkRight;
move -r 0 0 -60000 ;
PickWalkRight;
move -r 0 0 -70000 ;
PickWalkRight;
move -r 0 0 -80000 ;
PickWalkRight;
move -r 0 0 -90000 ;
PickWalkRight;
move -r 0 0 -100000 ;
PickWalkRight;
move -r 0 0 -110000 ;
PickWalkRight;
move -r 0 0 -120000 ;
PickWalkRight;
move -r 0 0 -130000 ;
PickWalkRight;
move -r 0 0 -140000 ;
PickWalkRight;
move -r 0 0 -150000 ;
PickWalkRight;
move -r 0 0 -160000 ;
PickWalkRight;
move -r 0 0 -170000 ;
PickWalkRight;
move -r 0 0 -180000 ;
PickWalkRight;
move -r 0 0 -190000 ;
PickWalkRight;
move -r 0 0 -20000 ;
//EXPLODING MESH     


PickWalkUp;
CombinePolygons;
DeleteHistory;
delete -ch;
CompleteCurrentTool;


//Create Exploded cage + HP (copy-pasted)
Group;
PickWalkDown;
duplicate -rr;
duplicate -rr;
PolySelectConvert 3;
TransformAlongNormal;
setAttr "polyMoveVertex2.localTranslate" -type double3 0 0 60.975944 ;
SelectToggleMode;
PickWalkLeft;
polySmooth  -mth 0 -sdt 0 -ovb 2 -ofb 0 -ofc 0 -ost 1 -ocr 0 -dv 1 -bnr 0 -c 1 -kb 1 -ksb 1 -khe 1 -kt 1 -kmb 2 -suv 1 -peh 0 -sl 1 -dpe 1 -ps 0.1 -ro 1 -ch 1;
CompleteCurrentTool;
SelectToggleMode;
toggleSelMode;
HideManipulators;
PickWalkUp;
PickWalkDown;
rename ExplodedLowpoly;
PickWalkRight;
rename ExplodedHighpoly;
PickWalkRight;
rename ExplodedCage;
PickWalkUp;
PickWalkDown;
//Create Exploded cage + HP (copy-pasted)

PickWalkUp;
rename EXPLODED;
PickWalkLeft;
rename NOTEXPLODED;
select -r EXPLODED ;
select -add NOTEXPLODED ;
Group;
rename ModelReadyForExport


20 year old guy from Sweden



Big Bob Marley fan
Love skateboarding
Maya, Mudbox and Photoshop user

Full name: Marcus Ralman


https://www.facebook.com/MarcusRalman3D

^ My facebook page ^

Last edited by Skalman; 10-04-2017 at 05:31 PM.