Home Technical Talk

select all joints and bake simulation maya

polycounter lvl 17
Offline / Send Message
bugo polycounter lvl 17
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?

Replies

  • ivars
    Options
    Offline / Send Message
    ivars polycounter lvl 15
    select -r `ls -type joint`;
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Well, that selects all the joints, ivars, but doesn't bugo want it to bake a simulation too? Or have I misunderstood the question?
  • SUNCHIRP
    Options
    Offline / Send Message
    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 : -
    select -hi;
    

    baking the animation will be a 1 line script also ( depending on your requirements, this may change ) : -
    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 ) : -

    select -hi;
    BakeSimulation;
    

    However, ivars is correct also, to select every bone in a scene ( multiple characters ), the command
    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 ) : -
    select -r `ls -type joint`;
    BakeSimulation;
    

    based on this setup in my bake simulation options dialog : -

    imgqr.jpg
  • bugo
    Options
    Offline / Send Message
    bugo polycounter lvl 17
    damn, thas it, thanks a lot guys. Where did u find the BakeSimulation command?
  • DerDude
    Options
    Offline / Send Message
    DerDude polycounter lvl 10
    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","animatio4nList","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;

    }
  • SUNCHIRP
    Options
    Offline / Send Message
    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.
Sign In or Register to comment.