Blender V5.3
sculpt_expand.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 "BLI_array.hh"
11#include "BLI_index_mask.hh"
13#include "BLI_set.hh"
14#include "DNA_scene_types.h"
15
16namespace blender {
17
18struct Brush;
19struct Scene;
20namespace bke::pbvh {
21class Node;
22}
23
25
36
37enum class TargetType {
39 FaceSets,
41};
42
47
48#define EXPAND_SYMM_AREAS 8
49
50struct Cache {
51 /* Target data elements that the expand operation will affect. */
53
54 /* Falloff data. */
56
57 /* Indexed by vertex index, precalculated falloff value of that vertex (without any falloff
58 * editing modification applied). */
60 /* Max falloff value in *vert_falloff. */
62
63 /* Indexed by base mesh face index, precalculated falloff value of that face. These values are
64 * calculated from the per vertex falloff (*vert_falloff) when needed. */
67
68 /* Falloff value of the active element (vertex or base mesh face) that Expand will expand to. */
70
71 /* When set to true, expand skips all falloff computations and considers all elements as enabled.
72 */
74
75 /* Initial mouse and cursor data from where the current falloff started. This data can be changed
76 * during the execution of Expand by moving the origin. */
81
82 /* Maximum number of vertices allowed in the SculptSession for previewing the falloff using
83 * geodesic distances. */
85
86 /* Original falloff type before starting the move operation. */
88 /* Falloff type using when moving the origin for preview. */
90
91 /* Face set ID that is going to be used when creating a new face set. */
93
94 /* Mouse position since the last time the origin was moved. Used for reference when moving the
95 * initial position of Expand. */
97
98 /* Active island checks. */
99 /* Indexed by symmetry pass index, contains the connected island ID for that
100 * symmetry pass. Other connected island IDs not found in this
101 * array will be ignored by Expand. */
103
104 /* Snapping. */
105 /* Set containing all face set IDs that Expand will use to snap the new data. */
106 std::unique_ptr<Set<int>> snap_enabled_face_sets;
107
108 /* Texture distortion data. */
109 const Brush *brush;
110 const Paint *paint;
112
113 /* Controls how much texture distortion will be applied to the current falloff */
115
116 /* Cached pbvh::Tree nodes. This allows to skip gathering all nodes from the pbvh::Tree each time
117 * expand needs to update the state of the elements. */
120
121 /* Expand state options. */
122
123 /* Number of loops (times that the falloff is going to be repeated). */
125
126 /* Invert the falloff result. */
127 bool invert;
128
129 /* When set to true, preserves the previous state of the data and adds the new one on top. */
131
132 /* When set to true, the mask or colors will be applied as a gradient. */
134
135 /* When set to true, Expand will use the Brush falloff curve data to shape the gradient. */
137
138 /* When set to true, Expand will move the origin (initial active vertex and cursor position)
139 * instead of updating the active vertex and active falloff. */
140 bool move;
141
142 /* When set to true, Expand will snap the new data to the face set IDs found in
143 * *original_face_sets. */
144 bool snap;
145
146 /* When set to true, Expand will use the current face set ID to modify an existing face set
147 * instead of creating a new one. */
149
150 /* When set to true, Expand will reposition the sculpt pivot to the boundary of the expand result
151 * after finishing the operation. */
153
154 /* Color target data type related data. */
155 float fill_color[4];
157
158 /* Face sets at the first step of the expand operation, before starting modifying the active
159 * vertex and active falloff. These are not the original face sets of the sculpt before starting
160 * the operator as they could have been modified by Expand when initializing the operator and
161 * before starting changing the active vertex. These face sets are used for restoring and
162 * checking the face sets state while the Expand operation modal runs. */
164
165 /* Original data of the sculpt as it was before running the Expand operator. */
169
172};
173
174} // namespace ed::sculpt_paint::expand
175
176} // namespace blender
BMesh Iterators.
VecBase< float, 2 > float2
#define EXPAND_SYMM_AREAS
std::unique_ptr< Set< int > > snap_enabled_face_sets
int active_connected_islands[EXPAND_SYMM_AREAS]