diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-05-14 16:41:56 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-05-14 16:41:56 +0400 |
commit | 8b687f6c36d66c2afed5ed129c71c225439dec57 (patch) | |
tree | aca533ca56b583c7f0ebc930cd4f4d1b8b52ebba /source/blender/editors/uvedit | |
parent | be5b447100710b8b81ed6c683cfc5ca34b866d1b (diff) |
code cleanup: add WM_gesture_lasso_path_to_array, move mouse path to array conversion there.
Diffstat (limited to 'source/blender/editors/uvedit')
-rw-r--r-- | source/blender/editors/uvedit/uvedit_ops.c | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 595d1905e16..a4227d92e27 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -2709,34 +2709,21 @@ static int do_lasso_select_mesh_uv(bContext *C, int mcords[][2], short moves, sh static int uv_lasso_select_exec(bContext *C, wmOperator *op) { - int i = 0; - int mcords[1024][2]; + int mcords_tot; + int (*mcords)[2] = WM_gesture_lasso_path_to_array(C, op, &mcords_tot); - RNA_BEGIN (op->ptr, itemptr, "path") - { - float loc[2]; - - RNA_float_get_array(&itemptr, "loc", loc); - mcords[i][0] = (int)loc[0]; - mcords[i][1] = (int)loc[1]; - i++; - if (i >= 1024) break; - } - RNA_END; - - if (i > 1) { + if (mcords) { short select; + short change; select = !RNA_boolean_get(op->ptr, "deselect"); + change = do_lasso_select_mesh_uv(C, mcords, mcords_tot, select); - if (do_lasso_select_mesh_uv(C, mcords, i, select)) { - return OPERATOR_FINISHED; - } - else { - return OPERATOR_CANCELLED; - } + MEM_freeN(mcords); + return change ? OPERATOR_FINISHED : OPERATOR_CANCELLED; } + return OPERATOR_PASS_THROUGH; } |