Blender V5.0
sculpt_automask.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2024 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8#pragma once
9
10#include <memory>
11
12#include "BLI_array.hh"
13#include "BLI_offset_indices.hh"
14#include "BLI_set.hh"
15
16#include "DNA_brush_enums.h"
17
18struct BMVert;
19struct Brush;
20struct CurveMapping;
21struct Depsgraph;
22struct Object;
23struct Sculpt;
24struct SculptSession;
25namespace blender::bke::pbvh {
26struct MeshNode;
27struct GridsNode;
28struct BMeshNode;
29} // namespace blender::bke::pbvh
30
32
48
49struct Cache {
51
54
55 enum class OcclusionValue : int8_t {
59 };
60
70
77
89 void calc_cavity_factor(const Depsgraph &depsgraph,
90 const Object &object,
91 const IndexMask &node_mask);
92};
93
98const Cache *active_cache_get(const SculptSession &ss);
99
106std::unique_ptr<Cache> cache_init(const Depsgraph &depsgraph,
107 const Sculpt &sd,
108 const Brush *brush,
109 Object &ob);
110
112Cache &filter_cache_ensure(const Depsgraph &depsgraph, const Sculpt &sd, Object &ob);
114Cache &stroke_cache_ensure(const Depsgraph &depsgraph,
115 const Sculpt &sd,
116 const Brush *brush,
117 Object &ob);
118
119bool mode_enabled(const Sculpt &sd, const Brush *br, eAutomasking_flag mode);
120bool is_enabled(const Sculpt &sd, const Object &object, const Brush *br);
121
125void calc_vert_factors(const Depsgraph &depsgraph,
126 const Object &object,
127 const Cache &automasking,
128 const bke::pbvh::MeshNode &node,
130 MutableSpan<float> factors);
131inline void calc_vert_factors(const Depsgraph &depsgraph,
132 const Object &object,
133 const Cache *cache,
134 const bke::pbvh::MeshNode &node,
136 MutableSpan<float> factors)
137{
138 if (cache) {
139 calc_vert_factors(depsgraph, object, *cache, node, verts, factors);
140 }
141}
142void calc_grids_factors(const Depsgraph &depsgraph,
143 const Object &object,
144 const Cache &automasking,
145 const bke::pbvh::GridsNode &node,
146 Span<int> grids,
147 MutableSpan<float> factors);
148inline void calc_grids_factors(const Depsgraph &depsgraph,
149 const Object &object,
150 const Cache *cache,
151 const bke::pbvh::GridsNode &node,
152 Span<int> grids,
153 MutableSpan<float> factors)
154{
155 if (cache) {
156 calc_grids_factors(depsgraph, object, *cache, node, grids, factors);
157 }
158}
159void calc_vert_factors(const Depsgraph &depsgraph,
160 const Object &object,
161 const Cache &automasking,
162 const bke::pbvh::BMeshNode &node,
163 const Set<BMVert *, 0> &verts,
164 MutableSpan<float> factors);
165inline void calc_vert_factors(const Depsgraph &depsgraph,
166 const Object &object,
167 const Cache *cache,
168 const bke::pbvh::BMeshNode &node,
169 const Set<BMVert *, 0> &verts,
170 MutableSpan<float> factors)
171{
172 if (cache) {
173 calc_vert_factors(depsgraph, object, *cache, node, verts, factors);
174 }
175}
176
180void calc_face_factors(const Depsgraph &depsgraph,
181 const Object &object,
183 Span<int> corner_verts,
184 const Cache &automasking,
185 const bke::pbvh::MeshNode &node,
186 Span<int> face_indices,
187 MutableSpan<float> factors);
188
189} // namespace blender::ed::sculpt_paint::auto_mask
eAutomasking_flag
BPy_StructRNA * depsgraph
static float verts[][3]
static char faces[256]
const Cache * active_cache_get(const SculptSession &ss)
Cache & stroke_cache_ensure(const Depsgraph &depsgraph, const Sculpt &sd, const Brush *brush, Object &ob)
Cache & filter_cache_ensure(const Depsgraph &depsgraph, const Sculpt &sd, Object &ob)
void calc_vert_factors(const Depsgraph &depsgraph, const Object &object, const Cache &automasking, const bke::pbvh::MeshNode &node, Span< int > verts, MutableSpan< float > factors)
void calc_grids_factors(const Depsgraph &depsgraph, const Object &object, const Cache &automasking, const bke::pbvh::GridsNode &node, Span< int > grids, MutableSpan< float > factors)
bool is_enabled(const Sculpt &sd, const Object &object, const Brush *br)
void calc_face_factors(const Depsgraph &depsgraph, const Object &object, OffsetIndices< int > faces, Span< int > corner_verts, const Cache &automasking, const bke::pbvh::MeshNode &node, Span< int > face_indices, MutableSpan< float > factors)
bool mode_enabled(const Sculpt &sd, const Brush *br, eAutomasking_flag mode)
std::unique_ptr< Cache > cache_init(const Depsgraph &depsgraph, const Sculpt &sd, const Brush *brush, Object &ob)
void calc_cavity_factor(const Depsgraph &depsgraph, const Object &object, const IndexMask &node_mask)