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:
-rw-r--r--source/blender/blenkernel/BKE_subdiv.h3
-rw-r--r--source/blender/blenkernel/intern/multires_subdiv.c3
-rw-r--r--source/blender/blenkernel/intern/subdiv.c13
-rw-r--r--source/blender/makesdna/DNA_modifier_types.h11
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c16
-rw-r--r--source/blender/modifiers/intern/MOD_multires.c2
-rw-r--r--source/blender/modifiers/intern/MOD_subsurf.c5
7 files changed, 49 insertions, 4 deletions
diff --git a/source/blender/blenkernel/BKE_subdiv.h b/source/blender/blenkernel/BKE_subdiv.h
index 96a79d753cf..92da909b2ae 100644
--- a/source/blender/blenkernel/BKE_subdiv.h
+++ b/source/blender/blenkernel/BKE_subdiv.h
@@ -204,6 +204,9 @@ void BKE_subdiv_exit(void);
/* NOTE: uv_smooth is eSubsurfUVSmooth. */
eSubdivFVarLinearInterpolation BKE_subdiv_fvar_interpolation_from_uv_smooth(int uv_smooth);
+eSubdivVtxBoundaryInterpolation BKE_subdiv_vtx_boundary_interpolation_from_subsurf(
+ int boundary_smooth);
+
/* =============================== STATISTICS =============================== */
void BKE_subdiv_stats_init(SubdivStats *stats);
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)
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index d7a41b5cb3b..fa2f54c7aa0 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -179,13 +179,19 @@ typedef enum {
SUBSURF_UV_SMOOTH_ALL = 5,
} eSubsurfUVSmooth;
+typedef enum {
+ SUBSURF_BOUNDARY_SMOOTH_ALL = 0,
+ SUBSURF_BOUNDARY_SMOOTH_PRESERVE_CORNERS = 1,
+} eSubsurfBoundarySmooth;
+
typedef struct SubsurfModifierData {
ModifierData modifier;
short subdivType, levels, renderLevels, flags;
short uv_smooth;
short quality;
- char _pad[4];
+ short boundary_smooth;
+ char _pad[2];
/* TODO(sergey): Get rid of those with the old CCG subdivision code. */
void *emCache, *mCache;
@@ -1042,7 +1048,8 @@ typedef struct MultiresModifierData {
char simple, flags, _pad[2];
short quality;
short uv_smooth;
- char _pad2[4];
+ short boundary_smooth;
+ char _pad2[2];
} MultiresModifierData;
typedef enum {
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 134ce15e3f2..a0a8d37fd56 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -1686,6 +1686,16 @@ static PropertyRNA *rna_def_property_subdivision_common(StructRNA *srna, const c
{0, NULL, 0, NULL, NULL},
};
+ static const EnumPropertyItem prop_boundary_smooth_items[] = {
+ {SUBSURF_BOUNDARY_SMOOTH_PRESERVE_CORNERS,
+ "PRESERVE_CORNERS",
+ 0,
+ "Keep Corners",
+ "Smooth boundaries, but corners are kept sharp"},
+ {SUBSURF_BOUNDARY_SMOOTH_ALL, "ALL", 0, "All", "Smooth boundaries, including corners"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
PropertyRNA *prop;
RNA_define_lib_overridable(true);
@@ -1704,6 +1714,12 @@ static PropertyRNA *rna_def_property_subdivision_common(StructRNA *srna, const c
prop, "Quality", "Accuracy of vertex positions, lower value is faster but less precise");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ prop = RNA_def_property(srna, "boundary_smooth", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "boundary_smooth");
+ RNA_def_property_enum_items(prop, prop_boundary_smooth_items);
+ RNA_def_property_ui_text(prop, "Boundary Smooth", "Controls how open boundaries are smoothed");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
prop = RNA_def_property(srna, "subdivision_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, type);
RNA_def_property_enum_items(prop, prop_subdivision_type_items);
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);
}