diff options
author | Piotr Ostrowski <postrowski> | 2020-09-30 16:56:37 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2020-09-30 18:20:29 +0300 |
commit | 6070f92ab94be7bd1d6729f178d71c71c4245fbb (patch) | |
tree | bacd1100dffa84ddf51fbd4d53b58eb3d29c0916 /source/blender/blenkernel/intern | |
parent | 53f20b940a1e520e131b8bb31cf0529ed4d30f9e (diff) |
Subdivision Surfaces: add boundary smooth option to modifiers
This adds the option to either smooth the entire boundary, or to keep
corners sharp, for the Subdivision Surface and Multiresolution modifiers.
This mainly helps with compatibility with other software. The default
behavior remains to smooth the entire boundary.
Differential Revision: https://developer.blender.org/D8485
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/multires_subdiv.c | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/subdiv.c | 13 |
2 files changed, 15 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/multires_subdiv.c b/source/blender/blenkernel/intern/multires_subdiv.c index fc092d3ccce..73ef623fbfd 100644 --- a/source/blender/blenkernel/intern/multires_subdiv.c +++ b/source/blender/blenkernel/intern/multires_subdiv.c @@ -40,7 +40,8 @@ void BKE_multires_subdiv_settings_init(SubdivSettings *settings, const MultiresM settings->is_adaptive = true; settings->level = settings->is_simple ? 1 : mmd->quality; settings->use_creases = (mmd->flags & eMultiresModifierFlag_UseCrease); - settings->vtx_boundary_interpolation = SUBDIV_VTX_BOUNDARY_EDGE_ONLY; + settings->vtx_boundary_interpolation = BKE_subdiv_vtx_boundary_interpolation_from_subsurf( + mmd->boundary_smooth); settings->fvar_linear_interpolation = BKE_subdiv_fvar_interpolation_from_uv_smooth( mmd->uv_smooth); } diff --git a/source/blender/blenkernel/intern/subdiv.c b/source/blender/blenkernel/intern/subdiv.c index fe1dd3835fd..f1cde39f657 100644 --- a/source/blender/blenkernel/intern/subdiv.c +++ b/source/blender/blenkernel/intern/subdiv.c @@ -72,6 +72,19 @@ eSubdivFVarLinearInterpolation BKE_subdiv_fvar_interpolation_from_uv_smooth(int return SUBDIV_FVAR_LINEAR_INTERPOLATION_ALL; } +eSubdivVtxBoundaryInterpolation BKE_subdiv_vtx_boundary_interpolation_from_subsurf( + int boundary_smooth) +{ + switch (boundary_smooth) { + case SUBSURF_BOUNDARY_SMOOTH_PRESERVE_CORNERS: + return SUBDIV_VTX_BOUNDARY_EDGE_AND_CORNER; + case SUBSURF_BOUNDARY_SMOOTH_ALL: + return SUBDIV_VTX_BOUNDARY_EDGE_ONLY; + } + BLI_assert(!"Unknown boundary smooth flag"); + return SUBDIV_VTX_BOUNDARY_EDGE_ONLY; +} + /* ================================ SETTINGS ================================ */ static bool check_mesh_has_non_quad(const Mesh *mesh) |