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:
-rw-r--r--release/scripts/startup/bl_ui/properties_paint_common.py1
-rw-r--r--source/blender/blenkernel/intern/brush.c1
-rw-r--r--source/blender/blenloader/intern/versioning_280.c7
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c22
-rw-r--r--source/blender/makesdna/DNA_brush_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_brush.c6
6 files changed, 29 insertions, 9 deletions
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index ec3dec6c54d..7d2846acb72 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -620,6 +620,7 @@ def brush_settings(layout, context, brush, popover=False):
layout.prop(brush, "pose_offset")
layout.prop(brush, "pose_smooth_iterations")
layout.prop(brush, "pose_ik_segments")
+ layout.prop(brush, "use_pose_ik_anchored")
layout.separator()
if brush.sculpt_tool == 'SCRAPE':
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index a2e3a997408..effb3002630 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -1000,6 +1000,7 @@ void BKE_brush_sculpt_reset(Brush *br)
case SCULPT_TOOL_POSE:
br->pose_smooth_iterations = 4;
br->pose_ik_segments = 1;
+ br->flag2 |= BRUSH_POSE_IK_ANCHORED;
br->flag &= ~BRUSH_ALPHA_PRESSURE;
br->flag &= ~BRUSH_SPACE;
br->flag &= ~BRUSH_SPACE_ATTEN;
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index cb12efd0ec2..b570947739a 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -4440,5 +4440,12 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
br->pose_ik_segments = 1;
}
}
+
+ /* Pose brush keep anchor point. */
+ for (Brush *br = bmain->brushes.first; br; br = br->id.next) {
+ if (br->sculpt_tool == SCULPT_TOOL_POSE) {
+ br->flag2 |= BRUSH_POSE_IK_ANCHORED;
+ }
+ }
}
}
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
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index 278256f39c8..c5bf026983b 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -458,6 +458,7 @@ typedef enum eBrushSamplingFlags {
typedef enum eBrushFlags2 {
BRUSH_MULTIPLANE_SCRAPE_DYNAMIC = (1 << 0),
BRUSH_MULTIPLANE_SCRAPE_PLANES_PREVIEW = (1 << 1),
+ BRUSH_POSE_IK_ANCHORED = (1 << 2),
} eBrushFlags2;
typedef enum {
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 42f475dda94..0096aa3f29f 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -2099,6 +2099,12 @@ static void rna_def_brush(BlenderRNA *brna)
prop, "Show Cursor Preview", "Preview the scrape planes in the cursor during the stroke");
RNA_def_property_update(prop, 0, "rna_Brush_update");
+ prop = RNA_def_property(srna, "use_pose_ik_anchored", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag2", BRUSH_POSE_IK_ANCHORED);
+ RNA_def_property_ui_text(
+ prop, "Keep Anchor Point", "Keep the position of the last segmend in the IK chain fixed");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
prop = RNA_def_property(srna, "invert_to_scrape_fill", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_INVERT_TO_SCRAPE_FILL);
RNA_def_property_ui_text(prop,