Blender V5.0
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
16struct Brush;
17struct Scene;
18namespace blender::bke::pbvh {
19class Node;
20}
21
23
34
40
45
46#define EXPAND_SYMM_AREAS 8
47
48struct Cache {
49 /* Target data elements that the expand operation will affect. */
51
52 /* Falloff data. */
54
55 /* Indexed by vertex index, precalculated falloff value of that vertex (without any falloff
56 * editing modification applied). */
58 /* Max falloff value in *vert_falloff. */
60
61 /* Indexed by base mesh face index, precalculated falloff value of that face. These values are
62 * calculated from the per vertex falloff (*vert_falloff) when needed. */
65
66 /* Falloff value of the active element (vertex or base mesh face) that Expand will expand to. */
68
69 /* When set to true, expand skips all falloff computations and considers all elements as enabled.
70 */
72
73 /* Initial mouse and cursor data from where the current falloff started. This data can be changed
74 * during the execution of Expand by moving the origin. */
79
80 /* Maximum number of vertices allowed in the SculptSession for previewing the falloff using
81 * geodesic distances. */
83
84 /* Original falloff type before starting the move operation. */
86 /* Falloff type using when moving the origin for preview. */
88
89 /* Face set ID that is going to be used when creating a new Face Set. */
91
92 /* Face Set ID of the Face set selected for editing. */
94
95 /* Mouse position since the last time the origin was moved. Used for reference when moving the
96 * initial position of Expand. */
98
99 /* Active island checks. */
100 /* Indexed by symmetry pass index, contains the connected island ID for that
101 * symmetry pass. Other connected island IDs not found in this
102 * array will be ignored by Expand. */
104
105 /* Snapping. */
106 /* Set containing all Face Sets IDs that Expand will use to snap the new data. */
107 std::unique_ptr<Set<int>> snap_enabled_face_sets;
108
109 /* Texture distortion data. */
110 const Brush *brush;
111 const Paint *paint;
113 // struct MTex *mtex;
114
115 /* Controls how much texture distortion will be applied to the current falloff */
117
118 /* Cached pbvh::Tree nodes. This allows to skip gathering all nodes from the pbvh::Tree each time
119 * expand needs to update the state of the elements. */
122
123 /* Expand state options. */
124
125 /* Number of loops (times that the falloff is going to be repeated). */
127
128 /* Invert the falloff result. */
129 bool invert;
130
131 /* When set to true, preserves the previous state of the data and adds the new one on top. */
133
134 /* When set to true, the mask or colors will be applied as a gradient. */
136
137 /* When set to true, Expand will use the Brush falloff curve data to shape the gradient. */
139
140 /* When set to true, Expand will move the origin (initial active vertex and cursor position)
141 * instead of updating the active vertex and active falloff. */
142 bool move;
143
144 /* When set to true, Expand will snap the new data to the Face Sets IDs found in
145 * *original_face_sets. */
146 bool snap;
147
148 /* When set to true, Expand will use the current Face Set ID to modify an existing Face Set
149 * instead of creating a new one. */
151
152 /* When set to true, Expand will reposition the sculpt pivot to the boundary of the expand result
153 * after finishing the operation. */
155
156 /* If nothing is masked set mask of every vertex to 0. */
158
159 /* Color target data type related data. */
160 float fill_color[4];
162
163 /* Face Sets at the first step of the expand operation, before starting modifying the active
164 * vertex and active falloff. These are not the original Face Sets of the sculpt before starting
165 * the operator as they could have been modified by Expand when initializing the operator and
166 * before starting changing the active vertex. These Face Sets are used for restoring and
167 * checking the Face Sets state while the Expand operation modal runs. */
169
170 /* Original data of the sculpt as it was before running the Expand operator. */
174
177};
178
179} // 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]