Author : afisher


Reply
Reply
 
Thread Tools Display Modes
bugo's Avatar
Old (#1)
Hey guys, I was wondering if I could get some help on doing a script in a way I can select all the joints on the scene and bake the simulation all in the script. I tried to grab the function in Maya but whenever I select by type it doesn't appear any commands on the expression editor.

Anyone have a guess how could I put these on a script?
Offline , dedicated polycounter, 1,466 Posts, Join Date Feb 2006, Location Redmond WA Send a message via MSN to bugo Send a message via Skype™ to bugo  
   Reply With Quote

ivars's Avatar
Old (#2)
select -r `ls -type joint`;
Offline , triangle, 478 Posts, Join Date Feb 2007, Location Sweden  
   Reply With Quote

MoP's Avatar
Old (#3)
Well, that selects all the joints, ivars, but doesn't bugo want it to bake a simulation too? Or have I misunderstood the question?
Offline , MoP, 11,603 Posts, Join Date Oct 2004, Location London, UK  
   Reply With Quote

SUNCHIRP's Avatar
Old (#4)
I didn't think baking animation worked by randomly selecting joints, I thought you had to select the hierarchy first, you would basically have to manually select the first joint you created in your chain, for instance the pelvis joint, then run your script, starting with selecting the hierarchy, then baking the animation in script : -

Mel script to select the hierarchy is small and simple : -

Code:
select -hi;
baking the animation will be a 1 line script also ( depending on your requirements, this may change ) : -

Code:
BakeSimulation;
BakeSimulation will be based on the defaults you have set up inside your EDIT > KEYS > BAKE SIMULATION options dialog, hierarchy must be selected as is, then whatever YOUR particular requirements are : -

so, in effect, the entire script would be ( manually select root bone first ) : -


Code:
select -hi;
BakeSimulation;
However, ivars is correct also, to select every bone in a scene ( multiple characters ), the command

Code:
select -r `ls -type joint`;
works perfectly, I guess you need to do a little testing, been some time since I did any animation related work.



EDIT : QUICK TEST, seems to work fine here, just tested two characters seperately animated in the same scene ( no manual preselection needed ) : -

Code:
select -r `ls -type joint`;
BakeSimulation;
based on this setup in my bake simulation options dialog : -


Last edited by SUNCHIRP; 01-05-2010 at 03:08 AM..
Offline , line, 64 Posts, Join Date Jan 2007, Location Dundee, Scotland.  
   Reply With Quote

bugo's Avatar
Old (#5)
damn, thas it, thanks a lot guys. Where did u find the BakeSimulation command?

Last edited by bugo; 01-05-2010 at 03:40 AM..
Offline , dedicated polycounter, 1,466 Posts, Join Date Feb 2006, Location Redmond WA Send a message via MSN to bugo Send a message via Skype™ to bugo  
   Reply With Quote

DerDude's Avatar
Old (#6)
When you press shift + strg and you press an command from the menu it pops out in your shelf with the current settings for the command. Then you can drop it into your script editor ;)

i use this for example mostly for exporting animations

global proc dm_bakeANI4export ()
{
// select Bones which will be baked
select -r -hierarchy |Bone_ROOT;
// bake job
doBakeSimulationArgList 3 { "1","0","10","1","0","1","1","1","0","0","animatio 4nList","0" };
// select stuff which will be deleted for export
select -r TOPCTRL;
// delete that stuff, here ya go
doDelete;
performCleanUpSceneForEverything;
select -cl ;
select -r `ls -type geometryShape`;
doDelete;

}
character animator @ crytek
Offline , spline, 201 Posts, Join Date Aug 2006, Location Germany  
   Reply With Quote

SUNCHIRP's Avatar
Old (#7)
In your script editor, switch on ECHO ALL COMMANDS, to show MAYA's script calls when you run them from a menu and so on, it's a quick and handy way to find out mel script commands easily. Once you know the command your looking for, you can then find it within the MEL Command Reference ( in the HELP files ), where you will be presented with all the options associated with that command.
Offline , line, 64 Posts, Join Date Jan 2007, Location Dundee, Scotland.  
   Reply With Quote

Reply

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Copyright 1998-2012 A. Risch