|
Blender V5.0
|
#include <algorithm>#include <cmath>#include <cstdlib>#include <cstring>#include <vector>#include "MEM_guardedalloc.h"#include "BIK_api.h"#include "BLI_listbase.h"#include "BLI_math_matrix.h"#include "BLI_math_rotation.h"#include "BLI_math_vector.h"#include "BKE_action.hh"#include "BKE_armature.hh"#include "BKE_constraint.h"#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 61 of file itasc_plugin.cc.
Referenced by copypose_callback(), and distance_callback().
| using ErrorCallback |
Definition at line 74 of file itasc_plugin.cc.
| using Vector3 = float[3] |
Definition at line 71 of file itasc_plugin.cc.
Definition at line 72 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 215 of file itasc_plugin.cc.
| enum IK_SegmentFlag |
| Enumerator | |
|---|---|
| IK_XDOF | |
| IK_YDOF | |
| IK_ZDOF | |
| IK_SWING | |
| IK_REVOLUTE | |
| IK_TRANSY | |
Definition at line 206 of file itasc_plugin.cc.
|
static |
Definition at line 612 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(), iTaSC::Timestamp::update, and x.
Referenced by convert_tree().
|
static |
Definition at line 1110 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_Channel::pchan, rot, and SetToZero().
Referenced by convert_tree().
|
static |
Definition at line 461 of file itasc_plugin.cc.
References KDL::atan2(), and R.
Referenced by GetJointRotation(), IK_QElbowSegment::SetBasis(), and IK_QRevoluteSegment::SetBasis().
|
static |
Definition at line 386 of file itasc_plugin.cc.
References CONSTRAINT_DISABLE, CONSTRAINT_IK_AUTO, CONSTRAINT_OFF, bConstraint::data, data, bConstraint::flag, is_cartesian_constraint(), and OB_ARMATURE.
Referenced by initialize_scene().
|
static |
Definition at line 933 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::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 1066 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(), 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 1140 of file itasc_plugin.cc.
References iTaSC::ACT_ALPHA, iTaSC::ACT_VALUE, iTaSC::Scene::addCache(), iTaSC::Armature::addConstraint(), iTaSC::Scene::addConstraintSet(), iTaSC::Armature::addEndEffector(), iTaSC::Armature::addLimitConstraint(), iTaSC::Scene::addObject(), iTaSC::Armature::addSegment(), iTaSC::Scene::addSolver(), Bone::arm_mat, Bone::arm_tail, IK_Scene::armature, assert, 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, PoseTarget::con, 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, iTaSC::Scene::initialize(), 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(), bConstraint::name, Bone::name, ID::name, IK_Channel::ndof, PoseTarget::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, 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, PoseTarget::tip, KDL::Joint::TransY, tree, bKinematicConstraint::type, unit_m3(), unit_m4(), and bKinematicConstraint::weight.
Referenced by create_scene().
|
static |
Definition at line 716 of file itasc_plugin.cc.
References iTaSC::ACT_ALPHA, iTaSC::ACT_FEEDBACK, iTaSC::ConstraintValues::action, iTaSC::ConstraintValues::alpha, ANIM_FEEDBACK, IK_Target::blenderConstraint, CONSTRAINT_OFF, IK_Target::controlType, iTaSC::CopyPose::CTL_POSITION, iTaSC::CopyPose::CTL_ROTATION, bConstraint::data, DefIKParam, bItasc::feedback, iTaSC::ConstraintValues::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 762 of file itasc_plugin.cc.
References IK_Target::blenderConstraint, IK_Target::controlType, iTaSC::CopyPose::CTL_POSITION, iTaSC::CopyPose::CTL_ROTATION, error(), float, i, bConstraint::lin_error, bConstraint::rot_error, KDL::sqr(), KDL::sqrt(), iTaSC::ConstraintValues::values, iTaSC::ConstraintSingleValue::y, and iTaSC::ConstraintSingleValue::yd.
Referenced by convert_tree().
Definition at line 1649 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 788 of file itasc_plugin.cc.
References iTaSC::ACT_ALPHA, iTaSC::ACT_FEEDBACK, iTaSC::ACT_VALUE, iTaSC::ConstraintSingleValue::action, iTaSC::ConstraintValues::action, iTaSC::ConstraintValues::alpha, ANIM_FEEDBACK, IK_Target::blenderConstraint, CONSTRAINT_OFF, bConstraint::data, DefIKParam, bKinematicConstraint::dist, bItasc::feedback, iTaSC::ConstraintValues::feedback, bConstraint::flag, bPose::ikparam, LIMITDIST_INSIDE, LIMITDIST_OUTSIDE, bKinematicConstraint::mode, IK_Target::owner, Object::pose, IK_Target::simulation, iTaSC::Timestamp::substep, iTaSC::ConstraintValues::values, bKinematicConstraint::weight, iTaSC::ConstraintSingleValue::y, and iTaSC::ConstraintSingleValue::yd.
Referenced by convert_tree().
|
static |
Definition at line 839 of file itasc_plugin.cc.
References IK_Target::blenderConstraint, float, bConstraint::lin_error, iTaSC::ConstraintValues::values, iTaSC::ConstraintSingleValue::y, and iTaSC::ConstraintSingleValue::yd.
Referenced by convert_tree().
|
static |
Definition at line 436 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 1701 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(), i, ITASC_AUTO_STEP, ITASC_INITIAL_REITERATION, ITASC_REITERATION, ITASC_SIMULATION, IK_Scene::jointArray, IK_Channel::jointValid, length(), bItasc::maxvel, mul_v3_fl(), 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 422 of file itasc_plugin.cc.
References BKE_pose_itasc_init(), DefIKParam, bPose::ikdata, and MEM_callocN().
Referenced by create_scene().
|
static |
Definition at line 523 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().
|
static |
Definition at line 1684 of file itasc_plugin.cc.
References IK_Scene::blScale, IK_Scene::channels, KDL::epsilon, fabs(), bPoseChannel::flag, bPose::ikdata, len_v3(), IK_Scene::next, IK_Channel::pchan, Object::pose, and POSE_IKTREE.
Referenced by itasc_initialize_tree().
|
static |
Definition at line 224 of file itasc_plugin.cc.
References BLI_addtail(), BLI_listbase_is_empty(), PoseTarget::con, CONSTRAINT_IK_STRETCH, CONSTRAINT_IK_TIP, bConstraint::data, data, ListBase::first, bPoseChannel::flag, bPoseChannel::iktree, MEM_calloc_arrayN(), MEM_callocN(), MEM_freeN(), bPoseChannel::parent, POSE_CHAIN, POSE_IKTREE, size(), PoseTarget::tip, and tree.
Referenced by initialize_scene().
|
static |
Definition at line 408 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 379 of file itasc_plugin.cc.
Referenced by constraint_valid(), and convert_tree().
| void itasc_clear_cache | ( | bPose * | pose | ) |
Definition at line 1951 of file itasc_plugin.cc.
References IK_Data::first, bPose::ikdata, and IK_Scene::next.
| void itasc_clear_data | ( | bPose * | pose | ) |
Definition at line 1938 of file itasc_plugin.cc.
References IK_Data::first, bPose::ikdata, MEM_freeN(), and IK_Scene::next.
Referenced by itasc_initialize_tree().
| void itasc_execute_tree | ( | Depsgraph * | depsgraph, |
| Scene * | scene, | ||
| Object * | ob, | ||
| bPoseChannel * | pchan_root, | ||
| float | ctime ) |
Definition at line 1912 of file itasc_plugin.cc.
References DefIKParam, depsgraph, execute_scene(), IK_Data::first, RenderData::frs_sec, RenderData::frs_sec_base, bPose::ikdata, bPose::ikparam, IK_Scene::next, Object::pose, and Scene::r.
Definition at line 1884 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 1933 of file itasc_plugin.cc.
| void itasc_test_constraint | ( | Object * | ob, |
| bConstraint * | cons ) |
Definition at line 1993 of file itasc_plugin.cc.
References CONSTRAINT_IK_COPYPOSE, CONSTRAINT_IK_DISTANCE, CONSTRAINT_TYPE_KINEMATIC, bConstraint::data, data, and bConstraint::type.
| void itasc_update_param | ( | bPose * | pose | ) |
Definition at line 1964 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, bItasc::minstep, and IK_Scene::next.
Referenced by itasc_initialize_tree().
|
static |
Definition at line 846 of file itasc_plugin.cc.
References iTaSC::ConstraintValues::alpha, axis_angle_to_mat3(), bPoseChannel::eul, eulO_to_mat3(), bItasc::feedback, iTaSC::ConstraintValues::feedback, GetJointRotation(), i, 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 472 of file itasc_plugin.cc.
References angle(), R, KDL::Rotation::RotX(), KDL::Rotation::RotY(), KDL::Rotation::RotZ(), and T.
Referenced by GetJointRotation().
|
static |
Definition at line 567 of file itasc_plugin.cc.
References BKE_constraint_target_matrix_get(), IK_Target::bldepsgraph, blend_m4_m4m4(), IK_Target::blenderConstraint, IK_Target::blscene, CONSTRAINT_OBTYPE_OBJECT, copy_m4_m4(), copy_v3_v3(), IK_Target::eeBlend, IK_Target::eeRest, bConstraint::enforce, mul_m4_m4m4(), mul_m4_series, next, IK_Target::owner, bPoseChannel::parent, bPoseChannel::pose_mat, bPoseChannel::pose_tail, and IK_Target::rootChannel.
Referenced by convert_tree().
|
static |
Definition at line 57 of file itasc_plugin.cc.
Referenced by convert_tree(), copypose_callback(), distance_callback(), get_ikdata(), and itasc_execute_tree().