Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Ostrowski <postrowski>2020-09-30 16:56:37 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-09-30 18:20:29 +0300
commit6070f92ab94be7bd1d6729f178d71c71c4245fbb (patch)
treebacd1100dffa84ddf51fbd4d53b58eb3d29c0916 /source/blender/modifiers
parent53f20b940a1e520e131b8bb31cf0529ed4d30f9e (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/modifiers')
-rw-r--r--source/blender/modifiers/intern/MOD_multires.c2
-rw-r--r--source/blender/modifiers/intern/MOD_subsurf.c5
2 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c
index 2c6ee50d419..41188fcc907 100644
--- a/source/blender/modifiers/intern/MOD_multires.c
+++ b/source/blender/modifiers/intern/MOD_multires.c
@@ -73,6 +73,7 @@ static void initData(ModifierData *md)
mmd->renderlvl = 0;
mmd->totlvl = 0;
mmd->uv_smooth = SUBSURF_UV_SMOOTH_PRESERVE_CORNERS;
+ mmd->boundary_smooth = SUBSURF_BOUNDARY_SMOOTH_ALL;
mmd->quality = 4;
mmd->flags |= (eMultiresModifierFlag_UseCrease | eMultiresModifierFlag_ControlEdges);
@@ -489,6 +490,7 @@ static void advanced_panel_draw(const bContext *UNUSED(C), Panel *panel)
col = uiLayoutColumn(layout, false);
uiLayoutSetEnabled(col, true);
uiItemR(col, ptr, "uv_smooth", 0, NULL, ICON_NONE);
+ uiItemR(col, ptr, "boundary_smooth", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "use_creases", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "use_custom_normals", 0, NULL, ICON_NONE);
diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c
index 7a118c6c14d..10d7b21d56f 100644
--- a/source/blender/modifiers/intern/MOD_subsurf.c
+++ b/source/blender/modifiers/intern/MOD_subsurf.c
@@ -74,6 +74,7 @@ static void initData(ModifierData *md)
smd->levels = 1;
smd->renderLevels = 2;
smd->uv_smooth = SUBSURF_UV_SMOOTH_PRESERVE_CORNERS;
+ smd->boundary_smooth = SUBSURF_BOUNDARY_SMOOTH_ALL;
smd->quality = 3;
smd->flags |= (eSubsurfModifierFlag_UseCrease | eSubsurfModifierFlag_ControlEdges);
}
@@ -167,7 +168,8 @@ static void subdiv_settings_init(SubdivSettings *settings,
1 :
(settings->is_adaptive ? smd->quality : requested_levels);
settings->use_creases = (smd->flags & eSubsurfModifierFlag_UseCrease);
- settings->vtx_boundary_interpolation = SUBDIV_VTX_BOUNDARY_EDGE_ONLY;
+ settings->vtx_boundary_interpolation = BKE_subdiv_vtx_boundary_interpolation_from_subsurf(
+ smd->boundary_smooth);
settings->fvar_linear_interpolation = BKE_subdiv_fvar_interpolation_from_uv_smooth(
smd->uv_smooth);
}
@@ -471,6 +473,7 @@ static void advanced_panel_draw(const bContext *C, Panel *panel)
uiItemR(col, ptr, "quality", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "uv_smooth", 0, NULL, ICON_NONE);
+ uiItemR(layout, ptr, "boundary_smooth", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "use_creases", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "use_custom_normals", 0, NULL, ICON_NONE);
}