Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Dobarro <pablodp606@gmail.com>2020-02-11 21:43:36 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-02-11 21:44:14 +0300
commit0ab7e321585f909a4fd3cc55221bf3d3827989e9 (patch)
tree5568149508acb6cffeb89c74b57f29c4d523dc45 /source/blender/editors/sculpt_paint
parent015d5eda884dfb10f8982f9b0f8d69c9ea540349 (diff)
Pose Brush: Option to disable the IK anchor point
The IK chain was using an anchor point by default as it makes sense for posing, but for creating curved shapes it is useful to be able to disable it. Reviewed By: jbakker Differential Revision: https://developer.blender.org/D6584
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index f4c94b6e5de..e0c75e1e64f 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -3576,7 +3576,9 @@ static void sculpt_flip_quat_by_symm_area(float quat[3],
}
}
-static void pose_solve_ik_chain(SculptPoseIKChain *ik_chain, const float initial_target[3])
+static void pose_solve_ik_chain(SculptPoseIKChain *ik_chain,
+ const float initial_target[3],
+ const bool use_anchor)
{
SculptPoseIKChainSegment *segments = ik_chain->segments;
int tot_segments = ik_chain->tot_segments;
@@ -3615,13 +3617,15 @@ static void pose_solve_ik_chain(SculptPoseIKChain *ik_chain, const float initial
}
/* Move back the whole chain to preserve the anchor point. */
- float anchor_diff[3];
- sub_v3_v3v3(
- anchor_diff, segments[tot_segments - 1].initial_orig, segments[tot_segments - 1].orig);
+ if (use_anchor) {
+ float anchor_diff[3];
+ sub_v3_v3v3(
+ anchor_diff, segments[tot_segments - 1].initial_orig, segments[tot_segments - 1].orig);
- for (int i = 0; i < tot_segments; i++) {
- add_v3_v3(segments[i].orig, anchor_diff);
- add_v3_v3(segments[i].head, anchor_diff);
+ for (int i = 0; i < tot_segments; i++) {
+ add_v3_v3(segments[i].orig, anchor_diff);
+ add_v3_v3(segments[i].head, anchor_diff);
+ }
}
}
@@ -3742,8 +3746,8 @@ static void do_pose_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
copy_v3_v3(ik_target, ss->cache->true_location);
add_v3_v3(ik_target, ss->cache->grab_delta);
- /* Solve the IK positions */
- pose_solve_ik_chain(ik_chain, ik_target);
+ /* Solve the IK positions. */
+ pose_solve_ik_chain(ik_chain, ik_target, brush->flag2 & BRUSH_POSE_IK_ANCHORED);
}
/* Flip the segment chain in all symmetry axis and calculate the transform matrices for each