Blender V2.61 - r43446
Classes | Defines | Typedefs | Enumerations | Functions | Variables

itasc_plugin.cpp File Reference

#include <stdlib.h>
#include <string.h>
#include <vector>
#include "MEM_guardedalloc.h"
#include "BIK_api.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BKE_global.h"
#include "BKE_armature.h"
#include "BKE_action.h"
#include "BKE_utildefines.h"
#include "BKE_constraint.h"
#include "DNA_object_types.h"
#include "DNA_action_types.h"
#include "DNA_constraint_types.h"
#include "DNA_armature_types.h"
#include "DNA_scene_types.h"
#include "itasc_plugin.h"

Go to the source code of this file.

Classes

struct  IK_Data
struct  IK_Target
struct  IK_Channel
struct  IK_Scene

Defines

#define ANIM_TIMESTEP   1.0
#define ANIM_FEEDBACK   0.8
#define ANIM_QMAX   0.52

Typedefs

typedef float Vector3 [3]
typedef float Vector4 [4]
typedef void(* ErrorCallback )(const iTaSC::ConstraintValues *values, unsigned int nvalues, IK_Target *iktarget)

Enumerations

enum  IK_SegmentFlag {
  IK_XDOF = 1, IK_YDOF = 2, IK_ZDOF = 4, IK_SWING = 8,
  IK_REVOLUTE = 16, IK_TRANSY = 32, IK_XDOF = 1, IK_YDOF = 2,
  IK_ZDOF = 4, IK_TRANS_XDOF = 8, IK_TRANS_YDOF = 16, IK_TRANS_ZDOF = 32
}
enum  IK_SegmentAxis {
  IK_X = 0, IK_Y = 1, IK_Z = 2, IK_TRANS_X = 3,
  IK_TRANS_Y = 4, IK_TRANS_Z = 5, IK_X = 0, IK_Y = 1,
  IK_Z = 2, IK_TRANS_X = 3, IK_TRANS_Y = 4, IK_TRANS_Z = 5
}

Functions

static int initialize_chain (Object *ob, bPoseChannel *pchan_tip, bConstraint *con)
static bool is_cartesian_constraint (bConstraint *con)
static bool constraint_valid (bConstraint *con)
int initialize_scene (Object *ob, bPoseChannel *pchan_tip)
static IK_Dataget_ikdata (bPose *pose)
static double EulerAngleFromMatrix (const KDL::Rotation &R, int axis)
static double ComputeTwist (const KDL::Rotation &R)
static void RemoveEulerAngleFromMatrix (KDL::Rotation &R, double angle, int axis)
static void GetJointRotation (KDL::Rotation &boneRot, int type, double *rot)
static bool target_callback (const iTaSC::Timestamp &timestamp, const iTaSC::Frame &current, iTaSC::Frame &next, void *param)
static bool base_callback (const iTaSC::Timestamp &timestamp, const iTaSC::Frame &current, iTaSC::Frame &next, void *param)
static bool copypose_callback (const iTaSC::Timestamp &timestamp, iTaSC::ConstraintValues *const _values, unsigned int _nvalues, void *_param)
static void copypose_error (const iTaSC::ConstraintValues *values, unsigned int nvalues, IK_Target *iktarget)
static bool distance_callback (const iTaSC::Timestamp &timestamp, iTaSC::ConstraintValues *const _values, unsigned int _nvalues, void *_param)
static void distance_error (const iTaSC::ConstraintValues *values, unsigned int _nvalues, IK_Target *iktarget)
static bool joint_callback (const iTaSC::Timestamp &timestamp, iTaSC::ConstraintValues *const _values, unsigned int _nvalues, void *_param)
static int convert_channels (IK_Scene *ikscene, PoseTree *tree)
static void convert_pose (IK_Scene *ikscene)
static void rest_pose (IK_Scene *ikscene)
static IK_Sceneconvert_tree (Scene *blscene, Object *ob, bPoseChannel *pchan)
static void create_scene (Scene *scene, Object *ob)
static void init_scene (Object *ob)
static void execute_scene (Scene *blscene, IK_Scene *ikscene, bItasc *ikparam, float ctime, float frtime)
void itasc_initialize_tree (struct Scene *scene, Object *ob, float ctime)
void itasc_execute_tree (struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, float ctime)
void itasc_release_tree (struct Scene *scene, struct Object *ob, float ctime)
void itasc_clear_data (struct bPose *pose)
void itasc_clear_cache (struct bPose *pose)
void itasc_update_param (struct bPose *pose)
void itasc_test_constraint (struct Object *ob, struct bConstraint *cons)

Variables

bItasc DefIKParam

Detailed Description

Definition in file itasc_plugin.cpp.


Define Documentation

#define ANIM_FEEDBACK   0.8

Definition at line 77 of file itasc_plugin.cpp.

Referenced by copypose_callback(), and distance_callback().

