Cleanup: Standardize StrokeCache symmetry variable naming

Prior to this commit, variables inside `StrokeCache` used either a
`true_` prefix to indicate that the relevant position / normal /
displacement was not modified by symmetry, or a `_symmetry` / `_symm`
suffix to indicate that it was.

This commit changes all such variables to have a `_symm` suffix, as
that has fewer connotations than the `true_` prefix.

Pull Request: https://projects.blender.org/blender/blender/pulls/126902
This commit is contained in:
Sean Kim
2024-08-30 01:10:34 +02:00
committed by Sean Kim
parent ce0aafe3ef
commit b019e4235a
41 changed files with 300 additions and 286 deletions

View File

@@ -63,7 +63,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(*ss.bm, verts, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, verts, factors);
calc_front_face(cache.view_normal_symm, verts, factors);
}
tls.distances.resize(verts.size());
@@ -106,7 +106,7 @@ void do_bmesh_topology_rake_brush(const Depsgraph &depsgraph,
const int count = iterations * strength + 1;
const float factor = iterations * strength / count;
float3 direction = ss.cache->grab_delta_symmetry;
float3 direction = ss.cache->grab_delta_symm;
/* TODO: Is this just the same as one of the projection utility functions? */
float3 tmp = ss.cache->sculpt_normal_symm * math::dot(ss.cache->sculpt_normal_symm, direction);

View File

@@ -76,7 +76,7 @@ static void calc_faces(const Depsgraph &depsgraph,
const MutableSpan<float> factors = tls.factors;
fill_factor_from_hide_and_mask(mesh, verts, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, vert_normals, verts, factors);
calc_front_face(cache.view_normal_symm, vert_normals, verts, factors);
}
tls.distances.resize(verts.size());
@@ -120,7 +120,7 @@ static void calc_grids(const Depsgraph &depsgraph,
const MutableSpan<float> factors = tls.factors;
fill_factor_from_hide_and_mask(subdiv_ccg, grids, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, subdiv_ccg, grids, factors);
calc_front_face(cache.view_normal_symm, subdiv_ccg, grids, factors);
}
tls.distances.resize(positions.size());
@@ -163,7 +163,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
const MutableSpan<float> factors = tls.factors;
fill_factor_from_hide_and_mask(*ss.bm, verts, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, verts, factors);
calc_front_face(cache.view_normal_symm, verts, factors);
}
tls.distances.resize(verts.size());
@@ -213,7 +213,7 @@ void do_clay_brush(const Depsgraph &depsgraph,
displace = -displace;
}
const float3 modified_area_co = ss.cache->location + (area_no * ss.cache->scale * displace);
const float3 modified_area_co = ss.cache->location_symm + (area_no * ss.cache->scale * displace);
float4 test_plane;
plane_from_point_normal_v3(test_plane, modified_area_co, area_no);

View File

@@ -63,7 +63,7 @@ static void calc_faces(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(mesh, verts, factors);
filter_region_clip_factors(ss, positions_eval, verts, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, vert_normals, verts, factors);
calc_front_face(cache.view_normal_symm, vert_normals, verts, factors);
}
tls.distances.resize(verts.size());
@@ -118,7 +118,7 @@ static void calc_grids(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(subdiv_ccg, grids, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, subdiv_ccg, grids, factors);
calc_front_face(cache.view_normal_symm, subdiv_ccg, grids, factors);
}
tls.distances.resize(positions.size());
@@ -173,7 +173,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(*ss.bm, verts, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, verts, factors);
calc_front_face(cache.view_normal_symm, verts, factors);
}
tls.distances.resize(verts.size());
@@ -214,7 +214,7 @@ void do_clay_strips_brush(const Depsgraph &depsgraph,
const IndexMask &node_mask)
{
SculptSession &ss = *object.sculpt;
if (math::is_zero(ss.cache->grab_delta_symmetry)) {
if (math::is_zero(ss.cache->grab_delta_symm)) {
return;
}
@@ -249,7 +249,7 @@ void do_clay_strips_brush(const Depsgraph &depsgraph,
const float3 area_position_displaced = area_position + area_normal * -radius * 0.7f;
float4x4 mat = float4x4::identity();
mat.x_axis() = math::cross(area_normal, ss.cache->grab_delta_symmetry);
mat.x_axis() = math::cross(area_normal, ss.cache->grab_delta_symm);
mat.y_axis() = math::cross(area_normal, float3(mat[0]));
mat.z_axis() = area_normal;
mat.location() = area_position_displaced;

View File

@@ -65,7 +65,7 @@ static void calc_faces(const Depsgraph &depsgraph,
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, vert_normals, verts, factors);
calc_front_face(cache.view_normal_symm, vert_normals, verts, factors);
}
tls.distances.resize(verts.size());
@@ -111,7 +111,7 @@ static void calc_grids(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(subdiv_ccg, grids, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, subdiv_ccg, grids, factors);
calc_front_face(cache.view_normal_symm, subdiv_ccg, grids, factors);
}
tls.distances.resize(positions.size());
@@ -157,7 +157,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(*ss.bm, verts, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, verts, factors);
calc_front_face(cache.view_normal_symm, verts, factors);
}
tls.distances.resize(verts.size());
@@ -192,7 +192,7 @@ void do_clay_thumb_brush(const Depsgraph &depsgraph,
{
const SculptSession &ss = *object.sculpt;
const Brush &brush = *BKE_paint_brush_for_read(&sd.paint);
const float3 &location = ss.cache->location;
const float3 &location = ss.cache->location_symm;
/* Sampled geometry normal and area center. */
float3 area_no_sp;
@@ -224,16 +224,16 @@ void do_clay_thumb_brush(const Depsgraph &depsgraph,
ss.cache->clay_thumb_brush.front_angle, 0.0f, 60.0f);
}
if (math::is_zero(ss.cache->grab_delta_symmetry)) {
if (math::is_zero(ss.cache->grab_delta_symm)) {
return;
}
/* Initialize brush local-space matrix. */
float4x4 mat = float4x4::identity();
mat.x_axis() = math::cross(area_no, ss.cache->grab_delta_symmetry);
mat.x_axis() = math::cross(area_no, ss.cache->grab_delta_symm);
mat.y_axis() = math::cross(area_no, mat.x_axis());
mat.z_axis() = area_no;
mat.location() = ss.cache->location;
mat.location() = ss.cache->location_symm;
normalize_m4(mat.ptr());
/* Scale brush local space matrix. */

View File

@@ -89,7 +89,7 @@ static void calc_faces(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(mesh, verts, factors);
filter_region_clip_factors(ss, positions_eval, verts, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, vert_normals, verts, factors);
calc_front_face(cache.view_normal_symm, vert_normals, verts, factors);
}
tls.distances.resize(verts.size());
@@ -106,10 +106,10 @@ static void calc_faces(const Depsgraph &depsgraph,
tls.translations.resize(verts.size());
const MutableSpan<float3> translations = tls.translations;
translations_from_position(positions_eval, verts, cache.location, translations);
translations_from_position(positions_eval, verts, cache.location_symm, translations);
if (brush.falloff_shape == PAINT_FALLOFF_SHAPE_TUBE) {
project_translations(translations, cache.view_normal);
project_translations(translations, cache.view_normal_symm);
}
scale_translations(translations, factors);
@@ -145,7 +145,7 @@ static void calc_grids(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(subdiv_ccg, grids, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, subdiv_ccg, grids, factors);
calc_front_face(cache.view_normal_symm, subdiv_ccg, grids, factors);
}
tls.distances.resize(positions.size());
@@ -161,10 +161,10 @@ static void calc_grids(const Depsgraph &depsgraph,
tls.translations.resize(positions.size());
const MutableSpan<float3> translations = tls.translations;
translations_from_position(positions, cache.location, translations);
translations_from_position(positions, cache.location_symm, translations);
if (brush.falloff_shape == PAINT_FALLOFF_SHAPE_TUBE) {
project_translations(translations, cache.view_normal);
project_translations(translations, cache.view_normal_symm);
}
scale_translations(translations, factors);
@@ -198,7 +198,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(*ss.bm, verts, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, verts, factors);
calc_front_face(cache.view_normal_symm, verts, factors);
}
tls.distances.resize(verts.size());
@@ -214,10 +214,10 @@ static void calc_bmesh(const Depsgraph &depsgraph,
tls.translations.resize(verts.size());
const MutableSpan<float3> translations = tls.translations;
translations_from_position(positions, cache.location, translations);
translations_from_position(positions, cache.location_symm, translations);
if (brush.falloff_shape == PAINT_FALLOFF_SHAPE_TUBE) {
project_translations(translations, cache.view_normal);
project_translations(translations, cache.view_normal_symm);
}
scale_translations(translations, factors);

View File

@@ -58,7 +58,7 @@ static void calc_faces(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(mesh, verts, factors);
filter_region_clip_factors(ss, positions_eval, verts, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, vert_normals, verts, factors);
calc_front_face(cache.view_normal_symm, vert_normals, verts, factors);
}
tls.distances.resize(verts.size());
@@ -100,7 +100,7 @@ static void calc_grids(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(subdiv_ccg, grids, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, subdiv_ccg, grids, factors);
calc_front_face(cache.view_normal_symm, subdiv_ccg, grids, factors);
}
tls.distances.resize(positions.size());
@@ -141,7 +141,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(*ss.bm, verts, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, verts, factors);
calc_front_face(cache.view_normal_symm, verts, factors);
}
tls.distances.resize(verts.size());
@@ -246,7 +246,7 @@ void do_nudge_brush(const Depsgraph &depsgraph,
const SculptSession &ss = *object.sculpt;
const float3 offset = math::cross(
math::cross(ss.cache->sculpt_normal_symm, ss.cache->grab_delta_symmetry),
math::cross(ss.cache->sculpt_normal_symm, ss.cache->grab_delta_symm),
ss.cache->sculpt_normal_symm);
offset_positions(depsgraph, sd, object, offset * ss.cache->bstrength, node_mask);
@@ -259,8 +259,8 @@ void do_gravity_brush(const Depsgraph &depsgraph,
{
const SculptSession &ss = *object.sculpt;
const float3 offset = ss.cache->gravity_direction * -ss.cache->radius_squared * ss.cache->scale *
sd.gravity_factor;
const float3 offset = ss.cache->gravity_direction_symm * -ss.cache->radius_squared *
ss.cache->scale * sd.gravity_factor;
offset_positions(depsgraph, sd, object, offset, node_mask);
}

View File

@@ -143,7 +143,7 @@ static void calc_faces(const Depsgraph &depsgraph,
filter_region_clip_factors(ss, face_centers, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, face_normals, factors);
calc_front_face(cache.view_normal_symm, face_normals, factors);
}
tls.distances.resize(face_indices.size());
@@ -249,7 +249,7 @@ static void calc_grids(const Depsgraph &depsgraph,
blender::ed::sculpt_paint::fill_factor_from_hide_and_mask(subdiv_ccg, grids, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, subdiv_ccg, grids, factors);
calc_front_face(cache.view_normal_symm, subdiv_ccg, grids, factors);
}
tls.distances.resize(positions.size());
@@ -387,7 +387,7 @@ static void calc_bmesh(Object &object,
fill_factor_from_hide_and_mask(*ss.bm, faces, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, faces, factors);
calc_front_face(cache.view_normal_symm, faces, factors);
}
tls.distances.resize(faces.size());

View File

@@ -57,7 +57,7 @@ static void calc_faces(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(mesh, verts, factors);
filter_region_clip_factors(ss, orig_data.positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, orig_data.normals, factors);
calc_front_face(cache.view_normal_symm, orig_data.normals, factors);
}
tls.distances.resize(verts.size());
@@ -101,7 +101,7 @@ static void calc_grids(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(subdiv_ccg, grids, factors);
filter_region_clip_factors(ss, orig_data.positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, orig_data.normals, grids, factors);
calc_front_face(cache.view_normal_symm, orig_data.normals, grids, factors);
}
tls.distances.resize(grid_verts_num);
@@ -146,7 +146,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(*ss.bm, verts, factors);
filter_region_clip_factors(ss, orig_positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, orig_normals, factors);
calc_front_face(cache.view_normal_symm, orig_normals, factors);
}
tls.distances.resize(verts.size());

View File

@@ -99,7 +99,7 @@ static void calc_faces(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(mesh, verts, factors);
filter_region_clip_factors(ss, positions_eval, verts, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, vert_normals, verts, factors);
calc_front_face(cache.view_normal_symm, vert_normals, verts, factors);
}
tls.distances.resize(verts.size());
@@ -144,7 +144,7 @@ static void calc_grids(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(subdiv_ccg, grids, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, subdiv_ccg, grids, factors);
calc_front_face(cache.view_normal_symm, subdiv_ccg, grids, factors);
}
tls.distances.resize(positions.size());
@@ -188,7 +188,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(*ss.bm, verts, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, verts, factors);
calc_front_face(cache.view_normal_symm, verts, factors);
}
tls.distances.resize(verts.size());

View File

@@ -111,8 +111,13 @@ static void calc_faces(const Depsgraph &depsgraph,
tls.translations.resize(verts.size());
const MutableSpan<float3> translations = tls.translations;
calc_translations(
brush, cache, kelvinet_params, cache.location, offset, orig_data.positions, translations);
calc_translations(brush,
cache,
kelvinet_params,
cache.location_symm,
offset,
orig_data.positions,
translations);
scale_translations(translations, factors);
@@ -146,8 +151,13 @@ static void calc_grids(const Depsgraph &depsgraph,
tls.translations.resize(grid_verts_num);
const MutableSpan<float3> translations = tls.translations;
calc_translations(
brush, cache, kelvinet_params, cache.location, offset, orig_data.positions, translations);
calc_translations(brush,
cache,
kelvinet_params,
cache.location_symm,
offset,
orig_data.positions,
translations);
scale_translations(translations, factors);
@@ -183,7 +193,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
tls.translations.resize(verts.size());
const MutableSpan<float3> translations = tls.translations;
calc_translations(
brush, cache, kelvinet_params, cache.location, offset, orig_positions, translations);
brush, cache, kelvinet_params, cache.location_symm, offset, orig_positions, translations);
scale_translations(translations, factors);
@@ -202,7 +212,7 @@ void do_elastic_deform_brush(const Depsgraph &depsgraph,
const Brush &brush = *BKE_paint_brush_for_read(&sd.paint);
const float strength = ss.cache->bstrength;
float3 grab_delta = ss.cache->grab_delta_symmetry;
float3 grab_delta = ss.cache->grab_delta_symm;
if (ss.cache->normal_weight > 0.0f) {
sculpt_project_v3_normal_align(ss, ss.cache->normal_weight, grab_delta);
}

View File

@@ -58,7 +58,7 @@ static void calc_faces(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(mesh, verts, factors);
filter_region_clip_factors(ss, positions_eval, verts, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, vert_normals, verts, factors);
calc_front_face(cache.view_normal_symm, vert_normals, verts, factors);
}
tls.distances.resize(verts.size());
@@ -104,7 +104,7 @@ static void calc_grids(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(subdiv_ccg, grids, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, subdiv_ccg, grids, factors);
calc_front_face(cache.view_normal_symm, subdiv_ccg, grids, factors);
}
tls.distances.resize(positions.size());
@@ -148,7 +148,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(*ss.bm, verts, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, verts, factors);
calc_front_face(cache.view_normal_symm, verts, factors);
}
tls.distances.resize(verts.size());

View File

@@ -60,7 +60,7 @@ static void calc_faces(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(mesh, verts, factors);
filter_region_clip_factors(ss, positions_eval, verts, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, vert_normals, verts, factors);
calc_front_face(cache.view_normal_symm, vert_normals, verts, factors);
}
tls.distances.resize(verts.size());
@@ -109,7 +109,7 @@ static void calc_grids(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(subdiv_ccg, grids, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, subdiv_ccg, grids, factors);
calc_front_face(cache.view_normal_symm, subdiv_ccg, grids, factors);
}
tls.distances.resize(positions.size());
@@ -157,7 +157,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(*ss.bm, verts, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, verts, factors);
calc_front_face(cache.view_normal_symm, verts, factors);
}
tls.distances.resize(verts.size());

View File

@@ -59,7 +59,7 @@ static void calc_faces(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(mesh, verts, factors);
filter_region_clip_factors(ss, positions_eval, verts, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, vert_normals, verts, factors);
calc_front_face(cache.view_normal_symm, vert_normals, verts, factors);
}
tls.distances.resize(verts.size());
@@ -106,7 +106,7 @@ static void calc_grids(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(subdiv_ccg, grids, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, subdiv_ccg, grids, factors);
calc_front_face(cache.view_normal_symm, subdiv_ccg, grids, factors);
}
tls.distances.resize(positions.size());
@@ -152,7 +152,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(*ss.bm, verts, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, verts, factors);
calc_front_face(cache.view_normal_symm, verts, factors);
}
tls.distances.resize(verts.size());

View File

@@ -42,7 +42,7 @@ BLI_NOINLINE static void calc_silhouette_factors(const StrokeCache &cache,
{
BLI_assert(normals.size() == factors.size());
const float sign = math::sign(math::dot(cache.initial_normal, cache.grab_delta_symmetry));
const float sign = math::sign(math::dot(cache.initial_normal_symm, cache.grab_delta_symm));
const float3 test_dir = math::normalize(offset) * sign;
for (const int i : factors.index_range()) {
factors[i] *= std::max(math::dot(test_dir, normals[i]), 0.0f);
@@ -71,7 +71,7 @@ static void calc_faces(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(mesh, verts, factors);
filter_region_clip_factors(ss, orig_data.positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, orig_data.normals, factors);
calc_front_face(cache.view_normal_symm, orig_data.normals, factors);
}
tls.distances.resize(verts.size());
@@ -119,7 +119,7 @@ static void calc_grids(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(subdiv_ccg, grids, factors);
filter_region_clip_factors(ss, orig_data.positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, orig_data.normals, factors);
calc_front_face(cache.view_normal_symm, orig_data.normals, factors);
}
tls.distances.resize(grid_verts_num);
@@ -168,7 +168,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(*ss.bm, verts, factors);
filter_region_clip_factors(ss, orig_positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, orig_normals, factors);
calc_front_face(cache.view_normal_symm, orig_normals, factors);
}
tls.distances.resize(verts.size());
@@ -204,7 +204,7 @@ void do_grab_brush(const Depsgraph &depsgraph,
const SculptSession &ss = *object.sculpt;
const Brush &brush = *BKE_paint_brush_for_read(&sd.paint);
float3 grab_delta = ss.cache->grab_delta_symmetry;
float3 grab_delta = ss.cache->grab_delta_symm;
if (ss.cache->normal_weight > 0.0f) {
sculpt_project_v3_normal_align(ss, ss.cache->normal_weight, grab_delta);

View File

@@ -65,7 +65,7 @@ static void calc_faces(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(mesh, verts, factors);
filter_region_clip_factors(ss, positions_eval, verts, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, vert_normals, verts, factors);
calc_front_face(cache.view_normal_symm, vert_normals, verts, factors);
}
tls.distances.resize(verts.size());
@@ -107,7 +107,7 @@ static void calc_grids(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(subdiv_ccg, grids, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, subdiv_ccg, grids, factors);
calc_front_face(cache.view_normal_symm, subdiv_ccg, grids, factors);
}
tls.distances.resize(positions.size());
@@ -150,7 +150,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(*ss.bm, verts, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, verts, factors);
calc_front_face(cache.view_normal_symm, verts, factors);
}
tls.distances.resize(verts.size());

View File

@@ -141,7 +141,7 @@ static void calc_faces(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(mesh, verts, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, vert_normals, verts, factors);
calc_front_face(cache.view_normal_symm, vert_normals, verts, factors);
}
tls.distances.resize(verts.size());
@@ -235,7 +235,7 @@ static void calc_grids(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(subdiv_ccg, grids, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, subdiv_ccg, grids, factors);
calc_front_face(cache.view_normal_symm, subdiv_ccg, grids, factors);
}
tls.distances.resize(positions.size());
@@ -300,7 +300,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(*ss.bm, verts, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, verts, factors);
calc_front_face(cache.view_normal_symm, verts, factors);
}
tls.distances.resize(verts.size());

View File

@@ -81,7 +81,7 @@ static void calc_faces(const Depsgraph &depsgraph,
fill_factor_from_hide(mesh, verts, factors);
filter_region_clip_factors(ss, positions, verts, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, vert_normals, verts, factors);
calc_front_face(cache.view_normal_symm, vert_normals, verts, factors);
}
tls.distances.resize(verts.size());
@@ -129,7 +129,7 @@ static void calc_grids(const Depsgraph &depsgraph,
fill_factor_from_hide(subdiv_ccg, grids, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, subdiv_ccg, grids, factors);
calc_front_face(cache.view_normal_symm, subdiv_ccg, grids, factors);
}
tls.distances.resize(positions.size());
@@ -177,7 +177,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
fill_factor_from_hide(verts, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, verts, factors);
calc_front_face(cache.view_normal_symm, verts, factors);
}
tls.distances.resize(verts.size());

View File

@@ -147,7 +147,7 @@ static void sample_node_surface_mesh(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(mesh, verts, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, vert_normals, verts, factors);
calc_front_face(cache.view_normal_symm, vert_normals, verts, factors);
}
auto_mask::calc_vert_factors(depsgraph, object, cache.automasking.get(), node, verts, factors);
@@ -190,7 +190,7 @@ static void sample_node_surface_grids(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(subdiv_ccg, grids, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, subdiv_ccg, grids, factors);
calc_front_face(cache.view_normal_symm, subdiv_ccg, grids, factors);
}
auto_mask::calc_grids_factors(depsgraph, object, cache.automasking.get(), node, grids, factors);
@@ -236,7 +236,7 @@ static void sample_node_surface_bmesh(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(*ss.bm, verts, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, verts, factors);
calc_front_face(cache.view_normal_symm, verts, factors);
}
auto_mask::calc_vert_factors(depsgraph, object, cache.automasking.get(), node, verts, factors);
@@ -360,7 +360,7 @@ static void calc_faces(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(mesh, verts, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, vert_normals, verts, factors);
calc_front_face(cache.view_normal_symm, vert_normals, verts, factors);
}
auto_mask::calc_vert_factors(depsgraph, object, cache.automasking.get(), node, verts, factors);
@@ -418,7 +418,7 @@ static void calc_grids(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(subdiv_ccg, grids, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, subdiv_ccg, grids, factors);
calc_front_face(cache.view_normal_symm, subdiv_ccg, grids, factors);
}
auto_mask::calc_grids_factors(depsgraph, object, cache.automasking.get(), node, grids, factors);
@@ -476,7 +476,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(*ss.bm, verts, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, verts, factors);
calc_front_face(cache.view_normal_symm, verts, factors);
}
auto_mask::calc_vert_factors(depsgraph, object, cache.automasking.get(), node, verts, factors);
@@ -543,7 +543,7 @@ void do_multiplane_scrape_brush(const Depsgraph &depsgraph,
return;
}
if (is_zero_v3(ss.cache->grab_delta_symmetry)) {
if (is_zero_v3(ss.cache->grab_delta_symm)) {
return;
}
@@ -551,10 +551,10 @@ void do_multiplane_scrape_brush(const Depsgraph &depsgraph,
/* Init brush local space matrix. */
float4x4 mat = float4x4::identity();
mat.x_axis() = math::cross(area_no, ss.cache->grab_delta_symmetry);
mat.x_axis() = math::cross(area_no, ss.cache->grab_delta_symm);
mat.y_axis() = math::cross(area_no, mat.x_axis());
mat.z_axis() = area_no;
mat.location() = ss.cache->location;
mat.location() = ss.cache->location_symm;
/* NOTE: #math::normalize behaves differently for some reason. */
normalize_m4(mat.ptr());
mat = math::invert(mat);
@@ -582,7 +582,7 @@ void do_multiplane_scrape_brush(const Depsgraph &depsgraph,
math::normalize(sample.area_nos[1] * 1.0f / float(sample.area_count[1]))};
float sampled_angle = angle_v3v3(sampled_plane_normals[0], sampled_plane_normals[1]);
const std::array<float3, 2> sampled_cv{area_no, ss.cache->location - mid_co};
const std::array<float3, 2> sampled_cv{area_no, ss.cache->location_symm - mid_co};
sampled_angle += DEG2RADF(brush.multiplane_scrape_angle) * ss.cache->pressure;
@@ -597,7 +597,7 @@ void do_multiplane_scrape_brush(const Depsgraph &depsgraph,
sampled_angle = 0.0f;
}
else {
area_co = ss.cache->location;
area_co = ss.cache->location_symm;
}
/* Interpolate between the previous and new sampled angles to avoid artifacts when if angle
@@ -607,7 +607,7 @@ void do_multiplane_scrape_brush(const Depsgraph &depsgraph,
}
else {
/* Standard mode: Scrape with the brush property fixed angle. */
area_co = ss.cache->location;
area_co = ss.cache->location_symm;
ss.cache->multiplane_scrape_angle = brush.multiplane_scrape_angle;
if (flip) {
ss.cache->multiplane_scrape_angle *= -1.0f;

View File

@@ -65,7 +65,7 @@ static void calc_node(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(subdiv_ccg, grids, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, subdiv_ccg, grids, factors);
calc_front_face(cache.view_normal_symm, subdiv_ccg, grids, factors);
}
tls.distances.resize(positions.size());

View File

@@ -54,7 +54,7 @@ static void calc_node(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(subdiv_ccg, grids, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, subdiv_ccg, grids, factors);
calc_front_face(cache.view_normal_symm, subdiv_ccg, grids, factors);
}
tls.distances.resize(positions.size());
@@ -86,13 +86,13 @@ static void calc_node(const Depsgraph &depsgraph,
float3 current_disp;
switch (brush.smear_deform_type) {
case BRUSH_SMEAR_DEFORM_DRAG:
current_disp = cache.location - cache.last_location;
current_disp = cache.location_symm - cache.last_location_symm;
break;
case BRUSH_SMEAR_DEFORM_PINCH:
current_disp = cache.location - positions[node_vert_index];
current_disp = cache.location_symm - positions[node_vert_index];
break;
case BRUSH_SMEAR_DEFORM_EXPAND:
current_disp = positions[node_vert_index] - cache.location;
current_disp = positions[node_vert_index] - cache.location_symm;
break;
}

View File

@@ -84,7 +84,7 @@ static void calc_faces(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(mesh, verts, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, vert_normals, verts, factors);
calc_front_face(cache.view_normal_symm, vert_normals, verts, factors);
}
tls.distances.resize(verts.size());
@@ -102,9 +102,9 @@ static void calc_faces(const Depsgraph &depsgraph,
tls.translations.resize(verts.size());
const MutableSpan<float3> translations = tls.translations;
calc_translations(positions, cache.location, stroke_xz, translations);
calc_translations(positions, cache.location_symm, stroke_xz, translations);
if (brush.falloff_shape == PAINT_FALLOFF_SHAPE_TUBE) {
project_translations(translations, cache.view_normal);
project_translations(translations, cache.view_normal_symm);
}
scale_translations(translations, factors);
@@ -133,7 +133,7 @@ static void calc_grids(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(subdiv_ccg, grids, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, subdiv_ccg, grids, factors);
calc_front_face(cache.view_normal_symm, subdiv_ccg, grids, factors);
}
tls.distances.resize(positions.size());
@@ -151,9 +151,9 @@ static void calc_grids(const Depsgraph &depsgraph,
tls.translations.resize(positions.size());
const MutableSpan<float3> translations = tls.translations;
calc_translations(positions, cache.location, stroke_xz, translations);
calc_translations(positions, cache.location_symm, stroke_xz, translations);
if (brush.falloff_shape == PAINT_FALLOFF_SHAPE_TUBE) {
project_translations(translations, cache.view_normal);
project_translations(translations, cache.view_normal_symm);
}
scale_translations(translations, factors);
@@ -183,7 +183,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(*ss.bm, verts, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, verts, factors);
calc_front_face(cache.view_normal_symm, verts, factors);
}
tls.distances.resize(verts.size());
@@ -201,9 +201,9 @@ static void calc_bmesh(const Depsgraph &depsgraph,
tls.translations.resize(verts.size());
const MutableSpan<float3> translations = tls.translations;
calc_translations(positions, cache.location, stroke_xz, translations);
calc_translations(positions, cache.location_symm, stroke_xz, translations);
if (brush.falloff_shape == PAINT_FALLOFF_SHAPE_TUBE) {
project_translations(translations, cache.view_normal);
project_translations(translations, cache.view_normal_symm);
}
scale_translations(translations, factors);
@@ -231,16 +231,16 @@ void do_pinch_brush(const Depsgraph &depsgraph,
return;
}
if (math::is_zero(ss.cache->grab_delta_symmetry)) {
if (math::is_zero(ss.cache->grab_delta_symm)) {
return;
}
/* Initialize `mat`. */
float4x4 mat = float4x4::identity();
mat.x_axis() = math::cross(area_no, ss.cache->grab_delta_symmetry);
mat.x_axis() = math::cross(area_no, ss.cache->grab_delta_symm);
mat.y_axis() = math::cross(area_no, mat.x_axis());
mat.z_axis() = area_no;
mat.location() = ss.cache->location;
mat.location() = ss.cache->location_symm;
normalize_m4(mat.ptr());
const std::array<float3, 2> stroke_xz{math::normalize(mat.x_axis()),

View File

@@ -119,7 +119,7 @@ BLI_NOINLINE static void calc_factors_faces(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(mesh, verts, factors);
filter_region_clip_factors(ss, positions_eval, verts, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, vert_normals, verts, factors);
calc_front_face(cache.view_normal_symm, vert_normals, verts, factors);
}
tls.distances.resize(verts.size());
@@ -240,7 +240,7 @@ BLI_NOINLINE static void calc_factors_grids(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(subdiv_ccg, grids, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, subdiv_ccg, grids, factors);
calc_front_face(cache.view_normal_symm, subdiv_ccg, grids, factors);
}
tls.distances.resize(grid_verts_num);
@@ -359,7 +359,7 @@ static void calc_factors_bmesh(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(*ss.bm, verts, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, verts, factors);
calc_front_face(cache.view_normal_symm, verts, factors);
}
tls.distances.resize(verts.size());
@@ -456,7 +456,7 @@ BLI_NOINLINE static void calc_topology_relax_factors_faces(const Depsgraph &deps
fill_factor_from_hide_and_mask(mesh, verts, factors);
filter_region_clip_factors(ss, orig_data.positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, orig_data.normals, factors);
calc_front_face(cache.view_normal_symm, orig_data.normals, factors);
}
tls.distances.resize(verts.size());
@@ -568,7 +568,7 @@ BLI_NOINLINE static void calc_topology_relax_factors_grids(const Depsgraph &deps
fill_factor_from_hide_and_mask(subdiv_ccg, grids, factors);
filter_region_clip_factors(ss, orig_data.positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, orig_data.normals, factors);
calc_front_face(cache.view_normal_symm, orig_data.normals, factors);
}
tls.distances.resize(grid_verts_num);
@@ -679,7 +679,7 @@ static void calc_topology_relax_factors_bmesh(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(*ss.bm, verts, factors);
filter_region_clip_factors(ss, orig_positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, orig_normals, factors);
calc_front_face(cache.view_normal_symm, orig_normals, factors);
}
tls.distances.resize(verts.size());

View File

@@ -75,7 +75,7 @@ static void calc_faces(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(mesh, verts, factors);
filter_region_clip_factors(ss, orig_data.positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, orig_data.normals, factors);
calc_front_face(cache.view_normal_symm, orig_data.normals, factors);
}
tls.distances.resize(verts.size());
@@ -95,7 +95,7 @@ static void calc_faces(const Depsgraph &depsgraph,
tls.translations.resize(verts.size());
const MutableSpan<float3> translations = tls.translations;
calc_translations(
orig_data.positions, cache.sculpt_normal_symm, factors, cache.location, translations);
orig_data.positions, cache.sculpt_normal_symm, factors, cache.location_symm, translations);
write_translations(depsgraph, sd, object, positions_eval, verts, translations, positions_orig);
}
@@ -123,7 +123,7 @@ static void calc_grids(const Depsgraph &depsgraph,
filter_region_clip_factors(ss, orig_data.positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, orig_data.normals, factors);
calc_front_face(cache.view_normal_symm, orig_data.normals, factors);
}
tls.distances.resize(grid_verts_num);
@@ -143,7 +143,7 @@ static void calc_grids(const Depsgraph &depsgraph,
tls.translations.resize(grid_verts_num);
const MutableSpan<float3> translations = tls.translations;
calc_translations(
orig_data.positions, cache.sculpt_normal_symm, factors, cache.location, translations);
orig_data.positions, cache.sculpt_normal_symm, factors, cache.location_symm, translations);
clip_and_lock_translations(sd, ss, orig_data.positions, translations);
apply_translations(translations, grids, subdiv_ccg);
@@ -171,7 +171,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(*ss.bm, verts, factors);
filter_region_clip_factors(ss, orig_positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, orig_normals, factors);
calc_front_face(cache.view_normal_symm, orig_normals, factors);
}
tls.distances.resize(verts.size());
@@ -190,7 +190,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
tls.translations.resize(verts.size());
const MutableSpan<float3> translations = tls.translations;
calc_translations(
orig_positions, cache.sculpt_normal_symm, factors, cache.location, translations);
orig_positions, cache.sculpt_normal_symm, factors, cache.location_symm, translations);
clip_and_lock_translations(sd, ss, orig_positions, translations);
apply_translations(translations, verts);

View File

@@ -60,7 +60,7 @@ static void calc_faces(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(mesh, verts, factors);
filter_region_clip_factors(ss, positions_eval, verts, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, vert_normals, verts, factors);
calc_front_face(cache.view_normal_symm, vert_normals, verts, factors);
}
tls.distances.resize(verts.size());
@@ -109,7 +109,7 @@ static void calc_grids(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(subdiv_ccg, grids, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, subdiv_ccg, grids, factors);
calc_front_face(cache.view_normal_symm, subdiv_ccg, grids, factors);
}
tls.distances.resize(positions.size());
@@ -158,7 +158,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(*ss.bm, verts, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, verts, factors);
calc_front_face(cache.view_normal_symm, verts, factors);
}
tls.distances.resize(verts.size());

View File

@@ -77,7 +77,7 @@ BLI_NOINLINE static void apply_positions_faces(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(mesh, verts, factors);
filter_region_clip_factors(ss, positions_eval, verts, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, vert_normals, verts, factors);
calc_front_face(cache.view_normal_symm, vert_normals, verts, factors);
}
tls.distances.resize(verts.size());
@@ -194,7 +194,7 @@ static void calc_grids(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(subdiv_ccg, grids, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, subdiv_ccg, grids, factors);
calc_front_face(cache.view_normal_symm, subdiv_ccg, grids, factors);
}
tls.distances.resize(positions.size());
@@ -243,7 +243,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(*ss.bm, verts, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, verts, factors);
calc_front_face(cache.view_normal_symm, verts, factors);
}
tls.distances.resize(verts.size());

View File

@@ -88,7 +88,7 @@ static void apply_masks_faces(const Depsgraph &depsgraph,
fill_factor_from_hide(mesh, verts, factors);
filter_region_clip_factors(ss, positions_eval, verts, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, vert_normals, verts, factors);
calc_front_face(cache.view_normal_symm, vert_normals, verts, factors);
}
tls.distances.resize(verts.size());
@@ -199,7 +199,7 @@ static void calc_grids(const Depsgraph &depsgraph,
fill_factor_from_hide(subdiv_ccg, grids, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, subdiv_ccg, grids, factors);
calc_front_face(cache.view_normal_symm, subdiv_ccg, grids, factors);
}
tls.distances.resize(positions.size());
@@ -252,7 +252,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
fill_factor_from_hide(verts, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, verts, factors);
calc_front_face(cache.view_normal_symm, verts, factors);
}
tls.distances.resize(verts.size());

View File

@@ -77,7 +77,7 @@ static float3 sculpt_rake_rotate(const StrokeCache &cache,
float factor)
{
float3 vec_rot = v_co - sculpt_co;
const math::Quaternion rotation = math::pow(*cache.rake_rotation_symmetry, factor);
const math::Quaternion rotation = math::pow(*cache.rake_rotation_symm, factor);
vec_rot = math::transform_point(rotation, vec_rot);
vec_rot += sculpt_co;
@@ -101,10 +101,10 @@ BLI_NOINLINE static void calc_pinch_influence(const Brush &brush,
for (const int i : positions.index_range()) {
/* Negative pinch will inflate, helps maintain volume. */
float3 delta_pinch = positions[i] - cache.location;
float3 delta_pinch = positions[i] - cache.location_symm;
if (brush.falloff_shape == PAINT_FALLOFF_SHAPE_TUBE) {
project_plane_v3_v3v3(delta_pinch, delta_pinch, cache.true_view_normal);
project_plane_v3_v3v3(delta_pinch, delta_pinch, cache.view_normal);
}
/* Important to calculate based on the grabbed location
@@ -133,11 +133,11 @@ BLI_NOINLINE static void calc_rake_rotation_influence(const StrokeCache &cache,
const Span<float> factors,
const MutableSpan<float3> translations)
{
if (!cache.rake_rotation_symmetry) {
if (!cache.rake_rotation_symm) {
return;
}
for (const int i : positions.index_range()) {
translations[i] += sculpt_rake_rotate(cache, cache.location, positions[i], factors[i]);
translations[i] += sculpt_rake_rotate(cache, cache.location_symm, positions[i], factors[i]);
}
}
@@ -150,7 +150,7 @@ BLI_NOINLINE static void calc_kelvinet_translation(const StrokeCache &cache,
BKE_kelvinlet_init_params(&params, cache.radius, cache.bstrength, 1.0f, 0.4f);
for (const int i : positions.index_range()) {
float3 disp;
BKE_kelvinlet_grab_triscale(disp, &params, positions[i], cache.location, translations[i]);
BKE_kelvinlet_grab_triscale(disp, &params, positions[i], cache.location_symm, translations[i]);
translations[i] = disp * factors[i];
}
}
@@ -185,7 +185,7 @@ static void calc_faces(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(mesh, verts, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, vert_normals, verts, factors);
calc_front_face(cache.view_normal_symm, vert_normals, verts, factors);
}
tls.distances.resize(verts.size());
@@ -246,7 +246,7 @@ static void calc_grids(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(subdiv_ccg, grids, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, subdiv_ccg, grids, factors);
calc_front_face(cache.view_normal_symm, subdiv_ccg, grids, factors);
}
tls.distances.resize(positions.size());
@@ -309,7 +309,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(*ss.bm, verts, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, verts, factors);
calc_front_face(cache.view_normal_symm, verts, factors);
}
tls.distances.resize(verts.size());
@@ -357,7 +357,7 @@ void do_snake_hook_brush(const Depsgraph &depsgraph,
SculptProjectVector spvc;
float3 grab_delta = ss.cache->grab_delta_symmetry;
float3 grab_delta = ss.cache->grab_delta_symm;
if (bstrength < 0.0f) {
grab_delta *= -1.0f;

View File

@@ -82,7 +82,7 @@ BLI_NOINLINE static void do_surface_smooth_brush_mesh(const Depsgraph &depsgraph
fill_factor_from_hide_and_mask(mesh, verts, factors);
filter_region_clip_factors(ss, positions_eval, verts, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, vert_normals, verts, factors);
calc_front_face(cache.view_normal_symm, vert_normals, verts, factors);
}
tls.distances.resize(verts.size());
@@ -202,7 +202,7 @@ BLI_NOINLINE static void do_surface_smooth_brush_grids(
fill_factor_from_hide_and_mask(subdiv_ccg, grids, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, subdiv_ccg, grids, factors);
calc_front_face(cache.view_normal_symm, subdiv_ccg, grids, factors);
}
tls.distances.resize(positions.size());
@@ -312,7 +312,7 @@ BLI_NOINLINE static void do_surface_smooth_brush_bmesh(
fill_factor_from_hide_and_mask(*ss.bm, verts, factors);
filter_region_clip_factors(ss, positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, verts, factors);
calc_front_face(cache.view_normal_symm, verts, factors);
}
tls.distances.resize(positions.size());

View File

@@ -58,7 +58,7 @@ static void calc_faces(const Depsgraph &depsgraph,
filter_region_clip_factors(ss, orig_data.positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, orig_data.normals, factors);
calc_front_face(cache.view_normal_symm, orig_data.normals, factors);
}
tls.distances.resize(verts.size());
@@ -103,7 +103,7 @@ static void calc_grids(const Depsgraph &depsgraph,
filter_region_clip_factors(ss, orig_data.positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, orig_data.normals, factors);
calc_front_face(cache.view_normal_symm, orig_data.normals, factors);
}
tls.distances.resize(grid_verts_num);
@@ -149,7 +149,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
filter_region_clip_factors(ss, orig_positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, orig_normals, factors);
calc_front_face(cache.view_normal_symm, orig_normals, factors);
}
tls.distances.resize(verts.size());
@@ -181,7 +181,7 @@ void do_thumb_brush(const Depsgraph &depsgraph,
const SculptSession &ss = *object.sculpt;
const Brush &brush = *BKE_paint_brush_for_read(&sd.paint);
const float3 &grab_delta = ss.cache->grab_delta_symmetry;
const float3 &grab_delta = ss.cache->grab_delta_symm;
const float3 &normal = ss.cache->sculpt_normal_symm;
const float3 offset = math::cross(math::cross(normal, grab_delta), normal) * ss.cache->bstrength;

View File

@@ -45,16 +45,16 @@ BLI_NOINLINE static void calc_translation_directions(const Brush &brush,
switch (brush.slide_deform_type) {
case BRUSH_SLIDE_DEFORM_DRAG:
r_translations.fill(math::normalize(cache.location - cache.last_location));
r_translations.fill(math::normalize(cache.location_symm - cache.last_location_symm));
break;
case BRUSH_SLIDE_DEFORM_PINCH:
for (const int i : positions.index_range()) {
r_translations[i] = math::normalize(cache.location - positions[i]);
r_translations[i] = math::normalize(cache.location_symm - positions[i]);
}
break;
case BRUSH_SLIDE_DEFORM_EXPAND:
for (const int i : positions.index_range()) {
r_translations[i] = math::normalize(positions[i] - cache.location);
r_translations[i] = math::normalize(positions[i] - cache.location_symm);
}
break;
}
@@ -178,7 +178,7 @@ static void calc_faces(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(mesh, verts, factors);
filter_region_clip_factors(ss, orig_data.positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, orig_data.normals, factors);
calc_front_face(cache.view_normal_symm, orig_data.normals, factors);
}
tls.distances.resize(verts.size());
@@ -228,7 +228,7 @@ static void calc_grids(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(subdiv_ccg, grids, factors);
filter_region_clip_factors(ss, orig_data.positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, orig_data.normals, grids, factors);
calc_front_face(cache.view_normal_symm, orig_data.normals, grids, factors);
}
tls.distances.resize(positions.size());
@@ -277,7 +277,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(*ss.bm, verts, factors);
filter_region_clip_factors(ss, orig_positions, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, orig_normals, factors);
calc_front_face(cache.view_normal_symm, orig_normals, factors);
}
tls.distances.resize(verts.size());

View File

@@ -1971,14 +1971,14 @@ static void paint_cursor_cursor_draw_3d_view_brush_cursor_active(PaintCursorCont
/* Display the simulation limits if sculpting outside them. */
/* This does not makes much sense of plane falloff as the falloff is infinite or global. */
if (len_v3v3(ss.cache->true_location, ss.cache->true_initial_location) >
if (len_v3v3(ss.cache->location, ss.cache->initial_location) >
ss.cache->radius * (1.0f + brush.cloth_sim_limit))
{
const float red[3] = {1.0f, 0.2f, 0.2f};
cloth::simulation_limits_draw(pcontext->pos,
brush,
ss.cache->true_initial_location,
ss.cache->true_initial_normal,
ss.cache->initial_location,
ss.cache->initial_normal,
ss.cache->radius,
2.0f,
red,

View File

@@ -294,7 +294,7 @@ IndexMask pbvh_gather_generic(const Depsgraph &depsgraph,
/* Build a list of all nodes that are potentially within the brush's area of influence */
if (brush.falloff_shape == PAINT_FALLOFF_SHAPE_SPHERE) {
nodes = bke::pbvh::search_nodes(*ss.pbvh, memory, [&](const bke::pbvh::Node &node) {
return node_in_sphere(node, ss.cache->location, ss.cache->radius_squared, true);
return node_in_sphere(node, ss.cache->location_symm, ss.cache->radius_squared, true);
});
ss.cache->sculpt_normal_symm =
@@ -302,12 +302,12 @@ IndexMask pbvh_gather_generic(const Depsgraph &depsgraph,
}
else {
const DistRayAABB_Precalc ray_dist_precalc = dist_squared_ray_to_aabb_v3_precalc(
ss.cache->location, ss.cache->view_normal);
ss.cache->location_symm, ss.cache->view_normal_symm);
nodes = bke::pbvh::search_nodes(*ss.pbvh, memory, [&](const bke::pbvh::Node &node) {
return node_in_cylinder(ray_dist_precalc, node, ss.cache->radius_squared, true);
});
ss.cache->sculpt_normal_symm = use_normal ? ss.cache->view_normal : float3(0);
ss.cache->sculpt_normal_symm = use_normal ? ss.cache->view_normal_symm : float3(0);
}
return nodes;
}
@@ -497,9 +497,9 @@ void update_cache_invariants(
mul_m3_v3(mat, view_dir);
copy_m3_m4(mat, ob.world_to_object().ptr());
mul_m3_v3(mat, view_dir);
normalize_v3_v3(cache->true_view_normal, view_dir);
normalize_v3_v3(cache->view_normal, view_dir);
cache->view_normal = cache->true_view_normal;
cache->view_normal_symm = cache->view_normal;
cache->bstrength = BKE_brush_alpha_get(scene, brush);
cache->is_last_valid = false;
@@ -519,7 +519,7 @@ void update_cache_variants(bContext *C, VPaint &vp, Object &ob, PointerRNA *ptr)
/* This effects the actual brush radius, so things farther away
* are compared with a larger radius and vice versa. */
if (cache->first_time) {
RNA_float_get_array(ptr, "location", cache->true_location);
RNA_float_get_array(ptr, "location", cache->location);
}
RNA_float_get_array(ptr, "mouse", cache->mouse);
@@ -536,7 +536,7 @@ void update_cache_variants(bContext *C, VPaint &vp, Object &ob, PointerRNA *ptr)
/* Truly temporary data that isn't stored in properties */
if (cache->first_time) {
cache->initial_radius = paint_calc_object_space_radius(
*cache->vc, cache->true_location, BKE_brush_size_get(scene, &brush));
*cache->vc, cache->location, BKE_brush_size_get(scene, &brush));
BKE_brush_unprojected_radius_set(scene, &brush, cache->initial_radius);
}
@@ -1378,8 +1378,8 @@ static void do_vpaint_brush_smear(const bContext *C,
const bool use_face_sel = (mesh.editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
float brush_dir[3];
sub_v3_v3v3(brush_dir, cache.location, cache.last_location);
project_plane_v3_v3v3(brush_dir, brush_dir, cache.view_normal);
sub_v3_v3v3(brush_dir, cache.location_symm, cache.last_location_symm);
project_plane_v3_v3v3(brush_dir, brush_dir, cache.view_normal_symm);
if (normalize_v3(brush_dir) == 0.0f) {
return;
}
@@ -1479,7 +1479,7 @@ static void do_vpaint_brush_smear(const bContext *C,
* selected vert to the neighbor. */
float other_dir[3];
sub_v3_v3v3(other_dir, vert_positions[vert], vert_positions[v_other_index]);
project_plane_v3_v3v3(other_dir, other_dir, cache.view_normal);
project_plane_v3_v3v3(other_dir, other_dir, cache.view_normal_symm);
normalize_v3(other_dir);
@@ -1992,7 +1992,7 @@ static void vpaint_do_symmetrical_brush_actions(bContext *C,
}
}
copy_v3_v3(cache.true_last_location, cache.true_location);
copy_v3_v3(cache.last_location, cache.location);
cache.is_last_valid = true;
}
@@ -2033,7 +2033,7 @@ static void vpaint_stroke_update_step(bContext *C,
/* Calculate pivot for rotation around selection if needed.
* also needed for "Frame Selected" on last stroke. */
float loc_world[3];
mul_v3_m4v3(loc_world, ob.object_to_world().ptr(), ss.cache->true_location);
mul_v3_m4v3(loc_world, ob.object_to_world().ptr(), ss.cache->location);
vwpaint::last_stroke_update(scene, loc_world);
ED_region_tag_redraw(vc.region);

View File

@@ -1225,8 +1225,8 @@ static void do_wpaint_brush_smear(const Depsgraph &depsgraph,
const bool use_vert_sel = (mesh.editflag & ME_EDIT_PAINT_VERT_SEL) != 0;
float brush_dir[3];
sub_v3_v3v3(brush_dir, cache.location, cache.last_location);
project_plane_v3_v3v3(brush_dir, brush_dir, cache.view_normal);
sub_v3_v3v3(brush_dir, cache.location_symm, cache.last_location_symm);
project_plane_v3_v3v3(brush_dir, brush_dir, cache.view_normal_symm);
if (normalize_v3(brush_dir) == 0.0f) {
return;
}
@@ -1301,7 +1301,7 @@ static void do_wpaint_brush_smear(const Depsgraph &depsgraph,
/* Get the direction from the selected vert to the neighbor. */
float other_dir[3];
sub_v3_v3v3(other_dir, vert_positions[vert], vert_positions[vert_other]);
project_plane_v3_v3v3(other_dir, other_dir, cache.view_normal);
project_plane_v3_v3v3(other_dir, other_dir, cache.view_normal_symm);
normalize_v3(other_dir);
@@ -1752,7 +1752,7 @@ static void wpaint_do_symmetrical_brush_actions(
if (mesh.editflag & ME_EDIT_MIRROR_VERTEX_GROUPS) {
/* We don't do any symmetry strokes when mirroring vertex groups. */
copy_v3_v3(cache.true_last_location, cache.true_location);
copy_v3_v3(cache.last_location, cache.location);
cache.is_last_valid = true;
return;
}
@@ -1780,7 +1780,7 @@ static void wpaint_do_symmetrical_brush_actions(
}
}
}
copy_v3_v3(cache.true_last_location, cache.true_location);
copy_v3_v3(cache.last_location, cache.location);
cache.is_last_valid = true;
}
@@ -1858,7 +1858,7 @@ static void wpaint_stroke_update_step(bContext *C,
/* Calculate pivot for rotation around selection if needed.
* also needed for "Frame Selected" on last stroke. */
float loc_world[3];
mul_v3_m4v3(loc_world, ob->object_to_world().ptr(), ss.cache->true_location);
mul_v3_m4v3(loc_world, ob->object_to_world().ptr(), ss.cache->location);
vwpaint::last_stroke_update(scene, loc_world);
BKE_mesh_batch_cache_dirty_tag(&mesh, BKE_MESH_BATCH_DIRTY_ALL);

View File

@@ -822,7 +822,7 @@ void sculpt_project_v3_normal_align(const SculptSession &ss,
{
float view_aligned_normal[3];
project_plane_v3_v3v3(
view_aligned_normal, ss.cache->sculpt_normal_symm, ss.cache->view_normal);
view_aligned_normal, ss.cache->sculpt_normal_symm, ss.cache->view_normal_symm);
len_view_scale = fabsf(dot_v3v3(view_aligned_normal, ss.cache->sculpt_normal_symm));
len_view_scale = (len_view_scale > FLT_EPSILON) ? 1.0f / len_view_scale : 1.0f;
}
@@ -1496,7 +1496,7 @@ const float *SCULPT_brush_frontface_normal_from_falloff_shape(const SculptSessio
return ss.cache->sculpt_normal_symm;
}
BLI_assert(falloff_shape == PAINT_FALLOFF_SHAPE_TUBE);
return ss.cache->view_normal;
return ss.cache->view_normal_symm;
}
/* ===== Sculpting =====
@@ -1507,7 +1507,7 @@ static float calc_overlap(const blender::ed::sculpt_paint::StrokeCache &cache,
const char axis,
const float angle)
{
float3 mirror = blender::ed::sculpt_paint::symmetry_flip(cache.true_location, symm);
float3 mirror = blender::ed::sculpt_paint::symmetry_flip(cache.location, symm);
if (axis != 0) {
float mat[3][3];
@@ -1515,7 +1515,7 @@ static float calc_overlap(const blender::ed::sculpt_paint::StrokeCache &cache,
mul_m3_v3(mat, mirror);
}
const float distsq = len_squared_v3v3(mirror, cache.true_location);
const float distsq = len_squared_v3v3(mirror, cache.location);
if (distsq <= 4.0f * (cache.radius_squared)) {
return (2.0f * (cache.radius) - sqrtf(distsq)) / (2.0f * (cache.radius));
@@ -1680,8 +1680,8 @@ static void calc_area_normal_and_center_node_mesh(const Object &object,
AreaNormalCenterData &anctd)
{
const SculptSession &ss = *object.sculpt;
const float3 &location = ss.cache ? ss.cache->location : ss.cursor_location;
const float3 &view_normal = ss.cache ? ss.cache->view_normal : ss.cursor_view_normal;
const float3 &location = ss.cache ? ss.cache->location_symm : ss.cursor_location;
const float3 &view_normal = ss.cache ? ss.cache->view_normal_symm : ss.cursor_view_normal;
const float position_radius = area_normal_and_center_get_position_radius(ss, brush);
const float position_radius_sq = position_radius * position_radius;
const float position_radius_inv = math::rcp(position_radius);
@@ -1763,8 +1763,8 @@ static void calc_area_normal_and_center_node_grids(const Object &object,
AreaNormalCenterData &anctd)
{
const SculptSession &ss = *object.sculpt;
const float3 &location = ss.cache ? ss.cache->location : ss.cursor_location;
const float3 &view_normal = ss.cache ? ss.cache->view_normal : ss.cursor_view_normal;
const float3 &location = ss.cache ? ss.cache->location_symm : ss.cursor_location;
const float3 &view_normal = ss.cache ? ss.cache->view_normal_symm : ss.cursor_view_normal;
const float position_radius = area_normal_and_center_get_position_radius(ss, brush);
const float position_radius_sq = position_radius * position_radius;
const float position_radius_inv = math::rcp(position_radius);
@@ -1867,8 +1867,8 @@ static void calc_area_normal_and_center_node_bmesh(const Object &object,
AreaNormalCenterData &anctd)
{
const SculptSession &ss = *object.sculpt;
const float3 &location = ss.cache ? ss.cache->location : ss.cursor_location;
const float3 &view_normal = ss.cache ? ss.cache->view_normal : ss.cursor_view_normal;
const float3 &location = ss.cache ? ss.cache->location_symm : ss.cursor_location;
const float3 &view_normal = ss.cache ? ss.cache->view_normal_symm : ss.cursor_view_normal;
const float position_radius = area_normal_and_center_get_position_radius(ss, brush);
const float position_radius_sq = position_radius * position_radius;
const float position_radius_inv = math::rcp(position_radius);
@@ -2123,7 +2123,7 @@ void calc_area_center(const Depsgraph &depsgraph,
if (anctd.count_co[0] == 0 && anctd.count_co[1] == 0) {
if (ss.cache) {
copy_v3_v3(r_area_co, ss.cache->location);
copy_v3_v3(r_area_co, ss.cache->location_symm);
}
}
}
@@ -2320,7 +2320,7 @@ void calc_area_normal_and_center(const Depsgraph &depsgraph,
if (anctd.count_co[0] == 0 && anctd.count_co[1] == 0) {
if (ss.cache) {
copy_v3_v3(r_area_co, ss.cache->location);
copy_v3_v3(r_area_co, ss.cache->location_symm);
}
}
@@ -2633,7 +2633,7 @@ bool node_in_cylinder(const DistRayAABB_Precalc &ray_dist_precalc,
static IndexMask pbvh_gather_cursor_update(Object &ob, bool use_original, IndexMaskMemory &memory)
{
SculptSession &ss = *ob.sculpt;
const float3 center = ss.cache ? ss.cache->location : ss.cursor_location;
const float3 center = ss.cache ? ss.cache->location_symm : ss.cursor_location;
return bke::pbvh::search_nodes(*ss.pbvh, memory, [&](const bke::pbvh::Node &node) {
return node_in_sphere(node, center, ss.cursor_radius, use_original);
});
@@ -2645,7 +2645,7 @@ static IndexMask pbvh_gather_generic(
{
SculptSession &ss = *ob.sculpt;
const float3 center = ss.cache->location;
const float3 center = ss.cache->location_symm;
const float radius_sq = math::square(ss.cache->radius * radius_scale);
const bool ignore_ineffective = brush.sculpt_tool != SCULPT_TOOL_MASK;
switch (brush.falloff_shape) {
@@ -2660,7 +2660,7 @@ static IndexMask pbvh_gather_generic(
case PAINT_FALLOFF_SHAPE_TUBE: {
const DistRayAABB_Precalc ray_dist_precalc = dist_squared_ray_to_aabb_v3_precalc(
center, ss.cache->view_normal);
center, ss.cache->view_normal_symm);
return bke::pbvh::search_nodes(*ss.pbvh, memory, [&](const bke::pbvh::Node &node) {
if (ignore_ineffective && node_fully_masked_or_hidden(node)) {
return false;
@@ -2694,7 +2694,7 @@ static float3 calc_sculpt_normal(const Depsgraph &depsgraph,
case SCULPT_DISP_DIR_AREA:
return calc_area_normal(depsgraph, brush, ob, node_mask).value_or(float3(0));
case SCULPT_DISP_DIR_VIEW:
return ss.cache->true_view_normal;
return ss.cache->view_normal;
case SCULPT_DISP_DIR_X:
return float3(1, 0, 0);
case SCULPT_DISP_DIR_Y:
@@ -2725,7 +2725,7 @@ static void update_sculpt_normal(const Depsgraph &depsgraph,
{
cache.sculpt_normal = calc_sculpt_normal(depsgraph, sd, ob, node_mask);
if (brush.falloff_shape == PAINT_FALLOFF_SHAPE_TUBE) {
project_plane_v3_v3v3(cache.sculpt_normal, cache.sculpt_normal, cache.view_normal);
project_plane_v3_v3v3(cache.sculpt_normal, cache.sculpt_normal, cache.view_normal_symm);
normalize_v3(cache.sculpt_normal);
}
copy_v3_v3(cache.sculpt_normal_symm, cache.sculpt_normal);
@@ -2785,7 +2785,8 @@ static void calc_brush_local_mat(const float rotation,
/* Convert view's brush transverse direction to object-space,
* i.e. the normal of the plane described by the motion */
float motion_normal_local[3];
calc_local_from_screen(*cache->vc, cache->location, motion_normal_screen, motion_normal_local);
calc_local_from_screen(
*cache->vc, cache->location_symm, motion_normal_screen, motion_normal_local);
/* Calculate the movement direction for the local matrix.
* Note that there is a deliberate prioritization here: Our calculations are
@@ -2804,7 +2805,7 @@ static void calc_brush_local_mat(const float rotation,
copy_v3_v3(mat[2], cache->sculpt_normal);
/* Set location. */
copy_v3_v3(mat[3], cache->location);
copy_v3_v3(mat[3], cache->location_symm);
/* Scale by brush radius. */
float radius = cache->radius;
@@ -3075,7 +3076,7 @@ void calc_brush_plane(const Depsgraph &depsgraph,
{
switch (brush.sculpt_plane) {
case SCULPT_DISP_DIR_VIEW:
copy_v3_v3(r_area_no, ss.cache->true_view_normal);
copy_v3_v3(r_area_no, ss.cache->view_normal);
break;
case SCULPT_DISP_DIR_X:
@@ -3093,7 +3094,7 @@ void calc_brush_plane(const Depsgraph &depsgraph,
case SCULPT_DISP_DIR_AREA:
calc_area_normal_and_center(depsgraph, brush, ob, node_mask, r_area_no, r_area_co);
if (brush.falloff_shape == PAINT_FALLOFF_SHAPE_TUBE) {
project_plane_v3_v3v3(r_area_no, r_area_no, ss.cache->view_normal);
project_plane_v3_v3v3(r_area_no, r_area_no, ss.cache->view_normal_symm);
normalize_v3(r_area_no);
}
break;
@@ -3282,14 +3283,14 @@ static void dynamic_topology_update(const Depsgraph &depsgraph,
mode,
min_edge_len,
max_edge_len,
ss.cache->location,
ss.cache->view_normal,
ss.cache->location_symm,
ss.cache->view_normal_symm,
ss.cache->radius,
(brush.flag & BRUSH_FRONTFACE) != 0,
(brush.falloff_shape != PAINT_FALLOFF_SHAPE_SPHERE));
/* Update average stroke position. */
copy_v3_v3(location, ss.cache->true_location);
copy_v3_v3(location, ss.cache->location);
mul_m4_v3(ob.object_to_world().ptr(), location);
}
@@ -3523,7 +3524,7 @@ static void do_brush_action(const Depsgraph &depsgraph,
}
cloth::brush_store_simulation_state(depsgraph, ob, *ss.cache->cloth_sim);
cloth::ensure_nodes_constraints(
sd, ob, node_mask, *ss.cache->cloth_sim, ss.cache->location, FLT_MAX);
sd, ob, node_mask, *ss.cache->cloth_sim, ss.cache->location_symm, FLT_MAX);
}
bool invert = ss.cache->pen_flip || ss.cache->invert;
@@ -3718,7 +3719,7 @@ static void do_brush_action(const Depsgraph &depsgraph,
}
/* Update average stroke position. */
copy_v3_v3(location, ss.cache->true_location);
copy_v3_v3(location, ss.cache->location);
mul_m4_v3(ob.object_to_world().ptr(), location);
add_v3_v3(ups.average_stroke_accum, location);
@@ -3735,13 +3736,13 @@ void SCULPT_cache_calc_brushdata_symm(blender::ed::sculpt_paint::StrokeCache &ca
const float angle)
{
using namespace blender;
cache.location = ed::sculpt_paint::symmetry_flip(cache.true_location, symm);
cache.last_location = ed::sculpt_paint::symmetry_flip(cache.true_last_location, symm);
cache.grab_delta_symmetry = ed::sculpt_paint::symmetry_flip(cache.grab_delta, symm);
cache.view_normal = ed::sculpt_paint::symmetry_flip(cache.true_view_normal, symm);
cache.location_symm = ed::sculpt_paint::symmetry_flip(cache.location, symm);
cache.last_location_symm = ed::sculpt_paint::symmetry_flip(cache.last_location, symm);
cache.grab_delta_symm = ed::sculpt_paint::symmetry_flip(cache.grab_delta, symm);
cache.view_normal_symm = ed::sculpt_paint::symmetry_flip(cache.view_normal, symm);
cache.initial_location = ed::sculpt_paint::symmetry_flip(cache.true_initial_location, symm);
cache.initial_normal = ed::sculpt_paint::symmetry_flip(cache.true_initial_normal, symm);
cache.initial_location_symm = ed::sculpt_paint::symmetry_flip(cache.initial_location, symm);
cache.initial_normal_symm = ed::sculpt_paint::symmetry_flip(cache.initial_normal, symm);
/* XXX This reduces the length of the grab delta if it approaches the line of symmetry
* XXX However, a different approach appears to be needed. */
@@ -3768,12 +3769,12 @@ void SCULPT_cache_calc_brushdata_symm(blender::ed::sculpt_paint::StrokeCache &ca
rotate_m4(cache.symm_rot_mat_inv.ptr(), axis, -angle);
}
mul_m4_v3(cache.symm_rot_mat.ptr(), cache.location);
mul_m4_v3(cache.symm_rot_mat.ptr(), cache.grab_delta_symmetry);
mul_m4_v3(cache.symm_rot_mat.ptr(), cache.location_symm);
mul_m4_v3(cache.symm_rot_mat.ptr(), cache.grab_delta_symm);
if (cache.supports_gravity) {
cache.gravity_direction = ed::sculpt_paint::symmetry_flip(cache.true_gravity_direction, symm);
mul_m4_v3(cache.symm_rot_mat.ptr(), cache.gravity_direction);
cache.gravity_direction_symm = ed::sculpt_paint::symmetry_flip(cache.gravity_direction, symm);
mul_m4_v3(cache.symm_rot_mat.ptr(), cache.gravity_direction_symm);
}
if (cache.rake_rotation) {
@@ -3783,7 +3784,7 @@ void SCULPT_cache_calc_brushdata_symm(blender::ed::sculpt_paint::StrokeCache &ca
cache.rake_rotation->y,
cache.rake_rotation->z);
flip_qt_qt(new_quat, existing, symm);
cache.rake_rotation_symmetry = math::Quaternion(existing);
cache.rake_rotation_symm = math::Quaternion(existing);
}
}
@@ -3823,8 +3824,8 @@ static void do_tiled(const Depsgraph &depsgraph,
/* Position of the "prototype" stroke for tiling. */
float orgLoc[3];
float original_initial_location[3];
copy_v3_v3(orgLoc, cache->location);
copy_v3_v3(original_initial_location, cache->initial_location);
copy_v3_v3(orgLoc, cache->location_symm);
copy_v3_v3(original_initial_location, cache->initial_location_symm);
for (int dim = 0; dim < 3; dim++) {
if ((sd.paint.symmetry_flags & (PAINT_TILE_X << dim)) && step[dim] > 0) {
@@ -3853,9 +3854,10 @@ static void do_tiled(const Depsgraph &depsgraph,
++cache->tile_pass;
for (int dim = 0; dim < 3; dim++) {
cache->location[dim] = cur[dim] * step[dim] + orgLoc[dim];
cache->location_symm[dim] = cur[dim] * step[dim] + orgLoc[dim];
cache->plane_offset[dim] = cur[dim] * step[dim];
cache->initial_location[dim] = cur[dim] * step[dim] + original_initial_location[dim];
cache->initial_location_symm[dim] = cur[dim] * step[dim] +
original_initial_location[dim];
}
action(depsgraph, scene, sd, ob, brush, ups, paint_mode_settings);
}
@@ -4239,11 +4241,11 @@ static void sculpt_update_cache_invariants(
zero_v2(cache->initial_mouse);
}
copy_v3_v3(cache->initial_location_symm, ss.cursor_location);
copy_v3_v3(cache->initial_location, ss.cursor_location);
copy_v3_v3(cache->true_initial_location, ss.cursor_location);
copy_v3_v3(cache->initial_normal_symm, ss.cursor_normal);
copy_v3_v3(cache->initial_normal, ss.cursor_normal);
copy_v3_v3(cache->true_initial_normal, ss.cursor_normal);
mode = RNA_enum_get(op->ptr, "mode");
cache->invert = mode == BRUSH_STROKE_INVERT;
@@ -4290,7 +4292,7 @@ static void sculpt_update_cache_invariants(
mul_m3_v3(mat, viewDir);
copy_m3_m4(mat, ob.world_to_object().ptr());
mul_m3_v3(mat, viewDir);
normalize_v3_v3(cache->true_view_normal, viewDir);
normalize_v3_v3(cache->view_normal, viewDir);
cache->supports_gravity = (!ELEM(brush->sculpt_tool,
SCULPT_TOOL_MASK,
@@ -4304,16 +4306,16 @@ static void sculpt_update_cache_invariants(
if (sd.gravity_object) {
Object *gravity_object = sd.gravity_object;
copy_v3_v3(cache->true_gravity_direction, gravity_object->object_to_world().ptr()[2]);
copy_v3_v3(cache->gravity_direction, gravity_object->object_to_world().ptr()[2]);
}
else {
cache->true_gravity_direction[0] = cache->true_gravity_direction[1] = 0.0f;
cache->true_gravity_direction[2] = 1.0f;
cache->gravity_direction[0] = cache->gravity_direction[1] = 0.0f;
cache->gravity_direction[2] = 1.0f;
}
/* Transform to sculpted object space. */
mul_m3_v3(mat, cache->true_gravity_direction);
normalize_v3(cache->true_gravity_direction);
mul_m3_v3(mat, cache->gravity_direction);
normalize_v3(cache->gravity_direction);
}
cache->accum = true;
@@ -4459,13 +4461,13 @@ static void brush_delta_update(const Depsgraph &depsgraph,
}
}
else {
copy_v3_v3(cache->orig_grab_location, cache->true_location);
copy_v3_v3(cache->orig_grab_location, cache->location);
}
}
else if (tool == SCULPT_TOOL_SNAKE_HOOK ||
(tool == SCULPT_TOOL_CLOTH && brush.cloth_deform_type == BRUSH_CLOTH_DEFORM_SNAKE_HOOK))
{
add_v3_v3(cache->true_location, cache->grab_delta);
add_v3_v3(cache->location, cache->grab_delta);
}
/* Compute 3d coordinate at same z from original location + mval. */
@@ -4502,14 +4504,14 @@ static void brush_delta_update(const Depsgraph &depsgraph,
}
if (brush.falloff_shape == PAINT_FALLOFF_SHAPE_TUBE) {
project_plane_v3_v3v3(cache->grab_delta, cache->grab_delta, ss.cache->true_view_normal);
project_plane_v3_v3v3(cache->grab_delta, cache->grab_delta, ss.cache->view_normal);
}
copy_v3_v3(cache->old_grab_location, grab_location);
if (need_delta_from_anchored_origin(brush)) {
/* Location stays the same for finding vertices in brush radius. */
copy_v3_v3(cache->true_location, cache->orig_grab_location);
copy_v3_v3(cache->location, cache->orig_grab_location);
ups.draw_anchored = true;
copy_v2_v2(ups.anchored_initial_mouse, cache->initial_mouse);
@@ -4614,7 +4616,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt &sd, Object &ob, Po
!((brush.flag & BRUSH_ANCHORED) || (brush.sculpt_tool == SCULPT_TOOL_SNAKE_HOOK) ||
(brush.sculpt_tool == SCULPT_TOOL_ROTATE) || cloth::is_cloth_deform_brush(brush)))
{
RNA_float_get_array(ptr, "location", cache.true_location);
RNA_float_get_array(ptr, "location", cache.location);
}
cache.pen_flip = RNA_boolean_get(ptr, "pen_flip");
@@ -4633,7 +4635,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt &sd, Object &ob, Po
/* Truly temporary data that isn't stored in properties. */
if (SCULPT_stroke_is_first_brush_step_of_symmetry_pass(*ss.cache)) {
cache.initial_radius = sculpt_calc_radius(*cache.vc, brush, scene, cache.true_location);
cache.initial_radius = sculpt_calc_radius(*cache.vc, brush, scene, cache.location);
if (!BKE_brush_use_locked_size(&scene, &brush)) {
BKE_brush_unprojected_radius_set(&scene, &brush, cache.initial_radius);
@@ -4675,11 +4677,10 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt &sd, Object &ob, Po
if (brush.flag & BRUSH_ANCHORED) {
/* True location has been calculated as part of the stroke system already here. */
if (brush.flag & BRUSH_EDGE_TO_EDGE) {
RNA_float_get_array(ptr, "location", cache.true_location);
RNA_float_get_array(ptr, "location", cache.location);
}
cache.radius = paint_calc_object_space_radius(
*cache.vc, cache.true_location, ups.pixel_radius);
cache.radius = paint_calc_object_space_radius(*cache.vc, cache.location, ups.pixel_radius);
cache.radius_squared = cache.radius * cache.radius;
}
@@ -5552,7 +5553,7 @@ static void stroke_update_step(bContext *C,
sculpt_fix_noise_tear(sd, ob);
ss.cache->first_time = false;
copy_v3_v3(ss.cache->true_last_location, ss.cache->true_location);
copy_v3_v3(ss.cache->last_location, ss.cache->location);
/* Cleanup. */
if (brush.sculpt_tool == SCULPT_TOOL_MASK) {
@@ -6839,10 +6840,11 @@ void calc_brush_distances_squared(const SculptSession &ss,
{
BLI_assert(verts.size() == r_distances.size());
const float3 &test_location = ss.cache ? ss.cache->location : ss.cursor_location;
const float3 &test_location = ss.cache ? ss.cache->location_symm : ss.cursor_location;
if (falloff_shape == PAINT_FALLOFF_SHAPE_TUBE && (ss.cache || ss.filter_cache)) {
/* The tube falloff shape requires the cached view normal. */
const float3 &view_normal = ss.cache ? ss.cache->view_normal : ss.filter_cache->view_normal;
const float3 &view_normal = ss.cache ? ss.cache->view_normal_symm :
ss.filter_cache->view_normal;
float4 test_plane;
plane_from_point_normal_v3(test_plane, test_location, view_normal);
for (const int i : verts.index_range()) {
@@ -6877,10 +6879,11 @@ void calc_brush_distances_squared(const SculptSession &ss,
{
BLI_assert(positions.size() == r_distances.size());
const float3 &test_location = ss.cache ? ss.cache->location : ss.cursor_location;
const float3 &test_location = ss.cache ? ss.cache->location_symm : ss.cursor_location;
if (falloff_shape == PAINT_FALLOFF_SHAPE_TUBE && (ss.cache || ss.filter_cache)) {
/* The tube falloff shape requires the cached view normal. */
const float3 &view_normal = ss.cache ? ss.cache->view_normal : ss.filter_cache->view_normal;
const float3 &view_normal = ss.cache ? ss.cache->view_normal_symm :
ss.filter_cache->view_normal;
float4 test_plane;
plane_from_point_normal_v3(test_plane, test_location, view_normal);
for (const int i : positions.index_range()) {

View File

@@ -221,7 +221,7 @@ static float calc_brush_normal_factor(const Depsgraph &depsgraph,
float3 initial_normal;
if (ss.cache) {
initial_normal = ss.cache->initial_normal;
initial_normal = ss.cache->initial_normal_symm;
}
else {
initial_normal = ss.filter_cache->initial_normal;
@@ -248,7 +248,7 @@ static float calc_view_normal_factor(const Depsgraph &depsgraph,
float3 view_normal;
if (ss.cache) {
view_normal = ss.cache->view_normal;
view_normal = ss.cache->view_normal_symm;
}
else {
view_normal = ss.filter_cache->view_normal;

View File

@@ -2167,7 +2167,7 @@ static void do_grab_brush(const Depsgraph &depsgraph,
boundary.edit_info.strength_factor,
nodes[i],
tls,
ss.cache->grab_delta_symmetry,
ss.cache->grab_delta_symm,
boundary.initial_vert_position,
strength,
deform_target,
@@ -2192,7 +2192,7 @@ static void do_grab_brush(const Depsgraph &depsgraph,
boundary.edit_info.strength_factor,
nodes[i],
tls,
ss.cache->grab_delta_symmetry,
ss.cache->grab_delta_symm,
boundary.initial_vert_position,
strength,
deform_target);
@@ -2213,7 +2213,7 @@ static void do_grab_brush(const Depsgraph &depsgraph,
boundary.edit_info.strength_factor,
nodes[i],
tls,
ss.cache->grab_delta_symmetry,
ss.cache->grab_delta_symm,
boundary.initial_vert_position,
strength,
deform_target);
@@ -2916,10 +2916,10 @@ static float displacement_from_grab_delta_get(const SculptSession &ss,
const SculptBoundary &boundary)
{
float4 plane;
const float3 normal = math::normalize(ss.cache->initial_location - boundary.pivot_position);
plane_from_point_normal_v3(plane, ss.cache->initial_location, normal);
const float3 normal = math::normalize(ss.cache->initial_location_symm - boundary.pivot_position);
plane_from_point_normal_v3(plane, ss.cache->initial_location_symm, normal);
const float3 pos = ss.cache->initial_location + ss.cache->grab_delta_symmetry;
const float3 pos = ss.cache->initial_location_symm + ss.cache->grab_delta_symm;
return dist_signed_to_plane_v3(pos, plane);
}

View File

@@ -169,9 +169,9 @@ static float3 cloth_brush_simulation_location_get(const SculptSession &ss, const
return float3(0);
}
if (brush->cloth_simulation_area_type == BRUSH_CLOTH_SIMULATION_AREA_LOCAL) {
return ss.cache->initial_location;
return ss.cache->initial_location_symm;
}
return ss.cache->location;
return ss.cache->location_symm;
}
IndexMask brush_affected_nodes_gather(SculptSession &ss,
@@ -186,7 +186,7 @@ IndexMask brush_affected_nodes_gather(SculptSession &ss,
const float radius_squared = math::square(ss.cache->initial_radius *
(1.0 + brush.cloth_sim_limit));
return bke::pbvh::search_nodes(*ss.pbvh, memory, [&](const bke::pbvh::Node &node) {
return node_in_sphere(node, ss.cache->initial_location, radius_squared, false);
return node_in_sphere(node, ss.cache->initial_location_symm, radius_squared, false);
});
}
case BRUSH_CLOTH_SIMULATION_AREA_GLOBAL:
@@ -194,7 +194,7 @@ IndexMask brush_affected_nodes_gather(SculptSession &ss,
case BRUSH_CLOTH_SIMULATION_AREA_DYNAMIC: {
const float radius_squared = math::square(ss.cache->radius * (1.0 + brush.cloth_sim_limit));
return bke::pbvh::search_nodes(*ss.pbvh, memory, [&](const bke::pbvh::Node &node) {
return node_in_sphere(node, ss.cache->location, radius_squared, false);
return node_in_sphere(node, ss.cache->location_symm, radius_squared, false);
});
}
}
@@ -464,7 +464,7 @@ static void add_constraints_for_verts(const Object &object,
if (pin_simulation_boundary) {
const float sim_falloff = cloth_brush_simulation_falloff_get(
*brush, ss.cache->initial_radius, ss.cache->location, init_positions[vert]);
*brush, ss.cache->initial_radius, ss.cache->location_symm, init_positions[vert]);
/* Vertex is inside the area of the simulation without any falloff applied. */
if (sim_falloff < 1.0f) {
/* Create constraints with more strength the closer the vertex is to the simulation
@@ -763,7 +763,7 @@ static void calc_forces_mesh(const Depsgraph &depsgraph,
}
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, vert_normals, verts, factors);
calc_front_face(cache.view_normal_symm, vert_normals, verts, factors);
}
tls.distances.resize(verts.size());
@@ -788,7 +788,7 @@ static void calc_forces_mesh(const Depsgraph &depsgraph,
switch (brush.cloth_deform_type) {
case BRUSH_CLOTH_DEFORM_DRAG:
translations_from_offset_and_factors(
math::normalize(cache.location - cache.last_location), factors, forces);
math::normalize(cache.location_symm - cache.last_location_symm), factors, forces);
apply_forces(cloth_sim, forces, verts);
break;
case BRUSH_CLOTH_DEFORM_PUSH:
@@ -797,23 +797,23 @@ static void calc_forces_mesh(const Depsgraph &depsgraph,
break;
case BRUSH_CLOTH_DEFORM_GRAB:
apply_grab_brush(
cloth_sim, verts, factors, falloff_plane.has_value(), cache.grab_delta_symmetry);
cloth_sim, verts, factors, falloff_plane.has_value(), cache.grab_delta_symm);
break;
case BRUSH_CLOTH_DEFORM_SNAKE_HOOK:
apply_snake_hook_brush(cloth_sim, verts, factors, cache.grab_delta_symmetry);
apply_snake_hook_brush(cloth_sim, verts, factors, cache.grab_delta_symm);
break;
case BRUSH_CLOTH_DEFORM_PINCH_POINT:
if (falloff_plane) {
calc_plane_pinch_forces(positions, falloff_plane->plane, falloff_plane->normal, forces);
}
else {
calc_pinch_forces(positions, cache.location, forces);
calc_pinch_forces(positions, cache.location_symm, forces);
}
scale_translations(forces, factors);
apply_forces(cloth_sim, forces, verts);
break;
case BRUSH_CLOTH_DEFORM_PINCH_PERPENDICULAR: {
calc_perpendicular_pinch_forces(positions, imat, cache.location, forces);
calc_perpendicular_pinch_forces(positions, imat, cache.location_symm, forces);
scale_translations(forces, factors);
apply_forces(cloth_sim, forces, verts);
break;
@@ -873,7 +873,7 @@ static void calc_forces_grids(const Depsgraph &depsgraph,
}
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, subdiv_ccg, grids, factors);
calc_front_face(cache.view_normal_symm, subdiv_ccg, grids, factors);
}
tls.distances.resize(verts.size());
@@ -898,7 +898,7 @@ static void calc_forces_grids(const Depsgraph &depsgraph,
switch (brush.cloth_deform_type) {
case BRUSH_CLOTH_DEFORM_DRAG:
translations_from_offset_and_factors(
math::normalize(cache.location - cache.last_location), factors, forces);
math::normalize(cache.location_symm - cache.last_location_symm), factors, forces);
apply_forces(cloth_sim, forces, verts);
break;
case BRUSH_CLOTH_DEFORM_PUSH:
@@ -907,23 +907,23 @@ static void calc_forces_grids(const Depsgraph &depsgraph,
break;
case BRUSH_CLOTH_DEFORM_GRAB:
apply_grab_brush(
cloth_sim, verts, factors, falloff_plane.has_value(), cache.grab_delta_symmetry);
cloth_sim, verts, factors, falloff_plane.has_value(), cache.grab_delta_symm);
break;
case BRUSH_CLOTH_DEFORM_SNAKE_HOOK:
apply_snake_hook_brush(cloth_sim, verts, factors, cache.grab_delta_symmetry);
apply_snake_hook_brush(cloth_sim, verts, factors, cache.grab_delta_symm);
break;
case BRUSH_CLOTH_DEFORM_PINCH_POINT:
if (falloff_plane) {
calc_plane_pinch_forces(positions, falloff_plane->plane, falloff_plane->normal, forces);
}
else {
calc_pinch_forces(positions, cache.location, forces);
calc_pinch_forces(positions, cache.location_symm, forces);
}
scale_translations(forces, factors);
apply_forces(cloth_sim, forces, verts);
break;
case BRUSH_CLOTH_DEFORM_PINCH_PERPENDICULAR: {
calc_perpendicular_pinch_forces(positions, imat, cache.location, forces);
calc_perpendicular_pinch_forces(positions, imat, cache.location_symm, forces);
scale_translations(forces, factors);
apply_forces(cloth_sim, forces, verts);
break;
@@ -981,7 +981,7 @@ static void calc_forces_bmesh(const Depsgraph &depsgraph,
}
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, bm_verts, factors);
calc_front_face(cache.view_normal_symm, bm_verts, factors);
}
tls.distances.resize(verts.size());
@@ -1006,7 +1006,7 @@ static void calc_forces_bmesh(const Depsgraph &depsgraph,
switch (brush.cloth_deform_type) {
case BRUSH_CLOTH_DEFORM_DRAG:
translations_from_offset_and_factors(
math::normalize(cache.location - cache.last_location), factors, forces);
math::normalize(cache.location_symm - cache.last_location_symm), factors, forces);
apply_forces(cloth_sim, forces, verts);
break;
case BRUSH_CLOTH_DEFORM_PUSH:
@@ -1015,23 +1015,23 @@ static void calc_forces_bmesh(const Depsgraph &depsgraph,
break;
case BRUSH_CLOTH_DEFORM_GRAB:
apply_grab_brush(
cloth_sim, verts, factors, falloff_plane.has_value(), cache.grab_delta_symmetry);
cloth_sim, verts, factors, falloff_plane.has_value(), cache.grab_delta_symm);
break;
case BRUSH_CLOTH_DEFORM_SNAKE_HOOK:
apply_snake_hook_brush(cloth_sim, verts, factors, cache.grab_delta_symmetry);
apply_snake_hook_brush(cloth_sim, verts, factors, cache.grab_delta_symm);
break;
case BRUSH_CLOTH_DEFORM_PINCH_POINT:
if (falloff_plane) {
calc_plane_pinch_forces(positions, falloff_plane->plane, falloff_plane->normal, forces);
}
else {
calc_pinch_forces(positions, cache.location, forces);
calc_pinch_forces(positions, cache.location_symm, forces);
}
scale_translations(forces, factors);
apply_forces(cloth_sim, forces, verts);
break;
case BRUSH_CLOTH_DEFORM_PINCH_PERPENDICULAR: {
calc_perpendicular_pinch_forces(positions, imat, cache.location, forces);
calc_perpendicular_pinch_forces(positions, imat, cache.location_symm, forces);
scale_translations(forces, factors);
apply_forces(cloth_sim, forces, verts);
break;
@@ -1523,11 +1523,11 @@ static void cloth_brush_apply_brush_foces(const Depsgraph &depsgraph,
float3 area_co;
float3 offset;
if (math::is_zero(cache.grab_delta_symmetry)) {
if (math::is_zero(cache.grab_delta_symm)) {
return;
}
float3 grab_delta = math::normalize(cache.grab_delta_symmetry);
float3 grab_delta = math::normalize(cache.grab_delta_symm);
/* Calculate push offset. */
if (brush.cloth_deform_type == BRUSH_CLOTH_DEFORM_PUSH) {
@@ -1541,10 +1541,10 @@ static void cloth_brush_apply_brush_foces(const Depsgraph &depsgraph,
calc_brush_plane(depsgraph, brush, ob, node_mask, area_no, area_co);
/* Initialize stroke local space matrix. */
mat.x_axis() = math::cross(area_no, cache.grab_delta_symmetry);
mat.x_axis() = math::cross(area_no, cache.grab_delta_symm);
mat.y_axis() = math::cross(area_no, mat.x_axis());
mat.z_axis() = area_no;
mat.location() = cache.location;
mat.location() = cache.location_symm;
normalize_m4(mat.ptr());
/* Update matrix for the cursor preview. */
@@ -1564,7 +1564,7 @@ static void cloth_brush_apply_brush_foces(const Depsgraph &depsgraph,
/* Gravity */
float3 gravity(0);
if (cache.supports_gravity) {
gravity += cache.gravity_direction * -sd.gravity_factor;
gravity += cache.gravity_direction_symm * -sd.gravity_factor;
}
std::optional<FalloffPlane> falloff_plane;
@@ -1941,7 +1941,7 @@ void plane_falloff_preview_draw(const uint gpuattr,
float4x4 local_mat = ss.cache->stroke_local_mat;
if (ss.cache->brush->cloth_deform_type == BRUSH_CLOTH_DEFORM_GRAB) {
add_v3_v3v3(local_mat[3], ss.cache->true_location, ss.cache->grab_delta);
add_v3_v3v3(local_mat[3], ss.cache->location, ss.cache->grab_delta);
}
GPU_matrix_mul(local_mat.ptr());

View File

@@ -147,10 +147,10 @@ struct StrokeCache {
/* Variants */
float radius;
float radius_squared;
float3 true_location;
float3 true_last_location;
float3 location;
float3 last_location;
float3 location_symm;
float3 last_location_symm;
float stroke_distance;
/* Used for alternating between deformation in brushes that need to apply different ones to
@@ -206,12 +206,12 @@ struct StrokeCache {
const Brush *brush;
float special_rotation;
float3 grab_delta, grab_delta_symmetry;
float3 grab_delta, grab_delta_symm;
float3 old_grab_location, orig_grab_location;
/* screen-space rotation defined by mouse motion */
std::optional<math::Quaternion> rake_rotation;
std::optional<math::Quaternion> rake_rotation_symmetry;
std::optional<math::Quaternion> rake_rotation_symm;
SculptRakeData rake_data;
/* Face Sets */
@@ -222,8 +222,8 @@ struct StrokeCache {
int symmetry;
/* The symmetry pass we are currently on between 0 and 7. */
ePaintSymmetryFlags mirror_symmetry_pass;
float3 true_view_normal;
float3 view_normal;
float3 view_normal_symm;
/* sculpt_normal gets calculated by calc_sculpt_normal(), then the
* sculpt_normal_symm gets updated quickly with the usual symmetry
@@ -291,10 +291,10 @@ struct StrokeCache {
/* Cloth brush */
std::unique_ptr<cloth::SimulationData> cloth_sim;
float3 initial_location_symm;
float3 initial_location;
float3 true_initial_location;
float3 initial_normal_symm;
float3 initial_normal;
float3 true_initial_normal;
/* Boundary brush */
std::array<std::unique_ptr<boundary::SculptBoundary>, PAINT_SYMM_AREAS> boundaries;
@@ -324,8 +324,8 @@ struct StrokeCache {
float plane_trim_squared;
bool supports_gravity;
float3 true_gravity_direction;
float3 gravity_direction;
float3 gravity_direction_symm;
std::unique_ptr<auto_mask::Cache> automasking;

View File

@@ -281,7 +281,7 @@ static void do_color_smooth_task(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(mesh, verts, factors);
filter_region_clip_factors(ss, vert_positions, verts, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, vert_normals, verts, factors);
calc_front_face(cache.view_normal_symm, vert_normals, verts, factors);
}
tls.distances.resize(verts.size());
@@ -366,7 +366,7 @@ static void do_paint_brush_task(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(mesh, verts, factors);
filter_region_clip_factors(ss, vert_positions, verts, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, vert_normals, verts, factors);
calc_front_face(cache.view_normal_symm, vert_normals, verts, factors);
}
tls.distances.resize(verts.size());
@@ -538,7 +538,8 @@ void do_paint_brush(const Depsgraph &depsgraph,
if (SCULPT_stroke_is_first_brush_step_of_symmetry_pass(*ss.cache)) {
if (SCULPT_stroke_is_first_brush_step(*ss.cache)) {
ss.cache->paint_brush.density_seed = float(BLI_hash_int_01(ss.cache->location[0] * 1000));
ss.cache->paint_brush.density_seed = float(
BLI_hash_int_01(ss.cache->location_symm[0] * 1000));
}
return;
}
@@ -695,7 +696,7 @@ static void do_smear_brush_task(const Depsgraph &depsgraph,
fill_factor_from_hide_and_mask(mesh, verts, factors);
filter_region_clip_factors(ss, vert_positions, verts, factors);
if (brush.flag & BRUSH_FRONTFACE) {
calc_front_face(cache.view_normal, vert_normals, verts, factors);
calc_front_face(cache.view_normal_symm, vert_normals, verts, factors);
}
tls.distances.resize(verts.size());
@@ -713,10 +714,10 @@ static void do_smear_brush_task(const Depsgraph &depsgraph,
float3 brush_delta;
if (brush.flag & BRUSH_ANCHORED) {
brush_delta = ss.cache->grab_delta_symmetry;
brush_delta = ss.cache->grab_delta_symm;
}
else {
brush_delta = ss.cache->location - ss.cache->last_location;
brush_delta = ss.cache->location_symm - ss.cache->last_location_symm;
}
Vector<int> neighbors;
@@ -733,10 +734,10 @@ static void do_smear_brush_task(const Depsgraph &depsgraph,
current_disp = brush_delta;
break;
case BRUSH_SMEAR_DEFORM_PINCH:
current_disp = ss.cache->location - vert_positions[vert];
current_disp = ss.cache->location_symm - vert_positions[vert];
break;
case BRUSH_SMEAR_DEFORM_EXPAND:
current_disp = vert_positions[vert] - ss.cache->location;
current_disp = vert_positions[vert] - ss.cache->location_symm;
break;
}

View File

@@ -231,7 +231,7 @@ static BitVector<> init_uv_primitives_brush_test(SculptSession &ss,
const Span<UVPrimitivePaintInput> uv_primitives,
const Span<float3> positions)
{
const float3 location = ss.cache ? ss.cache->location : ss.cursor_location;
const float3 location = ss.cache ? ss.cache->location_symm : ss.cursor_location;
const float radius = ss.cache ? ss.cache->radius : ss.cursor_radius;
const Bounds<float3> brush_bounds(location - radius, location + radius);

View File

@@ -1251,7 +1251,7 @@ void pose_brush_init(const Depsgraph &depsgraph, Object &ob, SculptSession &ss,
{
/* Init the IK chain that is going to be used to deform the vertices. */
ss.cache->pose_ik_chain = ik_chain_init(
depsgraph, ob, ss, brush, ss.cache->true_location, ss.cache->radius);
depsgraph, ob, ss, brush, ss.cache->location, ss.cache->radius);
/* Smooth the weights of each segment for cleaner deformation. */
for (IKChainSegment &segment : ss.cache->pose_ik_chain->segments) {
@@ -1302,7 +1302,7 @@ static void calc_scale_deform(SculptSession &ss, const Brush &brush)
{
IKChain &ik_chain = *ss.cache->pose_ik_chain;
float3 ik_target = ss.cache->true_location + ss.cache->grab_delta;
float3 ik_target = ss.cache->location + ss.cache->grab_delta;
/* Solve the IK for the first segment to include rotation as part of scale if enabled. */
if (!(brush.flag2 & BRUSH_POSE_USE_LOCK_ROTATION)) {
@@ -1330,7 +1330,7 @@ static void calc_rotate_deform(SculptSession &ss, const Brush &brush)
IKChain &ik_chain = *ss.cache->pose_ik_chain;
/* Calculate the IK target. */
float3 ik_target = ss.cache->true_location + ss.cache->grab_delta + ik_chain.grab_delta_offset;
float3 ik_target = ss.cache->location + ss.cache->grab_delta + ik_chain.grab_delta_offset;
/* Solve the IK positions. */
solve_ik_chain(ik_chain, ik_target, brush.flag2 & BRUSH_POSE_IK_ANCHORED);
@@ -1360,7 +1360,7 @@ static void calc_squash_stretch_deform(SculptSession &ss, const Brush & /*brush*
{
IKChain &ik_chain = *ss.cache->pose_ik_chain;
float3 ik_target = ss.cache->true_location + ss.cache->grab_delta;
float3 ik_target = ss.cache->location + ss.cache->grab_delta;
float3 scale;
scale[2] = calc_scale_from_grab_delta(ss, ik_target);