diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2020-08-04 18:19:27 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-08-05 23:59:27 +0300 |
commit | 9ea77f5232c7a07b529c9f0d6417112a20d441aa (patch) | |
tree | fdcd3c6d9c1082c749164a4fae409a19e3bfa256 /source | |
parent | 3474b0968a1db34bf6a1384aef92e0fbd5989dd2 (diff) |
Sculpt: Option to lock the rotation in the Pose Brush scale deform mode
The scale deform mode includes rotation by default, so when when scaling
down a part of the models it becomes harder to control as the effect of
the rotation less predictable (similar to using trackball rotation in a
very small radius). This locks the rotation of the segment, so parts of
the model can be scaled down in a more predictable way.
Reviewed By: sergey
Differential Revision: https://developer.blender.org/D8465
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_pose.c | 6 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_brush_types.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_brush.c | 7 |
3 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_pose.c b/source/blender/editors/sculpt_paint/sculpt_pose.c index 976006b3958..f099dc0a6c1 100644 --- a/source/blender/editors/sculpt_paint/sculpt_pose.c +++ b/source/blender/editors/sculpt_paint/sculpt_pose.c @@ -1025,8 +1025,10 @@ static void sculpt_pose_do_scale_deform(SculptSession *ss, Brush *brush) copy_v3_v3(ik_target, ss->cache->true_location); add_v3_v3(ik_target, ss->cache->grab_delta); - /* Solve the IK for the first segment to include rotation as part of scale. */ - pose_solve_ik_chain(ik_chain, ik_target, brush->flag2 & BRUSH_POSE_IK_ANCHORED); + /* Solve the IK for the first segment to include rotation as part of scale if enabled. */ + if (!(brush->flag2 & BRUSH_POSE_USE_LOCK_ROTATION)) { + pose_solve_ik_chain(ik_chain, ik_target, brush->flag2 & BRUSH_POSE_IK_ANCHORED); + } float scale[3]; copy_v3_fl(scale, sculpt_pose_get_scale_from_grab_delta(ss, ik_target)); diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h index 6d56db4b0e0..5cd7443900f 100644 --- a/source/blender/makesdna/DNA_brush_types.h +++ b/source/blender/makesdna/DNA_brush_types.h @@ -739,6 +739,7 @@ typedef enum eBrushFlags2 { BRUSH_POSE_IK_ANCHORED = (1 << 2), BRUSH_USE_CONNECTED_ONLY = (1 << 3), BRUSH_CLOTH_PIN_SIMULATION_BOUNDARY = (1 << 4), + BRUSH_POSE_USE_LOCK_ROTATION = (1 << 5), } eBrushFlags2; typedef enum { diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 73ffff07c6c..7772912e261 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -2803,6 +2803,13 @@ static void rna_def_brush(BlenderRNA *brna) prop, "Keep Anchor Point", "Keep the position of the last segment in the IK chain fixed"); RNA_def_property_update(prop, 0, "rna_Brush_update"); + prop = RNA_def_property(srna, "use_pose_lock_rotation", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag2", BRUSH_POSE_USE_LOCK_ROTATION); + RNA_def_property_ui_text(prop, + "Lock Rotation When Scaling", + "Do not rotate the segment when using the scale deform mode"); + RNA_def_property_update(prop, 0, "rna_Brush_update"); + prop = RNA_def_property(srna, "use_connected_only", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag2", BRUSH_USE_CONNECTED_ONLY); RNA_def_property_ui_text(prop, "Connected Only", "Affect only topologically connected elements"); |