[Bf-blender-cvs] [ed971a19fad] master: Curves: show sculpt tool settings in panels
Jacques Lucke
noreply at git.blender.org
Thu Apr 21 14:53:08 CEST 2022
Commit: ed971a19fad4ce0c8b81dc4613336eff9322bd20
Author: Jacques Lucke
Date: Thu Apr 21 14:51:37 2022 +0200
Branches: master
https://developer.blender.org/rBed971a19fad4ce0c8b81dc4613336eff9322bd20
Curves: show sculpt tool settings in panels
Ref T97444.
Differential Revision: https://developer.blender.org/D14700
===================================================================
M release/scripts/startup/bl_ui/properties_paint_common.py
M release/scripts/startup/bl_ui/space_view3d.py
M source/blender/blenkernel/intern/brush.c
M source/blender/blenkernel/intern/paint.c
M source/blender/blenloader/intern/versioning_300.c
M source/blender/editors/sculpt_paint/curves_sculpt_add.cc
M source/blender/editors/space_view3d/space_view3d.c
M source/blender/makesdna/DNA_brush_enums.h
M source/blender/makesdna/DNA_brush_types.h
M source/blender/makesdna/DNA_scene_types.h
M source/blender/makesrna/intern/rna_brush.c
M source/blender/makesrna/intern/rna_sculpt_paint.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index 064a99034d3..9a116aa1717 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -432,7 +432,7 @@ class FalloffPanel(BrushPanel):
row.operator("brush.curve_preset", icon='LINCURVE', text="").shape = 'LINE'
row.operator("brush.curve_preset", icon='NOCURVE', text="").shape = 'MAX'
- if mode in {'SCULPT', 'PAINT_VERTEX', 'PAINT_WEIGHT'} and brush.sculpt_tool != 'POSE':
+ if mode in {'SCULPT', 'PAINT_VERTEX', 'PAINT_WEIGHT', 'SCULPT_CURVES'} and brush.sculpt_tool != 'POSE':
col.separator()
row = col.row(align=True)
row.use_property_split = True
@@ -823,6 +823,11 @@ def brush_shared_settings(layout, context, brush, popover=False):
size = True
strength = True
+ # Sculpt Curves #
+ if mode == 'SCULPT_CURVES':
+ size = True
+ strength = True
+
### Draw settings. ###
ups = context.scene.tool_settings.unified_paint_settings
@@ -920,6 +925,16 @@ def brush_settings_advanced(layout, context, brush, popover=False):
col.prop(brush, "use_original_plane", text="Plane")
layout.separator()
+ elif mode == 'SCULPT_CURVES':
+ if brush.curves_sculpt_tool == 'ADD':
+ layout.prop(brush.curves_sculpt_settings, "add_amount")
+ layout.prop(brush.curves_sculpt_settings, "curve_length")
+ layout.prop(brush.curves_sculpt_settings, "interpolate_length")
+ layout.prop(brush.curves_sculpt_settings, "interpolate_shape")
+ elif brush.curves_sculpt_tool == 'GROW_SHRINK':
+ layout.prop(brush.curves_sculpt_settings, "scale_uniform")
+ layout.prop(brush.curves_sculpt_settings, "minimum_length")
+
# 3D and 2D Texture Paint.
elif mode in {'PAINT_TEXTURE', 'PAINT_2D'}:
capabilities = brush.image_paint_capabilities
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index c08f520f95a..81ccdd82dd8 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -514,9 +514,9 @@ class _draw_tool_settings_context_mode:
layout.prop(brush, "use_frontface")
layout.prop(brush, "falloff_shape", expand=True)
layout.prop(brush.curves_sculpt_settings, "add_amount")
- layout.prop(tool_settings.curves_sculpt, "curve_length")
- layout.prop(tool_settings.curves_sculpt, "interpolate_length")
- layout.prop(tool_settings.curves_sculpt, "interpolate_shape")
+ layout.prop(brush.curves_sculpt_settings, "curve_length")
+ layout.prop(brush.curves_sculpt_settings, "interpolate_length")
+ layout.prop(brush.curves_sculpt_settings, "interpolate_shape")
if brush.curves_sculpt_tool == 'GROW_SHRINK':
layout.prop(brush, "direction", expand=True, text="")
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;
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list