diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2020-01-07 18:46:56 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-01-07 18:57:54 +0300 |
commit | fdf89acc8634ecba4dfe66e20ff595c0c24ffdee (patch) | |
tree | 0c0f6398468259cca6e0f08ee5fca4079e3aca53 /source/blender/blenkernel/intern | |
parent | bd766f8f0608d04c473544274b8dd9dcc00ec39a (diff) |
Sculpt: Pose Brush with Inverse Kinematics
This commits introduces the pose_ik_segments brush property in the Pose Brush. When increasing the IK segments count, the brush generates more segments and weights associations following the topology of the mesh. When moving the brush, these segments are transformed using an IK solver and they are used to deform the mesh.
When pressing Ctrl, the brush controls the segments' roll rotation instead of using the IK solver. The brush falloff controls how much rotation is propagated from the first to the last segment in the chain.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D6389
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/brush.c | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/paint.c | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index e9760f76cfc..8d49ab39bab 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -992,6 +992,7 @@ void BKE_brush_sculpt_reset(Brush *br) break; case SCULPT_TOOL_POSE: br->pose_smooth_iterations = 4; + br->pose_ik_segments = 1; br->flag &= ~BRUSH_ALPHA_PRESSURE; br->flag &= ~BRUSH_SPACE; br->flag &= ~BRUSH_SPACE_ATTEN; diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index 584f1ab1b0c..0c03f1db729 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -1096,6 +1096,14 @@ void BKE_sculptsession_free(Object *ob) MEM_freeN(ss->preview_vert_index_list); } + if (ss->pose_ik_chain_preview) { + for (int i = 0; i < ss->pose_ik_chain_preview->tot_segments; i++) { + MEM_SAFE_FREE(ss->pose_ik_chain_preview->segments[i].weights); + } + MEM_SAFE_FREE(ss->pose_ik_chain_preview->segments); + MEM_SAFE_FREE(ss->pose_ik_chain_preview); + } + BKE_sculptsession_free_vwpaint_data(ob->sculpt); MEM_freeN(ss); |