Blender V4.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"
12#include "BLI_math_vector.hh"
13#include "BLI_set.hh"
14
15#include "BKE_pbvh.hh"
16
17struct Brush;
18struct Scene;
19namespace blender::bke::pbvh {
20class Node;
21}
22
24
35
36enum class TargetType {
37 Mask,
39 Colors,
40};
41
42enum class RecursionType {
45};
46
47#define EXPAND_SYMM_AREAS 8
48
49struct Cache {
50 /* Target data elements that the expand operation will affect. */
52
53 /* Falloff data. */
55
56 /* Indexed by vertex index, precalculated falloff value of that vertex (without any falloff
57 * editing modification applied). */
59 /* Max falloff value in *vert_falloff. */
61
62 /* Indexed by base mesh face index, precalculated falloff value of that face. These values are
63 * calculated from the per vertex falloff (*vert_falloff) when needed. */
66
67 /* Falloff value of the active element (vertex or base mesh face) that Expand will expand to. */
69
70 /* When set to true, expand skips all falloff computations and considers all elements as enabled.
71 */
73
74 /* Initial mouse and cursor data from where the current falloff started. This data can be changed
75 * during the execution of Expand by moving the origin. */
80
81 /* Maximum number of vertices allowed in the SculptSession for previewing the falloff using
82 * geodesic distances. */
84
85 /* Original falloff type before starting the move operation. */
87 /* Falloff type using when moving the origin for preview. */
89
90 /* Face set ID that is going to be used when creating a new Face Set. */
92
93 /* Face Set ID of the Face set selected for editing. */
95
96 /* Mouse position since the last time the origin was moved. Used for reference when moving the
97 * initial position of Expand. */
99
100 /* Active island checks. */
101 /* Indexed by symmetry pass index, contains the connected island ID for that
102 * symmetry pass. Other connected island IDs not found in this
103 * array will be ignored by Expand. */
105
106 /* Snapping. */
107 /* Set containing all Face Sets IDs that Expand will use to snap the new data. */
108 std::unique_ptr<Set<int>> snap_enabled_face_sets;
109
110 /* Texture distortion data. */
111 const Brush *brush;
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
#define EXPAND_SYMM_AREAS
std::unique_ptr< Set< int > > snap_enabled_face_sets
int active_connected_islands[EXPAND_SYMM_AREAS]