Revision: 37565
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37565
Author:   psy-fi
Date:     2011-06-16 18:27:20 +0000 (Thu, 16 Jun 2011)
Log Message:
-----------
Fix for subsurfed unwrapper. Subsurfed vertices now sample the pin and selected 
flags of the originals, if they exist

Modified Paths:
--------------
    branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_unwrap_ops.c

Modified: 
branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_unwrap_ops.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_unwrap_ops.c   
2011-06-16 18:25:41 UTC (rev 37564)
+++ branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_unwrap_ops.c   
2011-06-16 18:27:20 UTC (rev 37565)
@@ -248,17 +248,28 @@
 }
 
 
-static float *get_TexFace_UV_from_Index(EditFace *editFace, MTFace *texFace, 
int index)
+static void get_TexFace_Attributes_from_Index(EditFace *editFace, MTFace 
*texFace, int index, float **uv, ParamBool *pin, ParamBool *select, Scene 
*scene)
 {
-       if(editFace->v1->tmp.t == index)
-               return texFace->uv[0];
-       else if(editFace->v2->tmp.t == index)
-               return texFace->uv[1];
-       else if(editFace->v3->tmp.t == index)
-                       return texFace->uv[2];
-       else if(editFace->v4 && editFace->v4->tmp.t == index)
-                       return texFace->uv[3];
-       return NULL;
+       if(editFace->v1->tmp.t == index){
+               *uv = texFace->uv[0];
+               *pin = ((texFace->unwrap & TF_PIN1) != 0);
+               *select = (uvedit_uv_selected(scene, editFace, texFace, 0) != 
0);
+       }
+       else if(editFace->v2->tmp.t == index){
+               *uv = texFace->uv[1];
+               *pin = ((texFace->unwrap & TF_PIN2) != 0);
+               *select = (uvedit_uv_selected(scene, editFace, texFace, 1) != 
0);
+       }
+       else if(editFace->v3->tmp.t == index){
+               *uv = texFace->uv[2];
+               *pin = ((texFace->unwrap & TF_PIN3) != 0);
+               *select = (uvedit_uv_selected(scene, editFace, texFace, 2) != 
0);
+       }
+       else if(editFace->v4 && editFace->v4->tmp.t == index){
+               *uv = texFace->uv[3];
+               *pin = ((texFace->unwrap & TF_PIN4) != 0);
+               *select = (uvedit_uv_selected(scene, editFace, texFace, 3) != 
0);
+       }
 }
 
 
@@ -412,24 +423,11 @@
                        !(      uvedit_uv_selected(scene, origFace, 
origtexface, 0) ||
                                uvedit_uv_selected(scene, origFace, 
origtexface, 1) ||
                                uvedit_uv_selected(scene, origFace, 
origtexface, 2) ||
-                               (faceMap[i]->v4 && uvedit_uv_selected(scene, 
origFace, origtexface, 3)) )
+                               (origFace->v4 && uvedit_uv_selected(scene, 
origFace, origtexface, 3)) )
                ) {
                        continue;
                }
 
-               select[0] = (uvedit_uv_selected(scene, origFace, origtexface, 
0) != 0);
-               select[1] = (uvedit_uv_selected(scene, origFace, origtexface, 
1) != 0);
-               select[2] = (uvedit_uv_selected(scene, origFace, origtexface, 
2) != 0);
-
-               /* pinning is based upon original face */
-               pin[0] = ((texface->unwrap & TF_PIN1) != 0);
-               pin[1] = ((texface->unwrap & TF_PIN2) != 0);
-               pin[2] = ((texface->unwrap & TF_PIN3) != 0);
-               if(origFace->v4){
-                       select[3] = (uvedit_uv_selected(scene, origFace, 
texface, 3) != 0);
-                       pin[3] = ((texface->unwrap & TF_PIN4) != 0);
-               }
-
                /* Now we feed the rest of the data from the subsurfed faces */
                texface= subsurfedTexfaces+i;
 
@@ -449,24 +447,32 @@
                 * flushing the solution to the edit mesh. */
                if(origVertIndices[face->v1] == -1){
                        uv[0] = texface->uv[0];
+                       pin[0] = 0;
+                       select[0] = !!1;
                }
                else{
-                       uv[0] = get_TexFace_UV_from_Index(origFace, 
origtexface, origVertIndices[face->v1]);
+                        get_TexFace_Attributes_from_Index(origFace, 
origtexface, origVertIndices[face->v1], &uv[0], &pin[0], &select[0], scene);
                }
                if(origVertIndices[face->v2] == -1){
                        uv[1] = texface->uv[1];
+                       pin[1] = 0;
+                       select[1] = !!1;
                } else{
-                       uv[1] = get_TexFace_UV_from_Index(origFace, 
origtexface, origVertIndices[face->v2]);
+                       get_TexFace_Attributes_from_Index(origFace, 
origtexface, origVertIndices[face->v2], &uv[1], &pin[1], &select[1], scene);
                }
                if(origVertIndices[face->v3] == -1){
                        uv[2] = texface->uv[2];
+                       pin[2] = 0;
+                       select[2] = !!1;
                } else{
-                       uv[2] = get_TexFace_UV_from_Index(origFace, 
origtexface, origVertIndices[face->v3]);
+                       get_TexFace_Attributes_from_Index(origFace, 
origtexface, origVertIndices[face->v3], &uv[2], &pin[2], &select[2], scene);
                }
                if(origVertIndices[face->v4] == -1){
                        uv[3] = texface->uv[3];
+                       pin[3] = 0;
+                       select[3] = !!1;
                } else{
-                       uv[3] = get_TexFace_UV_from_Index(origFace, 
origtexface, origVertIndices[face->v4]);
+                       get_TexFace_Attributes_from_Index(origFace, 
origtexface, origVertIndices[face->v4], &uv[3], &pin[3], &select[3], scene);
                }
 
                param_face_add(handle, key, 4, vkeys, co, uv, pin, select);

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

Reply via email to