#define ANIM_QMAX   0.52

Definition at line 78 of file itasc_plugin.cpp.

#define ANIM_TIMESTEP   1.0

Definition at line 76 of file itasc_plugin.cpp.


Typedef Documentation

typedef void(* ErrorCallback)(const iTaSC::ConstraintValues *values, unsigned int nvalues, IK_Target *iktarget)

Definition at line 92 of file itasc_plugin.cpp.

typedef float Vector3[3]

Definition at line 89 of file itasc_plugin.cpp.

typedef float Vector4[4]

Definition at line 90 of file itasc_plugin.cpp.


Enumeration Type Documentation

Enumerator:
IK_X 
IK_Y 
IK_Z 
IK_TRANS_X 
IK_TRANS_Y 
IK_TRANS_Z 
IK_X 
IK_Y 
IK_Z 
IK_TRANS_X 
IK_TRANS_Y 
IK_TRANS_Z 

Definition at line 230 of file itasc_plugin.cpp.

Enumerator:
IK_XDOF 
IK_YDOF 
IK_ZDOF 
IK_SWING 
IK_REVOLUTE 
IK_TRANSY 
IK_XDOF 
IK_YDOF 
IK_ZDOF 
IK_TRANS_XDOF 
IK_TRANS_YDOF 
IK_TRANS_ZDOF 

Definition at line 221 of file itasc_plugin.cpp.


Function Documentation

static bool base_callback ( const iTaSC::Timestamp timestamp,
const iTaSC::Frame current,
iTaSC::Frame next,
void *  param 
) [static]
static double ComputeTwist ( const KDL::Rotation R) [static]

Definition at line 442 of file itasc_plugin.cpp.

References KDL::atan2(), and R.

Referenced by GetJointRotation().

static bool constraint_valid ( bConstraint con) [static]
static int convert_channels ( IK_Scene ikscene,
PoseTree tree 
) [static]
static void convert_pose ( IK_Scene ikscene) [static]
static IK_Scene* convert_tree ( Scene blscene,
Object ob,
bPoseChannel pchan 
) [static]

Definition at line 1046 of file itasc_plugin.cpp.

References iTaSC::ACT_ALPHA, iTaSC::ACT_VALUE, Bone::arm_mat, Bone::arm_tail, assert, base_callback(), IK_Target::blenderConstraint, IK_Scene::blscene, IK_Target::blscene, bPoseChannel::bone, BONE_IK_ROTCTL, BONE_IK_XLIMIT, BONE_IK_YLIMIT, BONE_IK_ZLIMIT, IK_Target::channel, IK_Target::constraint, CONSTRAINT_IK_COPYPOSE, CONSTRAINT_IK_DISTANCE, CONSTRAINT_IK_NO_POS_X, CONSTRAINT_IK_NO_POS_Y, CONSTRAINT_IK_NO_POS_Z, CONSTRAINT_IK_NO_ROT_X, CONSTRAINT_IK_NO_ROT_Y, CONSTRAINT_IK_NO_ROT_Z, CONSTRAINT_IK_POS, CONSTRAINT_IK_ROT, CONSTRAINT_IK_TARGETAXIS, IK_Target::constraintName, IK_Target::controlType, convert_channels(), convert_pose(), copy_m4_m4(), copy_v3_v3(), copypose_callback(), copypose_error(), iTaSC::CopyPose::CTL_POSITION, iTaSC::CopyPose::CTL_POSITIONX, iTaSC::CopyPose::CTL_POSITIONY, iTaSC::CopyPose::CTL_POSITIONZ, iTaSC::CopyPose::CTL_ROTATION, iTaSC::CopyPose::CTL_ROTATIONX, iTaSC::CopyPose::CTL_ROTATIONY, iTaSC::CopyPose::CTL_ROTATIONZ, bConstraint::data, DefIKParam, distance_callback(), distance_error(), e_matrix, IK_Target::ee, IK_Target::eeBlend, IK_Target::eeRest, KDL::epsilon, IK_Target::errorCallback, iTaSC::F_identity, ListBase::first, bPose::flag, RenderData::frs_sec, RenderData::frs_sec_base, Object::id, iTaSC::Distance::ID_DISTANCE, iTaSC::CopyPose::ID_POSITION, iTaSC::CopyPose::ID_ROTATION, if(), IK_REVOLUTE, IK_SWING, IK_TRANSY, IK_XDOF, IK_YDOF, IK_ZDOF, bPoseChannel::ikflag, bPose::ikparam, bPoseChannel::ikstretch, bPoseChannel::iktree, invert_m4_m4(), is_cartesian_constraint(), ITASC_AUTO_STEP, ITASC_SIMULATION, ITASC_SOLVER_DLS, ITASC_SOLVER_SDLS, joint_callback(), len_v3(), length(), Bone::length, bPoseChannel::limitmax, bPoseChannel::limitmin, KDL::Frame::M, MIN2, mult_m4_m4m4(), Bone::name, ID::name, KDL::Joint::None, NULL, Object::obmat, IK_Target::owner, KDL::Frame::p, PoseTree::parent, bPoseChannel::parent, PoseTree::pchan, Object::pose, POSE_GAME_ENGINE, Scene::r, iTaSC::ConstraintSet::registerCallback(), rest_pose(), MakeCursor::root, IK_Target::rootChannel, rot, KDL::Joint::RotX, KDL::Joint::RotY, KDL::Joint::RotZ, iTaSC::MovingFrame::setCallback(), iTaSC::ConstraintSet::setControlParameter(), IK_Target::simulation, KDL::Joint::Sphere, bPoseChannel::stiffness, iTaSC::ConstraintSet::substep(), KDL::Joint::Swing, IK_Target::target, target_callback(), IK_Target::targetName, PoseTree::targets, PoseTree::totchannel, KDL::Joint::TransY, and unit_m4().

