Curves: Add radius transform mode to edit mode
This adds the radius control operator and active tool to curves edit mode. Pull Request: https://projects.blender.org/blender/blender/pulls/114017
This commit is contained in:
parent
faeb9e7775
commit
c57fe9a6e0
|
@ -6078,6 +6078,8 @@ def km_edit_curves(params):
|
|||
("curves.select_less", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "ctrl": True, "repeat": True}, None),
|
||||
*_template_items_proportional_editing(
|
||||
params, connected=True, toggle_data_path='tool_settings.use_proportional_edit'),
|
||||
("transform.transform", {"type": 'S', "value": 'PRESS', "alt": True},
|
||||
{"properties": [("mode", 'CURVE_SHRINKFATTEN')]}),
|
||||
])
|
||||
|
||||
return keymap
|
||||
|
|
|
@ -2997,6 +2997,8 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel):
|
|||
],
|
||||
'EDIT_CURVES': [
|
||||
*_tools_default,
|
||||
None,
|
||||
_defs_edit_curve.curve_radius,
|
||||
],
|
||||
'EDIT_SURFACE': [
|
||||
*_tools_default,
|
||||
|
|
|
@ -1238,7 +1238,7 @@ class VIEW3D_MT_transform(VIEW3D_MT_transform_base, Menu):
|
|||
if context.mode == 'EDIT_MESH':
|
||||
layout.operator("transform.shrink_fatten", text="Shrink/Fatten").alt_navigation = alt_navigation
|
||||
layout.operator("transform.skin_resize")
|
||||
elif context.mode in ['EDIT_CURVE', 'EDIT_GREASE_PENCIL']:
|
||||
elif context.mode in ['EDIT_CURVE', 'EDIT_GREASE_PENCIL', 'EDIT_CURVES']:
|
||||
layout.operator("transform.transform", text="Radius").mode = 'CURVE_SHRINKFATTEN'
|
||||
|
||||
if context.mode != 'EDIT_CURVES' and context.mode != 'EDIT_GREASE_PENCIL':
|
||||
|
|
|
@ -97,14 +97,26 @@ static void createTransCurvesVerts(bContext * /*C*/, TransInfo *t)
|
|||
Curves *curves_id = static_cast<Curves *>(tc.obedit->data);
|
||||
bke::CurvesGeometry &curves = curves_id->geometry.wrap();
|
||||
|
||||
curve_populate_trans_data_structs(
|
||||
tc,
|
||||
curves,
|
||||
{} /* Currently no transform for attributes other than position. */,
|
||||
selection_per_object[i],
|
||||
use_proportional_edit,
|
||||
use_connected_only,
|
||||
0 /* No data offset for curves. */);
|
||||
std::optional<MutableSpan<float>> value_attribute;
|
||||
bke::SpanAttributeWriter<float> attribute_writer;
|
||||
if (t->mode == TFM_CURVE_SHRINKFATTEN) {
|
||||
bke::MutableAttributeAccessor attributes = curves.attributes_for_write();
|
||||
attribute_writer = attributes.lookup_or_add_for_write_span<float>(
|
||||
"radius",
|
||||
ATTR_DOMAIN_POINT,
|
||||
bke::AttributeInitVArray(VArray<float>::ForSingle(0.01f, curves.points_num())));
|
||||
|
||||
value_attribute = attribute_writer.span;
|
||||
}
|
||||
|
||||
curve_populate_trans_data_structs(tc,
|
||||
curves,
|
||||
value_attribute,
|
||||
selection_per_object[i],
|
||||
use_proportional_edit,
|
||||
use_connected_only,
|
||||
0 /* No data offset for curves. */);
|
||||
attribute_writer.finish();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue