diff options
author | Pablo Vazquez <pablovazquez> | 2022-05-11 12:54:14 +0300 |
---|---|---|
committer | Pablo Vazquez <pablo@blender.org> | 2022-05-11 14:21:59 +0300 |
commit | eef98e66cf9e726ae262a7bb7f734d01b9577812 (patch) | |
tree | aa88e5d1a3015eb44ffc9171ead06691a4905333 /source/blender/blenkernel/intern/mesh.cc | |
parent | 6bd270f3af7dff3cd3223966b65a9f73a492df1d (diff) |
Mesh: Add Auto Smooth option to Shade Smooth operator
Add a property to the **Shade Smooth** operator to quickly enable the Mesh `use_auto_smooth` option.
The `Angle` property is exposed in the **Adjust Last Operation** panel to make it easy to tweak on multiple objects without having to go to the Properties editor.
The operator is exposed in the `Object` menu and `Object Context Menu`.
=== Demo ===
{F13066173, size=full}
Regarding the implementation, there are multiple ways to go about this (like making a whole new operator altogether), but I think a property is the cleanest/simplest.
I imagine there are simpler ways to achieve this without duplicating the `use_auto_smooth` property in the operator itself (getting it from the Mesh props?), but I couldn't find other operators doing something similar.
Reviewed By: #modeling, mont29
Differential Revision: https://developer.blender.org/D14894
Diffstat (limited to 'source/blender/blenkernel/intern/mesh.cc')
-rw-r--r-- | source/blender/blenkernel/intern/mesh.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/mesh.cc b/source/blender/blenkernel/intern/mesh.cc index 628f59ae449..4e3544d0f60 100644 --- a/source/blender/blenkernel/intern/mesh.cc +++ b/source/blender/blenkernel/intern/mesh.cc @@ -1577,6 +1577,19 @@ void BKE_mesh_smooth_flag_set(Mesh *me, const bool use_smooth) } } +void BKE_mesh_auto_smooth_flag_set(Mesh *me, + const bool use_auto_smooth, + const float auto_smooth_angle) +{ + if (use_auto_smooth) { + me->flag |= ME_AUTOSMOOTH; + me->smoothresh = auto_smooth_angle; + } + else { + me->flag &= ~ME_AUTOSMOOTH; + } +} + int poly_find_loop_from_vert(const MPoly *poly, const MLoop *loopstart, uint vert) { for (int j = 0; j < poly->totloop; j++, loopstart++) { |