Cleanup: Sculpt: Remove duplicate function
Looks like `calc_sculpt_plane` was duplicated in d93dd8595103ea0c0d48.
This commit is contained in:
parent
a0294e0b9a
commit
a3fe547bf9
@ -92,95 +92,6 @@ static void sculpt_project_v3(const SculptProjectVector *spvc, const float vec[3
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void calc_sculpt_plane(
|
|
||||||
const Sculpt &sd, Object &ob, Span<PBVHNode *> nodes, float r_area_no[3], float r_area_co[3])
|
|
||||||
{
|
|
||||||
SculptSession &ss = *ob.sculpt;
|
|
||||||
const Brush &brush = *BKE_paint_brush_for_read(&sd.paint);
|
|
||||||
|
|
||||||
if (SCULPT_stroke_is_main_symmetry_pass(*ss.cache) &&
|
|
||||||
(SCULPT_stroke_is_first_brush_step_of_symmetry_pass(*ss.cache) ||
|
|
||||||
!(brush.flag & BRUSH_ORIGINAL_PLANE) || !(brush.flag & BRUSH_ORIGINAL_NORMAL)))
|
|
||||||
{
|
|
||||||
switch (brush.sculpt_plane) {
|
|
||||||
case SCULPT_DISP_DIR_VIEW:
|
|
||||||
copy_v3_v3(r_area_no, ss.cache->true_view_normal);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SCULPT_DISP_DIR_X:
|
|
||||||
ARRAY_SET_ITEMS(r_area_no, 1.0f, 0.0f, 0.0f);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SCULPT_DISP_DIR_Y:
|
|
||||||
ARRAY_SET_ITEMS(r_area_no, 0.0f, 1.0f, 0.0f);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SCULPT_DISP_DIR_Z:
|
|
||||||
ARRAY_SET_ITEMS(r_area_no, 0.0f, 0.0f, 1.0f);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SCULPT_DISP_DIR_AREA:
|
|
||||||
SCULPT_calc_area_normal_and_center(sd, ob, nodes, 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);
|
|
||||||
normalize_v3(r_area_no);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* For flatten center. */
|
|
||||||
/* Flatten center has not been calculated yet if we are not using the area normal. */
|
|
||||||
if (brush.sculpt_plane != SCULPT_DISP_DIR_AREA) {
|
|
||||||
SCULPT_calc_area_center(sd, ob, nodes, r_area_co);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* For area normal. */
|
|
||||||
if (!SCULPT_stroke_is_first_brush_step_of_symmetry_pass(*ss.cache) &&
|
|
||||||
(brush.flag & BRUSH_ORIGINAL_NORMAL))
|
|
||||||
{
|
|
||||||
copy_v3_v3(r_area_no, ss.cache->sculpt_normal);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
copy_v3_v3(ss.cache->sculpt_normal, r_area_no);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* For flatten center. */
|
|
||||||
if (!SCULPT_stroke_is_first_brush_step_of_symmetry_pass(*ss.cache) &&
|
|
||||||
(brush.flag & BRUSH_ORIGINAL_PLANE))
|
|
||||||
{
|
|
||||||
copy_v3_v3(r_area_co, ss.cache->last_center);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
copy_v3_v3(ss.cache->last_center, r_area_co);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* For area normal. */
|
|
||||||
copy_v3_v3(r_area_no, ss.cache->sculpt_normal);
|
|
||||||
|
|
||||||
/* For flatten center. */
|
|
||||||
copy_v3_v3(r_area_co, ss.cache->last_center);
|
|
||||||
|
|
||||||
/* For area normal. */
|
|
||||||
flip_v3(r_area_no, ss.cache->mirror_symmetry_pass);
|
|
||||||
|
|
||||||
/* For flatten center. */
|
|
||||||
flip_v3(r_area_co, ss.cache->mirror_symmetry_pass);
|
|
||||||
|
|
||||||
/* For area normal. */
|
|
||||||
mul_m4_v3(ss.cache->symm_rot_mat.ptr(), r_area_no);
|
|
||||||
|
|
||||||
/* For flatten center. */
|
|
||||||
mul_m4_v3(ss.cache->symm_rot_mat.ptr(), r_area_co);
|
|
||||||
|
|
||||||
/* Shift the plane for the current tile. */
|
|
||||||
add_v3_v3(r_area_co, ss.cache->plane_offset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void sculpt_rake_rotate(const SculptSession &ss,
|
static void sculpt_rake_rotate(const SculptSession &ss,
|
||||||
const float sculpt_co[3],
|
const float sculpt_co[3],
|
||||||
const float v_co[3],
|
const float v_co[3],
|
||||||
@ -1733,7 +1644,7 @@ void SCULPT_do_pinch_brush(const Sculpt &sd, Object &ob, Span<PBVHNode *> nodes)
|
|||||||
float area_co[3];
|
float area_co[3];
|
||||||
|
|
||||||
float mat[4][4];
|
float mat[4][4];
|
||||||
calc_sculpt_plane(sd, ob, nodes, area_no, area_co);
|
SCULPT_calc_brush_plane(sd, ob, nodes, area_no, area_co);
|
||||||
|
|
||||||
/* delay the first daub because grab delta is not setup */
|
/* delay the first daub because grab delta is not setup */
|
||||||
if (SCULPT_stroke_is_first_brush_step_of_symmetry_pass(*ss.cache)) {
|
if (SCULPT_stroke_is_first_brush_step_of_symmetry_pass(*ss.cache)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user