[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12112] trunk/blender/source/blender/src/ editview.c: added lasso selection for UV coords
Campbell Barton
cbarton at metavr.com
Sun Sep 23 15:00:36 CEST 2007
Revision: 12112
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12112
Author: campbellbarton
Date: 2007-09-23 15:00:35 +0200 (Sun, 23 Sep 2007)
Log Message:
-----------
added lasso selection for UV coords
Modified Paths:
--------------
trunk/blender/source/blender/src/editview.c
Modified: trunk/blender/source/blender/src/editview.c
===================================================================
--- trunk/blender/source/blender/src/editview.c 2007-09-23 10:38:09 UTC (rev 12111)
+++ trunk/blender/source/blender/src/editview.c 2007-09-23 13:00:35 UTC (rev 12112)
@@ -76,6 +76,7 @@
#include "BKE_utildefines.h"
#include "BKE_customdata.h"
+#include "BIF_drawimage.h"
#include "BIF_butspace.h"
#include "BIF_editaction.h"
#include "BIF_editarmature.h"
@@ -468,6 +469,42 @@
EM_selectmode_flush();
}
+/* this is an exception in that its the only lasso that dosnt use the 3d view (uses space image view) */
+static void do_lasso_select_mesh_uv(short mcords[][2], short moves, short select)
+{
+ EditMesh *em = G.editMesh;
+ EditFace *efa;
+ MTFace *tf;
+ int screenUV[2], nverts, i;
+ rcti rect;
+
+ lasso_select_boundbox(&rect, mcords, moves);
+
+ 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)) {
+ nverts= efa->v4? 4: 3;
+ for(i=0; i<nverts; i++) {
+ if ((select) != (SIMA_UVSEL_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);
+ } else {
+ SIMA_UVSEL_UNSET(efa, tf, i);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (G.sima->flag & SI_SYNC_UVSEL) {
+ if (select) EM_select_flush();
+ else EM_deselect_flush();
+ }
+}
+
static void do_lasso_select_curve__doSelect(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y)
{
struct { short (*mcords)[2]; short moves; short select; } *data = userData;
@@ -582,9 +619,13 @@
else
do_lasso_select_objects(mcords, moves, select);
}
- else if(G.obedit->type==OB_MESH)
- do_lasso_select_mesh(mcords, moves, select);
- else if(G.obedit->type==OB_CURVE || G.obedit->type==OB_SURF)
+ else if(G.obedit->type==OB_MESH) {
+ if(curarea->spacetype==SPACE_VIEW3D) {
+ do_lasso_select_mesh(mcords, moves, select);
+ } else if (EM_texFaceCheck()){
+ do_lasso_select_mesh_uv(mcords, moves, select);
+ }
+ } else if(G.obedit->type==OB_CURVE || G.obedit->type==OB_SURF)
do_lasso_select_curve(mcords, moves, select);
else if(G.obedit->type==OB_LATTICE)
do_lasso_select_lattice(mcords, moves, select);
@@ -752,6 +793,10 @@
if(G.f & (G_VERTEXPAINT|G_TEXTUREPAINT|G_WEIGHTPAINT)) return 0;
}
lasso= 1;
+ } else if (curarea->spacetype==SPACE_IMAGE) {
+ if(G.obedit) {
+ lasso= 1;
+ }
}
}
More information about the Bf-blender-cvs
mailing list