Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2007-11-25 16:43:14 +0300
committerCampbell Barton <ideasman42@gmail.com>2007-11-25 16:43:14 +0300
commita32287ebfbb36b1a3e1bb02563cb096179041f28 (patch)
tree26f9ecb6374e60a77a57affa60fe7cdf57205931 /source
parent13e73af13e4d61206459ee61585c09e967b557f8 (diff)
replace macro's with functions for UV editmode checks, this wasn't nice code and broke building on solaris
Diffstat (limited to 'source')
-rw-r--r--source/blender/include/BIF_editsima.h38
-rw-r--r--source/blender/src/drawimage.c66
-rw-r--r--source/blender/src/editface.c2
-rw-r--r--source/blender/src/editsima.c363
-rw-r--r--source/blender/src/editview.c10
-rw-r--r--source/blender/src/transform_conversions.c30
-rw-r--r--source/blender/src/unwrapper.c18
7 files changed, 304 insertions, 223 deletions
diff --git a/source/blender/include/BIF_editsima.h b/source/blender/include/BIF_editsima.h
index a8a5c16df1a..c0e28d7b1f1 100644
--- a/source/blender/include/BIF_editsima.h
+++ b/source/blender/include/BIF_editsima.h
@@ -40,31 +40,6 @@ struct MTFace;
#define TF_PIN_MASK(id) (TF_PIN1 << id)
#define TF_SEL_MASK(id) (TF_SEL1 << id)
-
-/* this checks weather a face is drarn without the local image check
- * - warning - no check for G.sima->flag, use SIMA_FACEDRAW_CHECK
- */
-#define SIMA_FACEDRAW_CHECK_NOLOCAL(efa) \
- ((G.sima->flag & SI_SYNC_UVSEL) ? (efa->h==0) : (efa->h==0 && efa->f & SELECT))
-
-/* this check includes the local image check - (does the faces image match the space image?) */
-#define SIMA_FACEDRAW_CHECK(efa, tf) \
- ((G.sima && G.sima->flag & SI_LOCAL_UV) ? ((tf->tpage==G.sima->image) ? SIMA_FACEDRAW_CHECK_NOLOCAL(efa):0) : (SIMA_FACEDRAW_CHECK_NOLOCAL(efa)))
-
-#define SIMA_FACESEL_CHECK(efa, tf) \
- ((G.sima && G.sima->flag & SI_SYNC_UVSEL) ? (efa->f & SELECT) : (!(~tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3)) &&(!efa->v4 || tf->flag & TF_SEL4)))
-#define SIMA_FACESEL_SET(efa, tf) \
- ((G.sima && G.sima->flag & SI_SYNC_UVSEL) ? (EM_select_face(efa, 1)) : (tf->flag |= (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4)))
-#define SIMA_FACESEL_UNSET(efa, tf) \
- ((G.sima && G.sima->flag & SI_SYNC_UVSEL) ? (EM_select_face(efa, 0)) : (tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4)))
-
-#define SIMA_UVSEL_CHECK(efa, tf, i) ((G.sima && G.sima->flag & SI_SYNC_UVSEL) ? \
- (G.scene->selectmode == SCE_SELECT_FACE ? efa->f & SELECT : ((*(&efa->v1 + i))->f & SELECT) ) : (tf->flag & TF_SEL_MASK(i) ))
-#define SIMA_UVSEL_SET(efa, tf, i) ((G.sima && G.sima->flag & SI_SYNC_UVSEL) ? \
- (G.scene->selectmode == SCE_SELECT_FACE ? EM_select_face(efa, 1) : ((*(&efa->v1 + i))->f |= SELECT) ) : (tf->flag |= TF_SEL_MASK(i) ))
-#define SIMA_UVSEL_UNSET(efa, tf, i) ((G.sima && G.sima->flag & SI_SYNC_UVSEL) ? \
- (G.scene->selectmode == SCE_SELECT_FACE ? EM_select_face(efa, 0) : ((*(&efa->v1 + i))->f &= ~SELECT) ) : (tf->flag &= ~TF_SEL_MASK(i) ))
-
struct Object;
void object_uvs_changed(struct Object *ob);
@@ -122,3 +97,16 @@ void pack_image_sima(void);
void BIF_image_update_frame(void);
void find_nearest_uv(struct MTFace **nearesttf, struct EditFace **nearestefa, unsigned int *nearestv, int *nearestuv);
+
+/* face selection check functions */
+
+int simaFaceDraw_Check_nolocal( struct EditFace *efa );
+int simaFaceDraw_Check( struct EditFace *efa, struct MTFace *tf );
+
+int simaFaceSel_Check( struct EditFace *efa, struct MTFace *tf );
+void simaFaceSel_Set( struct EditFace *efa, struct MTFace *tf );
+void simaFaceSel_UnSet( struct EditFace *efa, struct MTFace *tf );
+
+int simaUVSel_Check( struct EditFace *efa, struct MTFace *tf, int i);
+void simaUVSel_Set( struct EditFace *efa, struct MTFace *tf, int i);
+void simaUVSel_UnSet( struct EditFace *efa, struct MTFace *tf, int i);
diff --git a/source/blender/src/drawimage.c b/source/blender/src/drawimage.c
index 342e361d869..ea9dc6a0482 100644
--- a/source/blender/src/drawimage.c
+++ b/source/blender/src/drawimage.c
@@ -354,7 +354,7 @@ void image_changed(SpaceImage *sima, Image *image)
}
}
}
- /* change the space image after because SIMA_FACEDRAW_CHECK uses the space image
+ /* change the space image after because simaFaceDraw_Check uses the space image
* to check if the face is displayed in UV-localview */
sima->image = image;
@@ -581,10 +581,10 @@ void draw_uvs_sima(void)
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)) {
+ if (simaFaceDraw_Check(efa, tface)) {
efa->tmp.p = tface;
if (tface==activetface) continue; /* important the temp pointer is set above */
- if( SIMA_FACESEL_CHECK(efa, tface) )
+ if( simaFaceSel_Check(efa, tface) )
glColor4ubv((GLubyte *)col2);
else
glColor4ubv((GLubyte *)col1);
@@ -606,7 +606,7 @@ void draw_uvs_sima(void)
/* would be nice to do this within a draw loop but most below are optional, so it would involve too many checks */
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)) {
+ if (simaFaceDraw_Check(efa, tface)) {
efa->tmp.p = tface;
} else {
if (tface == activetface)
@@ -645,7 +645,7 @@ void draw_uvs_sima(void)
case SI_UVDT_DASH:
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)) {
+// if (simaFaceDraw_Check(efa, tface)) {
/*this is a shortcut to do the same as above but a faster for drawing */
if ((tface=(MTFace *)efa->tmp.p)) {
@@ -685,7 +685,7 @@ void draw_uvs_sima(void)
cpack((G.sima->dt_uv==SI_UVDT_WHITE) ? 0xFFFFFF : 0x0);
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)) {
+// if (simaFaceDraw_Check(efa, tface)) {
/*this is a shortcut to do the same as above but a faster for drawing */
if ((tface=(MTFace *)efa->tmp.p)) {
@@ -705,7 +705,7 @@ void draw_uvs_sima(void)
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)) {
+// if (simaFaceDraw_Check(efa, tface)) {
/*this is a shortcut to do the same as above but a faster for drawing */
if ((tface=(MTFace *)efa->tmp.p)) {
@@ -723,7 +723,7 @@ void draw_uvs_sima(void)
cpack(0xFFFFFF);
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)) {
+// if (simaFaceDraw_Check(efa, tface)) {
/*this is a shortcut to do the same as above but a faster for drawing */
if ((tface=(MTFace *)efa->tmp.p)) {
@@ -759,11 +759,11 @@ void draw_uvs_sima(void)
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)) {
+// if (simaFaceDraw_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) ) {
+ if( ! simaFaceSel_Check(efa, tface) ) {
tface_center(tface, cent, (void *)efa->v4);
bglVertex2fv(cent);
}
@@ -776,11 +776,11 @@ void draw_uvs_sima(void)
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)) {
+// if (simaFaceDraw_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) ) {
+ if( simaFaceSel_Check(efa, tface) ) {
tface_center(tface, cent, (void *)efa->v4);
bglVertex2fv(cent);
}
@@ -799,16 +799,16 @@ void draw_uvs_sima(void)
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)) {
+// if (simaFaceDraw_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(simaUVSel_Check(efa, tface, 0)); else bglVertex2fv(tface->uv[0]);
+ if(simaUVSel_Check(efa, tface, 1)); else bglVertex2fv(tface->uv[1]);
+ if(simaUVSel_Check(efa, tface, 2)); else bglVertex2fv(tface->uv[2]);
if(efa->v4) {
- if(SIMA_UVSEL_CHECK(efa, tface, 3)); else bglVertex2fv(tface->uv[3]);
+ if(simaUVSel_Check(efa, tface, 3)); else bglVertex2fv(tface->uv[3]);
}
}
}
@@ -822,7 +822,7 @@ void draw_uvs_sima(void)
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)) {
+// if (simaFaceDraw_Check(efa, tface)) {
/*this is a shortcut to do the same as above but a faster for drawing */
if ((tface=(MTFace *)efa->tmp.p)) {
@@ -844,16 +844,16 @@ void draw_uvs_sima(void)
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)) {
+// if (simaFaceDraw_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(!simaUVSel_Check(efa, tface, 0)); else bglVertex2fv(tface->uv[0]);
+ if(!simaUVSel_Check(efa, tface, 1)); else bglVertex2fv(tface->uv[1]);
+ if(!simaUVSel_Check(efa, tface, 2)); else bglVertex2fv(tface->uv[2]);
if(efa->v4) {
- if(!SIMA_UVSEL_CHECK(efa, tface, 3)); else bglVertex2fv(tface->uv[3]);
+ if(!simaUVSel_Check(efa, tface, 3)); else bglVertex2fv(tface->uv[3]);
}
}
}
@@ -1006,24 +1006,24 @@ void image_editvertex_buts(uiBlock *block)
for (efa= em->faces.first; efa; efa= efa->next) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (SIMA_FACEDRAW_CHECK(efa, tf)) {
+ if (simaFaceDraw_Check(efa, tf)) {
- if (SIMA_UVSEL_CHECK(efa, tf, 0)) {
+ if (simaUVSel_Check(efa, tf, 0)) {
cent[0]+= tf->uv[0][0];
cent[1]+= tf->uv[0][1];
nactive++;
}
- if (SIMA_UVSEL_CHECK(efa, tf, 1)) {
+ if (simaUVSel_Check(efa, tf, 1)) {
cent[0]+= tf->uv[1][0];
cent[1]+= tf->uv[1][1];
nactive++;
}
- if (SIMA_UVSEL_CHECK(efa, tf, 2)) {
+ if (simaUVSel_Check(efa, tf, 2)) {
cent[0]+= tf->uv[2][0];
cent[1]+= tf->uv[2][1];
nactive++;
}
- if (efa->v4 && SIMA_UVSEL_CHECK(efa, tf, 3)) {
+ if (efa->v4 && simaUVSel_Check(efa, tf, 3)) {
cent[0]+= tf->uv[3][0];
cent[1]+= tf->uv[3][1];
nactive++;
@@ -1070,20 +1070,20 @@ void image_editvertex_buts(uiBlock *block)
for (efa= em->faces.first; efa; efa= efa->next) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (SIMA_FACEDRAW_CHECK(efa, tf)) {
- if (SIMA_UVSEL_CHECK(efa, tf, 0)) {
+ if (simaFaceDraw_Check(efa, tf)) {
+ if (simaUVSel_Check(efa, tf, 0)) {
tf->uv[0][0]+= delta[0];
tf->uv[0][1]+= delta[1];
}
- if (SIMA_UVSEL_CHECK(efa, tf, 1)) {
+ if (simaUVSel_Check(efa, tf, 1)) {
tf->uv[1][0]+= delta[0];
tf->uv[1][1]+= delta[1];
}
- if (SIMA_UVSEL_CHECK(efa, tf, 2)) {
+ if (simaUVSel_Check(efa, tf, 2)) {
tf->uv[2][0]+= delta[0];
tf->uv[2][1]+= delta[1];
}
- if (efa->v4 && SIMA_UVSEL_CHECK(efa, tf, 3)) {
+ if (efa->v4 && simaUVSel_Check(efa, tf, 3)) {
tf->uv[3][0]+= delta[0];
tf->uv[3][1]+= delta[1];
}
diff --git a/source/blender/src/editface.c b/source/blender/src/editface.c
index d3af5cc47e8..be3d9429d31 100644
--- a/source/blender/src/editface.c
+++ b/source/blender/src/editface.c
@@ -370,7 +370,7 @@ void calculate_uv_map(unsigned short mapmode)
if ((G.sima && G.sima->flag & SI_SYNC_UVSEL)==0) {
for(efa=em->faces.first; efa; efa=efa->next) {
MTFace *tf= (MTFace *)CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- SIMA_FACESEL_SET(efa, tf);
+ simaFaceSel_Set(efa, tf);
}
}
}
diff --git a/source/blender/src/editsima.c b/source/blender/src/editsima.c
index 18191c970df..ce1d70527ed 100644
--- a/source/blender/src/editsima.c
+++ b/source/blender/src/editsima.c
@@ -164,8 +164,8 @@ void be_square_tface_uv(EditMesh *em)
for (efa= em->faces.first; efa; efa= efa->next) {
if (efa->v4) {
tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (SIMA_FACEDRAW_CHECK(efa, tface)) {
- if (SIMA_UVSEL_CHECK(efa, tface, 0)) {
+ if (simaFaceDraw_Check(efa, tface)) {
+ if (simaUVSel_Check(efa, tface, 0)) {
if( tface->uv[1][0] == tface->uv[2][0] ) {
tface->uv[1][1]= tface->uv[0][1];
tface->uv[3][0]= tface->uv[0][0];
@@ -176,7 +176,7 @@ void be_square_tface_uv(EditMesh *em)
}
}
- if (SIMA_UVSEL_CHECK(efa, tface, 1)) {
+ if (simaUVSel_Check(efa, tface, 1)) {
if( tface->uv[2][1] == tface->uv[3][1] ) {
tface->uv[2][0]= tface->uv[1][0];
tface->uv[0][1]= tface->uv[1][1];
@@ -187,7 +187,7 @@ void be_square_tface_uv(EditMesh *em)
}
}
- if (SIMA_UVSEL_CHECK(efa, tface, 2)) {
+ if (simaUVSel_Check(efa, tface, 2)) {
if( tface->uv[3][0] == tface->uv[0][0] ) {
tface->uv[3][1]= tface->uv[2][1];
tface->uv[1][0]= tface->uv[2][0];
@@ -197,7 +197,7 @@ void be_square_tface_uv(EditMesh *em)
tface->uv[1][1]= tface->uv[2][1];
}
}
- if (SIMA_UVSEL_CHECK(efa, tface, 3)) {
+ if (simaUVSel_Check(efa, tface, 3)) {
if( tface->uv[0][1] == tface->uv[1][1] ) {
tface->uv[0][0]= tface->uv[3][0];
tface->uv[2][1]= tface->uv[3][1];
@@ -276,14 +276,14 @@ void weld_align_tface_uv(char tool)
if(tool == 'x' || tool == 'w') {
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)) {
- if (SIMA_UVSEL_CHECK(efa, tface, 0))
+ if (simaFaceDraw_Check(efa, tface)) {
+ if (simaUVSel_Check(efa, tface, 0))
tface->uv[0][0]= cent[0];
- if (SIMA_UVSEL_CHECK(efa, tface, 1))
+ if (simaUVSel_Check(efa, tface, 1))
tface->uv[1][0]= cent[0];
- if (SIMA_UVSEL_CHECK(efa, tface, 2))
+ if (simaUVSel_Check(efa, tface, 2))
tface->uv[2][0]= cent[0];
- if (efa->v4 && SIMA_UVSEL_CHECK(efa, tface, 3))
+ if (efa->v4 && simaUVSel_Check(efa, tface, 3))
tface->uv[3][0]= cent[0];
}
}
@@ -292,14 +292,14 @@ void weld_align_tface_uv(char tool)
if(tool == 'y' || tool == 'w') {
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)) {
- if (SIMA_UVSEL_CHECK(efa, tface, 0))
+ if (simaFaceDraw_Check(efa, tface)) {
+ if (simaUVSel_Check(efa, tface, 0))
tface->uv[0][1]= cent[1];
- if (SIMA_UVSEL_CHECK(efa, tface, 1))
+ if (simaUVSel_Check(efa, tface, 1))
tface->uv[1][1]= cent[1];
- if (SIMA_UVSEL_CHECK(efa, tface, 2))
+ if (simaUVSel_Check(efa, tface, 2))
tface->uv[2][1]= cent[1];
- if (efa->v4 && SIMA_UVSEL_CHECK(efa, tface, 3))
+ if (efa->v4 && simaUVSel_Check(efa, tface, 3))
tface->uv[3][1]= cent[1];
}
}
@@ -335,26 +335,26 @@ void stitch_vert_uv_tface(void)
// gather uv averages per vert
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)) {
- if (SIMA_UVSEL_CHECK(efa, tface, 0)) {
+ if (simaFaceDraw_Check(efa, tface)) {
+ if (simaUVSel_Check(efa, tface, 0)) {
uvav = uv_average + efa->v1->tmp.l;
uvav->count++;
uvav->uv[0] += tface->uv[0][0];
uvav->uv[1] += tface->uv[0][1];
}
- if (SIMA_UVSEL_CHECK(efa, tface, 1)) {
+ if (simaUVSel_Check(efa, tface, 1)) {
uvav = uv_average + efa->v2->tmp.l;
uvav->count++;
uvav->uv[0] += tface->uv[1][0];
uvav->uv[1] += tface->uv[1][1];
}
- if (SIMA_UVSEL_CHECK(efa, tface, 2)) {
+ if (simaUVSel_Check(efa, tface, 2)) {
uvav = uv_average + efa->v3->tmp.l;
uvav->count++;
uvav->uv[0] += tface->uv[2][0];
uvav->uv[1] += tface->uv[2][1];
}
- if (efa->v4 && SIMA_UVSEL_CHECK(efa, tface, 3)) {
+ if (efa->v4 && simaUVSel_Check(efa, tface, 3)) {
uvav = uv_average + efa->v4->tmp.l;
uvav->count++;
uvav->uv[0] += tface->uv[3][0];
@@ -366,23 +366,23 @@ void stitch_vert_uv_tface(void)
// apply uv welding
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)) {
- if (SIMA_UVSEL_CHECK(efa, tface, 0)) {
+ if (simaFaceDraw_Check(efa, tface)) {
+ if (simaUVSel_Check(efa, tface, 0)) {
uvav = uv_average + efa->v1->tmp.l;
tface->uv[0][0] = uvav->uv[0]/uvav->count;
tface->uv[0][1] = uvav->uv[1]/uvav->count;
}
- if (SIMA_UVSEL_CHECK(efa, tface, 1)) {
+ if (simaUVSel_Check(efa, tface, 1)) {
uvav = uv_average + efa->v2->tmp.l;
tface->uv[1][0] = uvav->uv[0]/uvav->count;
tface->uv[1][1] = uvav->uv[1]/uvav->count;
}
- if (SIMA_UVSEL_CHECK(efa, tface, 2)) {
+ if (simaUVSel_Check(efa, tface, 2)) {
uvav = uv_average + efa->v3->tmp.l;
tface->uv[2][0] = uvav->uv[0]/uvav->count;
tface->uv[2][1] = uvav->uv[1]/uvav->count;
}
- if (efa->v4 && SIMA_UVSEL_CHECK(efa, tface, 3)) {
+ if (efa->v4 && simaUVSel_Check(efa, tface, 3)) {
uvav = uv_average + efa->v4->tmp.l;
tface->uv[3][0] = uvav->uv[0]/uvav->count;
tface->uv[3][1] = uvav->uv[1]/uvav->count;
@@ -426,7 +426,7 @@ void select_invert_tface_uv(void)
} else {
for (efa= em->faces.first; efa; efa= efa->next) {
tface = CustomData_em_get(&G.editMesh->fdata, efa->data, CD_MTFACE);
- if (SIMA_FACEDRAW_CHECK(efa, tface)) {
+ if (simaFaceDraw_Check(efa, tface)) {
tface->flag ^= TF_SEL1;
tface->flag ^= TF_SEL2;
tface->flag ^= TF_SEL3;
@@ -455,7 +455,7 @@ void select_swap_tface_uv(void)
for (efa= em->faces.first; efa; efa= efa->next) {
tface = CustomData_em_get(&G.editMesh->fdata, efa->data, CD_MTFACE);
- if (SIMA_FACEDRAW_CHECK(efa, tface)) {
+ if (simaFaceDraw_Check(efa, tface)) {
if(tface->flag & (TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4)) {
sel= 1;
break;
@@ -465,7 +465,7 @@ void select_swap_tface_uv(void)
for (efa= em->faces.first; efa; efa= efa->next) {
tface = CustomData_em_get(&G.editMesh->fdata, efa->data, CD_MTFACE);
- if (SIMA_FACEDRAW_CHECK(efa, tface)) {
+ if (simaFaceDraw_Check(efa, tface)) {
if(efa->v4) {
if(sel) tface->flag &= ~(TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4);
else tface->flag |= (TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4);
@@ -514,7 +514,7 @@ static void find_nearest_tface(MTFace **nearesttf, EditFace **nearestefa)
for (efa= em->faces.first; efa; efa= efa->next) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (SIMA_FACEDRAW_CHECK(efa, tf)) {
+ if (simaFaceDraw_Check(efa, tf)) {
fcenter[0]= fcenter[1]= 0;
nverts= efa->v4? 4: 3;
for(i=0; i<nverts; i++) {
@@ -585,13 +585,13 @@ void find_nearest_uv(MTFace **nearesttf, EditFace **nearestefa, unsigned int *ne
for (efa= em->faces.first; efa; efa= efa->next) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (SIMA_FACEDRAW_CHECK(efa, tf)) {
+ if (simaFaceDraw_Check(efa, tf)) {
nverts= efa->v4? 4: 3;
for(i=0; i<nverts; i++) {
uvco_to_areaco_noclip(tf->uv[i], uval);
dist= abs(mval[0]-uval[0]) + abs(mval[1]-uval[1]);
- if (SIMA_UVSEL_CHECK(efa, tf, i))
+ if (simaUVSel_Check(efa, tf, i))
dist += 5;
if(dist<=mindist) {
@@ -695,24 +695,24 @@ void mouse_select_sima(void)
if(G.qual & LR_SHIFTKEY) {
/* (de)select face */
if(actface) {
- if(SIMA_FACESEL_CHECK(nearestefa, nearesttf)) {
- SIMA_FACESEL_UNSET(nearestefa, nearesttf);
+ if(simaFaceSel_Check(nearestefa, nearesttf)) {
+ simaFaceSel_UnSet(nearestefa, nearesttf);
selectsticky= 0;
}
else {
- SIMA_FACESEL_SET(nearestefa, nearesttf);
+ simaFaceSel_Set(nearestefa, nearesttf);
selectsticky= 1;
}
flush = -1;
}
/* (de)select uv node */
else {
- if (SIMA_UVSEL_CHECK(nearestefa, nearesttf, nearestuv)) {
- SIMA_UVSEL_UNSET(nearestefa, nearesttf, nearestuv);
+ if (simaUVSel_Check(nearestefa, nearesttf, nearestuv)) {
+ simaUVSel_UnSet(nearestefa, nearesttf, nearestuv);
selectsticky= 0;
}
else {
- SIMA_UVSEL_SET(nearestefa, nearesttf, nearestuv);
+ simaUVSel_Set(nearestefa, nearesttf, nearestuv);
selectsticky= 1;
}
flush = 1;
@@ -729,19 +729,19 @@ void mouse_select_sima(void)
if(selectsticky==0) {
for (efa= em->faces.first; efa; efa= efa->next) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (SIMA_FACEDRAW_CHECK(efa, tf)) {
+ if (simaFaceDraw_Check(efa, tf)) {
/*if(nearesttf && tf!=nearesttf) tf->flag &=~ TF_ACTIVE;*/ /* TODO - deal with editmesh active face */
if (!sticky) continue;
if(msel_hit(limit, hitv, efa->v1->tmp.l, hituv, tf->uv[0], sticky))
- SIMA_UVSEL_UNSET(efa, tf, 0);
+ simaUVSel_UnSet(efa, tf, 0);
if(msel_hit(limit, hitv, efa->v2->tmp.l, hituv, tf->uv[1], sticky))
- SIMA_UVSEL_UNSET(efa, tf, 1);
+ simaUVSel_UnSet(efa, tf, 1);
if(msel_hit(limit, hitv, efa->v3->tmp.l, hituv, tf->uv[2], sticky))
- SIMA_UVSEL_UNSET(efa, tf, 2);
+ simaUVSel_UnSet(efa, tf, 2);
if (efa->v4)
if(msel_hit(limit, hitv, efa->v4->tmp.l, hituv, tf->uv[3], sticky))
- SIMA_UVSEL_UNSET(efa, tf, 3);
+ simaUVSel_UnSet(efa, tf, 3);
}
}
flush = -1;
@@ -750,17 +750,17 @@ void mouse_select_sima(void)
else {
for (efa= em->faces.first; efa; efa= efa->next) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (SIMA_FACEDRAW_CHECK(efa, tf)) {
+ if (simaFaceDraw_Check(efa, tf)) {
if (!sticky) continue;
if(msel_hit(limit, hitv, efa->v1->tmp.l, hituv, tf->uv[0], sticky))
- SIMA_UVSEL_SET(efa, tf, 0);
+ simaUVSel_Set(efa, tf, 0);
if(msel_hit(limit, hitv, efa->v2->tmp.l, hituv, tf->uv[1], sticky))
- SIMA_UVSEL_SET(efa, tf, 1);
+ simaUVSel_Set(efa, tf, 1);
if(msel_hit(limit, hitv, efa->v3->tmp.l, hituv, tf->uv[2], sticky))
- SIMA_UVSEL_SET(efa, tf, 2);
+ simaUVSel_Set(efa, tf, 2);
if (efa->v4)
if(msel_hit(limit, hitv, efa->v4->tmp.l, hituv, tf->uv[3], sticky))
- SIMA_UVSEL_SET(efa, tf, 3);
+ simaUVSel_Set(efa, tf, 3);
}
}
EM_set_actFace(nearestefa);
@@ -773,10 +773,10 @@ void mouse_select_sima(void)
if(actface) {
for (efa= em->faces.first; efa; efa= efa->next) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- SIMA_FACESEL_UNSET(efa, tf);
+ simaFaceSel_UnSet(efa, tf);
}
if(nearesttf) {
- SIMA_FACESEL_SET(nearestefa, nearesttf);
+ simaFaceSel_Set(nearestefa, nearesttf);
EM_set_actFace(nearestefa);
}
@@ -785,25 +785,25 @@ void mouse_select_sima(void)
/* deselect uvs, and select sticky uvs */
for (efa= em->faces.first; efa; efa= efa->next) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (SIMA_FACEDRAW_CHECK(efa, tf)) {
- if(!actface) SIMA_FACESEL_UNSET(efa, tf);
+ if (simaFaceDraw_Check(efa, tf)) {
+ if(!actface) simaFaceSel_UnSet(efa, tf);
if(!sticky) continue;
if(msel_hit(limit, hitv, efa->v1->tmp.l, hituv, tf->uv[0], sticky))
- SIMA_UVSEL_SET(efa, tf, 0);
+ simaUVSel_Set(efa, tf, 0);
if(msel_hit(limit, hitv, efa->v2->tmp.l, hituv, tf->uv[1], sticky))
- SIMA_UVSEL_SET(efa, tf, 1);
+ simaUVSel_Set(efa, tf, 1);
if(msel_hit(limit, hitv, efa->v3->tmp.l, hituv, tf->uv[2], sticky))
- SIMA_UVSEL_SET(efa, tf, 2);
+ simaUVSel_Set(efa, tf, 2);
if(efa->v4)
if(msel_hit(limit, hitv, efa->v4->tmp.l, hituv, tf->uv[3], sticky))
- SIMA_UVSEL_SET(efa, tf, 3);
+ simaUVSel_Set(efa, tf, 3);
flush= 1;
}
}
if(!actface) {
- SIMA_UVSEL_SET(nearestefa, nearesttf, nearestuv);
+ simaUVSel_Set(nearestefa, nearesttf, nearestuv);
flush= 1;
}
}
@@ -853,7 +853,7 @@ void borderselect_sima(short whichuvs)
/* assume not touched */
efa->tmp.l = 0;
tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (SIMA_FACEDRAW_CHECK(efa, tface)) {
+ if (simaFaceDraw_Check(efa, tface)) {
tface_center(tface, cent, (void *)efa->v4);
if(BLI_in_rctf(&rectf, cent[0], cent[1])) {
efa->tmp.l = ok = 1;
@@ -866,47 +866,47 @@ void borderselect_sima(short whichuvs)
} else {
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)) {
+ if (simaFaceDraw_Check(efa, tface)) {
if (whichuvs == UV_SELECT_ALL || (G.sima->flag & SI_SYNC_UVSEL) ) {
/* SI_SYNC_UVSEL - cant do pinned selection */
if(BLI_in_rctf(&rectf, tface->uv[0][0], tface->uv[0][1])) {
- if(select) SIMA_UVSEL_SET(efa, tface, 0);
- else SIMA_UVSEL_UNSET(efa, tface, 0);
+ if(select) simaUVSel_Set(efa, tface, 0);
+ else simaUVSel_UnSet(efa, tface, 0);
}
if(BLI_in_rctf(&rectf, tface->uv[1][0], tface->uv[1][1])) {
- if(select) SIMA_UVSEL_SET(efa, tface, 1);
- else SIMA_UVSEL_UNSET(efa, tface, 1);
+ if(select) simaUVSel_Set(efa, tface, 1);
+ else simaUVSel_UnSet(efa, tface, 1);
}
if(BLI_in_rctf(&rectf, tface->uv[2][0], tface->uv[2][1])) {
- if(select) SIMA_UVSEL_SET(efa, tface, 2);
- else SIMA_UVSEL_UNSET(efa, tface, 2);
+ if(select) simaUVSel_Set(efa, tface, 2);
+ else simaUVSel_UnSet(efa, tface, 2);
}
if(efa->v4 && BLI_in_rctf(&rectf, tface->uv[3][0], tface->uv[3][1])) {
- if(select) SIMA_UVSEL_SET(efa, tface, 3);
- else SIMA_UVSEL_UNSET(efa, tface, 3);
+ if(select) simaUVSel_Set(efa, tface, 3);
+ else simaUVSel_UnSet(efa, tface, 3);
}
} else if (whichuvs == UV_SELECT_PINNED) {
if ((tface->unwrap & TF_PIN1) &&
BLI_in_rctf(&rectf, tface->uv[0][0], tface->uv[0][1])) {
- if(select) SIMA_UVSEL_SET(efa, tface, 0);
- else SIMA_UVSEL_UNSET(efa, tface, 0);
+ if(select) simaUVSel_Set(efa, tface, 0);
+ else simaUVSel_UnSet(efa, tface, 0);
}
if ((tface->unwrap & TF_PIN2) &&
BLI_in_rctf(&rectf, tface->uv[1][0], tface->uv[1][1])) {
- if(select) SIMA_UVSEL_SET(efa, tface, 1);
- else SIMA_UVSEL_UNSET(efa, tface, 1);
+ if(select) simaUVSel_Set(efa, tface, 1);
+ else simaUVSel_UnSet(efa, tface, 1);
}
if ((tface->unwrap & TF_PIN3) &&
BLI_in_rctf(&rectf, tface->uv[2][0], tface->uv[2][1])) {
- if(select) SIMA_UVSEL_SET(efa, tface, 2);
- else SIMA_UVSEL_UNSET(efa, tface, 2);
+ if(select) simaUVSel_Set(efa, tface, 2);
+ else simaUVSel_UnSet(efa, tface, 2);
}
if ((efa->v4) && (tface->unwrap & TF_PIN4) && BLI_in_rctf(&rectf, tface->uv[3][0], tface->uv[3][1])) {
- if(select) SIMA_UVSEL_SET(efa, tface, 3);
- else SIMA_UVSEL_UNSET(efa, tface, 3);
+ if(select) simaUVSel_Set(efa, tface, 3);
+ else simaUVSel_UnSet(efa, tface, 3);
}
}
}
@@ -937,12 +937,12 @@ int snap_uv_sel_to_curs(void)
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)) {
- if (SIMA_UVSEL_CHECK(efa, tface, 0)) VECCOPY2D(tface->uv[0], G.v2d->cursor);
- if (SIMA_UVSEL_CHECK(efa, tface, 1)) VECCOPY2D(tface->uv[1], G.v2d->cursor);
- if (SIMA_UVSEL_CHECK(efa, tface, 2)) VECCOPY2D(tface->uv[2], G.v2d->cursor);
+ if (simaFaceDraw_Check(efa, tface)) {
+ if (simaUVSel_Check(efa, tface, 0)) VECCOPY2D(tface->uv[0], G.v2d->cursor);
+ if (simaUVSel_Check(efa, tface, 1)) VECCOPY2D(tface->uv[1], G.v2d->cursor);
+ if (simaUVSel_Check(efa, tface, 2)) VECCOPY2D(tface->uv[2], G.v2d->cursor);
if (efa->v4)
- if (SIMA_UVSEL_CHECK(efa, tface, 3)) VECCOPY2D(tface->uv[3], G.v2d->cursor);
+ if (simaUVSel_Check(efa, tface, 3)) VECCOPY2D(tface->uv[3], G.v2d->cursor);
change = 1;
}
}
@@ -968,12 +968,12 @@ int snap_uv_sel_to_adj_unsel(void)
* get unique indicies and to count how much to malloc */
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)) {
- if (SIMA_UVSEL_CHECK(efa, tface, 0) && efa->v1->tmp.l==-1) efa->v1->tmp.l= count++;
- if (SIMA_UVSEL_CHECK(efa, tface, 1) && efa->v2->tmp.l==-1) efa->v2->tmp.l= count++;
- if (SIMA_UVSEL_CHECK(efa, tface, 2) && efa->v3->tmp.l==-1) efa->v3->tmp.l= count++;
+ if (simaFaceDraw_Check(efa, tface)) {
+ if (simaUVSel_Check(efa, tface, 0) && efa->v1->tmp.l==-1) efa->v1->tmp.l= count++;
+ if (simaUVSel_Check(efa, tface, 1) && efa->v2->tmp.l==-1) efa->v2->tmp.l= count++;
+ if (simaUVSel_Check(efa, tface, 2) && efa->v3->tmp.l==-1) efa->v3->tmp.l= count++;
if (efa->v4)
- if (SIMA_UVSEL_CHECK(efa, tface, 3) && efa->v4->tmp.l==-1) efa->v4->tmp.l= count++;
+ if (simaUVSel_Check(efa, tface, 3) && efa->v4->tmp.l==-1) efa->v4->tmp.l= count++;
change = 1;
/* optional speedup */
@@ -989,23 +989,23 @@ int snap_uv_sel_to_adj_unsel(void)
/* add all UV coords from visible, unselected UV coords as well as counting them to average later */
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)) {
+// if (simaFaceDraw_Check(efa, tface)) {
if ((tface=(MTFace *)efa->tmp.p)) {
/* is this an unselected UV we can snap to? */
- if (efa->v1->tmp.l >= 0 && (!SIMA_UVSEL_CHECK(efa, tface, 0))) {
+ if (efa->v1->tmp.l >= 0 && (!simaUVSel_Check(efa, tface, 0))) {
coords[efa->v1->tmp.l*2] += tface->uv[0][0];
coords[(efa->v1->tmp.l*2)+1] += tface->uv[0][1];
usercount[efa->v1->tmp.l]++;
change = 1;
}
- if (efa->v2->tmp.l >= 0 && (!SIMA_UVSEL_CHECK(efa, tface, 1))) {
+ if (efa->v2->tmp.l >= 0 && (!simaUVSel_Check(efa, tface, 1))) {
coords[efa->v2->tmp.l*2] += tface->uv[1][0];
coords[(efa->v2->tmp.l*2)+1] += tface->uv[1][1];
usercount[efa->v2->tmp.l]++;
change = 1;
}
- if (efa->v3->tmp.l >= 0 && (!SIMA_UVSEL_CHECK(efa, tface, 2))) {
+ if (efa->v3->tmp.l >= 0 && (!simaUVSel_Check(efa, tface, 2))) {
coords[efa->v3->tmp.l*2] += tface->uv[2][0];
coords[(efa->v3->tmp.l*2)+1] += tface->uv[2][1];
usercount[efa->v3->tmp.l]++;
@@ -1013,7 +1013,7 @@ int snap_uv_sel_to_adj_unsel(void)
}
if (efa->v4) {
- if (efa->v4->tmp.l >= 0 && (!SIMA_UVSEL_CHECK(efa, tface, 3))) {
+ if (efa->v4->tmp.l >= 0 && (!simaUVSel_Check(efa, tface, 3))) {
coords[efa->v4->tmp.l*2] += tface->uv[3][0];
coords[(efa->v4->tmp.l*2)+1] += tface->uv[3][1];
usercount[efa->v4->tmp.l]++;
@@ -1033,10 +1033,10 @@ int snap_uv_sel_to_adj_unsel(void)
/* copy the averaged unselected UVs back to the selected UVs */
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)) {
+// if (simaFaceDraw_Check(efa, tface)) {
if ((tface=(MTFace *)efa->tmp.p)) {
- if ( SIMA_UVSEL_CHECK(efa, tface, 0) &&
+ if ( simaUVSel_Check(efa, tface, 0) &&
efa->v1->tmp.l >= 0 &&
(users = usercount[efa->v1->tmp.l])
) {
@@ -1044,7 +1044,7 @@ int snap_uv_sel_to_adj_unsel(void)
tface->uv[0][1] = coords[(efa->v1->tmp.l*2)+1] / users;
}
- if ( SIMA_UVSEL_CHECK(efa, tface, 1) &&
+ if ( simaUVSel_Check(efa, tface, 1) &&
efa->v2->tmp.l >= 0 &&
(users = usercount[efa->v2->tmp.l])
) {
@@ -1052,7 +1052,7 @@ int snap_uv_sel_to_adj_unsel(void)
tface->uv[1][1] = coords[(efa->v2->tmp.l*2)+1] / users;
}
- if ( SIMA_UVSEL_CHECK(efa, tface, 2) &&
+ if ( simaUVSel_Check(efa, tface, 2) &&
efa->v3->tmp.l >= 0 &&
(users = usercount[efa->v3->tmp.l])
) {
@@ -1061,7 +1061,7 @@ int snap_uv_sel_to_adj_unsel(void)
}
if (efa->v4) {
- if ( SIMA_UVSEL_CHECK(efa, tface, 3) &&
+ if ( simaUVSel_Check(efa, tface, 3) &&
efa->v4->tmp.l >= 0 &&
(users = usercount[efa->v4->tmp.l])
) {
@@ -1098,12 +1098,12 @@ int snap_uv_sel_to_pixels(void) /* warning, sanity checks must alredy be done */
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)) {
- if (SIMA_UVSEL_CHECK(efa, tface, 0)) snap_coord_to_pixel(tface->uv[0], w, h);
- if (SIMA_UVSEL_CHECK(efa, tface, 1)) snap_coord_to_pixel(tface->uv[1], w, h);
- if (SIMA_UVSEL_CHECK(efa, tface, 2)) snap_coord_to_pixel(tface->uv[2], w, h);
+ if (simaFaceDraw_Check(efa, tface)) {
+ if (simaUVSel_Check(efa, tface, 0)) snap_coord_to_pixel(tface->uv[0], w, h);
+ if (simaUVSel_Check(efa, tface, 1)) snap_coord_to_pixel(tface->uv[1], w, h);
+ if (simaUVSel_Check(efa, tface, 2)) snap_coord_to_pixel(tface->uv[2], w, h);
if (efa->v4)
- if (SIMA_UVSEL_CHECK(efa, tface, 3)) snap_coord_to_pixel(tface->uv[3], w, h);
+ if (simaUVSel_Check(efa, tface, 3)) snap_coord_to_pixel(tface->uv[3], w, h);
change = 1;
}
}
@@ -1184,8 +1184,8 @@ void sel_uvco_inside_radius(short sel, EditFace *efa, MTFace *tface, int index,
r2 = x * x + y * y;
if (r2 < 1.0) {
- if (sel == LEFTMOUSE) SIMA_UVSEL_SET(efa, tface, select_index);
- else SIMA_UVSEL_UNSET(efa, tface, select_index);
+ if (sel == LEFTMOUSE) simaUVSel_Set(efa, tface, select_index);
+ else simaUVSel_UnSet(efa, tface, select_index);
}
}
@@ -1435,7 +1435,7 @@ void select_linked_tface_uv(int mode) /* TODO */
if (mode == 2) {
for (a=0, efa= em->faces.first; efa; efa= efa->next, a++) {
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (SIMA_FACEDRAW_CHECK(efa, tf)) {
+ if (simaFaceDraw_Check(efa, tf)) {
if(tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4)) {
stack[stacksize]= a;
stacksize++;
@@ -1556,7 +1556,7 @@ void unlink_selection(void)
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)) {
+ if (simaFaceDraw_Check(efa, tface)) {
if(efa->v4) {
if(~tface->flag & (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4))
tface->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
@@ -1624,9 +1624,9 @@ void uvface_setsel__internal(short select)
for(i=0; i<nverts; i++) {
if ((*(&efa->v1 + i))->tmp.l) {
if (select) {
- SIMA_UVSEL_SET(efa, tf, i);
+ simaUVSel_Set(efa, tf, i);
} else {
- SIMA_UVSEL_UNSET(efa, tf, i);
+ simaUVSel_UnSet(efa, tf, i);
}
}
}
@@ -1659,9 +1659,9 @@ void uvface_setsel__internal(short select)
nverts= efa->v4? 4: 3;
for(i=0; i<nverts; i++) {
if (select) {
- SIMA_UVSEL_SET(efa, tf, i);
+ simaUVSel_Set(efa, tf, i);
} else {
- SIMA_UVSEL_UNSET(efa, tf, i);
+ simaUVSel_UnSet(efa, tf, i);
}
vlist= vlist_iter= get_uv_map_vert_EM(vmap, (*(&efa->v1 + i))->tmp.l);
@@ -1687,9 +1687,9 @@ void uvface_setsel__internal(short select)
tf_vlist = CustomData_em_get(&em->fdata, efa_vlist->data, CD_MTFACE);
if (select) {
- SIMA_UVSEL_SET(efa_vlist, tf_vlist, vlist_iter->tfindex);
+ simaUVSel_Set(efa_vlist, tf_vlist, vlist_iter->tfindex);
} else {
- SIMA_UVSEL_UNSET(efa_vlist, tf_vlist, vlist_iter->tfindex);
+ simaUVSel_UnSet(efa_vlist, tf_vlist, vlist_iter->tfindex);
}
}
vlist_iter = vlist_iter->next;
@@ -1705,9 +1705,9 @@ void uvface_setsel__internal(short select)
if (efa->tmp.l) {
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if (select) {
- SIMA_FACESEL_SET(efa, tf);
+ simaFaceSel_Set(efa, tf);
} else {
- SIMA_FACESEL_UNSET(efa, tf);
+ simaFaceSel_UnSet(efa, tf);
}
}
}
@@ -1724,20 +1724,20 @@ void pin_tface_uv(int mode)
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)) {
+ if (simaFaceDraw_Check(efa, tface)) {
if(mode ==1) {
- if(SIMA_UVSEL_CHECK(efa, tface, 0)) tface->unwrap |= TF_PIN1;
- if(SIMA_UVSEL_CHECK(efa, tface, 1)) tface->unwrap |= TF_PIN2;
- if(SIMA_UVSEL_CHECK(efa, tface, 2)) tface->unwrap |= TF_PIN3;
+ if(simaUVSel_Check(efa, tface, 0)) tface->unwrap |= TF_PIN1;
+ if(simaUVSel_Check(efa, tface, 1)) tface->unwrap |= TF_PIN2;
+ if(simaUVSel_Check(efa, tface, 2)) tface->unwrap |= TF_PIN3;
if(efa->v4)
- if(SIMA_UVSEL_CHECK(efa, tface, 3)) tface->unwrap |= TF_PIN4;
+ if(simaUVSel_Check(efa, tface, 3)) tface->unwrap |= TF_PIN4;
}
else if (mode ==0) {
- if(SIMA_UVSEL_CHECK(efa, tface, 0)) tface->unwrap &= ~TF_PIN1;
- if(SIMA_UVSEL_CHECK(efa, tface, 1)) tface->unwrap &= ~TF_PIN2;
- if(SIMA_UVSEL_CHECK(efa, tface, 2)) tface->unwrap &= ~TF_PIN3;
+ if(simaUVSel_Check(efa, tface, 0)) tface->unwrap &= ~TF_PIN1;
+ if(simaUVSel_Check(efa, tface, 1)) tface->unwrap &= ~TF_PIN2;
+ if(simaUVSel_Check(efa, tface, 2)) tface->unwrap &= ~TF_PIN3;
if(efa->v4)
- if(SIMA_UVSEL_CHECK(efa, tface, 3)) tface->unwrap &= ~TF_PIN4;
+ if(simaUVSel_Check(efa, tface, 3)) tface->unwrap &= ~TF_PIN4;
}
}
}
@@ -1756,12 +1756,12 @@ void select_pinned_tface_uv(void)
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)) {
- if (tface->unwrap & TF_PIN1) SIMA_UVSEL_SET(efa, tface, 0);
- if (tface->unwrap & TF_PIN2) SIMA_UVSEL_SET(efa, tface, 1);
- if (tface->unwrap & TF_PIN3) SIMA_UVSEL_SET(efa, tface, 2);
+ if (simaFaceDraw_Check(efa, tface)) {
+ if (tface->unwrap & TF_PIN1) simaUVSel_Set(efa, tface, 0);
+ if (tface->unwrap & TF_PIN2) simaUVSel_Set(efa, tface, 1);
+ if (tface->unwrap & TF_PIN3) simaUVSel_Set(efa, tface, 2);
if(efa->v4) {
- if (tface->unwrap & TF_PIN4) SIMA_UVSEL_SET(efa, tface, 3);
+ if (tface->unwrap & TF_PIN4) simaUVSel_Set(efa, tface, 3);
}
}
@@ -1789,11 +1789,11 @@ int minmax_tface_uv(float *min, float *max)
sel= 0;
for (efa= em->faces.first; efa; efa= efa->next) {
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (SIMA_FACEDRAW_CHECK(efa, tf)) {
- if (SIMA_UVSEL_CHECK(efa, tf, 0)) DO_MINMAX2(tf->uv[0], min, max);
- if (SIMA_UVSEL_CHECK(efa, tf, 1)) DO_MINMAX2(tf->uv[1], min, max);
- if (SIMA_UVSEL_CHECK(efa, tf, 2)) DO_MINMAX2(tf->uv[2], min, max);
- if (efa->v4 && (SIMA_UVSEL_CHECK(efa, tf, 3))) DO_MINMAX2(tf->uv[3], min, max);
+ if (simaFaceDraw_Check(efa, tf)) {
+ if (simaUVSel_Check(efa, tf, 0)) DO_MINMAX2(tf->uv[0], min, max);
+ if (simaUVSel_Check(efa, tf, 1)) DO_MINMAX2(tf->uv[1], min, max);
+ if (simaUVSel_Check(efa, tf, 2)) DO_MINMAX2(tf->uv[2], min, max);
+ if (efa->v4 && (simaUVSel_Check(efa, tf, 3))) DO_MINMAX2(tf->uv[3], min, max);
sel = 1;
}
}
@@ -1816,11 +1816,11 @@ int cent_tface_uv(float *cent, int mode)
for (efa= G.editMesh->faces.first; efa; efa= efa->next) {
tf = CustomData_em_get(&G.editMesh->fdata, efa->data, CD_MTFACE);
- if (SIMA_FACEDRAW_CHECK(efa, tf)) {
- if (SIMA_UVSEL_CHECK(efa, tf, 0)) { DO_MINMAX2(tf->uv[0], min, max); change= 1;}
- if (SIMA_UVSEL_CHECK(efa, tf, 1)) { DO_MINMAX2(tf->uv[1], min, max); change= 1;}
- if (SIMA_UVSEL_CHECK(efa, tf, 2)) { DO_MINMAX2(tf->uv[2], min, max); change= 1;}
- if (efa->v4 && (SIMA_UVSEL_CHECK(efa, tf, 3))) { DO_MINMAX2(tf->uv[3], min, max); change= 1;}
+ if (simaFaceDraw_Check(efa, tf)) {
+ if (simaUVSel_Check(efa, tf, 0)) { DO_MINMAX2(tf->uv[0], min, max); change= 1;}
+ if (simaUVSel_Check(efa, tf, 1)) { DO_MINMAX2(tf->uv[1], min, max); change= 1;}
+ if (simaUVSel_Check(efa, tf, 2)) { DO_MINMAX2(tf->uv[2], min, max); change= 1;}
+ if (efa->v4 && (simaUVSel_Check(efa, tf, 3))) { DO_MINMAX2(tf->uv[3], min, max); change= 1;}
}
}
}
@@ -2341,3 +2341,96 @@ void aspect_sima(SpaceImage *sima, float *x, float *y)
/* x is always 1 */
*y = sima->image->aspy / sima->image->aspx;
}
+
+
+/* Face selection tests - Keep these together */
+
+/* this checks weather a face is drarn without the local image check */
+int simaFaceDraw_Check_nolocal( EditFace *efa )
+{
+ if (G.sima && G.sima->flag & SI_SYNC_UVSEL) {
+ return (efa->h==0);
+ } else {
+ return (efa->h==0 && efa->f & SELECT);
+ }
+ return 0;
+}
+
+int simaFaceDraw_Check( EditFace *efa, MTFace *tf )
+{
+ if (G.sima && G.sima->flag & SI_LOCAL_UV) {
+ if (tf->tpage==G.sima->image) {
+ return simaFaceDraw_Check_nolocal(efa);
+ } else {
+ return 0;
+ }
+ } else {
+ return simaFaceDraw_Check_nolocal(efa);
+ }
+}
+
+int simaFaceSel_Check( struct EditFace *efa, struct MTFace *tf )
+{
+ if (G.sima && G.sima->flag & SI_SYNC_UVSEL) {
+ return (efa->f & SELECT);
+ } else {
+ return (!(~tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3)) &&(!efa->v4 || tf->flag & TF_SEL4));
+ }
+}
+
+void simaFaceSel_Set( struct EditFace *efa, struct MTFace *tf )
+{
+ if (G.sima && G.sima->flag & SI_SYNC_UVSEL) {
+ EM_select_face(efa, 1);
+ } else {
+ tf->flag |= (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
+ }
+}
+
+void simaFaceSel_UnSet( struct EditFace *efa, struct MTFace *tf )
+{
+ if (G.sima && G.sima->flag & SI_SYNC_UVSEL) {
+ EM_select_face(efa, 0);
+ } else {
+ tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
+ }
+}
+
+int simaUVSel_Check( struct EditFace *efa, struct MTFace *tf, int i)
+{
+ if (G.sima && G.sima->flag & SI_SYNC_UVSEL) {
+ if (G.scene->selectmode == SCE_SELECT_FACE) {
+ return efa->f & SELECT;
+ } else {
+ return (*(&efa->v1 + i))->f & SELECT;
+ }
+ } else {
+ return tf->flag & TF_SEL_MASK(i);
+ }
+}
+
+void simaUVSel_Set( struct EditFace *efa, struct MTFace *tf, int i)
+{
+ if (G.sima && G.sima->flag & SI_SYNC_UVSEL) {
+ if (G.scene->selectmode == SCE_SELECT_FACE) {
+ EM_select_face(efa, 1);
+ } else {
+ (*(&efa->v1 + i))->f |= SELECT;
+ }
+ } else {
+ tf->flag |= TF_SEL_MASK(i);
+ }
+}
+
+void simaUVSel_UnSet( struct EditFace *efa, struct MTFace *tf, int i)
+{
+ if (G.sima && G.sima->flag & SI_SYNC_UVSEL) {
+ if (G.scene->selectmode == SCE_SELECT_FACE) {
+ EM_select_face(efa, 0);
+ } else {
+ (*(&efa->v1 + i))->f &= ~SELECT;
+ }
+ } else {
+ tf->flag &= ~TF_SEL_MASK(i);
+ }
+}
diff --git a/source/blender/src/editview.c b/source/blender/src/editview.c
index a11ef953c22..5a141bcfcf5 100644
--- a/source/blender/src/editview.c
+++ b/source/blender/src/editview.c
@@ -487,7 +487,7 @@ static void do_lasso_select_mesh_uv(short mcords[][2], short moves, short select
/* assume not touched */
efa->tmp.l = 0;
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if ((select) != (SIMA_FACESEL_CHECK(efa, tf))) {
+ if ((select) != (simaFaceSel_Check(efa, tf))) {
tface_center(tf, cent, (void *)efa->v4);
uvco_to_areaco_noclip(cent, screenUV);
if (BLI_in_rcti(&rect, screenUV[0], screenUV[1]) && lasso_inside(mcords, moves, screenUV[0], screenUV[1])) {
@@ -502,16 +502,16 @@ static void do_lasso_select_mesh_uv(short mcords[][2], short moves, short select
} else { /* Vert Sel*/
for (efa= em->faces.first; efa; efa= efa->next) {
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (SIMA_FACEDRAW_CHECK(efa, tf)) {
+ if (simaFaceDraw_Check(efa, tf)) {
nverts= efa->v4? 4: 3;
for(i=0; i<nverts; i++) {
- if ((select) != (SIMA_UVSEL_CHECK(efa, tf, i))) {
+ if ((select) != (simaUVSel_Check(efa, tf, i))) {
uvco_to_areaco_noclip(tf->uv[i], screenUV);
if (BLI_in_rcti(&rect, screenUV[0], screenUV[1]) && lasso_inside(mcords, moves, screenUV[0], screenUV[1])) {
if (select) {
- SIMA_UVSEL_SET(efa, tf, i);
+ simaUVSel_Set(efa, tf, i);
} else {
- SIMA_UVSEL_UNSET(efa, tf, i);
+ simaUVSel_UnSet(efa, tf, i);
}
}
}
diff --git a/source/blender/src/transform_conversions.c b/source/blender/src/transform_conversions.c
index fd2e089e169..879577927ae 100644
--- a/source/blender/src/transform_conversions.c
+++ b/source/blender/src/transform_conversions.c
@@ -1901,11 +1901,11 @@ static void createTransUVs(TransInfo *t)
/* count */
for (efa= em->faces.first; efa; efa= efa->next) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if SIMA_FACEDRAW_CHECK(efa, tf) {
- if (SIMA_UVSEL_CHECK(efa, tf, 0)) countsel++;
- if (SIMA_UVSEL_CHECK(efa, tf, 1)) countsel++;
- if (SIMA_UVSEL_CHECK(efa, tf, 2)) countsel++;
- if (efa->v4 && SIMA_UVSEL_CHECK(efa, tf, 3)) countsel++;
+ if (simaFaceDraw_Check(efa, tf)) {
+ if (simaUVSel_Check(efa, tf, 0)) countsel++;
+ if (simaUVSel_Check(efa, tf, 1)) countsel++;
+ if (simaUVSel_Check(efa, tf, 2)) countsel++;
+ if (efa->v4 && simaUVSel_Check(efa, tf, 3)) countsel++;
if(propmode)
count += (efa->v4)? 4: 3;
}
@@ -1927,16 +1927,16 @@ static void createTransUVs(TransInfo *t)
td2d= t->data2d;
for (efa= em->faces.first; efa; efa= efa->next) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if SIMA_FACEDRAW_CHECK(efa, tf) {
- if(propmode || SIMA_UVSEL_CHECK(efa, tf, 0))
- UVsToTransData(td++, td2d++, tf->uv[0], SIMA_UVSEL_CHECK(efa, tf, 0));
- if(propmode || SIMA_UVSEL_CHECK(efa, tf, 1))
- UVsToTransData(td++, td2d++, tf->uv[1], SIMA_UVSEL_CHECK(efa, tf, 1));
- if(propmode || SIMA_UVSEL_CHECK(efa, tf, 2))
- UVsToTransData(td++, td2d++, tf->uv[2], SIMA_UVSEL_CHECK(efa, tf, 2));
-
- if(efa->v4 && (propmode || SIMA_UVSEL_CHECK(efa, tf, 3)))
- UVsToTransData(td++, td2d++, tf->uv[3], SIMA_UVSEL_CHECK(efa, tf, 3));
+ if (simaFaceDraw_Check(efa, tf)) {
+ if(propmode || simaUVSel_Check(efa, tf, 0))
+ UVsToTransData(td++, td2d++, tf->uv[0], simaUVSel_Check(efa, tf, 0));
+ if(propmode || simaUVSel_Check(efa, tf, 1))
+ UVsToTransData(td++, td2d++, tf->uv[1], simaUVSel_Check(efa, tf, 1));
+ if(propmode || simaUVSel_Check(efa, tf, 2))
+ UVsToTransData(td++, td2d++, tf->uv[2], simaUVSel_Check(efa, tf, 2));
+
+ if(efa->v4 && (propmode || simaUVSel_Check(efa, tf, 3)))
+ UVsToTransData(td++, td2d++, tf->uv[3], simaUVSel_Check(efa, tf, 3));
}
}
diff --git a/source/blender/src/unwrapper.c b/source/blender/src/unwrapper.c
index bca7e44ed72..5cf5f3dc70b 100644
--- a/source/blender/src/unwrapper.c
+++ b/source/blender/src/unwrapper.c
@@ -221,10 +221,10 @@ ParamHandle *construct_param_handle(EditMesh *em, short implicit, short fill, sh
tf= (MTFace *)CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if (implicit &&
- !( SIMA_UVSEL_CHECK(efa, tf, 0) ||
- SIMA_UVSEL_CHECK(efa, tf, 1) ||
- SIMA_UVSEL_CHECK(efa, tf, 2) ||
- (efa->v4 && SIMA_UVSEL_CHECK(efa, tf, 3)) )
+ !( simaUVSel_Check(efa, tf, 0) ||
+ simaUVSel_Check(efa, tf, 1) ||
+ simaUVSel_Check(efa, tf, 2) ||
+ (efa->v4 && simaUVSel_Check(efa, tf, 3)) )
) {
continue;
}
@@ -246,16 +246,16 @@ ParamHandle *construct_param_handle(EditMesh *em, short implicit, short fill, sh
pin[1] = ((tf->unwrap & TF_PIN2) != 0);
pin[2] = ((tf->unwrap & TF_PIN3) != 0);
- select[0] = ((SIMA_UVSEL_CHECK(efa, tf, 0)) != 0);
- select[1] = ((SIMA_UVSEL_CHECK(efa, tf, 1)) != 0);
- select[2] = ((SIMA_UVSEL_CHECK(efa, tf, 2)) != 0);
+ select[0] = ((simaUVSel_Check(efa, tf, 0)) != 0);
+ select[1] = ((simaUVSel_Check(efa, tf, 1)) != 0);
+ select[2] = ((simaUVSel_Check(efa, tf, 2)) != 0);
if (efa->v4) {
vkeys[3] = (ParamKey)efa->v4->tmp.l;
co[3] = efa->v4->co;
uv[3] = tf->uv[3];
pin[3] = ((tf->unwrap & TF_PIN4) != 0);
- select[3] = (SIMA_UVSEL_CHECK(efa, tf, 3) != 0);
+ select[3] = (simaUVSel_Check(efa, tf, 3) != 0);
nverts = 4;
}
else
@@ -304,7 +304,7 @@ void unwrap_lscm(short seamcut)
MTFace *tf;
for(efa=em->faces.first; efa; efa=efa->next) {
tf= (MTFace *)CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- SIMA_FACESEL_SET(efa, tf);
+ simaFaceSel_Set(efa, tf);
}
}
}