[Bf-blender-cvs] [af2a8017314] blender2.8: Subsurf: Correction to origindex

Sergey Sharybin noreply at git.blender.org
Fri Jul 27 17:21:38 CEST 2018


Commit: af2a801731441d132b81bd109c999bde3db58a88
Author: Sergey Sharybin
Date:   Wed Jul 25 10:30:11 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBaf2a801731441d132b81bd109c999bde3db58a88

Subsurf: Correction to origindex

Only enforce origindex to NONE for a generated geometry. For the rest
of geometry rely on CustomData_copy() to set it to the proper value.

This will ensure origindex is set correct for cases when there is an
array modifier prior to subsurf.

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

M	source/blender/blenkernel/intern/subdiv_mesh.c

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

diff --git a/source/blender/blenkernel/intern/subdiv_mesh.c b/source/blender/blenkernel/intern/subdiv_mesh.c
index ad2e094fa48..76f41d512bc 100644
--- a/source/blender/blenkernel/intern/subdiv_mesh.c
+++ b/source/blender/blenkernel/intern/subdiv_mesh.c
@@ -566,10 +566,10 @@ static void loop_interpolation_end(LoopsForInterpolation *loop_interpolation)
 static void subdiv_copy_vertex_data(
         const SubdivMeshContext *ctx,
         MVert *subdiv_vertex,
-        const Mesh *coarse_mesh,
+        const Mesh *UNUSED(coarse_mesh),
         const MPoly *coarse_poly,
         const VerticesForInterpolation *vertex_interpolation,
-        const int ptex_of_poly_index,
+        const int UNUSED(ptex_of_poly_index),
         const float u, const float v)
 {
 	const int subdiv_vertex_index = subdiv_vertex - ctx->subdiv_mesh->mvert;
@@ -587,27 +587,33 @@ static void subdiv_copy_vertex_data(
 		ctx->vert_origindex[subdiv_vertex_index] = ORIGINDEX_NONE;
 		if (coarse_poly->totloop == 4) {
 			if (u == 0.0f && v == 0.0f) {
-				ctx->vert_origindex[subdiv_vertex_index] =
-				        vertex_interpolation->vertex_indices[0];
+				// ctx->vert_origindex[subdiv_vertex_index] =
+				//         vertex_interpolation->vertex_indices[0];
 			}
 			else if (u == 1.0f && v == 0.0f) {
-				ctx->vert_origindex[subdiv_vertex_index] =
-				        vertex_interpolation->vertex_indices[1];
+				// ctx->vert_origindex[subdiv_vertex_index] =
+				//         vertex_interpolation->vertex_indices[1];
 			}
 			else if (u == 1.0f && v == 1.0f) {
-				ctx->vert_origindex[subdiv_vertex_index] =
-				        vertex_interpolation->vertex_indices[2];
+				// ctx->vert_origindex[subdiv_vertex_index] =
+				//         vertex_interpolation->vertex_indices[2];
 			}
 			else if (u == 0.0f && v == 1.0f) {
-				ctx->vert_origindex[subdiv_vertex_index] =
-				        vertex_interpolation->vertex_indices[3];
+				// ctx->vert_origindex[subdiv_vertex_index] =
+				//         vertex_interpolation->vertex_indices[3];
+			}
+			else {
+				ctx->vert_origindex[subdiv_vertex_index] = ORIGINDEX_NONE;
 			}
 		} else {
 			if (u == 0.0f && v == 0.0f) {
-				const MLoop *coarse_mloop = coarse_mesh->mloop;
-				ctx->vert_origindex[subdiv_vertex_index] =
-				        coarse_mloop[coarse_poly->loopstart +
-				                             ptex_of_poly_index].v;
+				// const MLoop *coarse_mloop = coarse_mesh->mloop;
+				// ctx->vert_origindex[subdiv_vertex_index] =
+				//         coarse_mloop[coarse_poly->loopstart +
+				//                              ptex_of_poly_index].v;
+			}
+			else {
+				ctx->vert_origindex[subdiv_vertex_index] = ORIGINDEX_NONE;
 			}
 		}
 	}
@@ -996,7 +1002,7 @@ static void subdiv_copy_poly_data(const SubdivMeshContext *ctx,
 	                     subdiv_poly_index,
 	                     1);
 	if (ctx->poly_origindex != NULL) {
-		ctx->poly_origindex[subdiv_poly_index] = coarse_poly_index;
+		// ctx->poly_origindex[subdiv_poly_index] = coarse_poly_index;
 	}
 }



More information about the Bf-blender-cvs mailing list