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
path: root/source
diff options
context:
space:
mode:
authorPablo Dobarro <pablodp606@gmail.com>2020-07-21 23:57:50 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-07-21 23:59:07 +0300
commit878d191baee6b6a7997cf21d980f39ea97a0a33b (patch)
treeb4106e231b219acb884e10006056f18d4a7b3e6d /source
parent46b126a2c8402a527cd611b47d04ee7de29a9775 (diff)
Sculpt: Add extra deform types to Slide
This adds extra deform modes to the slide mode of the Topology Slide/Relax brush (both slide and smear are almost identical). This is useful to move topology to a specific area to add more localized details Reviewed By: sergey Differential Revision: https://developer.blender.org/D8349
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/brush.c1
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c18
-rw-r--r--source/blender/makesdna/DNA_brush_types.h11
-rw-r--r--source/blender/makesrna/intern/rna_brush.c12
4 files changed, 38 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index a85617680d2..355bdfd10fd 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -1484,6 +1484,7 @@ void BKE_brush_sculpt_reset(Brush *br)
case SCULPT_TOOL_SLIDE_RELAX:
br->spacing = 10;
br->alpha = 1.0f;
+ br->slide_deform_type = BRUSH_SLIDE_DEFORM_DRAG;
break;
case SCULPT_TOOL_CLAY:
br->flag |= BRUSH_SIZE_PRESSURE;
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index e679c62fdaa..da5d6588dc8 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -3100,11 +3100,23 @@ static void do_topology_slide_task_cb_ex(void *__restrict userdata,
thread_id);
float current_disp[3];
float current_disp_norm[3];
- float final_disp[3];
- zero_v3(final_disp);
- sub_v3_v3v3(current_disp, ss->cache->location, ss->cache->last_location);
+ float final_disp[3] = {0.0f, 0.0f, 0.0f};
+
+ switch (brush->slide_deform_type) {
+ case BRUSH_SLIDE_DEFORM_DRAG:
+ sub_v3_v3v3(current_disp, ss->cache->location, ss->cache->last_location);
+ break;
+ case BRUSH_SLIDE_DEFORM_PINCH:
+ sub_v3_v3v3(current_disp, ss->cache->location, vd.co);
+ break;
+ case BRUSH_SLIDE_DEFORM_EXPAND:
+ sub_v3_v3v3(current_disp, vd.co, ss->cache->location);
+ break;
+ }
+
normalize_v3_v3(current_disp_norm, current_disp);
mul_v3_v3fl(current_disp, current_disp_norm, ss->cache->bstrength);
+
SculptVertexNeighborIter ni;
SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, vd.index, ni) {
float vertex_disp[3];
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index 76a172d6fda..e2102abb285 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -349,6 +349,12 @@ typedef enum eBrushSmearDeformType {
BRUSH_SMEAR_DEFORM_EXPAND = 2,
} eBrushSmearDeformType;
+typedef enum eBrushSlideDeformType {
+ BRUSH_SLIDE_DEFORM_DRAG = 0,
+ BRUSH_SLIDE_DEFORM_PINCH = 1,
+ BRUSH_SLIDE_DEFORM_EXPAND = 2,
+} eBrushSlideDeformType;
+
/* Gpencilsettings.Vertex_mode */
typedef enum eGp_Vertex_Mode {
/* Affect to Stroke only. */
@@ -494,7 +500,7 @@ typedef struct Brush {
/** Source for fill tool color gradient application. */
char gradient_fill_mode;
- char _pad0[5];
+ char _pad0[1];
/** Projection shape (sphere, circle). */
char falloff_shape;
@@ -578,6 +584,9 @@ typedef struct Brush {
/* smear */
int smear_deform_type;
+ /* slide/relax */
+ int slide_deform_type;
+
/* overlay */
int texture_overlay_alpha;
int mask_overlay_alpha;
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 43f31922292..71922eb86b5 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -2004,6 +2004,13 @@ static void rna_def_brush(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL},
};
+ static const EnumPropertyItem brush_slide_deform_type_items[] = {
+ {BRUSH_SLIDE_DEFORM_DRAG, "DRAG", 0, "Drag", ""},
+ {BRUSH_SLIDE_DEFORM_PINCH, "PINCH", 0, "Pinch", ""},
+ {BRUSH_SLIDE_DEFORM_EXPAND, "EXPAND", 0, "Expand", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
srna = RNA_def_struct(brna, "Brush", "ID");
RNA_def_struct_ui_text(
srna, "Brush", "Brush data-block for storing brush settings for painting and sculpting");
@@ -2129,6 +2136,11 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Deformation", "Deformation type that is used in the brush");
RNA_def_property_update(prop, 0, "rna_Brush_update");
+ prop = RNA_def_property(srna, "slide_deform_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, brush_slide_deform_type_items);
+ RNA_def_property_ui_text(prop, "Deformation", "Deformation type that is used in the brush");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
prop = RNA_def_property(srna, "pose_deform_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, brush_pose_deform_type_items);
RNA_def_property_ui_text(prop, "Deformation", "Deformation type that is used in the brush");