[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46005] trunk/blender/source/blender/ editors/uvedit/uvedit_ops.c: fix for select flushing in UV-sync-selection mode (regression from 2.62), both border select and circle select failed in edge and vertex mode ( though de-selecting worked ok).
Campbell Barton
ideasman42 at gmail.com
Fri Apr 27 14:44:32 CEST 2012
Revision: 46005
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46005
Author: campbellbarton
Date: 2012-04-27 12:44:32 +0000 (Fri, 27 Apr 2012)
Log Message:
-----------
fix for select flushing in UV-sync-selection mode (regression from 2.62), both border select and circle select failed in edge and vertex mode (though de-selecting worked ok).
Modified Paths:
--------------
trunk/blender/source/blender/editors/uvedit/uvedit_ops.c
Modified: trunk/blender/source/blender/editors/uvedit/uvedit_ops.c
===================================================================
--- trunk/blender/source/blender/editors/uvedit/uvedit_ops.c 2012-04-27 11:49:09 UTC (rev 46004)
+++ trunk/blender/source/blender/editors/uvedit/uvedit_ops.c 2012-04-27 12:44:32 UTC (rev 46005)
@@ -2261,6 +2261,25 @@
ot->poll = ED_operator_uvedit;
}
+static void uv_select_sync_flush(ToolSettings *ts, BMEditMesh *em, const short select)
+{
+ /* bmesh API handles flushing but not on de-select */
+ if (ts->uv_flag & UV_SYNC_SELECTION) {
+ if (ts->selectmode != SCE_SELECT_FACE) {
+ if (select == FALSE) {
+ EDBM_deselect_flush(em);
+ }
+ else {
+ EDBM_select_flush(em);
+ }
+ }
+
+ if (select == FALSE) {
+ BM_select_history_validate(em->bm);
+ }
+ }
+}
+
/* ******************** border select operator **************** */
/* This function sets the selection on tagged faces, need because settings the
@@ -2491,21 +2510,8 @@
}
if (change) {
- /* bmesh API habdles flushing but not on de-select */
- if (ts->uv_flag & UV_SYNC_SELECTION) {
- if (ts->selectmode != SCE_SELECT_FACE) {
- if (select == FALSE) {
- EDBM_deselect_flush(em);
- }
- }
- }
+ uv_select_sync_flush(ts, em, select);
- if (ts->uv_flag & UV_SYNC_SELECTION) {
- if (select == FALSE) {
- BM_select_history_validate(em->bm);
- }
- }
-
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
return OPERATOR_FINISHED;
@@ -2539,13 +2545,12 @@
/* ******************** circle select operator **************** */
-static void select_uv_inside_ellipse(BMEditMesh *em, SpaceImage *UNUSED(sima), Scene *scene, int select,
- float *offset, float *ell, BMLoop *l, MLoopUV *luv)
+static int select_uv_inside_ellipse(BMEditMesh *em, SpaceImage *UNUSED(sima), Scene *scene, int select,
+ float *offset, float *ell, BMLoop *l, MLoopUV *luv)
{
/* normalized ellipse: ell[0] = scaleX, ell[1] = scaleY */
float x, y, r2, *uv;
-
-
+
uv = luv->uv;
x = (uv[0] - offset[0]) * ell[0];
@@ -2554,8 +2559,12 @@
r2 = x * x + y * y;
if (r2 < 1.0f) {
if (select) uvedit_uv_select_enable(em, scene, l, FALSE);
- else uvedit_uv_select_disable(em, scene, l);
+ else uvedit_uv_select_disable(em, scene, l);
+ return TRUE;
}
+ else {
+ return FALSE;
+ }
}
static int circle_select_exec(bContext *C, wmOperator *op)
@@ -2572,6 +2581,7 @@
int x, y, radius, width, height, select;
float zoomx, zoomy, offset[2], ellipse[2];
int gesture_mode = RNA_int_get(op->ptr, "gesture_mode");
+ int change = FALSE;
/* get operator properties */
select = (gesture_mode == GESTURE_MODAL_SELECT);
@@ -2593,16 +2603,16 @@
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
- select_uv_inside_ellipse(em, sima, scene, select, offset, ellipse, l, luv);
+ change |= select_uv_inside_ellipse(em, sima, scene, select, offset, ellipse, l, luv);
}
}
-#if 0 //I think the BM_elem_select_set api stuff handles all this as necessary?
- if (select) EM_select_flush(em);
- else EM_deselect_flush(em);
-#endif
- WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
+ if (change) {
+ uv_select_sync_flush(scene->toolsettings, em, select);
+ WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
+ }
+
return OPERATOR_FINISHED;
}
More information about the Bf-blender-cvs
mailing list