Hi 2 all, guys! Can anybody help me decide one problem?
I want to do orientConstraint with check channel in ChannelBox: rx, ry, rz for (-lock = 0) and (-keyable = 1) and if they unlock and/or keyable, that create orientConstraint
without any flags, or not - with flags -skip x, -skip y, -skip z - depending of verification. I have one option, but it does it by removing the original animation, if any on the
keys. That is, it just does Break Connections before connectAttr. And I wouldn’t touch anim keys being able to save the animation over of the field of Time Range.
group -em -name test5;
group -name test4;
group -name test3;
group -name test2;
group -name test1;
group -em -name loc5;
group -name loc4;
group -name loc3;
group -name loc2;
group -name loc1;
select -r test1;
SelectHierarchy;
string $test[] = ls -sl;
string $testJNT[];
clear $testJNT;
select -r loc1;
SelectHierarchy;
string $loc[] = ls -sl;
string $locJNT[];
clear $locJNT;
for ($one in $test)
{
setAttr -lock true -keyable false ($one + “.tx”);
setAttr -lock true -keyable false ($one + “.ty”);
setAttr -lock true -keyable false ($one + “.tz”);
setAttr -lock true -keyable false ($one + “.sx”);
setAttr -lock true -keyable false ($one + “.sy”);
setAttr -lock true -keyable false ($one + “.sz”);
setAttr -lock true -keyable false ($one + “.v”);
$testJNT[size($testJNT)] = $one;
}
for ($one in $loc)
{
setAttr -lock true -keyable false ($one + “.tx”);
setAttr -lock true -keyable false ($one + “.ty”);
setAttr -lock true -keyable false ($one + “.tz”);
setAttr -lock true -keyable false ($one + “.sx”);
setAttr -lock true -keyable false ($one + “.sy”);
setAttr -lock true -keyable false ($one + “.sz”);
setAttr -lock true -keyable false ($one + “.v”);
$locJNT[size($locJNT)] = $one;
}
int $index = 0;
for ($index = 0; $index < size($testJNT); $index++)
{
string $orientConstraint[] = orientConstraint -mo -sk x -sk y -sk z -weight 1 $locJNT[$index] $testJNT[$index];
string $o = $orientConstraint[0];
string $p = $pointConstraint[0];
string $i = $testJNT[$index];
string $rx = ($i + “.rx”);
string $ry = ($i + “.ry”);
string $rz = ($i + “.rz”);
string $tx = ($i + “.tx”);
string $ty = ($i + “.ty”);
string $tz = ($i + “.tz”);
string $oRx = ($o + “.constraintRotateX”);
string $oRy = ($o + “.constraintRotateY”);
string $oRz = ($o + “.constraintRotateZ”);
string $pTx = ($p + “.constraintTranslateX”);
string $pTy = ($p + “.constraintTranslateY”);
string $pTz = ($p + “.constraintTranslateZ”);
int $isLockRx = `getAttr -lock $rx`;
int $isHideRx = `getAttr -keyable $rx`;
int $isLockRy = `getAttr -lock $ry`;
int $isHideRy = `getAttr -keyable $ry`;
int $isLockRz = `getAttr -lock $rz`;
int $isHideRz = `getAttr -keyable $rz`;
int $isLockTx = `getAttr -lock $tx`;
int $isHideTx = `getAttr -keyable $tx`;
int $isLockTy = `getAttr -lock $ty`;
int $isHideTy = `getAttr -keyable $ty`;
int $isLockTz = `getAttr -lock $tz`;
int $isHideTz = `getAttr -keyable $tz`;
if ($isLockRx==0 && $isHideRx==1 )
{
connectAttr -f $oRx $rx;
}
if ($isLockRy==0 && $isHideRy==1 )
{
connectAttr -f $oRy $ry;
}
if ($isLockRz==0 && $isHideRz==1 )
{
connectAttr -f $oRz $rz;
}
if ($isLockTx==0 && $isHideTx==1 )
{
connectAttr -f $pTx $tx;
}
if ($isLockTy==0 && $isHideTy==1 )
{
connectAttr -f $pTy $ty;
}
if ($isLockTz==0 && $isHideTz==1 )
{
connectAttr -f $pTz $tz;
}
}