|
Blender V4.3
|
#include <algorithm>#include <cmath>#include <cstdlib>#include <cstring>#include <vector>#include "MEM_guardedalloc.h"#include "BIK_api.h"#include "BLI_blenlib.h"#include "BLI_math_matrix.h"#include "BLI_math_rotation.h"#include "BLI_math_vector.h"#include "BLI_utildefines.h"#include "BKE_action.hh"#include "BKE_armature.hh"#include "BKE_constraint.h"#include "BKE_global.hh"#include "DNA_action_types.h"#include "DNA_armature_types.h"#include "DNA_constraint_types.h"#include "DNA_object_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 |
Macros | |
| #define | ANIM_FEEDBACK 0.8 |
Typedefs | |
| using | Vector3 = float[3] |
| using | Vector4 = float[4] |
| using | ErrorCallback |
Enumerations | |
| enum | IK_SegmentFlag { IK_XDOF = 1 , IK_YDOF = 2 , IK_ZDOF = 4 , IK_SWING = 8 , IK_REVOLUTE = 16 , IK_TRANSY = 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 } |
Variables | |
| static bItasc | DefIKParam |
| #define ANIM_FEEDBACK 0.8 |
Definition at line 53 of file itasc_plugin.cc.
Referenced by copypose_callback(), and distance_callback().
| using ErrorCallback |
Definition at line 66 of file itasc_plugin.cc.
| using Vector3 = float[3] |
Definition at line 63 of file itasc_plugin.cc.
Definition at line 64 of file itasc_plugin.cc.
| enum IK_SegmentAxis |
| Enumerator | |
|---|---|
| IK_X | |
| IK_Y | |
| IK_Z | |
| IK_TRANS_X | |
| IK_TRANS_Y | |
| IK_TRANS_Z | |
Definition at line 207 of file itasc_plugin.cc.
| enum IK_SegmentFlag |
| Enumerator | |
|---|---|
| IK_XDOF | |
| IK_YDOF | |
| IK_ZDOF | |
| IK_SWING | |
| IK_REVOLUTE | |
| IK_TRANSY | |
Definition at line 198 of file itasc_plugin.cc.
|
static |
Definition at line 604 of file itasc_plugin.cc.
References IK_Scene::armature, IK_Scene::baseFrame, BKE_constraint_target_matrix_get(), IK_Scene::blArmature, IK_Scene::bldepsgraph, IK_Scene::blScale, IK_Scene::blscene, IK_Scene::channels, CONSTRAINT_OBTYPE_OBJECT, copy_m4_m4(), copy_v3_v3(), KDL::cos(), bConstraint::data, IK_Target::ee, iTaSC::F_identity, iTaSC::Armature::getPose(), iTaSC::Object::getPose(), iTaSC::Armature::getRelativeFrame(), iTaSC::Armature::getSegment(), KDL::Joint::getType(), KDL::Frame::getValue(), KDL::Rotation::Inverse(), invert_m4_m4(), length(), KDL::Frame::M, mul_m4_m4m4(), next, KDL::Normalize(), KDL::Frame::p, bPoseChannel::parent, IK_Channel::pchan, IK_Scene::polarConstraint, bKinematicConstraint::poleangle, bPoseChannel::pose_mat, bPoseChannel::pose_tail, result, KDL::Frame::setValue(), KDL::sin(), IK_Channel::tail, IK_Target::target, IK_Scene::targets, KDL::Joint::TransY, KDL::Rotation::UnitX(), KDL::Rotation::UnitY(), KDL::Rotation::UnitZ(), and iTaSC::Timestamp::update.
Referenced by convert_tree().
|
static |
Definition at line 1102 of file itasc_plugin.cc.
References IK_Scene::blArmature, bPoseChannel::bone, IK_Scene::channels, IK_TRANSY, IK_Scene::jointArray, IK_Channel::jointType, len_v3(), Bone::length, IK_Channel::ndof, IK_Scene::numchan, IK_Scene::numjoint, IK_Channel::pchan, rot, and SetToZero().
Referenced by convert_tree().
|
static |
Definition at line 453 of file itasc_plugin.cc.
References KDL::atan2(), and R.
Referenced by GetJointRotation(), IK_QElbowSegment::SetBasis(), and IK_QRevoluteSegment::SetBasis().
|
static |
Definition at line 378 of file itasc_plugin.cc.
References CONSTRAINT_DISABLE, CONSTRAINT_IK_AUTO, CONSTRAINT_OFF, bConstraint::data, bConstraint::flag, is_cartesian_constraint(), and OB_ARMATURE.
Referenced by initialize_scene().
|
static |
Definition at line 925 of file itasc_plugin.cc.
References BKE_pose_where_is_bone(), IK_Scene::blArmature, IK_Scene::blscene, BONE_IK_NO_XDOF, BONE_IK_NO_XDOF_TEMP, BONE_IK_NO_YDOF, BONE_IK_NO_YDOF_TEMP, BONE_IK_NO_ZDOF, BONE_IK_NO_ZDOF_TEMP, BONE_IK_XLIMIT, BONE_IK_YLIMIT, BONE_IK_ZLIMIT, IK_Scene::channels, depsgraph, bPoseChannel::flag, flag, IK_REVOLUTE, IK_SWING, IK_TRANSY, IK_XDOF, IK_YDOF, IK_ZDOF, bPoseChannel::ikflag, bPoseChannel::ikstretch, IK_Scene::jointArray, IK_Channel::jointType, bPoseChannel::limitmax, bPoseChannel::limitmin, IK_Channel::ndof, IK_Scene::numchan, IK_Scene::numjoint, IK_Channel::owner, IK_Channel::parent, IK_Channel::pchan, POSE_CHAIN, POSE_DONE, KDL::JntArray::resize(), and tree.
Referenced by convert_tree().
|
static |
Definition at line 1058 of file itasc_plugin.cc.
References Bone::arm_mat, IK_Scene::blArmature, bPoseChannel::bone, Bone::bone_mat, IK_Scene::channels, copy_m4_m4(), GetJointRotation(), IK_TRANSY, invert_m4_m4(), IK_Scene::jointArray, IK_Channel::jointType, len_v3(), len_v3v3(), mul_m4_m4m3(), mul_m4_m4m4(), IK_Channel::ndof, normalize_m4(), IK_Scene::numchan, IK_Scene::numjoint, bPoseChannel::parent, IK_Channel::pchan, bPoseChannel::pose_head, bPoseChannel::pose_mat, bPoseChannel::pose_tail, rot, KDL::Rotation::setValue(), and unit_m4().
Referenced by execute_scene().
|
static |
Definition at line 1132 of file itasc_plugin.cc.
References iTaSC::ACT_ALPHA, iTaSC::ACT_VALUE, iTaSC::Armature::addConstraint(), iTaSC::Armature::addEndEffector(), iTaSC::Armature::addLimitConstraint(), iTaSC::Armature::addSegment(), Bone::arm_mat, Bone::arm_tail, IK_Scene::armature, IK_Scene::base, base_callback(), BKE_pose_rest(), IK_Scene::blArmature, IK_Scene::bldepsgraph, IK_Target::bldepsgraph, IK_Target::blenderConstraint, IK_Scene::blInvScale, IK_Scene::blScale, IK_Scene::blscene, IK_Target::blscene, bPoseChannel::bone, BONE_CONNECTED, BONE_IK_ROTCTL, BONE_IK_XLIMIT, BONE_IK_YLIMIT, BONE_IK_ZLIMIT, Bone::bone_mat, IK_Scene::cache, IK_Target::channel, IK_Scene::channels, 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(), copy_m3_m4(), 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, depsgraph, bKinematicConstraint::dist, 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, bItasc::flag, bKinematicConstraint::flag, Bone::flag, KDL::Rotation::GetRot(), iTaSC::ControlledObject::getWq(), IK_Channel::head, Object::id, iTaSC::Distance::ID_DISTANCE, iTaSC::CopyPose::ID_POSITION, iTaSC::CopyPose::ID_ROTATION, IK_REVOLUTE, IK_SWING, IK_TRANSY, IK_XDOF, IK_YDOF, IK_ZDOF, bPoseChannel::ikflag, bPose::ikparam, bPoseChannel::ikstretch, bPoseChannel::iktree, invert_m3_m3(), invert_m4_m4(), is_cartesian_constraint(), ITASC_SIMULATION, ITASC_SOLVER_DLS, ITASC_SOLVER_SDLS, ITASC_TRANSLATE_ROOT_BONES, joint_callback(), IK_Scene::jointArray, IK_Channel::jointType, len_v3(), Bone::length, length(), bPoseChannel::limitmax, bPoseChannel::limitmin, KDL::Frame::M, min_ff(), mul_m3_v3(), mul_m4_m4m4(), Bone::name, ID::name, IK_Channel::ndof, bConstraint::next, KDL::Joint::None, KDL::Vector::Norm(), normalize_m3(), IK_Scene::numchan, bKinematicConstraint::orientweight, IK_Target::owner, KDL::Frame::p, bPoseChannel::parent, IK_Channel::pchan, IK_Scene::polarConstraint, bKinematicConstraint::poletar, Object::pose, bPoseChannel::pose_head, bPoseChannel::pose_mat, bPoseChannel::pose_tail, iTaSC::ConstraintSet::registerCallback(), ret, IK_Target::rootChannel, rot, KDL::Joint::RotX, KDL::Joint::RotY, KDL::Joint::RotZ, IK_Scene::scene, scene, iTaSC::MovingFrame::setCallback(), iTaSC::ConstraintSet::setControlParameter(), IK_Target::simulation, bItasc::solver, IK_Scene::solver, KDL::Joint::Sphere, bPoseChannel::stiffness, sub_v3_v3v3(), iTaSC::ConstraintSet::substep(), KDL::Joint::Swing, IK_Channel::tail, IK_Target::target, target_callback(), IK_Target::targetName, IK_Scene::targets, KDL::Joint::TransY, tree, bKinematicConstraint::type, unit_m3(), unit_m4(), and bKinematicConstraint::weight.
Referenced by create_scene().
|
static |
Definition at line 708 of file itasc_plugin.cc.
References iTaSC::ACT_ALPHA, iTaSC::ACT_FEEDBACK, ANIM_FEEDBACK, IK_Target::blenderConstraint, CONSTRAINT_OFF, IK_Target::controlType, iTaSC::CopyPose::CTL_POSITION, iTaSC::CopyPose::CTL_ROTATION, bConstraint::data, DefIKParam, bItasc::feedback, bConstraint::flag, bPose::ikparam, bKinematicConstraint::orientweight, IK_Target::owner, Object::pose, IK_Target::simulation, and bKinematicConstraint::weight.
Referenced by convert_tree().
|
static |
Definition at line 754 of file itasc_plugin.cc.
References IK_Target::blenderConstraint, IK_Target::controlType, iTaSC::CopyPose::CTL_POSITION, iTaSC::CopyPose::CTL_ROTATION, error(), float, bConstraint::lin_error, bConstraint::rot_error, KDL::sqr(), and KDL::sqrt().
Referenced by convert_tree().
Definition at line 1641 of file itasc_plugin.cc.
References BLI_freelistN(), BLI_remlink(), bPose::chanbase, convert_tree(), depsgraph, IK_Data::first, get_ikdata(), LISTBASE_FOREACH, MEM_freeN(), IK_Scene::next, Object::pose, and tree.
Referenced by itasc_initialize_tree().
|
static |
Definition at line 780 of file itasc_plugin.cc.
References iTaSC::ACT_ALPHA, iTaSC::ACT_FEEDBACK, iTaSC::ACT_VALUE, ANIM_FEEDBACK, IK_Target::blenderConstraint, CONSTRAINT_OFF, bConstraint::data, DefIKParam, bKinematicConstraint::dist, bItasc::feedback, bConstraint::flag, bPose::ikparam, LIMITDIST_INSIDE, LIMITDIST_OUTSIDE, bKinematicConstraint::mode, IK_Target::owner, Object::pose, IK_Target::simulation, iTaSC::Timestamp::substep, and bKinematicConstraint::weight.
Referenced by convert_tree().
|
static |
Definition at line 831 of file itasc_plugin.cc.
References IK_Target::blenderConstraint, float, and bConstraint::lin_error.
Referenced by convert_tree().
|
static |
Definition at line 428 of file itasc_plugin.cc.
References KDL::atan2(), KDL::epsilon, R, and KDL::sqrt().
Referenced by GetJointRotation(), IK_QElbowSegment::SetBasis(), and IK_QRevoluteSegment::SetBasis().
|
static |
Definition at line 1693 of file itasc_plugin.cc.
References IK_Scene::armature, IK_Scene::baseFrame, BKE_pose_where_is_bone(), IK_Scene::blArmature, IK_Target::blenderConstraint, IK_Scene::blInvScale, IK_Scene::cache, IK_Scene::channels, IK_Target::constraint, CONSTRAINT_OFF, convert_pose(), copy_v3_v3(), depsgraph, iTaSC::Solver::DLS_QMAX, IK_Target::errorCallback, bConstraint::flag, bItasc::flag, bPoseChannel::flag, float, IK_Channel::frame, iTaSC::ConstraintSet::getControlParameters(), iTaSC::Armature::getMaxEndEffectorChange(), iTaSC::Armature::getMaxJointChange(), iTaSC::ControlledObject::getNrOfConstraints(), iTaSC::Cache::getPreviousCacheItem(), iTaSC::Armature::getRelativeFrame(), iTaSC::Armature::getSegment(), KDL::Joint::getType(), KDL::Frame::getValue(), ITASC_AUTO_STEP, ITASC_INITIAL_REITERATION, ITASC_REITERATION, ITASC_SIMULATION, IK_Scene::jointArray, IK_Channel::jointValid, length(), bItasc::maxvel, mul_v3_fl(), IK_Scene::numchan, bItasc::numiter, bItasc::numstep, KDL::Frame::p, IK_Channel::parent, IK_Channel::pchan, POSE_CHAIN, POSE_DONE, bPoseChannel::pose_head, bPoseChannel::pose_mat, bPoseChannel::pose_tail, bItasc::precision, IK_Scene::scene, iTaSC::Armature::setJointArray(), iTaSC::Solver::setParam(), IK_Scene::solver, sub_v3_v3v3(), IK_Channel::tail, IK_Scene::targets, KDL::Joint::TransY, and iTaSC::Scene::update().
Referenced by itasc_execute_tree().
Definition at line 414 of file itasc_plugin.cc.
References BKE_pose_itasc_init(), DefIKParam, bPose::ikdata, bItasc::iksolver, and MEM_callocN.
Referenced by create_scene().
|
static |
Definition at line 515 of file itasc_plugin.cc.
References ComputeTwist(), EulerAngleFromMatrix(), KDL::Rotation::GetRot(), KDL::Vector2::GetValue(), KDL::Vector::GetValue(), KDL::Rotation::GetXZRot(), IK_REVOLUTE, IK_SWING, IK_TRANSY, IK_XDOF, IK_YDOF, IK_ZDOF, RemoveEulerAngleFromMatrix(), and rot.
Referenced by convert_pose(), and joint_callback().
Definition at line 1676 of file itasc_plugin.cc.
References KDL::epsilon, fabs(), Scene::flag, bPose::ikdata, len_v3(), Object::pose, POSE_IKTREE, and scene.
Referenced by itasc_initialize_tree().
|
static |
Definition at line 216 of file itasc_plugin.cc.
References BLI_addtail(), BLI_listbase_is_empty(), CONSTRAINT_IK_STRETCH, CONSTRAINT_IK_TIP, bConstraint::data, data, ListBase::first, bPoseChannel::flag, bPoseChannel::iktree, MEM_callocN, MEM_freeN(), bPoseChannel::parent, POSE_CHAIN, POSE_IKTREE, size(), and tree.
Referenced by initialize_scene().
|
static |
Definition at line 400 of file itasc_plugin.cc.
References CONSTRAINT_TYPE_KINEMATIC, constraint_valid(), bPoseChannel::constraints, initialize_chain(), and LISTBASE_FOREACH.
Referenced by itasc_initialize_tree().
|
static |
Definition at line 371 of file itasc_plugin.cc.
Referenced by constraint_valid(), and convert_tree().
| void itasc_clear_cache | ( | bPose * | pose | ) |
Definition at line 1943 of file itasc_plugin.cc.
References IK_Data::first, bPose::ikdata, and scene.
| void itasc_clear_data | ( | bPose * | pose | ) |
Definition at line 1930 of file itasc_plugin.cc.
References IK_Data::first, bPose::ikdata, MEM_freeN(), IK_Scene::next, and scene.
Referenced by itasc_initialize_tree().
| void itasc_execute_tree | ( | Depsgraph * | depsgraph, |
| Scene * | scene, | ||
| Object * | ob, | ||
| bPoseChannel * | pchan_root, | ||
| float | ctime ) |
Definition at line 1904 of file itasc_plugin.cc.
References DefIKParam, depsgraph, execute_scene(), IK_Data::first, bPose::ikdata, bPose::ikparam, and Object::pose.
Definition at line 1876 of file itasc_plugin.cc.
References bPose::chanbase, count, create_scene(), depsgraph, bPose::flag, bPose::ikdata, init_scene(), initialize_scene(), itasc_clear_data(), itasc_update_param(), LISTBASE_FOREACH, PCHAN_HAS_IK, Object::pose, and POSE_WAS_REBUILT.
Definition at line 1925 of file itasc_plugin.cc.
| void itasc_test_constraint | ( | Object * | ob, |
| bConstraint * | cons ) |
Definition at line 1985 of file itasc_plugin.cc.
References CONSTRAINT_IK_COPYPOSE, CONSTRAINT_IK_DISTANCE, CONSTRAINT_TYPE_KINEMATIC, bConstraint::data, and bConstraint::type.
| void itasc_update_param | ( | bPose * | pose | ) |
Definition at line 1956 of file itasc_plugin.cc.
References iTaSC::ACT_FEEDBACK, CONSTRAINT_ID_ALL, bItasc::dampeps, bItasc::dampmax, iTaSC::Solver::DLS_EPSILON, iTaSC::Solver::DLS_LAMBDA_MAX, iTaSC::Solver::DLS_QMAX, bItasc::feedback, IK_Data::first, bItasc::flag, iTaSC::Armature::ID_JOINT, bPose::ikdata, bPose::ikparam, ITASC_SIMULATION, bItasc::maxstep, bItasc::maxvel, and bItasc::minstep.
Referenced by itasc_initialize_tree().
|
static |
Definition at line 838 of file itasc_plugin.cc.
References iTaSC::ConstraintValues::alpha, axis_angle_to_mat3(), bPoseChannel::eul, eulO_to_mat3(), bItasc::feedback, iTaSC::ConstraintValues::feedback, GetJointRotation(), iTaSC::ConstraintValues::id, iTaSC::Armature::ID_JOINT_RX, iTaSC::Armature::ID_JOINT_RY, iTaSC::Armature::ID_JOINT_RZ, IK_REVOLUTE, IK_SWING, IK_TRANSY, IK_XDOF, IK_YDOF, IK_ZDOF, bPose::ikparam, bPoseChannel::ikrotweight, IK_Channel::jointType, IK_Channel::jointValid, IK_Channel::jointValue, normalize_qt(), IK_Channel::owner, IK_Channel::pchan, Object::pose, bPoseChannel::quat, quat_to_mat3(), ROT_MODE_AXISANGLE, bPoseChannel::rotmode, iTaSC::ConstraintValues::values, and iTaSC::ConstraintSingleValue::yd.
Referenced by convert_tree().
|
static |
Definition at line 464 of file itasc_plugin.cc.
References R, KDL::Rotation::RotX(), KDL::Rotation::RotY(), KDL::Rotation::RotZ(), and T.
Referenced by GetJointRotation().
|
static |
Definition at line 559 of file itasc_plugin.cc.
References BKE_constraint_target_matrix_get(), blend_m4_m4m4(), CONSTRAINT_OBTYPE_OBJECT, copy_m4_m4(), copy_v3_v3(), bConstraint::enforce, mul_m4_m4m4(), mul_m4_series, next, bPoseChannel::parent, bPoseChannel::pose_mat, and bPoseChannel::pose_tail.
Referenced by convert_tree().
|
static |
Definition at line 49 of file itasc_plugin.cc.
Referenced by convert_tree(), copypose_callback(), distance_callback(), get_ikdata(), and itasc_execute_tree().