Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Dobarro <pablodp606@gmail.com>2020-08-10 18:57:01 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-08-10 19:04:00 +0300
commited9c0464bae66411384c216ba3f34f65658e0f68 (patch)
treeb0a5004801180bbf67ae220f92932d007397671f /source/blender/blenkernel/BKE_paint.h
parent71639cc8627fb26e50233b9bb942776a950b6ab1 (diff)
Sculpt: Boundary Brush
This brush includes a set of deformation modes designed to deform and control the shape of the mesh boundaries, which are really hard to do with regular sculpt brushes (and even in edit mode). This is useful for creating cloth assets and hard surface base meshes. The brush detects the mesh boundary closest to the active vertex and propagates the deformation using the brush falloff into the mesh. It includes bend, expand, inflate, grab and twist deform modes. The main use cases of this brush are the Bend and Expand deformation modes, which depend on a grid topology to create the best results. In order to do further adjustments and tweaks to the result of these deformation modes, the brush also includes the Inflate, Grab and Twist deformation modes, which do not depend that much on the topology. Grab and Inflate are the same operation that is implemented in the Grab and Inflate tools, they are also available in the boundary brush as producing deformations with regular brushes in these areas is very hard to control. Even if this brush can produce deformations in triangle meshes and meshes with a non-regular quad grid, the more regular and clean the topology is, the better. Most of the assets this brush is intended to deform are always created from a cylindrical or plane quad grid, so it should be fine. Also, its algorithms can be improved in future versions to handle more corner cases and topology patterns. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8356
Diffstat (limited to 'source/blender/blenkernel/BKE_paint.h')
-rw-r--r--source/blender/blenkernel/BKE_paint.h73
1 files changed, 73 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index 4e520948bcb..58687858a9e 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -314,6 +314,76 @@ typedef struct SculptVertexInfo {
BLI_bitmap *boundary;
} SculptVertexInfo;
+typedef struct SculptBoundaryEditInfo {
+ /* Vertex index from where the topology propagation reached this vertex. */
+ int original_vertex;
+
+ /* How many steps were needed to reach this vertex from the boundary. */
+ int num_propagation_steps;
+
+ /* Stregth that is used to deform this vertex. */
+ float strength_factor;
+} SculptBoundaryEditInfo;
+
+/* Edge for drawing the boundary preview in the cursor. */
+typedef struct SculptBoundaryPreviewEdge {
+ int v1;
+ int v2;
+} SculptBoundaryPreviewEdge;
+
+typedef struct SculptBoundary {
+ /* Vertex indices of the active boundary. */
+ int *vertices;
+ int vertices_capacity;
+ int num_vertices;
+
+ /* Data for drawing the preview. */
+ SculptBoundaryPreviewEdge *edges;
+ int edges_capacity;
+ int num_edges;
+
+ /* True if the boundary loops into itself. */
+ bool forms_loop;
+
+ /* Initial vertex in the boundary which is closest to the current sculpt active vertex. */
+ int initial_vertex;
+
+ /* Vertex that at max_propagation_steps from the boundary and closest to the original active
+ * vertex that was used to initialize the boundary. This is used as a reference to check how much
+ * the deformation will go into the mesh and to calculate the strength of the brushes. */
+ int pivot_vertex;
+
+ /* Stores the initial positions of the pivot and boundary initial vertex as they may be deformed
+ * during the brush action. This allows to use them as a reference positions and vectors for some
+ * brush effects. */
+ float initial_vertex_position[3];
+ float initial_pivot_position[3];
+
+ /* Maximum number of topology steps that were calculated from the boundary. */
+ int max_propagation_steps;
+
+ /* Indexed by vertex index, contains the topology information needed for boundary deformations.
+ */
+ struct SculptBoundaryEditInfo *edit_info;
+
+ /* Bend Deform type. */
+ struct {
+ float (*pivot_rotation_axis)[3];
+ float (*pivot_positions)[3];
+ } bend;
+
+ /* Slide Deform type. */
+ struct {
+ float (*directions)[3];
+ } slide;
+
+ /* Twist Deform type. */
+ struct {
+ float rotation_axis[3];
+ float pivot_position[3];
+ } twist;
+} SculptBoundary;
+
typedef struct SculptFakeNeighbors {
bool use_fake_neighbors;
@@ -415,6 +485,9 @@ typedef struct SculptSession {
float pose_origin[3];
SculptPoseIKChain *pose_ik_chain_preview;
+ /* Boundary Brush Preview */
+ SculptBoundary *boundary_preview;
+
/* Mesh State Persistence */
/* This is freed with the PBVH, so it is always in sync with the mesh. */
SculptPersistentBase *persistent_base;