Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2016-04-11 15:56:17 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-04-11 16:04:11 +0300
commite5a2790ecbdc748cc5d67af60ad5251eee0a7b6f (patch)
treeeb70a8e50245370d023c5d3c0c3e189bd15c144a /source/blender/modifiers
parent90271e7ff185b3714c40182db953923567933bae (diff)
Fix T48084: Solidify uses alternate quad-direction
This prevents twisted quads from self-intersecting. This change makes the duplicate surface match the first vertex in the face, so the diagonal indices match in the face copy.
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r--source/blender/modifiers/intern/MOD_solidify.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c
index 0a4d6474234..527576843e3 100644
--- a/source/blender/modifiers/intern/MOD_solidify.c
+++ b/source/blender/modifiers/intern/MOD_solidify.c
@@ -455,6 +455,7 @@ static DerivedMesh *applyModifier(
mp = mpoly + numFaces;
for (i = 0; i < dm->numPolyData; i++, mp++) {
+ const int loop_end = mp->totloop - 1;
MLoop *ml2;
unsigned int e;
int j;
@@ -462,10 +463,20 @@ static DerivedMesh *applyModifier(
/* reverses the loop direction (MLoop.v as well as custom-data)
* MLoop.e also needs to be corrected too, done in a separate loop below. */
ml2 = mloop + mp->loopstart + dm->numLoopData;
+#if 0
for (j = 0; j < mp->totloop; j++) {
CustomData_copy_data(&dm->loopData, &result->loopData, mp->loopstart + j,
- mp->loopstart + (mp->totloop - j - 1) + dm->numLoopData, 1);
+ mp->loopstart + (loop_end - j) + dm->numLoopData, 1);
}
+#else
+ /* slightly more involved, keep the first vertex the same for the copy,
+ * ensures the diagonals in the new face match the original. */
+ j = 0;
+ for (int j_prev = loop_end; j < mp->totloop; j_prev = j++) {
+ CustomData_copy_data(&dm->loopData, &result->loopData, mp->loopstart + j,
+ mp->loopstart + (loop_end - j_prev) + dm->numLoopData, 1);
+ }
+#endif
if (mat_ofs) {
mp->mat_nr += mat_ofs;
@@ -473,10 +484,10 @@ static DerivedMesh *applyModifier(
}
e = ml2[0].e;
- for (j = 0; j < mp->totloop - 1; j++) {
+ for (j = 0; j < loop_end; j++) {
ml2[j].e = ml2[j + 1].e;
}
- ml2[mp->totloop - 1].e = e;
+ ml2[loop_end].e = e;
mp->loopstart += dm->numLoopData;