Интересно, что, воспользовавшись скриптом djBuildPoleVector, всё выходит и значения ротейт остаются "нулевыми"...
Но, блин, хочется понять самому причину... без автоматики, без скриптов... Уловить суть "что делаю не так?"
Понять "что делает скрипт такого, что не делаю я" для меня трудно, т.к. в мэл языке я пока туг...
Вот сам скрипт:
// djBuildPoleVector.mel
//
// author: David Johnson
// contact: david@djx.com.au
// website: http://www.djx.com.au
// last rev: Friday, 15 June 2007
// version: 1.0
//
// ©2007 David Johnson
//
// ||||||||||||||||||||||||||||||| (written by Nils Lerin - nils.lerin@gmail.com)
// || Requires nilsNoFlipIK.mel || (available from http://www.highend3d.com)
// ||||||||||||||||||||||||||||||| (direct link http://www.highend3d.com/maya/downloads/mel_scripts/character/nilsNoFlipIK-4595.html)
//
// Add your own control object as a poleVector constraint and maintain the joint orientation.
//
// There already a few scripts around that place a poleVector constraint
// so that the poleVector does not move, but I couldnt find one that let
// me place the controller where I wanted and still keep the original joint orientation.
//
// Nils Lerin's nilsNoFlipIK.mel script calculates the ikHandle twist
// that is needed to maintain orientation for a specified pole vector.
// djBuildPoleVector.mel uses this twist value to compensate for the poleVector change.
//
// Installation:
// Copy djBuildPoleVector.mel and nilsNoFlipIK.mel to your scripts folder
// Source them both (or restart maya)
//
// Directions:
// Select the control object
// Shift-select the ikHandle
// run this script by typing djBuildPoleVector (or make a shelf button)
//
//--------------------------------------------------------------------------------------------
source nilsNoFlipIK.mel;
global proc djBuildPoleVector() {
// Ensure that nilsNoFlipIKProc exists
//
if(!`exists "nilsNoFlipIKProc"`) {
error("nilsNoFlipIK.mel maybe missing. Check that nilsNoFlipIK.mel is in your scripts folder.");
return;
}
string $sel[] = `ls -sl`;
// Validate selection
if(size($sel)!=2) {
warning("Invalid selection. Select one control object and shift-select one ikHandle.");
return;
}
// Sort out the control object and the ikHandle
// (allow the user to select in either order)
//
int $indexIK;
int $indexC;
if(`nodeType $sel[1]` == "ikHandle") {
if(`nodeType $sel[0]` == "ikHandle") {
warning("Invalid selection. Both objects are ikHandles.");
return;
}
else {
$indexIK = 1;
$indexC = 0;
}
}
else {
if(`nodeType $sel[0]` == "ikHandle") {
$indexIK = 0;
$indexC = 1;
}
else {
warning("Invalid selection. You must select one object and one ikHandle.");
return;
}
}
// Make sure ikHandle twist attribute is unlocked
//
int $twistLock = `getAttr -lock ($sel[$indexIK]+".twist")`;
if($twistLock) {
warning($sel[$indexIK]+".twist is locked. Unlock before trying again.");
return;
}
// store the original pole vector
// create a temporary pole vector constraint
// store the resulting pole vector
// remove the temporary pole vector constraint
// restore the original pole vector
//
float $pvOrig[] = `getAttr ($sel[$indexIK]+".poleVector")`;
poleVectorConstraint -weight 1 $sel[$indexC] $sel[$indexIK];
float $pvNew[] = `getAttr ($sel[$indexIK]+".poleVector")`;
poleVectorConstraint -weight 1 -rm $sel[$indexC] $sel[$indexIK];
setAttr ($sel[$indexIK]+".poleVector") -type "double3" $pvOrig[0] $pvOrig[1] $pvOrig[2];
// compute the twist value
//
float $pvTwist = `nilsNoFlipIKProc $pvNew[0] $pvNew[1] $pvNew[2] $sel[$indexIK]`;
// create the pole vector constraint
// apply the twist to restore original orientation
// lock the twist attribute
//
poleVectorConstraint -weight 1 $sel[$indexC] $sel[$indexIK];
setAttr ($sel[$indexIK]+".twist") $pvTwist;
setAttr -lock true ($sel[$indexIK]+".twist");
// helpful information (maybe)
//
print("djBuildPoleVector info...\n");
print(" old pole vector: "+$pvOrig[0]+", "+$pvOrig[1]+", "+$pvOrig[2]+"\n");
print(" new pole vector: "+$pvNew[0]+", "+$pvNew[1]+", "+$pvNew[2]+"\n");
print(" twist locked at: "+$pvTwist+"\n");
print("\n");
print("djBuildPoleVector done. (See script editor for details)");
}
//--------------------------------------------------------------------------------------------