Community
Maya Forum
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to change the rotation order xyz to zyx ,but have the same performance?

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
yqt1364
1677 Views, 8 Replies

How to change the rotation order xyz to zyx ,but have the same performance?

i change the rotate order xyz to zyx  the bone pos changed, but the transform attributes not changed.i just want to change the rotate order  and don't change the bone performance

8 REPLIES 8
Message 2 of 9
hamsterHamster
in reply to: yqt1364

It is likely that you need to resample the data for another rotation order. In short, what comes to mind, is to use HIK and define XYZ character, then have a characterized copy of the original character with ZYX order joints and use the former as a Source, then Bake skeleton.

If you plan to export it to FBX then there are some settings within the exporter which might reinterpolate those rotations from HIK Quaternion back to Euler.

hamsterHamster_0-1634327580220.png

 


,,,_°(O__O)°_,,,
Maya2019.1 @ Windows10 & GeForce GTX1080Ti

If the post was helpful, click the
 ACCEPT SOLUTION  button, so others might find it much more easily.

Message 3 of 9
yqt1364
in reply to: yqt1364

thanks your reply; i fund a mel command [xform -p true -roo zxy;] to change the keyframe attribute; but i can't change rotate attribute in each frame.the rotate order attribute seems shared by all the bone animatin .only the select keyframe rotate changed. 

Message 4 of 9
hamsterHamster
in reply to: yqt1364

The command is the right one. I just wrote expression that runs through the timeline, unfortunately it doesn't update keyframes. I asked into Maya Programming, waiting for response.


,,,_°(O__O)°_,,,
Maya2019.1 @ Windows10 & GeForce GTX1080Ti

If the post was helpful, click the
 ACCEPT SOLUTION  button, so others might find it much more easily.

Message 5 of 9
hamsterHamster
in reply to: yqt1364

You see @yqt1364 , wonders happen.

With that great help from @mcw0 the script works.

// resamples animation from one rotation order to another
string $sel[] = `ls -sl` ;

// save current rot order for every object in selection
int $roos[] ;
$i = 0 ;
for ( $s in $sel ) {
    $roos[$i] = `getAttr ($s+".rotateOrder")` ;
    $i++ ;
}

// resample keyframes within the playback range
$start = `playbackOptions -q -min` ;
$end = `playbackOptions -q -max` ;
print("Resampling range: "+ $start +" - "+ $end +"\n") ;
$axis = { "x", "y", "z"} ;
for ( $i = $start; $i <= $end; $i++ ) {
    currentTime -e $i ; 
    for ( $j = 0; $j < size($sel); $j++ ) {
        select -r $sel[$j] ;
        setAttr ($sel[$j]+".rotateOrder") $roos[$j] ;
        xform -p true -roo zxy $sel[$j];      // HERE YOU SET DESIRED ROT ORDER
        for ($a in $axis){
            $val = `getAttr ($sel[$j] +".r"+ $a)` ;
            setKeyframe -at (".r"+ $a) -v $val ;
        }
    }
}

 See entire discussion here.

And support the idea here.


,,,_°(O__O)°_,,,
Maya2019.1 @ Windows10 & GeForce GTX1080Ti

If the post was helpful, click the
 ACCEPT SOLUTION  button, so others might find it much more easily.

Message 6 of 9
mcw0
in reply to: hamsterHamster

I don't know.  The original question was about maintaining "performance" and not "pose".  Changing the rotation order changes the performance because the interpolation between keyframes will be different.  The only solid solution is to bake the animation to the new rotation order.

Message 7 of 9
hamsterHamster
in reply to: yqt1364

My version of script does exactly that - it bakes every frame. Your example, as I understood, was a little different - it iterates through every existing keyframe.

At least, I resampled some xyz-mocaped rigs in my project and those look easier editable than before, even some gimbal locks seem to be gone, sufficient to offset just one shoulder curve to e.g. get rid of torso-arm penetration, whereas before I had to edit all three axis.


,,,_°(O__O)°_,,,
Maya2019.1 @ Windows10 & GeForce GTX1080Ti

If the post was helpful, click the
 ACCEPT SOLUTION  button, so others might find it much more easily.

Message 8 of 9
mcw0
in reply to: hamsterHamster

My bad.  I didn't look that closely.  That's what I get for sneaking stuff in while at work.  LOL!!!

Message 9 of 9
yqt1364
in reply to: hamsterHamster

thanks for your script! it's solve my problem! Cheers.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums