diff options
Diffstat (limited to 'source/blender/ikplugin')
-rw-r--r-- | source/blender/ikplugin/BIK_api.h | 13 | ||||
-rw-r--r-- | source/blender/ikplugin/intern/ikplugin_api.c | 2 | ||||
-rw-r--r-- | source/blender/ikplugin/intern/ikplugin_api.h | 5 | ||||
-rw-r--r-- | source/blender/ikplugin/intern/iksolver_plugin.c | 29 | ||||
-rw-r--r-- | source/blender/ikplugin/intern/iksolver_plugin.h | 5 | ||||
-rw-r--r-- | source/blender/ikplugin/intern/itasc_plugin.cpp | 25 | ||||
-rw-r--r-- | source/blender/ikplugin/intern/itasc_plugin.h | 5 |
7 files changed, 34 insertions, 50 deletions
diff --git a/source/blender/ikplugin/BIK_api.h b/source/blender/ikplugin/BIK_api.h index 2c2053b47a6..674b384adf2 100644 --- a/source/blender/ikplugin/BIK_api.h +++ b/source/blender/ikplugin/BIK_api.h @@ -22,8 +22,7 @@ * \ingroup ikplugin */ -#ifndef __BIK_API_H__ -#define __BIK_API_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -36,10 +35,10 @@ struct bConstraint; struct bPose; struct bPoseChannel; -void BIK_initialize_tree(struct Depsgraph *depsgraph, - struct Scene *scene, - struct Object *ob, - float ctime); +void BIK_init_tree(struct Depsgraph *depsgraph, + struct Scene *scene, + struct Object *ob, + float ctime); void BIK_execute_tree(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, @@ -54,5 +53,3 @@ void BIK_test_constraint(struct Object *ob, struct bConstraint *cons); #ifdef __cplusplus } #endif - -#endif /* __BIK_API_H__ */ diff --git a/source/blender/ikplugin/intern/ikplugin_api.c b/source/blender/ikplugin/intern/ikplugin_api.c index 5e683d36408..233150a77aa 100644 --- a/source/blender/ikplugin/intern/ikplugin_api.c +++ b/source/blender/ikplugin/intern/ikplugin_api.c @@ -80,7 +80,7 @@ static IKPlugin *get_plugin(bPose *pose) /*----------------------------------------*/ /* Plugin API */ -void BIK_initialize_tree(struct Depsgraph *depsgraph, Scene *scene, Object *ob, float ctime) +void BIK_init_tree(struct Depsgraph *depsgraph, Scene *scene, Object *ob, float ctime) { IKPlugin *plugin = get_plugin(ob->pose); diff --git a/source/blender/ikplugin/intern/ikplugin_api.h b/source/blender/ikplugin/intern/ikplugin_api.h index faf21cecacd..f61ba7e3a63 100644 --- a/source/blender/ikplugin/intern/ikplugin_api.h +++ b/source/blender/ikplugin/intern/ikplugin_api.h @@ -22,8 +22,7 @@ * \ingroup ikplugin */ -#ifndef __IKPLUGIN_API_H__ -#define __IKPLUGIN_API_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -56,5 +55,3 @@ typedef struct IKPlugin IKPlugin; #ifdef __cplusplus } #endif - -#endif /* __IKPLUGIN_API_H__ */ diff --git a/source/blender/ikplugin/intern/iksolver_plugin.c b/source/blender/ikplugin/intern/iksolver_plugin.c index 3646686e81f..ba096653e0f 100644 --- a/source/blender/ikplugin/intern/iksolver_plugin.c +++ b/source/blender/ikplugin/intern/iksolver_plugin.c @@ -452,21 +452,20 @@ static void execute_posetree(struct Depsgraph *depsgraph, /* don't solve IK when we are setting the pole angle */ break; } - else { - mul_m4_m4m4(goal, goalinv, rootmat); - copy_v3_v3(polepos, goal[3]); - poleconstrain = 1; - - /* for pole targets, we blend the result of the ik solver - * instead of the target position, otherwise we can't get - * a smooth transition */ - resultblend = 1; - resultinf = target->con->enforce; - - if (data->flag & CONSTRAINT_IK_GETANGLE) { - poleangledata = data; - data->flag &= ~CONSTRAINT_IK_GETANGLE; - } + + mul_m4_m4m4(goal, goalinv, rootmat); + copy_v3_v3(polepos, goal[3]); + poleconstrain = 1; + + /* for pole targets, we blend the result of the ik solver + * instead of the target position, otherwise we can't get + * a smooth transition */ + resultblend = 1; + resultinf = target->con->enforce; + + if (data->flag & CONSTRAINT_IK_GETANGLE) { + poleangledata = data; + data->flag &= ~CONSTRAINT_IK_GETANGLE; } } diff --git a/source/blender/ikplugin/intern/iksolver_plugin.h b/source/blender/ikplugin/intern/iksolver_plugin.h index 20a9e78cc47..28356b4fc9c 100644 --- a/source/blender/ikplugin/intern/iksolver_plugin.h +++ b/source/blender/ikplugin/intern/iksolver_plugin.h @@ -22,8 +22,7 @@ * \ingroup ikplugin */ -#ifndef __IKSOLVER_PLUGIN_H__ -#define __IKSOLVER_PLUGIN_H__ +#pragma once #include "ikplugin_api.h" @@ -46,5 +45,3 @@ void iksolver_clear_data(struct bPose *pose); #ifdef __cplusplus } #endif - -#endif /* __IKSOLVER_PLUGIN_H__ */ diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp index 8f84d04f602..a5fdb9ef491 100644 --- a/source/blender/ikplugin/intern/itasc_plugin.cpp +++ b/source/blender/ikplugin/intern/itasc_plugin.cpp @@ -446,24 +446,21 @@ static double EulerAngleFromMatrix(const KDL::Rotation &R, int axis) if (axis == 0) { return -KDL::atan2(R(1, 2), R(2, 2)); } - else if (axis == 1) { + if (axis == 1) { return KDL::atan2(-R(0, 2), t); } - else { - return -KDL::atan2(R(0, 1), R(0, 0)); - } + + return -KDL::atan2(R(0, 1), R(0, 0)); } - else { - if (axis == 0) { - return -KDL::atan2(-R(2, 1), R(1, 1)); - } - else if (axis == 1) { - return KDL::atan2(-R(0, 2), t); - } - else { - return 0.0f; - } + + if (axis == 0) { + return -KDL::atan2(-R(2, 1), R(1, 1)); + } + if (axis == 1) { + return KDL::atan2(-R(0, 2), t); } + + return 0.0f; } static double ComputeTwist(const KDL::Rotation &R) diff --git a/source/blender/ikplugin/intern/itasc_plugin.h b/source/blender/ikplugin/intern/itasc_plugin.h index e7a319809b7..89342295b35 100644 --- a/source/blender/ikplugin/intern/itasc_plugin.h +++ b/source/blender/ikplugin/intern/itasc_plugin.h @@ -22,8 +22,7 @@ * \ingroup ikplugin */ -#ifndef __ITASC_PLUGIN_H__ -#define __ITASC_PLUGIN_H__ +#pragma once #include "ikplugin_api.h" @@ -49,5 +48,3 @@ void itasc_test_constraint(struct Object *ob, struct bConstraint *cons); #ifdef __cplusplus } #endif - -#endif /* __ITASC_PLUGIN_H__ */ |