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/makesrna/intern/rna_modifier.c | |
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/makesrna/intern/rna_modifier.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_modifier.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index fc0144f3f7b..8fbd906766e 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -1195,6 +1195,26 @@ static PropertyRNA *rna_def_property_subdivision_common(StructRNA *srna, const c static void rna_def_modifier_subsurf(BlenderRNA *brna) { + static const EnumPropertyItem prop_uv_smooth_items[] = { + {SUBSURF_UV_SMOOTH_NONE, "NONE", 0, + "Sharp", "UVs are not smoothed, boundaries are kept sharp"}, + {SUBSURF_UV_SMOOTH_PRESERVE_CORNERS, "PRESERVE_CORNERS", 0, + "Smooth, keep corners", "UVs are smoothed, corners on discontinuous boundary are kept sharp"}, +#if 0 + {SUBSURF_UV_SMOOTH_PRESERVE_CORNERS_AND_JUNCTIONS, "PRESERVE_CORNERS_AND_JUNCTIONS", 0, + "Smooth, keep corners+junctions", "UVs are smoothed, corners on discontinuous boundary and " + "junctions of 3 or more regions are kept sharp"}, + {SUBSURF_UV_SMOOTH_PRESERVE_CORNERS_JUNCTIONS_AND_CONCAVE, "PRESERVE_CORNERS_JUNCTIONS_AND_CONCAVE", 0, + "Smooth, keep corners+junctions+concave", "UVs are smoothed, corners on discontinuous boundary, " + "junctions of 3 or more regions and darts and concave corners are kept sharp"}, + {SUBSURF_UV_SMOOTH_PRESERVE_BOUNDARIES, "PRESERVE_BOUNDARIES", 0, + "Smooth, keep corners", "UVs are smoothed, boundaries are kept sharp"}, + {SUBSURF_UV_SMOOTH_ALL, "PRESERVE_BOUNDARIES", 0, + "Smooth all", "UVs and boundaries are smoothed"}, +#endif + {0, NULL, 0, NULL, NULL} + }; + StructRNA *srna; PropertyRNA *prop; @@ -1224,9 +1244,10 @@ static void rna_def_modifier_subsurf(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Optimal Display", "Skip drawing/rendering of interior subdivided edges"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); - prop = RNA_def_property(srna, "use_subsurf_uv", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", eSubsurfModifierFlag_SubsurfUv); - RNA_def_property_ui_text(prop, "Subdivide UVs", "Use subsurf to subdivide UVs"); + prop = RNA_def_property(srna, "uv_smooth", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "uv_smooth"); + RNA_def_property_enum_items(prop, prop_uv_smooth_items); + RNA_def_property_ui_text(prop, "UV Smooth", "Controls how smoothing is applied to UVs"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); #ifdef WITH_OPENSUBDIV |