[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15156] branches/apricot/source/blender/ src/editmesh_tools.c: edge loop side/ del uv only worked with a maximum of 4 faces connected to a vert.

Campbell Barton ideasman42 at gmail.com
Sun Jun 8 04:38:39 CEST 2008


Revision: 15156
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15156
Author:   campbellbarton
Date:     2008-06-08 04:38:38 +0200 (Sun, 08 Jun 2008)

Log Message:
-----------
edge loop side/del uv only worked with a maximum of 4 faces connected to a vert.
now make a list that can have any number of face/uvs.

Modified Paths:
--------------
    branches/apricot/source/blender/src/editmesh_tools.c

Modified: branches/apricot/source/blender/src/editmesh_tools.c
===================================================================
--- branches/apricot/source/blender/src/editmesh_tools.c	2008-06-08 01:00:09 UTC (rev 15155)
+++ branches/apricot/source/blender/src/editmesh_tools.c	2008-06-08 02:38:38 UTC (rev 15156)
@@ -4649,7 +4649,8 @@
 typedef struct SlideUv {
 	float origuv[2];
 	float *uv_up, *uv_down;
-	float *fuv[4];
+	//float *fuv[4];
+	LinkNode *fuv_list;
 } SlideUv;
 
 typedef struct SlideVert {
@@ -4698,6 +4699,8 @@
 	int  uvlay_tot= CustomData_number_of_layers(&G.editMesh->fdata, CD_MTFACE);
 	int uvlay_idx;
 	SlideUv *slideuvs, *suv, *suv_last;	
+	float uv_tmp[2];
+	LinkNode *fuv_link;
 	
 	short event, draw=1;
 	short mval[2], mvalo[2];
@@ -5042,9 +5045,10 @@
 							EditVert *ev_up, *ev_down;
 				
 							if (ev->tmp.l) {
-								if (fabs(suv->fuv[0][0]-uv_new[0]) > 0.0001 || fabs(suv->fuv[0][1]-uv_new[1])) {
+								if (fabs(suv->origuv[0]-uv_new[0]) > 0.0001 || fabs(suv->origuv[1]-uv_new[1])) {
 									ev->tmp.l = -1; /* Tag as invalid */
-									suv->fuv[0] = suv->fuv[1] = suv->fuv[2] = suv->fuv[3] = NULL;
+									BLI_linklist_free(suv->fuv_list,NULL);
+									suv->fuv_list = NULL;
 									BLI_ghash_remove(uvarray[uvlay_idx],ev, NULL, NULL);
 									suv = NULL;
 									break;
@@ -5053,9 +5057,12 @@
 								ev->tmp.l = 1;
 								suv = suv_last;
 
-								suv->fuv[0] = suv->fuv[1] = suv->fuv[2] = suv->fuv[3] = NULL;
+								suv->fuv_list = NULL;
 								suv->uv_up = suv->uv_down = NULL;
+								suv->origuv[0] = uv_new[0];
+								suv->origuv[1] = uv_new[1];
 								
+								BLI_linklist_prepend(&suv->fuv_list, uv_new);
 								BLI_ghash_insert(uvarray[uvlay_idx],ev,suv);
 								
 								suv_last++; /* advance to next slide UV */
@@ -5080,27 +5087,11 @@
 								}
 					
 								/* Copy the pointers to the face UV's */
-								for (k=0; k<4; k++) {
-									if (!suv->fuv[k]) {
-										suv->fuv[k] = uv_new;
-										break;
-									}
-								}
-					
-								if (k==3) { /* Dont look any further since 4 faces gace been found */
-								 	break;
-								}
+								BLI_linklist_prepend(&suv->fuv_list, uv_new);
 							}
-					
 						}
 					}
 				}
-		
-				/* UV SUPPORT */
-				if (suv && suv->fuv[0]) {
-					suv->origuv[0] = suv->fuv[0][0];
-					suv->origuv[1] = suv->fuv[0][1];
-				}
 				look = look->next;
 			}
 		} /* end uv layer loop */
