Toggle between 2 mel files - Script Help!

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

 
Thread Tools Display Modes
  06 June 2018
Toggle between 2 mel files - Script Help!

hi,

I am trying to come up with a script that could switch between 2 mel files just as the title says, I don't know code so if someone could help I would be appreciated.

more in depth.

the mel files consist in 2 MM that i would like them to switch when a poly object is selected or a curve is selected but maybe this way it gets more complicated so i was thinking maybe i could simplify by creating a script just to toggle between them when needed.
 
  06 June 2018
Hi
You could use:
1. Script job to automatically execute the MEL according to object selected (poly/curve).
2. Check the selection if its poly/curve and switch to the corresponding block of code to be executed accordingly using "if then else loop".
Regards
__________________
Prem
Download Vehicle Rig
Blog
 
  06 June 2018
thank you shinyprem for taking the time to reply,
gonna do my best and will reply later.
 
  06 June 2018
Still, a long way but I am not sure if I'm on the right track here ,
i used SelectionChanged not sure if its the right one if I can tell later that in the case is still in polys that it's not needed its probably the right one.

I was trying to test it but it's giving me a problem ""$selection" is an undeclared variable", not sure what is missing.


{int $jobNum = `scriptJob -killWithScene -e "SelectionChanged" "MMLoaded"`;
}
global proc MMLoaded()
{
string $selection[] = `ls -type mesh`;
}
if ($selection == 1)
print ("Poly object selected!");
else{
print ("Not a poly!")
}
 
  06 June 2018
Hi,
It could be something like this.

int $jobNum = `scriptJob -e "SelectionChanged" "MMLoaded"`;
global proc MMLoaded()
{
string $selections[] = `ls -sl`;
string $shape[] = `pickWalk -d down`;
int$check = `objectType -isType "mesh" $shape[0]`;
if ($check == 1)
  print ("Poly object selected!");
else
  print ("Not a poly!");
}
__________________
Prem
Download Vehicle Rig
Blog

Last edited by shinyprem : 06 June 2018 at 05:16 PM.
 
  06 June 2018
yes, now works, nothing like I had :(.

still, this won't work well if give's the message every time I select something from the same category/type.
I think that's what's the event "SelectionChanged" is for, isn't there any other event more qualified for the task? or i can, later on, define to only show the message if I change from mesh to nurbsCurve?.

I think that might be possible so i will check on that, to only display if there is a change in selection type.

thanks for helping shinyprem .
 
  06 June 2018
hi, shinyprem found another way of doing it and a lot easier for me still I did enjoy it, trying to do something from the start.
I think I should try some Mel/phyton classes in the future .

thanks a lot for your attention and see you around.
 
  06 June 2018
Hi
Sure I will be arround. I am also a learner, this is a way to learn.
Regards
__________________
Prem
Download Vehicle Rig
Blog
 
reply share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 11:35 AM.


Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.