diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_blender_version.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_subdiv.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/multires_subdiv.c | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/subdiv_converter_mesh.c | 9 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 28 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_modifier_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_modifier.c | 10 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_multires.c | 1 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_subsurf.c | 2 |
9 files changed, 54 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index 9ae85725488..4c88410134c 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -24,7 +24,7 @@ * and keep comment above the defines. * Use STRINGIFY() rather than defining with quotes */ #define BLENDER_VERSION 280 -#define BLENDER_SUBVERSION 53 +#define BLENDER_SUBVERSION 54 /* Several breakages with 280, e.g. collections vs layers */ #define BLENDER_MINVERSION 280 #define BLENDER_MINSUBVERSION 0 diff --git a/source/blender/blenkernel/BKE_subdiv.h b/source/blender/blenkernel/BKE_subdiv.h index 8c6b92e3638..f14a11005e7 100644 --- a/source/blender/blenkernel/BKE_subdiv.h +++ b/source/blender/blenkernel/BKE_subdiv.h @@ -58,6 +58,7 @@ typedef struct SubdivSettings { bool is_simple; bool is_adaptive; int level; + bool use_creases; eSubdivVtxBoundaryInterpolation vtx_boundary_interpolation; eSubdivFVarLinearInterpolation fvar_linear_interpolation; } SubdivSettings; diff --git a/source/blender/blenkernel/intern/multires_subdiv.c b/source/blender/blenkernel/intern/multires_subdiv.c index 3d1a019f427..59229f28751 100644 --- a/source/blender/blenkernel/intern/multires_subdiv.c +++ b/source/blender/blenkernel/intern/multires_subdiv.c @@ -41,6 +41,7 @@ void BKE_multires_subdiv_settings_init( settings->is_simple = (mmd->simple != 0); 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->fvar_linear_interpolation = BKE_subdiv_fvar_interpolation_from_uv_smooth(mmd->uv_smooth); diff --git a/source/blender/blenkernel/intern/subdiv_converter_mesh.c b/source/blender/blenkernel/intern/subdiv_converter_mesh.c index 00a2436098e..eda6b522b85 100644 --- a/source/blender/blenkernel/intern/subdiv_converter_mesh.c +++ b/source/blender/blenkernel/intern/subdiv_converter_mesh.c @@ -168,6 +168,9 @@ static float get_edge_sharpness(const OpenSubdiv_Converter *converter, return 10.0f; } #endif + if (!storage->settings.use_creases) { + return 0.0f; + } const int edge_index = storage->manifold_edge_index_reverse[manifold_edge_index]; const MEdge *medge = storage->mesh->medge; @@ -190,9 +193,13 @@ static bool is_infinite_sharp_vertex(const OpenSubdiv_Converter *converter, vertex_index); } -static float get_vertex_sharpness(const OpenSubdiv_Converter *UNUSED(converter), +static float get_vertex_sharpness(const OpenSubdiv_Converter *converter, int UNUSED(manifold_vertex_index)) { + ConverterStorage *storage = converter->user_data; + if (!storage->settings.use_creases) { + return 0.0f; + } return 0.0f; } diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 5c0ff1af7b2..25ada2fd13e 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -2967,6 +2967,34 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) } } + if (!MAIN_VERSION_ATLEAST(bmain, 280, 54)) { + for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) { + bool is_first_subdiv = true; + for (ModifierData *md = ob->modifiers.first; md; md = md->next) { + if (md->type == eModifierType_Subsurf) { + SubsurfModifierData *smd = (SubsurfModifierData *)md; + if (is_first_subdiv) { + smd->flags |= eSubsurfModifierFlag_UseCrease; + } + else { + smd->flags &= ~eSubsurfModifierFlag_UseCrease; + } + is_first_subdiv = false; + } + else if (md->type == eModifierType_Multires) { + MultiresModifierData *mmd = (MultiresModifierData *)md; + if (is_first_subdiv) { + mmd->flags |= eMultiresModifierFlag_UseCrease; + } + else { + mmd->flags &= ~eMultiresModifierFlag_UseCrease; + } + is_first_subdiv = false; + } + } + } + } + { /* Versioning code until next subversion bump goes here. */ diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 14f8a63a359..fcdfb4fcf44 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -144,6 +144,7 @@ typedef enum { eSubsurfModifierFlag_ControlEdges = (1 << 2), /* DEPRECATED, ONLY USED FOR DO-VERSIONS */ eSubsurfModifierFlag_SubsurfUv_DEPRECATED = (1 << 3), + eSubsurfModifierFlag_UseCrease = (1 << 4), } SubsurfModifierFlag; typedef enum { @@ -960,6 +961,7 @@ typedef enum { eMultiresModifierFlag_ControlEdges = (1 << 0), /* DEPRECATED, only used for versioning. */ eMultiresModifierFlag_PlainUv_DEPRECATED = (1 << 1), + eMultiresModifierFlag_UseCrease = (1 << 2), } MultiresModifierFlag; typedef struct FluidsimModifierData { diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 6dca81415f3..18ab5565d22 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -1278,6 +1278,11 @@ static void rna_def_modifier_subsurf(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flags", eSubsurfModifierFlag_ControlEdges); 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_creases", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", eSubsurfModifierFlag_UseCrease); + RNA_def_property_ui_text(prop, "Use Creases", "Use mesh edge crease information to sharpen edges"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); } static void rna_def_modifier_generic_map_info(StructRNA *srna) @@ -1423,6 +1428,11 @@ static void rna_def_modifier_multires(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flags", eMultiresModifierFlag_ControlEdges); 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_creases", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", eMultiresModifierFlag_UseCrease); + RNA_def_property_ui_text(prop, "Use Creases", "Use mesh edge crease information to sharpen edges"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); } static void rna_def_modifier_lattice(BlenderRNA *brna) diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c index af17bd7d53c..a8760d05834 100644 --- a/source/blender/modifiers/intern/MOD_multires.c +++ b/source/blender/modifiers/intern/MOD_multires.c @@ -61,6 +61,7 @@ static void initData(ModifierData *md) mmd->totlvl = 0; mmd->uv_smooth = SUBSURF_UV_SMOOTH_PRESERVE_CORNERS; mmd->quality = 3; + mmd->flags |= eMultiresModifierFlag_UseCrease; } static void copyData(const ModifierData *md_src, ModifierData *md_dst, const int flag) diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c index 40c9e5c3b1b..74bf6b7e976 100644 --- a/source/blender/modifiers/intern/MOD_subsurf.c +++ b/source/blender/modifiers/intern/MOD_subsurf.c @@ -59,6 +59,7 @@ static void initData(ModifierData *md) smd->renderLevels = 2; smd->uv_smooth = SUBSURF_UV_SMOOTH_PRESERVE_CORNERS; smd->quality = 3; + smd->flags |= eSubsurfModifierFlag_UseCrease; } static void copyData(const ModifierData *md, ModifierData *target, const int flag) @@ -126,6 +127,7 @@ static void subdiv_settings_init(SubdivSettings *settings, settings->is_simple = (smd->subdivType == SUBSURF_TYPE_SIMPLE); settings->is_adaptive = true; settings->level = settings->is_simple ? 1 : smd->quality; + settings->use_creases = (smd->flags & eSubsurfModifierFlag_UseCrease); settings->vtx_boundary_interpolation = SUBDIV_VTX_BOUNDARY_EDGE_ONLY; settings->fvar_linear_interpolation = BKE_subdiv_fvar_interpolation_from_uv_smooth(smd->uv_smooth); |