#include <stdlib.h>
using namespace HDK_Sample;
void
{
"hdk_iksample",
"IKSample",
1,
1
);
}
{
}
{
PRM_Name(
"straighten",
"Straighten Solution"),
};
{
};
{
mySopFlags.setManagesDataIDs(true);
}
SOP_IKSample::~SOP_IKSample()
{
}
bool
{
}
bool
SOP_IKSample::setupRestChain()
{
GA_Size num_bones = num_points - 1;
if (num_bones < 1)
{
str.
sprintf(
"%d", 2 - (
int)num_points);
return false;
}
for (
GA_Size i = 0; i < num_bones; i++)
{
prev_pos = pos;
prev_dir = dir;
}
return true;
}
{
int input_changed;
if (input_changed)
{
if (!setupRestChain())
{
float length = 0;
pscale_attrib.set(ptoff, length);
i++;
}
pscale_attrib.bumpDataId();
}
const char *solver_name = "inverse";
if (!evaluateSolverParms(context, parms))
if (!myRestChain.
solve(solver_name, &parms, solution))
{
}
{
{
}
}
{
}
xform.setTranslates(pos);
for (
GA_Index i = 0; i < num_bones; i++)
{
xform.leftMult(UT_R_FROM_F(bone.getExtraXform()));
xform.pretranslate(0, 0, -1 * prev_length);
xform.getTranslates(pos);
bone.getRotates(rot.
data());
orient_attrib.
set(ptoff, q);
prev_length = bone.getLength();
}
xform.pretranslate(0, 0, -1 * prev_length);
xform.getTranslates(pos);
}
const char *
{
return "Points for IK";
}