Revision: 15951
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15951
Author:   artificer
Date:     2008-08-04 16:49:55 +0200 (Mon, 04 Aug 2008)

Log Message:
-----------
Fix for [#17376] Applying mirror modifier does not respect UV pinning.

The custom data system wasn't swapping pinning or selection flags for MTFace
data when face vertices were reordered.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/customdata.c

Modified: trunk/blender/source/blender/blenkernel/intern/customdata.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/customdata.c 2008-08-04 
14:27:25 UTC (rev 15950)
+++ trunk/blender/source/blender/blenkernel/intern/customdata.c 2008-08-04 
14:49:55 UTC (rev 15951)
@@ -265,14 +265,34 @@
 {
        MTFace *tf = data;
        float uv[4][2];
+       const static short pin_flags[4] =
+           { TF_PIN1, TF_PIN2, TF_PIN3, TF_PIN4 };
+       const static char sel_flags[4] =
+           { TF_SEL1, TF_SEL2, TF_SEL3, TF_SEL4 };
+       short unwrap = tf->unwrap & ~(TF_PIN1 | TF_PIN2 | TF_PIN3 | TF_PIN4);
+       char flag = tf->flag & ~(TF_SEL1 | TF_SEL2 | TF_SEL3 | TF_SEL4);
        int j;
 
        for(j = 0; j < 4; ++j) {
-               uv[j][0] = tf->uv[corner_indices[j]][0];
-               uv[j][1] = tf->uv[corner_indices[j]][1];
+               int source_index = corner_indices[j];
+
+               uv[j][0] = tf->uv[source_index][0];
+               uv[j][1] = tf->uv[source_index][1];
+
+               // swap pinning flags around
+               if(tf->unwrap & pin_flags[source_index]) {
+                       unwrap |= pin_flags[j];
+               }
+
+               // swap selection flags around
+               if(tf->flag & sel_flags[source_index]) {
+                       flag |= sel_flags[j];
+               }
        }
 
        memcpy(tf->uv, uv, sizeof(tf->uv));
+       tf->unwrap = unwrap;
+       tf->flag = flag;
 }
 
 static void layerDefault_tface(void *data, int count)


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

Reply via email to