Friday 23 August 2013

mel scripts: select all anim curves & select all keys

These wee bits of mel have proved incredibly useful recently as I've been doing some shot layout:


This selects all animCurve nodes
select -r `ls -typ animCurve`; 


This selects all keys on all animCurve nodes
selectKey`ls -typ animCurve`;

Maya convert instance to object

My street environment was created with tons of instancing - including groups containing instances which were then instanced in turn. I'm not hugely familiar with instancing but it wound up creating problems in terms of flexibility of editing objects and general bugginess so I decided to convert the instances into objects in their own right.

This, it turns out, wasn't as easy as I might have thought.

I tried various methods including the menu item modify/convert/instance to object. My problem with using this is that you seem to need to do it in the 'correct order' otherwise instances of objects just disappear.

In the end the method I used is pretty labour intensive, but it works reliably without geometry going awol.

1) group all of the objects that you want to apply the instance-to-object conversion to - including all geometry that is (or in my case, might be ;) the originals of instanced geometry

2) using the outliner "expand all" in the group (shift and left click on the + sign next to the group)

3) select all items within the group

4) run this mel script duplicate -un

5) whilst the duplicated objects are still selected group and unparent them

6) delete the original group

7) repeat the above until all instances are objects (this is the labour intensive bit!)