Revision: 48848
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48848
Author:   nicholasbishop
Date:     2012-07-12 05:55:07 +0000 (Thu, 12 Jul 2012)
Log Message:
-----------
Fix normals around root nodes of skin modifier output.

The direction for these are flipped from other end caps, so add a root
flag to indicate whether the cap polygon's vertex output order should be
reversed.

Fixes bug [#32079] Skin-modifier calculates root's normals wrong
projects.blender.org/tracker/index.php?func=detail&aid=32079&group_id=9&atid=498

Modified Paths:
--------------
    trunk/blender/source/blender/modifiers/intern/MOD_skin.c

Modified: trunk/blender/source/blender/modifiers/intern/MOD_skin.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_skin.c    2012-07-12 
01:14:56 UTC (rev 48847)
+++ trunk/blender/source/blender/modifiers/intern/MOD_skin.c    2012-07-12 
05:55:07 UTC (rev 48848)
@@ -91,6 +91,7 @@
        CAP_START = 1,
        CAP_END = 2,
        SEAM_FRAME = 4,
+       ROOT = 8
 } SkinNodeFlag;
 
 typedef struct Frame {
@@ -502,6 +503,9 @@
                /* End frame */
                create_frame(&skin_nodes[v].frames[0], mvert[v].co, rad, mat, 
0);
        }
+
+       if (nodes[v].flag & MVERT_SKIN_ROOT)
+               skin_nodes[v].flag |= ROOT;
 }
 
 /* Returns 1 for seam, 0 otherwise */
@@ -1493,18 +1497,27 @@
                }
 
                if (sn->flag & CAP_START) {
-                       add_poly(so,
-                                sn->frames[0].verts[3],
-                                sn->frames[0].verts[2],
-                                sn->frames[0].verts[1],
-                                sn->frames[0].verts[0]);
+                       if (sn->flag & ROOT) {
+                               add_poly(so,
+                                                sn->frames[0].verts[0],
+                                                sn->frames[0].verts[1],
+                                                sn->frames[0].verts[2],
+                                                sn->frames[0].verts[3]);
+                       }
+                       else {
+                               add_poly(so,
+                                                sn->frames[0].verts[3],
+                                                sn->frames[0].verts[2],
+                                                sn->frames[0].verts[1],
+                                                sn->frames[0].verts[0]);
+                       }
                }
                if (sn->flag & CAP_END) {
                        add_poly(so,
-                                sn->frames[1].verts[3],
+                                sn->frames[1].verts[0],
+                                sn->frames[1].verts[1],
                                 sn->frames[1].verts[2],
-                                sn->frames[1].verts[1],
-                                sn->frames[1].verts[0]);
+                                sn->frames[1].verts[3]);
                }
        }
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to