[Bf-blender-cvs] [3600e9057be] sculpt-dev: Array Brush: expose fill holes and orientation lock
aousdfh
noreply at git.blender.org
Thu Jul 15 21:12:26 CEST 2021
Commit: 3600e9057be63338096685746329c703c70be686
Author: aousdfh
Date: Thu Jul 15 21:00:14 2021 +0200
Branches: sculpt-dev
https://developer.blender.org/rB3600e9057be63338096685746329c703c70be686
Array Brush: expose fill holes and orientation lock
===================================================================
M release/scripts/startup/bl_ui/properties_paint_common.py
M source/blender/editors/sculpt_paint/sculpt_array.c
M source/blender/makesdna/DNA_brush_enums.h
M source/blender/makesrna/intern/rna_brush.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index 0da1dce95c2..f1da8897fee 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -764,6 +764,8 @@ def brush_settings(layout, context, brush, popover=False):
col = layout.column()
col.prop(brush, "array_deform_type")
col.prop(brush, "array_count")
+ col.prop(brush, "use_array_lock_orientation")
+ col.prop(brush, "use_array_fill_holes")
elif sculpt_tool == 'SMOOTH':
col = layout.column()
diff --git a/source/blender/editors/sculpt_paint/sculpt_array.c b/source/blender/editors/sculpt_paint/sculpt_array.c
index 398de769b45..fa4c69d462e 100644
--- a/source/blender/editors/sculpt_paint/sculpt_array.c
+++ b/source/blender/editors/sculpt_paint/sculpt_array.c
@@ -153,7 +153,7 @@ static BMesh *sculpt_array_source_build(Object *ob, Brush *brush, SculptArray *a
/* TODO(pablodp606): Handle individual Face Sets for Face Set automasking. */
BM_mesh_delete_hflag_context(srcbm, BM_ELEM_TAG, DEL_VERTS);
- const bool fill_holes = false;
+ const bool fill_holes = brush->flag2 & BRUSH_ARRAY_FILL_HOLES;
if (fill_holes) {
BM_mesh_elem_hflag_disable_all(srcbm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_TAG, false);
BM_mesh_elem_hflag_enable_all(srcbm, BM_EDGE, BM_ELEM_TAG, false);
@@ -248,9 +248,10 @@ printf("ALLOCATION COPY INDEX\n");
static void sculpt_array_mesh_build(Sculpt *sd, Object *ob, SculptArray *array) {
Mesh *sculpt_mesh = BKE_object_get_original_mesh(ob);
+ Brush *brush = BKE_paint_brush(&sd->paint);
sculpt_array_datalayers_add(sculpt_mesh);
- BMesh *srcbm = sculpt_array_source_build(ob, NULL, array);
+ BMesh *srcbm = sculpt_array_source_build(ob, brush, array);
BMesh *destbm;
const BMAllocTemplate allocsizeb = BMALLOC_TEMPLATE_FROM_ME(sculpt_mesh);
@@ -398,7 +399,7 @@ static void scultp_array_basis_from_direction(float r_mat[4][4], StrokeCache *ca
normalize_v3(r_mat[2]);
}
-static void sculpt_array_update_copy(StrokeCache *cache, SculptArray *array, SculptArrayCopy *copy, eBrushArrayDeformType array_type) {
+static void sculpt_array_update_copy(StrokeCache *cache, SculptArray *array, SculptArrayCopy *copy, Brush *brush) {
float copy_position[3];
unit_m4(copy->mat);
@@ -406,6 +407,8 @@ static void sculpt_array_update_copy(StrokeCache *cache, SculptArray *array, Scu
float scale = 1.0f;
float direction[3];
+ eBrushArrayDeformType array_type = brush->array_deform_type;
+
switch (array_type)
{
case BRUSH_ARRAY_DEFORM_LINEAR: {
@@ -431,7 +434,9 @@ static void sculpt_array_update_copy(StrokeCache *cache, SculptArray *array, Scu
}
+ if (!(brush->flag2 & BRUSH_ARRAY_LOCK_ORIENTATION)) {
scultp_array_basis_from_direction(copy->mat, cache, direction);
+ }
/*
@@ -458,7 +463,7 @@ static void sculpt_array_update(Object *ob, Brush *brush, SculptArray *array) {
/* Main symmetry pass. */
for (int copy_index = 0; copy_index < array->num_copies; copy_index++) {
SculptArrayCopy *copy = &array->copies[0][copy_index];
- sculpt_array_update_copy(ss->cache, array, copy, brush->array_deform_type);
+ sculpt_array_update_copy(ss->cache, array, copy, brush);
}
for (int symm_pass = 1; symm_pass < PAINT_SYMM_AREAS; symm_pass++) {
@@ -556,8 +561,9 @@ static void sculpt_array_ensure_original_coordinates(Object *ob, SculptArray *ar
}
}
-static void sculpt_array_ensure_base_transform(Object *ob, SculptArray *array){
+static void sculpt_array_ensure_base_transform(Sculpt *sd, Object *ob, SculptArray *array){
SculptSession *ss = ob->sculpt;
+ Brush *brush = BKE_paint_brush(&sd->paint);
Mesh *sculpt_mesh = BKE_object_get_original_mesh(ob);
const int totvert = SCULPT_vertex_count_get(ss);
@@ -567,7 +573,7 @@ static void sculpt_array_ensure_base_transform(Object *ob, SculptArray *array){
unit_m4(array->source_mat);
- if (false) {
+ if (brush->flag2 & BRUSH_ARRAY_LOCK_ORIENTATION) {
unit_m4(array->source_mat);
copy_v3_v3(array->source_mat[3], array->source_origin);
invert_m4_m4(array->source_imat, array->source_mat);
@@ -644,7 +650,7 @@ void SCULPT_do_array_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
return;
}
- sculpt_array_ensure_base_transform(ob, ss->cache->array);
+ sculpt_array_ensure_base_transform(sd, ob, ss->cache->array);
sculpt_array_ensure_original_coordinates(ob, ss->cache->array);
sculpt_array_ensure_geometry_indices(ob, ss->cache->array);
diff --git a/source/blender/makesdna/DNA_brush_enums.h b/source/blender/makesdna/DNA_brush_enums.h
index ab3597e10c5..b9f31b88188 100644
--- a/source/blender/makesdna/DNA_brush_enums.h
+++ b/source/blender/makesdna/DNA_brush_enums.h
@@ -425,6 +425,8 @@ typedef enum eBrushFlags2 {
BRUSH_AREA_RADIUS_PRESSURE = (1 << 7),
BRUSH_GRAB_SILHOUETTE = (1 << 8),
BRUSH_USE_SURFACE_FALLOFF = (1 << 9),
+ BRUSH_ARRAY_LOCK_ORIENTATION = (1 << 10),
+ BRUSH_ARRAY_FILL_HOLES = (1 << 11),
} eBrushFlags2;
typedef enum {
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index c9d6383778f..8478fe3c7f8 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -3114,6 +3114,18 @@ static void rna_def_brush(BlenderRNA *brna)
"Propagate the falloff of the brush trough the surface of the mesh");
RNA_def_property_update(prop, 0, "rna_Brush_update");
+ prop = RNA_def_property(srna, "use_array_lock_orientation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag2", BRUSH_ARRAY_LOCK_ORIENTATION);
+ RNA_def_property_ui_text(
+ prop, "Lock Orientation", "");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_array_fill_holes", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag2", BRUSH_ARRAY_FILL_HOLES);
+ RNA_def_property_ui_text(
+ prop, "Fill Holes", "");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
prop = RNA_def_property(srna, "use_paint_antialiasing", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "sampling_flag", BRUSH_PAINT_ANTIALIASING);
RNA_def_property_ui_text(prop, "Anti-Aliasing", "Smooths the edges of the strokes");
More information about the Bf-blender-cvs
mailing list