GPv3: Edit Mode: "Scale Thickness" option
This implements the `use_scale_thickness` setting for GPv3. Pull Request: https://projects.blender.org/blender/blender/pulls/126213
This commit is contained in:
committed by
Falk David
parent
359caa3710
commit
8f386cd308
@@ -6129,8 +6129,12 @@ class VIEW3D_MT_edit_greasepencil(Menu):
|
||||
class VIEW3D_MT_edit_greasepencil_stroke(Menu):
|
||||
bl_label = "Stroke"
|
||||
|
||||
def draw(self, _context):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
tool_settings = context.tool_settings
|
||||
settings = tool_settings.gpencil_sculpt
|
||||
|
||||
layout.operator("grease_pencil.stroke_subdivide", text="Subdivide")
|
||||
layout.operator("grease_pencil.stroke_subdivide_smooth", text="Subdivide and Smooth")
|
||||
layout.operator("grease_pencil.stroke_simplify", text="Simplify")
|
||||
@@ -6153,6 +6157,7 @@ class VIEW3D_MT_edit_greasepencil_stroke(Menu):
|
||||
|
||||
layout.operator("grease_pencil.set_uniform_thickness")
|
||||
layout.operator("grease_pencil.set_uniform_opacity")
|
||||
layout.prop(settings, "use_scale_thickness", text="Scale Thickness")
|
||||
|
||||
layout.separator()
|
||||
|
||||
@@ -6359,7 +6364,7 @@ class VIEW3D_MT_pivot_pie(Menu):
|
||||
pie.prop_enum(tool_settings, "transform_pivot_point", value='ACTIVE_ELEMENT')
|
||||
if (obj is None) or (mode in {'OBJECT', 'POSE', 'WEIGHT_PAINT'}):
|
||||
pie.prop(tool_settings, "use_transform_pivot_point_align")
|
||||
if mode == 'EDIT_GPENCIL':
|
||||
if mode in ['EDIT_GPENCIL', 'EDIT_GREASE_PENCIL']:
|
||||
pie.prop(tool_settings.gpencil_sculpt, "use_scale_thickness")
|
||||
|
||||
|
||||
|
||||
@@ -32,6 +32,9 @@ static void createTransGreasePencilVerts(bContext *C, TransInfo *t)
|
||||
MutableSpan<TransDataContainer> trans_data_contrainers(t->data_container, t->data_container_len);
|
||||
const bool use_proportional_edit = (t->flag & T_PROP_EDIT_ALL) != 0;
|
||||
const bool use_connected_only = (t->flag & T_PROP_CONNECTED) != 0;
|
||||
ToolSettings *ts = scene->toolsettings;
|
||||
const bool is_scale_thickness = ((t->mode == TFM_CURVE_SHRINKFATTEN) ||
|
||||
(ts->gp_sculpt.flag & GP_SCULPT_SETT_FLAG_SCALE_THICKNESS));
|
||||
|
||||
Vector<int> handle_selection;
|
||||
|
||||
@@ -181,7 +184,7 @@ static void createTransGreasePencilVerts(bContext *C, TransInfo *t)
|
||||
bke::CurvesGeometry &curves = info.drawing.strokes_for_write();
|
||||
|
||||
std::optional<MutableSpan<float>> value_attribute;
|
||||
if (t->mode == TFM_CURVE_SHRINKFATTEN) {
|
||||
if (is_scale_thickness) {
|
||||
MutableSpan<float> radii = info.drawing.radii_for_write();
|
||||
value_attribute = radii;
|
||||
}
|
||||
|
||||
@@ -1065,6 +1065,19 @@ void ElementResize(const TransInfo *t,
|
||||
}
|
||||
else if (t->obedit_type == OB_GREASE_PENCIL) {
|
||||
mul_v3_fl(vec, td->factor);
|
||||
|
||||
/* Scale stroke thickness. */
|
||||
if (td->val) {
|
||||
NumInput num_evil = t->num;
|
||||
float values_final_evil[4];
|
||||
copy_v4_v4(values_final_evil, t->values_final);
|
||||
transform_snap_increment(t, values_final_evil);
|
||||
applyNumInput(&num_evil, values_final_evil);
|
||||
|
||||
float ratio = values_final_evil[0];
|
||||
float transformed_value = td->ival * fabs(ratio);
|
||||
*td->val = transformed_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user