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:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-08-02 14:36:22 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-08-13 13:37:46 +0300
commit517f58be3cf52da5d22e739f2aa40a5b5142885a (patch)
treec12e08b3af29aba20863efa93f99388ea3638ca4 /source/blender/modifiers
parentf8a499b596b8af46201b86a30c9807ca54363e25 (diff)
Subsurf: Make uv boundaries easily extendible
This replaces old single toggle option to subdivide UVs with an enum which can have more options. The usecase for this is to be compatible with other software. But we also might choose different subdivision type as default in the future. DNA and underlying code supports all possible options, but only the ones which are compatible with old subdivision code are currently exposes. Reviewers: brecht Reviewed By: brecht Differential Revision: https://developer.blender.org/D3575
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r--source/blender/modifiers/intern/MOD_subsurf.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c
index 1b25b4f62dc..82e2d8bfe8d 100644
--- a/source/blender/modifiers/intern/MOD_subsurf.c
+++ b/source/blender/modifiers/intern/MOD_subsurf.c
@@ -65,7 +65,7 @@ static void initData(ModifierData *md)
smd->levels = 1;
smd->renderLevels = 2;
- smd->flags |= eSubsurfModifierFlag_SubsurfUv;
+ smd->uv_smooth = SUBSURF_UV_SMOOTH_PRESERVE_CORNERS;
}
static void copyData(const ModifierData *md, ModifierData *target, const int flag)
@@ -207,10 +207,32 @@ static void subdiv_settings_init(SubdivSettings *settings,
settings->is_simple = (smd->subdivType == SUBSURF_TYPE_SIMPLE);
settings->is_adaptive = !settings->is_simple;
settings->level = subdiv_levels_for_modifier_get(smd, ctx);
- settings->fvar_linear_interpolation =
- (smd->flags & eSubsurfModifierFlag_SubsurfUv)
- ? SUBDIV_FVAR_LINEAR_INTERPOLATION_CORNERS_ONLY
- : SUBDIV_FVAR_LINEAR_INTERPOLATION_ALL;
+ switch (smd->uv_smooth) {
+ case SUBSURF_UV_SMOOTH_NONE:
+ settings->fvar_linear_interpolation =
+ SUBDIV_FVAR_LINEAR_INTERPOLATION_ALL;
+ break;
+ case SUBSURF_UV_SMOOTH_PRESERVE_CORNERS:
+ settings->fvar_linear_interpolation =
+ SUBDIV_FVAR_LINEAR_INTERPOLATION_CORNERS_ONLY;
+ break;
+ case SUBSURF_UV_SMOOTH_PRESERVE_CORNERS_AND_JUNCTIONS:
+ settings->fvar_linear_interpolation =
+ SUBDIV_FVAR_LINEAR_INTERPOLATION_CORNERS_AND_JUNCTIONS;
+ break;
+ case SUBSURF_UV_SMOOTH_PRESERVE_CORNERS_JUNCTIONS_AND_CONCAVE:
+ settings->fvar_linear_interpolation =
+ SUBDIV_FVAR_LINEAR_INTERPOLATION_CORNERS_JUNCTIONS_AND_CONCAVE;
+ break;
+ case SUBSURF_UV_SMOOTH_PRESERVE_BOUNDARIES:
+ settings->fvar_linear_interpolation =
+ SUBDIV_FVAR_LINEAR_INTERPOLATION_BOUNDARIES;
+ break;
+ case SUBSURF_UV_SMOOTH_ALL:
+ settings->fvar_linear_interpolation =
+ SUBDIV_FVAR_LINEAR_INTERPOLATION_NONE;
+ break;
+ }
}
static void subdiv_mesh_settings_init(SubdivToMeshSettings *settings,