[Bf-blender-cvs] [5b8503425a4] master: Fix subdivision surface wrong for non-limit surface and subdivision level 1

Brecht Van Lommel noreply at git.blender.org
Thu Oct 1 17:47:09 CEST 2020


Commit: 5b8503425a491f94f526d1f65cefea1599cafd92
Author: Brecht Van Lommel
Date:   Thu Oct 1 17:39:24 2020 +0200
Branches: master
https://developer.blender.org/rB5b8503425a491f94f526d1f65cefea1599cafd92

Fix subdivision surface wrong for non-limit surface and subdivision level 1

Remove the workaround for T59395 that increases the minimal refinement to 2
to work around an OpenSubdiv bug. This bug appears to be fixed in the latest
OpenSubdiv version we are using.

Problem found by Piotr Ostrowski.

Ref D9076

===================================================================

M	source/blender/blenkernel/BKE_subdiv.h
M	source/blender/blenkernel/intern/subdiv.c
M	source/blender/modifiers/intern/MOD_multires.c
M	source/blender/modifiers/intern/MOD_subsurf.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_subdiv.h b/source/blender/blenkernel/BKE_subdiv.h
index 92da909b2ae..3d47c8d3bc5 100644
--- a/source/blender/blenkernel/BKE_subdiv.h
+++ b/source/blender/blenkernel/BKE_subdiv.h
@@ -220,8 +220,6 @@ void BKE_subdiv_stats_print(const SubdivStats *stats);
 
 /* ================================ SETTINGS ================================ */
 
-void BKE_subdiv_settings_validate_for_mesh(SubdivSettings *settings, const struct Mesh *mesh);
-
 bool BKE_subdiv_settings_equal(const SubdivSettings *settings_a, const SubdivSettings *settings_b);
 
 /* ============================== CONSTRUCTION ============================== */
diff --git a/source/blender/blenkernel/intern/subdiv.c b/source/blender/blenkernel/intern/subdiv.c
index f1cde39f657..e6b51c586c3 100644
--- a/source/blender/blenkernel/intern/subdiv.c
+++ b/source/blender/blenkernel/intern/subdiv.c
@@ -87,27 +87,6 @@ eSubdivVtxBoundaryInterpolation BKE_subdiv_vtx_boundary_interpolation_from_subsu
 
 /* ================================ SETTINGS ================================ */
 
-static bool check_mesh_has_non_quad(const Mesh *mesh)
-{
-  for (int poly_index = 0; poly_index < mesh->totpoly; poly_index++) {
-    const MPoly *poly = &mesh->mpoly[poly_index];
-    if (poly->totloop != 4) {
-      return true;
-    }
-  }
-  return false;
-}
-
-void BKE_subdiv_settings_validate_for_mesh(SubdivSettings *settings, const Mesh *mesh)
-{
-  if (settings->level != 1) {
-    return;
-  }
-  if (check_mesh_has_non_quad(mesh)) {
-    settings->level = 2;
-  }
-}
-
 bool BKE_subdiv_settings_equal(const SubdivSettings *settings_a, const SubdivSettings *settings_b)
 {
   return (settings_a->is_simple == settings_b->is_simple &&
diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c
index f1c07b47c26..e1b89019d3a 100644
--- a/source/blender/modifiers/intern/MOD_multires.c
+++ b/source/blender/modifiers/intern/MOD_multires.c
@@ -225,7 +225,6 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
   if (subdiv_settings.level == 0) {
     return result;
   }
-  BKE_subdiv_settings_validate_for_mesh(&subdiv_settings, mesh);
   MultiresRuntimeData *runtime_data = multires_ensure_runtime(mmd);
   Subdiv *subdiv = subdiv_descriptor_ensure(mmd, &subdiv_settings, mesh);
   if (subdiv == NULL) {
@@ -322,7 +321,6 @@ static void deformMatrices(ModifierData *md,
     return;
   }
 
-  BKE_subdiv_settings_validate_for_mesh(&subdiv_settings, mesh);
   MultiresRuntimeData *runtime_data = multires_ensure_runtime(mmd);
   Subdiv *subdiv = subdiv_descriptor_ensure(mmd, &subdiv_settings, mesh);
   if (subdiv == NULL) {
diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c
index f730ccf5e29..7efb9d77eb5 100644
--- a/source/blender/modifiers/intern/MOD_subsurf.c
+++ b/source/blender/modifiers/intern/MOD_subsurf.c
@@ -263,7 +263,6 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
   if (subdiv_settings.level == 0) {
     return result;
   }
-  BKE_subdiv_settings_validate_for_mesh(&subdiv_settings, mesh);
   SubsurfRuntimeData *runtime_data = subsurf_ensure_runtime(smd);
   Subdiv *subdiv = subdiv_descriptor_ensure(smd, &subdiv_settings, mesh);
   if (subdiv == NULL) {
@@ -323,7 +322,6 @@ static void deformMatrices(ModifierData *md,
   if (subdiv_settings.level == 0) {
     return;
   }
-  BKE_subdiv_settings_validate_for_mesh(&subdiv_settings, mesh);
   SubsurfRuntimeData *runtime_data = subsurf_ensure_runtime(smd);
   Subdiv *subdiv = subdiv_descriptor_ensure(smd, &subdiv_settings, mesh);
   if (subdiv == NULL) {



More information about the Bf-blender-cvs mailing list