Referenced by create_scene().

static bool copypose_callback ( const iTaSC::Timestamp timestamp,
iTaSC::ConstraintValues *const  _values,
unsigned int  _nvalues,
void *  _param 
) [static]
static void copypose_error ( const iTaSC::ConstraintValues values,
unsigned int  nvalues,
IK_Target iktarget 
) [static]
static void create_scene ( Scene scene,
Object ob 
) [static]
static bool distance_callback ( const iTaSC::Timestamp timestamp,
iTaSC::ConstraintValues *const  _values,
unsigned int  _nvalues,
void *  _param 
) [static]
static void distance_error ( const iTaSC::ConstraintValues values,
unsigned int  _nvalues,
IK_Target iktarget 
) [static]
static double EulerAngleFromMatrix ( const KDL::Rotation R,
int  axis 
) [static]

Definition at line 427 of file itasc_plugin.cpp.

References KDL::atan2(), KDL::epsilon, R, and KDL::sqrt().

Referenced by GetJointRotation().

static void execute_scene ( Scene blscene,
IK_Scene ikscene,
bItasc ikparam,
float  ctime,
float  frtime 
) [static]
static IK_Data* get_ikdata ( bPose pose) [static]

Definition at line 415 of file itasc_plugin.cpp.

References bPose::ikdata, bItasc::iksolver, init_pose_itasc(), and MEM_callocN().

Referenced by create_scene().

static void GetJointRotation ( KDL::Rotation boneRot,
int  type,
double *  rot 
) [static]
static void init_scene ( Object ob) [static]

Definition at line 1522 of file itasc_plugin.cpp.

References bPose::ikdata, NULL, Object::pose, and POSE_IKTREE.

Referenced by itasc_initialize_tree().

static int initialize_chain ( Object ob,
bPoseChannel pchan_tip,
bConstraint con 
) [static]
int initialize_scene ( Object ob,
bPoseChannel pchan_tip 
)
static bool is_cartesian_constraint ( bConstraint con) [static]

Definition at line 374 of file itasc_plugin.cpp.

Referenced by constraint_valid(), and convert_tree().

void itasc_clear_cache ( struct bPose pose)

Definition at line 1760 of file itasc_plugin.cpp.

References IK_Data::first, bPose::ikdata, IK_Scene::next, and NULL.

void itasc_clear_data ( struct bPose pose)

Definition at line 1747 of file itasc_plugin.cpp.

References IK_Data::first, bPose::ikdata, MEM_freeN(), IK_Scene::next, and NULL.

Referenced by itasc_initialize_tree().

void itasc_execute_tree ( struct Scene scene,
struct Object ob,
struct bPoseChannel pchan,
float  ctime 
)
void itasc_initialize_tree ( struct Scene scene,
Object ob,
float  ctime 
)
void itasc_release_tree ( struct Scene scene,
struct Object ob,
float  ctime 
)

Definition at line 1742 of file itasc_plugin.cpp.

void itasc_test_constraint ( struct Object ob,
struct bConstraint cons 
)
void itasc_update_param ( struct bPose pose)
static bool joint_callback ( const iTaSC::Timestamp timestamp,
iTaSC::ConstraintValues *const  _values,
unsigned int  _nvalues,
void *  _param 
) [static]
static void RemoveEulerAngleFromMatrix ( KDL::Rotation R,
double  angle,
int  axis 
) [static]

Definition at line 453 of file itasc_plugin.cpp.

References KDL::Rotation::RotX(), KDL::Rotation::RotY(), KDL::Rotation::RotZ(), and T.

Referenced by GetJointRotation().

static void rest_pose ( IK_Scene ikscene) [static]
static bool target_callback ( const iTaSC::Timestamp timestamp,
const iTaSC::Frame current,
iTaSC::Frame next,
void *  param 
) [static]

Variable Documentation