@@ -5149,11 +5140,13 @@
 					if (G.scene->toolsettings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) {
 						for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) {
 							suv = BLI_ghash_lookup( uvarray[uvlay_idx], ev );
-							if (suv && suv->fuv[0] && suv->uv_up && suv->uv_down) {
-								VecLerpf2D(suv->fuv[0], suv->origuv,  (perc>=0)?suv->uv_up:suv->uv_down, fabs(perc));
-								if (suv->fuv[1]) VECCOPY2D(suv->fuv[1], suv->fuv[0]);
-								if (suv->fuv[2]) VECCOPY2D(suv->fuv[2], suv->fuv[0]);
-								if (suv->fuv[3]) VECCOPY2D(suv->fuv[3], suv->fuv[0]);
+							if (suv && suv->fuv_list && suv->uv_up && suv->uv_down) {
+								VecLerpf2D(uv_tmp, suv->origuv,  (perc>=0)?suv->uv_up:suv->uv_down, fabs(perc));
+								fuv_link = suv->fuv_list;
+								while (fuv_link) {
+									VECCOPY2D(((float *)fuv_link->link), uv_tmp);
+									fuv_link = fuv_link->next;
+								}
 							}
 						}
 					}
@@ -5177,11 +5170,13 @@
 							/* dont do anything if no UVs */
 							for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) {
 								suv = BLI_ghash_lookup( uvarray[uvlay_idx], ev );
-								if (suv && suv->fuv[0] && suv->uv_up && suv->uv_down) {
-									VecLerpf2D(suv->fuv[0], suv->uv_down, suv->uv_up, fabs(newlen));
-									if (suv->fuv[1]) VECCOPY2D(suv->fuv[1], suv->fuv[0]);
-									if (suv->fuv[2]) VECCOPY2D(suv->fuv[2], suv->fuv[0]);
-									if (suv->fuv[3]) VECCOPY2D(suv->fuv[3], suv->fuv[0]);
+								if (suv && suv->fuv_list && suv->uv_up && suv->uv_down) {
+									VecLerpf2D(uv_tmp, suv->uv_down, suv->uv_up, fabs(newlen));
+									fuv_link = suv->fuv_list;
+									while (fuv_link) {
+										VECCOPY2D(((float *)fuv_link->link), uv_tmp);
+										fuv_link = fuv_link->next;
+									}
 								}
 							}
 						}
@@ -5192,11 +5187,13 @@
 							/* dont do anything if no UVs */
 							for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) {
 								suv = BLI_ghash_lookup( uvarray[uvlay_idx], ev );
-								if (suv && suv->fuv[0] && suv->uv_up && suv->uv_down) {
-									VecLerpf2D(suv->fuv[0], suv->uv_up, suv->uv_down, fabs(newlen));
-									if (suv->fuv[1]) VECCOPY2D(suv->fuv[1], suv->fuv[0]);
-									if (suv->fuv[2]) VECCOPY2D(suv->fuv[2], suv->fuv[0]);
-									if (suv->fuv[3]) VECCOPY2D(suv->fuv[3], suv->fuv[0]);
+								if (suv && suv->fuv_list && suv->uv_up && suv->uv_down) {
+									VecLerpf2D(uv_tmp, suv->uv_up, suv->uv_down, fabs(newlen));
+									fuv_link = suv->fuv_list;
+									while (fuv_link) {
+										VECCOPY2D(((float *)fuv_link->link), uv_tmp);
+										fuv_link = fuv_link->next;
+									}
 								}
 							}
 						}
@@ -5389,6 +5386,14 @@
 		MEM_freeN(uvarray);
 		MEM_freeN(slideuvs);
 		
+		suv = suv_last-1;
+		while (suv >= slideuvs) {
+			if (suv->fuv_list) {
+				BLI_linklist_free(suv->fuv_list,NULL);
+			}
+			suv--;
+		}
+		
 		allqueue(REDRAWIMAGE, 0);
 	}
 





More information about the Bf-blender-cvs mailing list