Cleanup: Sculpt: Move automasking functions to proper header

This commit is contained in:
Hans Goudey
2024-09-18 11:11:06 -04:00
parent 4a45ae7393
commit 721ece9efb
47 changed files with 120 additions and 74 deletions

View File

@@ -16,6 +16,7 @@
#include "BLI_task.hh"
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "editors/sculpt_paint/sculpt_intern.hh"
#include "editors/sculpt_paint/sculpt_smooth.hh"

View File

@@ -18,6 +18,7 @@
#include "BLI_utildefines.h"
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "editors/sculpt_paint/sculpt_intern.hh"
namespace blender::ed::sculpt_paint {

View File

@@ -25,6 +25,7 @@
#include "BLI_task.hh"
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "editors/sculpt_paint/sculpt_intern.hh"
namespace blender::ed::sculpt_paint {

View File

@@ -27,6 +27,7 @@
#include "BLI_task.hh"
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "editors/sculpt_paint/sculpt_intern.hh"
namespace blender::ed::sculpt_paint {

View File

@@ -25,6 +25,7 @@
#include "BLI_task.hh"
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "editors/sculpt_paint/sculpt_intern.hh"
namespace blender::ed::sculpt_paint {

View File

@@ -23,6 +23,7 @@
#include "BLI_task.hh"
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "editors/sculpt_paint/sculpt_intern.hh"
namespace blender::ed::sculpt_paint {

View File

@@ -4,6 +4,7 @@
#include "editors/sculpt_paint/brushes/types.hh"
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "DNA_brush_types.h"

View File

@@ -23,6 +23,7 @@
#include "BLI_task.hh"
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "editors/sculpt_paint/sculpt_intern.hh"
namespace blender::ed::sculpt_paint {

View File

@@ -22,6 +22,7 @@
#include "BLI_task.hh"
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "editors/sculpt_paint/sculpt_intern.hh"
namespace blender::ed::sculpt_paint {

View File

@@ -24,6 +24,7 @@
#include "BLI_task.hh"
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "editors/sculpt_paint/sculpt_intern.hh"
namespace blender::ed::sculpt_paint {

View File

@@ -19,6 +19,7 @@
#include "BLI_task.hh"
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "editors/sculpt_paint/sculpt_intern.hh"
#include "editors/sculpt_paint/sculpt_smooth.hh"

View File

@@ -24,6 +24,7 @@
#include "BLI_task.hh"
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "editors/sculpt_paint/sculpt_intern.hh"
namespace blender::ed::sculpt_paint {

View File

@@ -23,6 +23,7 @@
#include "BLI_task.hh"
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "editors/sculpt_paint/sculpt_intern.hh"
namespace blender::ed::sculpt_paint {

View File

@@ -23,6 +23,7 @@
#include "BLI_task.hh"
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "editors/sculpt_paint/sculpt_intern.hh"
namespace blender::ed::sculpt_paint {

View File

@@ -23,6 +23,7 @@
#include "BLI_task.hh"
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "editors/sculpt_paint/sculpt_intern.hh"
namespace blender::ed::sculpt_paint {

View File

@@ -25,6 +25,7 @@
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/paint_intern.hh"
#include "editors/sculpt_paint/paint_mask.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "editors/sculpt_paint/sculpt_intern.hh"
namespace blender::ed::sculpt_paint {

View File

@@ -21,6 +21,7 @@
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/paint_intern.hh"
#include "editors/sculpt_paint/paint_mask.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "editors/sculpt_paint/sculpt_intern.hh"
namespace blender::ed::sculpt_paint {

View File

@@ -31,6 +31,7 @@
#include <cstdlib>
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "editors/sculpt_paint/sculpt_intern.hh"
namespace blender::ed::sculpt_paint {

View File

@@ -20,6 +20,7 @@
#include "BLI_task.hh"
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "editors/sculpt_paint/sculpt_intern.hh"
namespace blender::ed::sculpt_paint {

View File

@@ -21,6 +21,7 @@
#include "BLI_task.hh"
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "editors/sculpt_paint/sculpt_intern.hh"
namespace blender::ed::sculpt_paint {

View File

@@ -24,6 +24,7 @@
#include "BLI_task.hh"
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "editors/sculpt_paint/sculpt_intern.hh"
namespace blender::ed::sculpt_paint {

View File

@@ -14,6 +14,7 @@
#include "BLI_task.hh"
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "editors/sculpt_paint/sculpt_boundary.hh"
#include "editors/sculpt_paint/sculpt_face_set.hh"
#include "editors/sculpt_paint/sculpt_intern.hh"

View File

@@ -24,6 +24,7 @@
#include "BLI_task.hh"
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "editors/sculpt_paint/sculpt_intern.hh"
namespace blender::ed::sculpt_paint {

View File

@@ -24,6 +24,7 @@
#include "BLI_task.hh"
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "editors/sculpt_paint/sculpt_intern.hh"
namespace blender::ed::sculpt_paint {

View File

@@ -21,6 +21,7 @@
#include "BLI_virtual_array.hh"
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "editors/sculpt_paint/sculpt_boundary.hh"
#include "editors/sculpt_paint/sculpt_intern.hh"
#include "editors/sculpt_paint/sculpt_smooth.hh"

View File

@@ -16,6 +16,7 @@
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/paint_intern.hh"
#include "editors/sculpt_paint/paint_mask.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "editors/sculpt_paint/sculpt_boundary.hh"
#include "editors/sculpt_paint/sculpt_intern.hh"
#include "editors/sculpt_paint/sculpt_smooth.hh"

View File

@@ -27,6 +27,7 @@
#include "BLI_task.hh"
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "editors/sculpt_paint/sculpt_intern.hh"
namespace blender::ed::sculpt_paint {

View File

@@ -21,6 +21,7 @@
#include "BLI_virtual_array.hh"
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "editors/sculpt_paint/sculpt_intern.hh"
#include "editors/sculpt_paint/sculpt_smooth.hh"

View File

@@ -23,6 +23,7 @@
#include "BLI_task.hh"
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "editors/sculpt_paint/sculpt_intern.hh"
namespace blender::ed::sculpt_paint {

View File

@@ -23,6 +23,7 @@
#include "BLI_task.hh"
#include "editors/sculpt_paint/mesh_brush_common.hh"
#include "editors/sculpt_paint/sculpt_automask.hh"
#include "editors/sculpt_paint/sculpt_intern.hh"
namespace blender::ed::sculpt_paint {

View File

@@ -280,80 +280,6 @@ void calc_brush_texture_factors(const SculptSession &ss,
Span<float3> positions,
MutableSpan<float> factors);
namespace auto_mask {
/**
* Calculate all auto-masking influence on each vertex.
*/
void calc_vert_factors(const Depsgraph &depsgraph,
const Object &object,
const Cache &cache,
const bke::pbvh::MeshNode &node,
Span<int> verts,
MutableSpan<float> factors);
inline void calc_vert_factors(const Depsgraph &depsgraph,
const Object &object,
const Cache *cache,
const bke::pbvh::MeshNode &node,
Span<int> verts,
MutableSpan<float> factors)
{
if (cache == nullptr) {
return;
}
calc_vert_factors(depsgraph, object, *cache, node, verts, factors);
}
void calc_grids_factors(const Depsgraph &depsgraph,
const Object &object,
const Cache &cache,
const bke::pbvh::GridsNode &node,
Span<int> grids,
MutableSpan<float> factors);
inline void calc_grids_factors(const Depsgraph &depsgraph,
const Object &object,
const Cache *cache,
const bke::pbvh::GridsNode &node,
Span<int> grids,
MutableSpan<float> factors)
{
if (cache == nullptr) {
return;
}
calc_grids_factors(depsgraph, object, *cache, node, grids, factors);
}
void calc_vert_factors(const Depsgraph &depsgraph,
const Object &object,
const Cache &cache,
const bke::pbvh::BMeshNode &node,
const Set<BMVert *, 0> &verts,
MutableSpan<float> factors);
inline void calc_vert_factors(const Depsgraph &depsgraph,
const Object &object,
const Cache *cache,
const bke::pbvh::BMeshNode &node,
const Set<BMVert *, 0> &verts,
MutableSpan<float> factors)
{
if (cache == nullptr) {
return;
}
calc_vert_factors(depsgraph, object, *cache, node, verts, factors);
}
/**
* Calculate all auto-masking influence on each face.
*/
void calc_face_factors(const Depsgraph &depsgraph,
const Object &object,
OffsetIndices<int> faces,
Span<int> corner_verts,
const Cache &cache,
const bke::pbvh::MeshNode &node,
Span<int> face_indices,
MutableSpan<float> factors);
} // namespace auto_mask
/**
* Many brushes end up calculating translations from the original positions. Instead of applying
* these directly to the modified values, it's helpful to process them separately to easily

View File

@@ -44,6 +44,7 @@
#include "mesh_brush_common.hh"
#include "paint_intern.hh"
#include "sculpt_automask.hh"
#include "sculpt_gesture.hh"
#include "sculpt_intern.hh"
#include "sculpt_islands.hh"

View File

@@ -43,6 +43,7 @@
#include "mesh_brush_common.hh"
#include "paint_intern.hh"
#include "sculpt_automask.hh"
#include "sculpt_gesture.hh"
#include "sculpt_hide.hh"
#include "sculpt_intern.hh"

View File

@@ -69,6 +69,7 @@
#include "mesh_brush_common.hh"
#include "paint_intern.hh" /* own include */
#include "sculpt_automask.hh"
#include "sculpt_intern.hh"
using namespace blender;

View File

@@ -100,6 +100,7 @@
#include "editors/sculpt_paint/brushes/types.hh"
#include "mesh_brush_common.hh"
#include "sculpt_automask.hh"
using blender::float3;
using blender::MutableSpan;

View File

@@ -11,16 +11,24 @@
#include "BLI_array.hh"
#include "BLI_bit_vector.hh"
#include "BLI_offset_indices.hh"
#include "BLI_set.hh"
#include "BLI_sys_types.h"
#include "DNA_brush_enums.h"
struct BMVert;
struct Brush;
struct CurveMapping;
struct Depsgraph;
struct Object;
struct Sculpt;
struct SculptSession;
namespace blender::bke::pbvh {
struct MeshNode;
struct GridsNode;
struct BMeshNode;
} // namespace blender::bke::pbvh
namespace blender::ed::sculpt_paint::auto_mask {
@@ -96,4 +104,71 @@ bool needs_normal(const SculptSession &ss, const Sculpt &sd, const Brush *brush)
bool brush_type_can_reuse_automask(int sculpt_brush_type);
/**
* Calculate all auto-masking influence on each vertex.
*/
void calc_vert_factors(const Depsgraph &depsgraph,
const Object &object,
const Cache &cache,
const bke::pbvh::MeshNode &node,
Span<int> verts,
MutableSpan<float> factors);
inline void calc_vert_factors(const Depsgraph &depsgraph,
const Object &object,
const Cache *cache,
const bke::pbvh::MeshNode &node,
Span<int> verts,
MutableSpan<float> factors)
{
if (cache) {
calc_vert_factors(depsgraph, object, *cache, node, verts, factors);
}
}
void calc_grids_factors(const Depsgraph &depsgraph,
const Object &object,
const Cache &cache,
const bke::pbvh::GridsNode &node,
Span<int> grids,
MutableSpan<float> factors);
inline void calc_grids_factors(const Depsgraph &depsgraph,
const Object &object,
const Cache *cache,
const bke::pbvh::GridsNode &node,
Span<int> grids,
MutableSpan<float> factors)
{
if (cache) {
calc_grids_factors(depsgraph, object, *cache, node, grids, factors);
}
}
void calc_vert_factors(const Depsgraph &depsgraph,
const Object &object,
const Cache &cache,
const bke::pbvh::BMeshNode &node,
const Set<BMVert *, 0> &verts,
MutableSpan<float> factors);
inline void calc_vert_factors(const Depsgraph &depsgraph,
const Object &object,
const Cache *cache,
const bke::pbvh::BMeshNode &node,
const Set<BMVert *, 0> &verts,
MutableSpan<float> factors)
{
if (cache) {
calc_vert_factors(depsgraph, object, *cache, node, verts, factors);
}
}
/**
* Calculate all auto-masking influence on each face.
*/
void calc_face_factors(const Depsgraph &depsgraph,
const Object &object,
OffsetIndices<int> faces,
Span<int> corner_verts,
const Cache &cache,
const bke::pbvh::MeshNode &node,
Span<int> face_indices,
MutableSpan<float> factors);
} // namespace blender::ed::sculpt_paint::auto_mask

View File

@@ -30,6 +30,7 @@
#include "mesh_brush_common.hh"
#include "paint_intern.hh"
#include "sculpt_automask.hh"
#include "sculpt_boundary.hh"
#include "sculpt_dyntopo.hh"
#include "sculpt_face_set.hh"

View File

@@ -26,6 +26,7 @@
#include "brushes/types.hh"
#include "mesh_brush_common.hh"
#include "paint_intern.hh"
#include "sculpt_automask.hh"
#include "sculpt_cloth.hh"
#include "sculpt_flood_fill.hh"
#include "sculpt_intern.hh"

View File

@@ -54,6 +54,7 @@
#include "mesh_brush_common.hh"
#include "paint_hide.hh"
#include "sculpt_automask.hh"
#include "sculpt_boundary.hh"
#include "sculpt_gesture.hh"
#include "sculpt_intern.hh"

View File

@@ -24,6 +24,7 @@
#include "mesh_brush_common.hh"
#include "paint_intern.hh"
#include "paint_mask.hh"
#include "sculpt_automask.hh"
#include "sculpt_hide.hh"
#include "sculpt_intern.hh"
#include "sculpt_smooth.hh"

View File

@@ -30,6 +30,7 @@
#include "IMB_colormanagement.hh"
#include "mesh_brush_common.hh"
#include "sculpt_automask.hh"
#include "sculpt_color.hh"
#include "sculpt_intern.hh"
#include "sculpt_smooth.hh"

View File

@@ -29,6 +29,7 @@
#include "bmesh.hh"
#include "mesh_brush_common.hh"
#include "sculpt_automask.hh"
#include "sculpt_intern.hh"
namespace blender::ed::sculpt_paint::paint::image {

View File

@@ -28,6 +28,7 @@
#include "mesh_brush_common.hh"
#include "paint_intern.hh"
#include "sculpt_automask.hh"
#include "sculpt_cloth.hh"
#include "sculpt_face_set.hh"
#include "sculpt_flood_fill.hh"

View File

@@ -18,6 +18,7 @@
#include "WM_types.hh"
#include "mesh_brush_common.hh"
#include "sculpt_automask.hh"
#include "sculpt_gesture.hh"
#include "sculpt_intern.hh"
#include "sculpt_undo.hh"

View File

@@ -22,6 +22,7 @@
#include "BKE_subdiv_ccg.hh"
#include "mesh_brush_common.hh"
#include "sculpt_automask.hh"
#include "sculpt_color.hh"
#include "sculpt_face_set.hh"
#include "sculpt_hide.hh"

View File

@@ -36,6 +36,7 @@
#include "mesh_brush_common.hh"
#include "paint_intern.hh"
#include "paint_mask.hh"
#include "sculpt_automask.hh"
#include "sculpt_filter.hh"
#include "sculpt_intern.hh"
#include "sculpt_undo.hh"

View File

@@ -82,6 +82,7 @@
#include "mesh_brush_common.hh"
#include "paint_hide.hh"
#include "paint_intern.hh"
#include "sculpt_automask.hh"
#include "sculpt_color.hh"
#include "sculpt_dyntopo.hh"
#include "sculpt_face_set.hh"