diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-08-02 14:36:22 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-08-13 13:37:46 +0300 |
commit | 517f58be3cf52da5d22e739f2aa40a5b5142885a (patch) | |
tree | c12e08b3af29aba20863efa93f99388ea3638ca4 /source/blender/blenkernel | |
parent | f8a499b596b8af46201b86a30c9807ca54363e25 (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/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_subdiv.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/multires.c | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/subdiv_converter.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/subsurf_ccg.c | 2 |
4 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_subdiv.h b/source/blender/blenkernel/BKE_subdiv.h index d81047563a7..03d765a154f 100644 --- a/source/blender/blenkernel/BKE_subdiv.h +++ b/source/blender/blenkernel/BKE_subdiv.h @@ -42,6 +42,8 @@ struct OpenSubdiv_TopologyRefiner; typedef enum { SUBDIV_FVAR_LINEAR_INTERPOLATION_NONE, SUBDIV_FVAR_LINEAR_INTERPOLATION_CORNERS_ONLY, + SUBDIV_FVAR_LINEAR_INTERPOLATION_CORNERS_AND_JUNCTIONS, + SUBDIV_FVAR_LINEAR_INTERPOLATION_CORNERS_JUNCTIONS_AND_CONCAVE, SUBDIV_FVAR_LINEAR_INTERPOLATION_BOUNDARIES, SUBDIV_FVAR_LINEAR_INTERPOLATION_ALL, } eSubdivFVarLinearInterpolation; diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index 331b3797739..d35d363428b 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -729,7 +729,10 @@ static DerivedMesh *subsurf_dm_create_local( smd.levels = smd.renderLevels = lvl; if (!is_plain_uv) { - smd.flags |= eSubsurfModifierFlag_SubsurfUv; + smd.uv_smooth = SUBSURF_UV_SMOOTH_PRESERVE_CORNERS; + } + else { + smd.uv_smooth = SUBSURF_UV_SMOOTH_NONE; } if (is_simple) { smd.subdivType = ME_SIMPLE_SUBSURF; diff --git a/source/blender/blenkernel/intern/subdiv_converter.c b/source/blender/blenkernel/intern/subdiv_converter.c index 0ef32200bd3..5cad2f3e4cd 100644 --- a/source/blender/blenkernel/intern/subdiv_converter.c +++ b/source/blender/blenkernel/intern/subdiv_converter.c @@ -44,6 +44,10 @@ BKE_subdiv_converter_fvar_linear_from_settings(const SubdivSettings *settings) return OSD_FVAR_LINEAR_INTERPOLATION_NONE; case SUBDIV_FVAR_LINEAR_INTERPOLATION_CORNERS_ONLY: return OSD_FVAR_LINEAR_INTERPOLATION_CORNERS_ONLY; + case SUBDIV_FVAR_LINEAR_INTERPOLATION_CORNERS_AND_JUNCTIONS: + return OSD_FVAR_LINEAR_INTERPOLATION_CORNERS_PLUS1; + case SUBDIV_FVAR_LINEAR_INTERPOLATION_CORNERS_JUNCTIONS_AND_CONCAVE: + return OSD_FVAR_LINEAR_INTERPOLATION_CORNERS_PLUS2; case SUBDIV_FVAR_LINEAR_INTERPOLATION_BOUNDARIES: return OSD_FVAR_LINEAR_INTERPOLATION_BOUNDARIES; case SUBDIV_FVAR_LINEAR_INTERPOLATION_ALL: diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index cead75ae659..9fda7f585b4 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -2927,7 +2927,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived( { int useSimple = (smd->subdivType == ME_SIMPLE_SUBSURF) ? CCG_SIMPLE_SUBDIV : 0; CCGFlags useAging = (smd->flags & eSubsurfModifierFlag_DebugIncr) ? CCG_USE_AGING : 0; - int useSubsurfUv = smd->flags & eSubsurfModifierFlag_SubsurfUv; + int useSubsurfUv = (smd->uv_smooth != SUBSURF_UV_SMOOTH_NONE); int drawInteriorEdges = !(smd->flags & eSubsurfModifierFlag_ControlEdges); CCGDerivedMesh *result; bool use_gpu_backend = subsurf_use_gpu_backend(flags); |