var opcnt= 8, targetspline= "tailspline"; /* BonesToSpline (c)2000 Naam -------------------------- Fill in the number of siblings-bones of the bone object (including itself) and the name of a target spline, and this expression will magically place all said bones onto the spline (NOT it's points - the spline itself!) and stretch them accordingly. Keep in mind it's best to fix the bones AFTER applying this expression... */ main(doc,op){ var op1=op; var sop=doc->FindObject(targetspline);if (!sop) return; sop->InitLength(1); var mat,smat=sop->GetMg(),pos,pos1,i=0.0,bc,rot; while (op1) { i++; pos=smat->GetMulP(sop->GetSplinePoint(sop->UniformToNatural((i-1)/opcnt),1)); pos1=smat->GetMulP(sop->GetSplinePoint(sop->UniformToNatural((i)/opcnt),1)); mat=op1->GetUpMg(); mat->Invert(); pos=mat->GetMulP(pos); pos1=mat->GetMulP(pos1); op1->SetPosition(pos); bc=op1->GetContainer(); bc->SetData(BONEOBJECT_LENGTH,vlen(pos-pos1)); op1->SetContainer(bc); rot=VectorToHPB(pos1-pos); op1->SetRotation(rot); op1=op1->GetDown(); } }