[Bf-blender-cvs] [204de8c6db6] master: Sculpt: fix T103156: Scale square brush uvs by sqrt2.
Joseph Eagar
noreply at git.blender.org
Tue Dec 27 06:05:24 CET 2022
Commit: 204de8c6db646fd08b393a17a3b25a5de76611e4
Author: Joseph Eagar
Date: Mon Dec 26 21:03:26 2022 -0800
Branches: master
https://developer.blender.org/rB204de8c6db646fd08b393a17a3b25a5de76611e4
Sculpt: fix T103156: Scale square brush uvs by sqrt2.
Scale texture coordiantes for square brushes by sqrt2,
proportionally to how square they are (how close
tip_roundness is to zero).
Note: this is done in `calc_brush_local_mat()`, the
result of which appears to be used exclusively for
texture mapping.
===================================================================
M source/blender/editors/sculpt_paint/sculpt.cc
===================================================================
diff --git a/source/blender/editors/sculpt_paint/sculpt.cc b/source/blender/editors/sculpt_paint/sculpt.cc
index 9cb30c9f83d..899044145d3 100644
--- a/source/blender/editors/sculpt_paint/sculpt.cc
+++ b/source/blender/editors/sculpt_paint/sculpt.cc
@@ -2908,8 +2908,15 @@ static void calc_brush_local_mat(const MTex *mtex, Object *ob, float local_mat[4
copy_v3_v3(mat[3], cache->location);
/* Scale by brush radius. */
+ float radius = cache->radius;
+
+ /* Square tips should scale by square root of 2. */
+ if (sculpt_tool_has_cube_tip(cache->brush->sculpt_tool)) {
+ radius += (radius * M_SQRT2 - radius) * (1.0f - cache->brush->tip_roundness);
+ }
+
normalize_m4(mat);
- scale_m4_fl(scale, cache->radius);
+ scale_m4_fl(scale, radius);
mul_m4_m4m4(tmat, mat, scale);
/* Return inverse (for converting from model-space coords to local area coords). */
More information about the Bf-blender-cvs
mailing list