Curves: control number of control points in new curves
Previously, the number of control points in a new curve was hardcoded. Differential Revision: https://developer.blender.org/D14857
This commit is contained in:
parent
b4fa74e812
commit
dbba5c4df9
|
@ -929,6 +929,7 @@ def brush_settings_advanced(layout, context, brush, popover=False):
|
|||
elif mode == 'SCULPT_CURVES':
|
||||
if brush.curves_sculpt_tool == 'ADD':
|
||||
layout.prop(brush.curves_sculpt_settings, "add_amount")
|
||||
layout.prop(brush.curves_sculpt_settings, "points_per_curve")
|
||||
layout.prop(brush.curves_sculpt_settings, "curve_length")
|
||||
layout.prop(brush.curves_sculpt_settings, "interpolate_length")
|
||||
layout.prop(brush.curves_sculpt_settings, "interpolate_shape")
|
||||
|
|
|
@ -519,6 +519,7 @@ class _draw_tool_settings_context_mode:
|
|||
layout.prop(brush, "use_frontface", text="Front Faces Only")
|
||||
layout.prop(brush, "falloff_shape", expand=True)
|
||||
layout.prop(brush.curves_sculpt_settings, "add_amount")
|
||||
layout.prop(brush.curves_sculpt_settings, "points_per_curve")
|
||||
layout.prop(brush.curves_sculpt_settings, "curve_length")
|
||||
layout.prop(brush.curves_sculpt_settings, "interpolate_length")
|
||||
layout.prop(brush.curves_sculpt_settings, "interpolate_shape")
|
||||
|
|
|
@ -1559,6 +1559,7 @@ void BKE_brush_init_curves_sculpt_settings(Brush *brush)
|
|||
}
|
||||
BrushCurvesSculptSettings *settings = brush->curves_sculpt_settings;
|
||||
settings->add_amount = 1;
|
||||
settings->points_per_curve = 8;
|
||||
settings->minimum_length = 0.01f;
|
||||
settings->curve_length = 0.3f;
|
||||
}
|
||||
|
|
|
@ -3024,5 +3024,15 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
|||
}
|
||||
}
|
||||
FOREACH_NODETREE_END;
|
||||
|
||||
/* Initialize brush curves sculpt settings. */
|
||||
LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
|
||||
if (brush->ob_mode != OB_MODE_SCULPT_CURVES) {
|
||||
continue;
|
||||
}
|
||||
if (brush->curves_sculpt_settings->points_per_curve == 0) {
|
||||
brush->curves_sculpt_settings->points_per_curve = 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ struct AddOperationExecutor {
|
|||
bool use_interpolation_;
|
||||
float new_curve_length_;
|
||||
int add_amount_;
|
||||
int points_per_curve_ = 8;
|
||||
int points_per_curve_;
|
||||
|
||||
/** Various matrices to convert between coordinate spaces. */
|
||||
float4x4 curves_to_world_mat_;
|
||||
|
@ -171,6 +171,7 @@ struct AddOperationExecutor {
|
|||
const eBrushFalloffShape falloff_shape = static_cast<eBrushFalloffShape>(
|
||||
brush_->falloff_shape);
|
||||
add_amount_ = std::max(0, brush_settings_->add_amount);
|
||||
points_per_curve_ = std::max(2, brush_settings_->points_per_curve);
|
||||
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_;
|
||||
|
|
|
@ -140,6 +140,8 @@ typedef struct BrushGpencilSettings {
|
|||
typedef struct BrushCurvesSculptSettings {
|
||||
/** Number of curves added by the add brush. */
|
||||
int add_amount;
|
||||
/** Number of control points in new curves added by the add brush. */
|
||||
int points_per_curve;
|
||||
/* eBrushCurvesSculptFlag. */
|
||||
uint32_t flag;
|
||||
/** When shrinking curves, they shouldn't become shorter than this length. */
|
||||
|
|
|
@ -1953,6 +1953,11 @@ static void rna_def_curves_sculpt_options(BlenderRNA *brna)
|
|||
RNA_def_property_range(prop, 1, INT32_MAX);
|
||||
RNA_def_property_ui_text(prop, "Add Amount", "Number of curves added by the Add brush");
|
||||
|
||||
prop = RNA_def_property(srna, "points_per_curve", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_range(prop, 2, INT32_MAX);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Points per Curve", "Number of control points in a newly added curve");
|
||||
|
||||
prop = RNA_def_property(srna, "scale_uniform", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_CURVES_SCULPT_FLAG_SCALE_UNIFORM);
|
||||
RNA_def_property_ui_text(prop,
|
||||
|
|
Loading…
Reference in New Issue