Blender V4.5
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
15struct Brush;
16struct Scene;
17namespace blender::bke::pbvh {
18class Node;
19}
20
22
33
39
44
45#define EXPAND_SYMM_AREAS 8
46
47struct Cache {
48 /* Target data elements that the expand operation will affect. */
50
51 /* Falloff data. */
53
54 /* Indexed by vertex index, precalculated falloff value of that vertex (without any falloff
55 * editing modification applied). */
57 /* Max falloff value in *vert_falloff. */
59
60 /* Indexed by base mesh face index, precalculated falloff value of that face. These values are
61 * calculated from the per vertex falloff (*vert_falloff) when needed. */
64
65 /* Falloff value of the active element (vertex or base mesh face) that Expand will expand to. */
67
68 /* When set to true, expand skips all falloff computations and considers all elements as enabled.
69 */
71
72 /* Initial mouse and cursor data from where the current falloff started. This data can be changed
73 * during the execution of Expand by moving the origin. */
78
79 /* Maximum number of vertices allowed in the SculptSession for previewing the falloff using
80 * geodesic distances. */
82
83 /* Original falloff type before starting the move operation. */
85 /* Falloff type using when moving the origin for preview. */
87
88 /* Face set ID that is going to be used when creating a new Face Set. */
90
91 /* Face Set ID of the Face set selected for editing. */
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 Sets 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;
111 // struct MTex *mtex;
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 Sets 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 /* If nothing is masked set mask of every vertex to 0. */
156
157 /* Color target data type related data. */
158 float fill_color[4];
160
161 /* Face Sets at the first step of the expand operation, before starting modifying the active
162 * vertex and active falloff. These are not the original Face Sets of the sculpt before starting
163 * the operator as they could have been modified by Expand when initializing the operator and
164 * before starting changing the active vertex. These Face Sets are used for restoring and
165 * checking the Face Sets state while the Expand operation modal runs. */
167
168 /* Original data of the sculpt as it was before running the Expand operator. */
172
175};
176
177} // namespace blender::ed::sculpt_paint::expand
VecBase< float, 2 > float2
#define EXPAND_SYMM_AREAS
std::unique_ptr< Set< int > > snap_enabled_face_sets
int active_connected_islands[EXPAND_SYMM_AREAS]