Cleanup: Remove sculpt_brush_types.cc

The file only had a single function remaining inside of it, moving it
inside `sculpt.cc` seems more prudent until we determine a better place
for related methods.

Pull Request: https://projects.blender.org/blender/blender/pulls/126708
This commit is contained in:
Sean Kim
2024-08-24 00:22:33 +02:00
committed by Sean Kim
parent 47223553f7
commit 0e5c6ec33f
3 changed files with 23 additions and 67 deletions

View File

@@ -92,7 +92,6 @@ set(SRC
sculpt.cc
sculpt_automasking.cc
sculpt_boundary.cc
sculpt_brush_types.cc
sculpt_cloth.cc
sculpt_detail.cc
sculpt_dyntopo.cc

View File

@@ -808,6 +808,29 @@ bool SCULPT_check_vertex_pivot_symmetry(const float vco[3], const float pco[3],
return is_in_symmetry_area;
}
void sculpt_project_v3_normal_align(const SculptSession &ss,
const float normal_weight,
float grab_delta[3])
{
/* Signed to support grabbing in (to make a hole) as well as out. */
const float len_signed = dot_v3v3(ss.cache->sculpt_normal_symm, grab_delta);
/* This scale effectively projects the offset so dragging follows the cursor,
* as the normal points towards the view, the scale increases. */
float len_view_scale;
{
float view_aligned_normal[3];
project_plane_v3_v3v3(
view_aligned_normal, ss.cache->sculpt_normal_symm, ss.cache->view_normal);
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;
}
mul_v3_fl(grab_delta, 1.0f - normal_weight);
madd_v3_v3fl(
grab_delta, ss.cache->sculpt_normal_symm, (len_signed * normal_weight) * len_view_scale);
}
namespace blender::ed::sculpt_paint {
std::optional<int> nearest_vert_calc_mesh(const bke::pbvh::Tree &pbvh,

View File

@@ -1,66 +0,0 @@
/* SPDX-FileCopyrightText: 2006 by Nicholas Bishop. All rights reserved.
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup edsculpt
* Implements the Sculpt Mode tools.
*/
#include "MEM_guardedalloc.h"
#include "BLI_ghash.h"
#include "BLI_math_geom.h"
#include "BLI_math_matrix.h"
#include "BLI_math_rotation.h"
#include "BLI_math_vector.h"
#include "BLI_math_vector.hh"
#include "BLI_span.hh"
#include "BLI_task.h"
#include "BLI_utildefines.h"
#include "DNA_brush_types.h"
#include "DNA_customdata_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BKE_brush.hh"
#include "BKE_ccg.hh"
#include "BKE_colortools.hh"
#include "BKE_kelvinlet.h"
#include "BKE_paint.hh"
#include "BKE_pbvh_api.hh"
#include "ED_view3d.hh"
#include "paint_intern.hh"
#include "sculpt_intern.hh"
#include "bmesh.hh"
#include <cmath>
#include <cstdlib>
#include <cstring>
void sculpt_project_v3_normal_align(const SculptSession &ss,
const float normal_weight,
float grab_delta[3])
{
/* Signed to support grabbing in (to make a hole) as well as out. */
const float len_signed = dot_v3v3(ss.cache->sculpt_normal_symm, grab_delta);
/* This scale effectively projects the offset so dragging follows the cursor,
* as the normal points towards the view, the scale increases. */
float len_view_scale;
{
float view_aligned_normal[3];
project_plane_v3_v3v3(
view_aligned_normal, ss.cache->sculpt_normal_symm, ss.cache->view_normal);
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;
}
mul_v3_fl(grab_delta, 1.0f - normal_weight);
madd_v3_v3fl(
grab_delta, ss.cache->sculpt_normal_symm, (len_signed * normal_weight) * len_view_scale);
}