View Full Version : Applying euler filter to selected objects

10 October 2005, 06:22 PM

I am trying to find a way to run the filterCurve command in my script to an entire skeleton i have selected. I am trying to run the Euler Filter on it by using the filterCurve but it seems you have to have all the keyed channels selected before you run the command. Seems simple, but I am having a problem, I can select all the animation curves by using the selectKeyed command, however i dont' know how i can make a list of all those selections and save it to an array variable to plug it into the filterCurve command. Just having the name of the the object does not apply the filterCurve command to all the curves, you have to have all the attributes like rotateX, translateY, etc in the varable so its like: pelvis_rotateX not just pelvis.

So i'm looking for a workaround or maybe I'm not combining the right command to do this. I am using the ls command and i can select the entire hierarchy, but i need a way to find out the names of all the keyed channels in the entire selection to run the filter.

Is there an easy way? I was thining about running a loop and just grab each bone in the array and run the filter by hard coding in the extra "rotateX" or whatever but I was just wondering if anyone had a better idea or knowledge of doing this?

Thanks for your help!

10 October 2005, 07:38 PM
Well I found a little help online on someones site that just added a few extra lines and added a loop that filtered each name in the variable array, it works, but it takes a little bit of time to complete, but I am still open to any ideas on a faster result or a better way...

Thanks for your help!

11 November 2005, 06:15 PM
I'm having the same issue -- can you post that code? Have you found a better way?
Any help would be appreciated.


11 November 2005, 08:51 PM
hey, yeah I figured out something that works relatively quickly. Maya is kind of strange sometimes to do something straight forward.

I don't have the script with me right now, but on Monday when go back to work I'll post what I did and hopefully that will help.

The basic idea is to grab a list of all the objects that you want to filter using the `ls` command and then i created another array that added a ".rotateX" ".rotateY" etc, to each bone and then do another loop to run the filter on each item in that new array so its like running `filterCurve root.rotateY` so that how i did it.

I tried running just one loop for each object that ran `filterCurve root.rotateY root.rotateX etc` but it was A LOT slower than the above way. Stange...

I hope that gives you an idea like I said, I'll some code on Monday when I get back to the studio.

Good luck!

11 November 2005, 07:33 PM
Your help would be great on this -- thanks!

11 November 2005, 09:29 PM
hey, I finally had time to post it, I hope this helps. Your usage may be slighty different, but I am running the filter on joints only and i know they have keys if any on specific attributes so you may need to adjust the difference

// grab the list of all the selected joints
$hiSelection = `ls -sl -et joint`;
int $i = 0;

// run a loop for each joint in the arrray
for($obj in $hiSelection)

// get number of attributes that have keys on them
$curveKey = `selectKey $obj`;

// if there is more than 6 (trans ZXY and rotate ZXY).. filter will not work if there is no
// keys set on specific attribute given
if( $curveKey >= 6 ) {

// add the attribute to each joint so the filter knows that to run it on
// assign that name to another array
$eulerList[$i] = $obj + "_rotateX";

// same thing as above but just with the other attributes
$eulerList[$i] = $obj + "_rotateY ";
$eulerList[$i] = $obj + "_rotateZ ";

$eulerList[$i] = $obj + "_translateX ";

$eulerList[$i] = $obj + "_translateY ";

$eulerList[$i] = $obj + "_translateZ ";

// clear the selectKey because maya messes up on what joint does and does not have
// animation keys - duh!
selectKey -cl;


// now run the filter for each jointname_attribute in the new array
for($eulerObj in $eulerList) {

filterCurve $eulerObj; // runs the filter on jointname_attribute

good luck and post if you have any question. Im new to MEL so i'm limited on what i can help you with.


01 January 2006, 12:33 AM
Thanks! Your script was inspirational! Here is my take -- it should work on any animated (baked) joints in the scene:

select -all;
select -hi;
string $selected[] = `ls -sl -type joint`;
//select $selected;
select -cl;
int $i;
for ($i=0; $i<size($selected); $i=$i+1)
select -add $selected[$i];
filterCurve ($selected[$i] + ".rx") ($selected[$i] + ".ry") ($selected[$i] + ".rz");

CGTalk Moderation
01 January 2006, 12:33 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.