Fix #123181: Sculpt Transform tools dont keep verts on the symmetry axis #123428
@ -138,6 +138,8 @@ static std::array<float4x4, 8> transform_matrices_init(
|
|||||||
return mats;
|
return mats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static constexpr float transform_mirror_max_distance_eps = 0.00002f;
|
||||||
|
|||||||
|
|
||||||
static void transform_node(Object &ob,
|
static void transform_node(Object &ob,
|
||||||
const std::array<float4x4, 8> &transform_mats,
|
const std::array<float4x4, 8> &transform_mats,
|
||||||
PBVHNode *node)
|
PBVHNode *node)
|
||||||
@ -149,6 +151,8 @@ static void transform_node(Object &ob,
|
|||||||
|
|
||||||
PBVHVertexIter vd;
|
PBVHVertexIter vd;
|
||||||
|
|
||||||
|
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(ob);
|
||||||
|
|
||||||
undo::push_node(ob, node, undo::Type::Position);
|
undo::push_node(ob, node, undo::Type::Position);
|
||||||
BKE_pbvh_vertex_iter_begin (*ss.pbvh, node, vd, PBVH_ITER_UNIQUE) {
|
BKE_pbvh_vertex_iter_begin (*ss.pbvh, node, vd, PBVH_ITER_UNIQUE) {
|
||||||
SCULPT_orig_vert_data_update(orig_data, vd);
|
SCULPT_orig_vert_data_update(orig_data, vd);
|
||||||
@ -172,6 +176,17 @@ static void transform_node(Object &ob,
|
|||||||
sub_v3_v3v3(disp, transformed_co, start_co);
|
sub_v3_v3v3(disp, transformed_co, start_co);
|
||||||
mul_v3_fl(disp, 1.0f - fade);
|
mul_v3_fl(disp, 1.0f - fade);
|
||||||
add_v3_v3v3(vd.co, start_co, disp);
|
add_v3_v3v3(vd.co, start_co, disp);
|
||||||
|
|
||||||
|
/* Keep vertices on the mirror axis. */
|
||||||
|
if ((symm & PAINT_SYMM_X) && (fabs(start_co[0]) < transform_mirror_max_distance_eps)) {
|
||||||
|
vd.co[0] = 0.0f;
|
||||||
|
}
|
||||||
|
if ((symm & PAINT_SYMM_Y) && (fabs(start_co[1]) < transform_mirror_max_distance_eps)) {
|
||||||
|
vd.co[1] = 0.0f;
|
||||||
|
}
|
||||||
|
if ((symm & PAINT_SYMM_Z) && (fabs(start_co[2]) < transform_mirror_max_distance_eps)) {
|
||||||
|
vd.co[2] = 0.0f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
BKE_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user
static constexpr const float transform_mirror_max_distance_eps = 0.00002f;
Agreed, but the
const
is unnecessaryOh, yeah, it seems we can not change
constexpr
varibles even at compile time...