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:
authorJacques Lucke <jacques@blender.org>2022-04-21 15:51:37 +0300
committerJacques Lucke <jacques@blender.org>2022-04-21 15:51:37 +0300
commited971a19fad4ce0c8b81dc4613336eff9322bd20 (patch)
tree90e906cee58497e700e53d920ea8970f2d58bc1b /source
parent2882cbe685e7eca2a79438998354035c5d665205 (diff)
Curves: show sculpt tool settings in panels
Ref T97444. Differential Revision: https://developer.blender.org/D14700
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/brush.c6
-rw-r--r--source/blender/blenkernel/intern/paint.c1
-rw-r--r--source/blender/blenloader/intern/versioning_300.c16
-rw-r--r--source/blender/editors/sculpt_paint/curves_sculpt_add.cc10
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c2
-rw-r--r--source/blender/makesdna/DNA_brush_enums.h2
-rw-r--r--source/blender/makesdna/DNA_brush_types.h2
-rw-r--r--source/blender/makesdna/DNA_scene_types.h9
-rw-r--r--source/blender/makesrna/intern/rna_brush.c17
-rw-r--r--source/blender/makesrna/intern/rna_sculpt_paint.c18
10 files changed, 42 insertions, 41 deletions
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index b9cd9e1ee59..0593db34e20 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -1557,8 +1557,10 @@ void BKE_brush_init_curves_sculpt_settings(Brush *brush)
if (brush->curves_sculpt_settings == NULL) {
brush->curves_sculpt_settings = MEM_callocN(sizeof(BrushCurvesSculptSettings), __func__);
}
- brush->curves_sculpt_settings->add_amount = 1;
- brush->curves_sculpt_settings->minimum_length = 0.01f;
+ BrushCurvesSculptSettings *settings = brush->curves_sculpt_settings;
+ settings->add_amount = 1;
+ settings->minimum_length = 0.01f;
+ settings->curve_length = 0.3f;
}
struct Brush *BKE_brush_first_search(struct Main *bmain, const eObjectMode ob_mode)
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 472e2c7ada8..0f523d87d9b 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -1101,7 +1101,6 @@ bool BKE_paint_ensure(ToolSettings *ts, struct Paint **r_paint)
}
else if ((CurvesSculpt **)r_paint == &ts->curves_sculpt) {
CurvesSculpt *data = MEM_callocN(sizeof(*data), __func__);
- data->curve_length = 0.3f;
paint = &data->paint;
}
else if (*r_paint == &ts->imapaint.paint) {
diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c
index a9a63e1d4b9..f0055fb73ac 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -2529,12 +2529,6 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
brush->curves_sculpt_settings = MEM_callocN(sizeof(BrushCurvesSculptSettings), __func__);
brush->curves_sculpt_settings->add_amount = 1;
}
- LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
- if (scene->toolsettings && scene->toolsettings->curves_sculpt &&
- scene->toolsettings->curves_sculpt->curve_length == 0.0f) {
- scene->toolsettings->curves_sculpt->curve_length = 0.3f;
- }
- }
for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
@@ -2737,5 +2731,15 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
}
+
+ LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
+ BrushCurvesSculptSettings *settings = brush->curves_sculpt_settings;
+ if (settings == NULL) {
+ continue;
+ }
+ if (settings->curve_length == 0.0f) {
+ settings->curve_length = 0.3f;
+ }
+ }
}
}
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_add.cc b/source/blender/editors/sculpt_paint/curves_sculpt_add.cc
index 5f262384945..0d399419ad8 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_add.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_add.cc
@@ -96,6 +96,7 @@ struct AddOperationExecutor {
CurvesSculpt *curves_sculpt_ = nullptr;
Brush *brush_ = nullptr;
+ BrushCurvesSculptSettings *brush_settings_ = nullptr;
float brush_radius_re_;
float2 brush_pos_re_;
@@ -162,17 +163,18 @@ struct AddOperationExecutor {
curves_sculpt_ = scene_->toolsettings->curves_sculpt;
brush_ = BKE_paint_brush(&curves_sculpt_->paint);
+ brush_settings_ = brush_->curves_sculpt_settings;
brush_radius_re_ = BKE_brush_size_get(scene_, brush_);
brush_pos_re_ = stroke_extension.mouse_position;
use_front_face_ = brush_->flag & BRUSH_FRONTFACE;
const eBrushFalloffShape falloff_shape = static_cast<eBrushFalloffShape>(
brush_->falloff_shape);
- add_amount_ = std::max(0, brush_->curves_sculpt_settings->add_amount);
- interpolate_length_ = curves_sculpt_->flag & CURVES_SCULPT_FLAG_INTERPOLATE_LENGTH;
- interpolate_shape_ = curves_sculpt_->flag & CURVES_SCULPT_FLAG_INTERPOLATE_SHAPE;
+ add_amount_ = std::max(0, brush_settings_->add_amount);
+ interpolate_length_ = brush_settings_->flag & BRUSH_CURVES_SCULPT_FLAG_INTERPOLATE_LENGTH;
+ interpolate_shape_ = brush_settings_->flag & BRUSH_CURVES_SCULPT_FLAG_INTERPOLATE_SHAPE;
use_interpolation_ = interpolate_length_ || interpolate_shape_;
- new_curve_length_ = curves_sculpt_->curve_length;
+ new_curve_length_ = brush_settings_->curve_length;
tot_old_curves_ = curves_->curves_num();
tot_old_points_ = curves_->points_num();
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 6cb3d629e55..1d22c2f237b 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -1628,7 +1628,7 @@ void ED_view3d_buttons_region_layout_ex(const bContext *C,
ARRAY_SET_ITEMS(contexts, ".greasepencil_vertex");
break;
case CTX_MODE_SCULPT_CURVES:
- ARRAY_SET_ITEMS(contexts, ".curves_sculpt");
+ ARRAY_SET_ITEMS(contexts, ".paint_common", ".curves_sculpt");
break;
default:
break;
diff --git a/source/blender/makesdna/DNA_brush_enums.h b/source/blender/makesdna/DNA_brush_enums.h
index ee78b610276..3e7a4431bf5 100644
--- a/source/blender/makesdna/DNA_brush_enums.h
+++ b/source/blender/makesdna/DNA_brush_enums.h
@@ -610,6 +610,8 @@ typedef enum eBrushFalloffShape {
typedef enum eBrushCurvesSculptFlag {
BRUSH_CURVES_SCULPT_FLAG_SCALE_UNIFORM = (1 << 0),
BRUSH_CURVES_SCULPT_FLAG_GROW_SHRINK_INVERT = (1 << 1),
+ BRUSH_CURVES_SCULPT_FLAG_INTERPOLATE_LENGTH = (1 << 2),
+ BRUSH_CURVES_SCULPT_FLAG_INTERPOLATE_SHAPE = (1 << 3),
} eBrushCurvesSculptFlag;
#define MAX_BRUSH_PIXEL_RADIUS 500
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index 2d879f5afa0..7d230b7d7a3 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -144,6 +144,8 @@ typedef struct BrushCurvesSculptSettings {
uint32_t flag;
/** When shrinking curves, they shouldn't become shorter than this length. */
float minimum_length;
+ /** Length of newly added curves when it is not interpolated from other curves. */
+ float curve_length;
} BrushCurvesSculptSettings;
typedef struct Brush {
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 9a9aef16306..bfe967fcde5 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1014,17 +1014,8 @@ typedef struct Sculpt {
struct Object *gravity_object;
} Sculpt;
-typedef enum CurvesSculptFlag {
- CURVES_SCULPT_FLAG_INTERPOLATE_LENGTH = (1 << 0),
- CURVES_SCULPT_FLAG_INTERPOLATE_SHAPE = (1 << 1),
-} CurvesSculptFlag;
-
typedef struct CurvesSculpt {
Paint paint;
- /** CurvesSculptFlag. */
- uint32_t flag;
- /** Length of newly added curves when it is not interpolated from other curves. */
- float curve_length;
} CurvesSculpt;
typedef struct UvSculpt {
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 25dd87b1e74..a64e244b4c0 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -1944,6 +1944,23 @@ static void rna_def_curves_sculpt_options(BlenderRNA *brna)
RNA_def_property_range(prop, 0.0f, FLT_MAX);
RNA_def_property_ui_text(
prop, "Minimum Length", "Avoid shrinking curves shorter than this length");
+
+ prop = RNA_def_property(srna, "interpolate_length", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_CURVES_SCULPT_FLAG_INTERPOLATE_LENGTH);
+ RNA_def_property_ui_text(
+ prop, "Interpolate Length", "Use length of the curves in close proximity");
+
+ prop = RNA_def_property(srna, "interpolate_shape", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_CURVES_SCULPT_FLAG_INTERPOLATE_SHAPE);
+ RNA_def_property_ui_text(
+ prop, "Interpolate Shape", "Use shape of the curves in close proximity");
+
+ prop = RNA_def_property(srna, "curve_length", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_range(prop, 0.0, FLT_MAX);
+ RNA_def_property_ui_text(
+ prop,
+ "Curve Length",
+ "Length of newly added curves when it is not interpolated from other curves");
}
static void rna_def_brush(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index f416b024738..017e8bde7a1 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -1565,28 +1565,10 @@ static void rna_def_gpencil_sculpt(BlenderRNA *brna)
static void rna_def_curves_sculpt(BlenderRNA *brna)
{
StructRNA *srna;
- PropertyRNA *prop;
srna = RNA_def_struct(brna, "CurvesSculpt", "Paint");
RNA_def_struct_path_func(srna, "rna_CurvesSculpt_path");
RNA_def_struct_ui_text(srna, "Curves Sculpt Paint", "");
-
- prop = RNA_def_property(srna, "interpolate_length", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CURVES_SCULPT_FLAG_INTERPOLATE_LENGTH);
- RNA_def_property_ui_text(
- prop, "Interpolate Length", "Use length of the curves in close proximity");
-
- prop = RNA_def_property(srna, "interpolate_shape", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CURVES_SCULPT_FLAG_INTERPOLATE_SHAPE);
- RNA_def_property_ui_text(
- prop, "Interpolate Shape", "Use shape of the curves in close proximity");
-
- prop = RNA_def_property(srna, "curve_length", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_range(prop, 0.0, FLT_MAX);
- RNA_def_property_ui_text(
- prop,
- "Curve Length",
- "Length of newly added curves when it is not interpolated from other curves");
}
void RNA_def_sculpt_paint(BlenderRNA *brna)