[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12170] trunk/blender/source/blender: - rewrote UV Stitch, (seperate from limit stitch now), does much less
Campbell Barton
cbarton at metavr.com
Sun Sep 30 10:28:16 CEST 2007
Revision: 12170
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12170
Author: campbellbarton
Date: 2007-09-30 10:28:15 +0200 (Sun, 30 Sep 2007)
Log Message:
-----------
- rewrote UV Stitch, (seperate from limit stitch now), does much less
work for same results.
- UV Stitch with the V key was not working (as stated in the menu)
- Rotate UV's and Colors now have an option for CCW (was in the menu
but not implimented)
- Draw face dot in UV when in face mode
Modified Paths:
--------------
trunk/blender/source/blender/include/BIF_editsima.h
trunk/blender/source/blender/src/drawimage.c
trunk/blender/source/blender/src/editmesh_tools.c
trunk/blender/source/blender/src/editsima.c
trunk/blender/source/blender/src/header_image.c
trunk/blender/source/blender/src/space.c
Modified: trunk/blender/source/blender/include/BIF_editsima.h
===================================================================
--- trunk/blender/source/blender/include/BIF_editsima.h 2007-09-29 18:51:01 UTC (rev 12169)
+++ trunk/blender/source/blender/include/BIF_editsima.h 2007-09-30 08:28:15 UTC (rev 12170)
@@ -93,7 +93,8 @@
void mirror_tface_uv(char mirroraxis);
void hide_tface_uv(int swap);
void reveal_tface_uv(void);
-void stitch_uv_tface(int mode);
+void stitch_limit_uv_tface(void);
+void stitch_vert_uv_tface(void);
void unlink_selection(void);
void select_linked_tface_uv(int mode);
void pin_tface_uv(int mode);
Modified: trunk/blender/source/blender/src/drawimage.c
===================================================================
--- trunk/blender/source/blender/src/drawimage.c 2007-09-29 18:51:01 UTC (rev 12169)
+++ trunk/blender/source/blender/src/drawimage.c 2007-09-30 08:28:15 UTC (rev 12170)
@@ -445,10 +445,31 @@
setlinestyle(0);
}
-/* draws uv's in the image space */
+// checks if we are selecting only faces
+static int draw_uvs_face_check(void)
+{
+ if (G.sima==NULL)
+ return 0;
+ if (G.sima->flag & SI_SYNC_UVSEL && G.scene->selectmode == SCE_SELECT_FACE)
+ return 1;
+ if (G.sima->flag & SI_SELACTFACE)
+ return 1;
+ return 0;
+}
+void tface_center(MTFace *tf, float cent[2], void * isquad)
+{
+ if (isquad) {
+ cent[0] = (tf->uv[0][0] + tf->uv[1][0] + tf->uv[2][0] + tf->uv[3][0]) / 4.0;
+ cent[1] = (tf->uv[0][1] + tf->uv[1][1] + tf->uv[2][1] + tf->uv[3][1]) / 4.0;
+ } else {
+ cent[0] = (tf->uv[0][0] + tf->uv[1][0] + tf->uv[2][0]) / 3.0;
+ cent[1] = (tf->uv[0][1] + tf->uv[1][1] + tf->uv[2][1]) / 3.0;
+ }
+}
+/* draws uv's in the image space */
void draw_uvs_sima(void)
{
MTFace *tface,*activetface = NULL;
@@ -457,10 +478,13 @@
char col1[4], col2[4];
float pointsize;
+ int drawface;
if (!G.obedit || !CustomData_has_layer(&em->fdata, CD_MTFACE))
return;
+ drawface = draw_uvs_face_check();
+
calc_image_view(G.sima, 'f'); /* float */
myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
glLoadIdentity();
@@ -686,74 +710,120 @@
glDisable(GL_BLEND);
}
- /* unselected uv's */
- BIF_ThemeColor(TH_VERTEX);
- pointsize = BIF_GetThemeValuef(TH_VERTEX_SIZE);
- glPointSize(pointsize);
-
- bglBegin(GL_POINTS);
- for (efa= em->faces.first; efa; efa= efa->next) {
+ if (drawface) {
+ // draw UV face points
+ float cent[2];
-// tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-// if (SIMA_FACEDRAW_CHECK(efa, tface)) {
- /*this is a shortcut to do the same as above but a faster for drawing */
- if ((tface=(MTFace *)efa->tmp.p)) {
+ /* unselected faces's */
+ pointsize = BIF_GetThemeValuef(TH_FACEDOT_SIZE);
+ // TODO - drawobject.c changes this value after - Investiagate!
+ glPointSize(pointsize);
- if(SIMA_UVSEL_CHECK(efa, tface, 0)); else bglVertex2fv(tface->uv[0]);
- if(SIMA_UVSEL_CHECK(efa, tface, 1)); else bglVertex2fv(tface->uv[1]);
- if(SIMA_UVSEL_CHECK(efa, tface, 2)); else bglVertex2fv(tface->uv[2]);
- if(efa->v4) {
- if(SIMA_UVSEL_CHECK(efa, tface, 3)); else bglVertex2fv(tface->uv[3]);
+ BIF_ThemeColor(TH_WIRE);
+ bglBegin(GL_POINTS);
+ for (efa= em->faces.first; efa; efa= efa->next) {
+
+// tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+// if (SIMA_FACEDRAW_CHECK(efa, tface)) {
+
+ /*this is a shortcut to do the same as above but a faster for drawing */
+ if ((tface=(MTFace *)efa->tmp.p)) {
+ if( ! SIMA_FACESEL_CHECK(efa, tface) ) {
+ tface_center(tface, cent, (void *)efa->v4);
+ bglVertex2fv(cent);
+ }
}
}
- }
- bglEnd();
-
- /* pinned uv's */
- /* give odd pointsizes odd pin pointsizes */
- glPointSize(pointsize*2 + (((int)pointsize % 2)? (-1): 0));
- cpack(0xFF);
-
- bglBegin(GL_POINTS);
- for (efa= em->faces.first; efa; efa= efa->next) {
-// tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-// if (SIMA_FACEDRAW_CHECK(efa, tface)) {
-
- /*this is a shortcut to do the same as above but a faster for drawing */
- if ((tface=(MTFace *)efa->tmp.p)) {
+ bglEnd();
+ /* selected faces's */
+ BIF_ThemeColor(TH_FACE_DOT);
+ bglBegin(GL_POINTS);
+ for (efa= em->faces.first; efa; efa= efa->next) {
- if(tface->unwrap & TF_PIN1) bglVertex2fv(tface->uv[0]);
- if(tface->unwrap & TF_PIN2) bglVertex2fv(tface->uv[1]);
- if(tface->unwrap & TF_PIN3) bglVertex2fv(tface->uv[2]);
- if(efa->v4) {
- if(tface->unwrap & TF_PIN4) bglVertex2fv(tface->uv[3]);
+// tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+// if (SIMA_FACEDRAW_CHECK(efa, tface)) {
+
+ /*this is a shortcut to do the same as above but a faster for drawing */
+ if ((tface=(MTFace *)efa->tmp.p)) {
+ if( SIMA_FACESEL_CHECK(efa, tface) ) {
+ tface_center(tface, cent, (void *)efa->v4);
+ bglVertex2fv(cent);
+ }
}
}
- }
- bglEnd();
-
- /* selected uv's */
- BIF_ThemeColor(TH_VERTEX_SELECT);
- glPointSize(pointsize);
-
- bglBegin(GL_POINTS);
- for (efa= em->faces.first; efa; efa= efa->next) {
-// tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-// if (SIMA_FACEDRAW_CHECK(efa, tface)) {
+ bglEnd();
+ } else {
- /*this is a shortcut to do the same as above but a faster for drawing */
- if ((tface=(MTFace *)efa->tmp.p)) {
-
- if(!SIMA_UVSEL_CHECK(efa, tface, 0)); else bglVertex2fv(tface->uv[0]);
- if(!SIMA_UVSEL_CHECK(efa, tface, 1)); else bglVertex2fv(tface->uv[1]);
- if(!SIMA_UVSEL_CHECK(efa, tface, 2)); else bglVertex2fv(tface->uv[2]);
- if(efa->v4) {
- if(!SIMA_UVSEL_CHECK(efa, tface, 3)); else bglVertex2fv(tface->uv[3]);
+ /* unselected uv's */
+ BIF_ThemeColor(TH_VERTEX);
+ pointsize = BIF_GetThemeValuef(TH_VERTEX_SIZE);
+ glPointSize(pointsize);
+
+ bglBegin(GL_POINTS);
+ for (efa= em->faces.first; efa; efa= efa->next) {
+
+// tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+// if (SIMA_FACEDRAW_CHECK(efa, tface)) {
+
+ /*this is a shortcut to do the same as above but a faster for drawing */
+ if ((tface=(MTFace *)efa->tmp.p)) {
+
+ if(SIMA_UVSEL_CHECK(efa, tface, 0)); else bglVertex2fv(tface->uv[0]);
+ if(SIMA_UVSEL_CHECK(efa, tface, 1)); else bglVertex2fv(tface->uv[1]);
+ if(SIMA_UVSEL_CHECK(efa, tface, 2)); else bglVertex2fv(tface->uv[2]);
+ if(efa->v4) {
+ if(SIMA_UVSEL_CHECK(efa, tface, 3)); else bglVertex2fv(tface->uv[3]);
+ }
}
}
+ bglEnd();
+
+ /* pinned uv's */
+ /* give odd pointsizes odd pin pointsizes */
+ glPointSize(pointsize*2 + (((int)pointsize % 2)? (-1): 0));
+ cpack(0xFF);
+
+ bglBegin(GL_POINTS);
+ for (efa= em->faces.first; efa; efa= efa->next) {
+// tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+// if (SIMA_FACEDRAW_CHECK(efa, tface)) {
+
+ /*this is a shortcut to do the same as above but a faster for drawing */
+ if ((tface=(MTFace *)efa->tmp.p)) {
+
+ if(tface->unwrap & TF_PIN1) bglVertex2fv(tface->uv[0]);
+ if(tface->unwrap & TF_PIN2) bglVertex2fv(tface->uv[1]);
+ if(tface->unwrap & TF_PIN3) bglVertex2fv(tface->uv[2]);
+ if(efa->v4) {
+ if(tface->unwrap & TF_PIN4) bglVertex2fv(tface->uv[3]);
+ }
+ }
+ }
+ bglEnd();
+
+ /* selected uv's */
+ BIF_ThemeColor(TH_VERTEX_SELECT);
+ glPointSize(pointsize);
+
+ bglBegin(GL_POINTS);
+ for (efa= em->faces.first; efa; efa= efa->next) {
+// tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+// if (SIMA_FACEDRAW_CHECK(efa, tface)) {
+
+ /*this is a shortcut to do the same as above but a faster for drawing */
+ if ((tface=(MTFace *)efa->tmp.p)) {
+
+ if(!SIMA_UVSEL_CHECK(efa, tface, 0)); else bglVertex2fv(tface->uv[0]);
+ if(!SIMA_UVSEL_CHECK(efa, tface, 1)); else bglVertex2fv(tface->uv[1]);
+ if(!SIMA_UVSEL_CHECK(efa, tface, 2)); else bglVertex2fv(tface->uv[2]);
+ if(efa->v4) {
+ if(!SIMA_UVSEL_CHECK(efa, tface, 3)); else bglVertex2fv(tface->uv[3]);
+ }
+ }
+ }
+ bglEnd();
}
- bglEnd();
glPointSize(1.0);
}
Modified: trunk/blender/source/blender/src/editmesh_tools.c
===================================================================
--- trunk/blender/source/blender/src/editmesh_tools.c 2007-09-29 18:51:01 UTC (rev 12169)
+++ trunk/blender/source/blender/src/editmesh_tools.c 2007-09-30 08:28:15 UTC (rev 12170)
@@ -6559,7 +6559,7 @@
{
EditMesh *em = G.editMesh;
EditFace *efa;
- short change = 0;
+ short change = 0, ccw;
MTFace *tf;
float u1, v1;
@@ -6568,29 +6568,50 @@
return;
}
+ ccw = (G.qual == LR_SHIFTKEY);
+
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT) {
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
u1= tf->uv[0][0];
v1= tf->uv[0][1];
- tf->uv[0][0]= tf->uv[1][0];
- tf->uv[0][1]= tf->uv[1][1];
-
- tf->uv[1][0]= tf->uv[2][0];
- tf->uv[1][1]= tf->uv[2][1];
-
- if(efa->v4) {
- tf->uv[2][0]= tf->uv[3][0];
- tf->uv[2][1]= tf->uv[3][1];
-
- tf->uv[3][0]= u1;
- tf->uv[3][1]= v1;
+ if (ccw) {
+ if(efa->v4) {
+ tf->uv[0][0]= tf->uv[3][0];
+ tf->uv[0][1]= tf->uv[3][1];
+
+ tf->uv[3][0]= tf->uv[2][0];
+ tf->uv[3][1]= tf->uv[2][1];
+ } else {
+ tf->uv[0][0]= tf->uv[2][0];
+ tf->uv[0][1]= tf->uv[2][1];
+ }
+
+ tf->uv[2][0]= tf->uv[1][0];
+ tf->uv[2][1]= tf->uv[1][1];
+
+ tf->uv[1][0]= u1;
+ tf->uv[1][1]= v1;
+ } else {
+ tf->uv[0][0]= tf->uv[1][0];
+ tf->uv[0][1]= tf->uv[1][1];
+
+ tf->uv[1][0]= tf->uv[2][0];
+ tf->uv[1][1]= tf->uv[2][1];
+
+ if(efa->v4) {
+ tf->uv[2][0]= tf->uv[3][0];
+ tf->uv[2][1]= tf->uv[3][1];
+
+ tf->uv[3][0]= u1;
+ tf->uv[3][1]= v1;
+ }
+ else {
+ tf->uv[2][0]= u1;
+ tf->uv[2][1]= v1;
+ }
}
- else {
- tf->uv[2][0]= u1;
- tf->uv[2][1]= v1;
- }
change = 1;
}
}
@@ -6657,27 +6678,40 @@
{
EditMesh *em = G.editMesh;
EditFace *efa;
- short change = 0;
+ short change = 0, ccw;
MCol tmpcol, *mcol;
if (!EM_vertColorCheck()) {
error("mesh has no color layers");
return;
}
+ ccw = (G.qual == LR_SHIFTKEY);
+
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT) {
mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
tmpcol= mcol[0];
- mcol[0]= mcol[1];
- mcol[1]= mcol[2];
-
- if(efa->v4) {
- mcol[2]= mcol[3];
- mcol[3]= tmpcol;
+ if (ccw) {
+ if(efa->v4) {
+ mcol[0]= mcol[3];
+ mcol[3]= mcol[2];
+ } else {
+ mcol[0]= mcol[2];
+ }
+ mcol[2]= mcol[1];
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list