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:
authorPhilipp Oeser <info@graphics-engineer.com>2020-10-06 13:50:11 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2020-10-13 14:17:01 +0300
commitc11ae5cd21259a991b3cb1febdd4184fa62d789a (patch)
tree0bb29791dd416c82831c08805347b47e973de354 /source/blender/editors/sculpt_paint
parent3f78569c3e62ea3a184c7e0854e6e699c814cc72 (diff)
Fix sculpting/painting with viewport clipping and radial symmetry
This was reported for sculpting, the same is true for weightpaint or vertexpaint though. When viewport clipping and radial symmetry are enabled, the 'sculpt_brush_test_clipping()' function was not considering radial symmetry at all, so if the coordinate was outside the clipping planes, no action would take place. Now the coordinte is brought back to where the stroke actually happens and that is checked against clipping. Since other mirroring options while painting/sculpting (as well as editmode operations with mirroring) usually still take place even if the mirrored coord is outside the clipping planes, this should also be the case for radial symmetry. This grows the 'SculptBrushTest' struct a bit, but should be acceptable? Fixes T81466 Maniphest Tasks: T81466 Differential Revision: https://developer.blender.org/D9120
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c7
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_intern.h3
2 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 1a2848f1b38..806a9e4b0fb 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -1591,10 +1591,14 @@ void SCULPT_brush_test_init(SculptSession *ss, SculptBrushTest *test)
if (ss->cache) {
copy_v3_v3(test->location, ss->cache->location);
test->mirror_symmetry_pass = ss->cache->mirror_symmetry_pass;
+ test->radial_symmetry_pass = ss->cache->radial_symmetry_pass;
+ copy_m4_m4(test->symm_rot_mat_inv, ss->cache->symm_rot_mat_inv);
}
else {
copy_v3_v3(test->location, ss->cursor_location);
test->mirror_symmetry_pass = 0;
+ test->radial_symmetry_pass = 0;
+ unit_m4(test->symm_rot_mat_inv);
}
/* Just for initialize. */
@@ -1622,6 +1626,9 @@ BLI_INLINE bool sculpt_brush_test_clipping(const SculptBrushTest *test, const fl
}
float symm_co[3];
flip_v3_v3(symm_co, co, test->mirror_symmetry_pass);
+ if (test->radial_symmetry_pass) {
+ mul_m4_v3(test->symm_rot_mat_inv, symm_co);
+ }
return ED_view3d_clipping_test(rv3d, symm_co, true);
}
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index e6710e27115..84a47ab86ba 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -735,6 +735,9 @@ typedef struct SculptBrushTest {
float dist;
int mirror_symmetry_pass;
+ int radial_symmetry_pass;
+ float symm_rot_mat_inv[4][4];
+
/* For circle (not sphere) projection. */
float plane_view[4];