Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "toonz/ikskeleton.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void IKSkeleton::computeSkeleton(IKNode *node)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	for (int i = 0; i < (int)m_nodes.size(); i++) {
Toshihiro Shimizu 890ddd
		m_nodes[i]->computeS();
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void IKSkeleton::compute(void)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	IKNode *root = this->getRoot();
Toshihiro Shimizu 890ddd
	computeSkeleton(root);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void IKSkeleton::setPurpose(int nodeIndex, IKNode::Purpose purpose)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	switch (purpose) {
Toshihiro Shimizu 890ddd
	case IKNode::JOINT:
Toshihiro Shimizu 890ddd
		m_nodes[nodeIndex]->setPurpose(purpose);
Toshihiro Shimizu 890ddd
		break;
Toshihiro Shimizu 890ddd
	case IKNode::EFFECTOR:
Toshihiro Shimizu 890ddd
		if (m_nodes[nodeIndex]->getPurpose() != IKNode::EFFECTOR) {
Toshihiro Shimizu 890ddd
			m_nodes[nodeIndex]->setPurpose(purpose);
Toshihiro Shimizu 890ddd
			m_nodes[nodeIndex]->setSeqNumEffector(numEffector);
Toshihiro Shimizu 890ddd
			numEffector++;
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
		break;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//========================================================================