diff options
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_select.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_select.c | 115 |
1 files changed, 57 insertions, 58 deletions
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 93cf656dea4..b15dc6ab3c7 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -458,14 +458,14 @@ static void lasso_select_boundbox(rcti *rect, int mcords[][2], short moves) { short a; - rect->xmin= rect->xmax= mcords[0][0]; - rect->ymin= rect->ymax= mcords[0][1]; + rect->xmin = rect->xmax = mcords[0][0]; + rect->ymin = rect->ymax = mcords[0][1]; for (a=1; a<moves; a++) { - if (mcords[a][0]<rect->xmin) rect->xmin= mcords[a][0]; - else if (mcords[a][0]>rect->xmax) rect->xmax= mcords[a][0]; - if (mcords[a][1]<rect->ymin) rect->ymin= mcords[a][1]; - else if (mcords[a][1]>rect->ymax) rect->ymax= mcords[a][1]; + if (mcords[a][0]<rect->xmin) rect->xmin = mcords[a][0]; + else if (mcords[a][0]>rect->xmax) rect->xmax = mcords[a][0]; + if (mcords[a][1]<rect->ymin) rect->ymin = mcords[a][1]; + else if (mcords[a][1]>rect->ymax) rect->ymax = mcords[a][1]; } } @@ -529,7 +529,7 @@ static void do_lasso_select_mesh(ViewContext *vc, int mcords[][2], short moves, if (extend == 0 && select) EDBM_flag_disable_all(vc->em, BM_ELEM_SELECT); - /* for non zbuf projections, dont change the GL state */ + /* for non zbuf projections, don't change the GL state */ ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); glLoadMatrixf(vc->rv3d->viewmat); @@ -816,12 +816,11 @@ int do_paintvert_box_select(ViewContext *vc, rcti *rect, int select, int extend) } mvert= me->mvert; - for (a=1; a<=me->totvert; a++, mvert++) { + for (a = 1; a <= me->totvert; a++, mvert++) { if (selar[a]) { - if (mvert->flag & ME_HIDE); - else { - if (select) mvert->flag |= SELECT; - else mvert->flag &= ~SELECT; + if ((mvert->flag & ME_HIDE) == 0) { + if (select) mvert->flag |= SELECT; + else mvert->flag &= ~SELECT; } } } @@ -998,18 +997,18 @@ static int view3d_lasso_select_exec(bContext *C, wmOperator *op) void VIEW3D_OT_select_lasso(wmOperatorType *ot) { - ot->name= "Lasso Select"; - ot->description= "Select items using lasso selection"; - ot->idname= "VIEW3D_OT_select_lasso"; + ot->name = "Lasso Select"; + ot->description = "Select items using lasso selection"; + ot->idname = "VIEW3D_OT_select_lasso"; - ot->invoke= WM_gesture_lasso_invoke; - ot->modal= WM_gesture_lasso_modal; - ot->exec= view3d_lasso_select_exec; - ot->poll= view3d_selectable_data; - ot->cancel= WM_gesture_lasso_cancel; + ot->invoke = WM_gesture_lasso_invoke; + ot->modal = WM_gesture_lasso_modal; + ot->exec = view3d_lasso_select_exec; + ot->poll = view3d_selectable_data; + ot->cancel = WM_gesture_lasso_cancel; /* flags */ - ot->flag= OPTYPE_UNDO; + ot->flag = OPTYPE_UNDO; RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", ""); RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Deselect rather than select items"); @@ -1087,7 +1086,7 @@ static EnumPropertyItem *object_select_menu_enum_itemf(bContext *C, PointerRNA * int totitem= 0; int i= 0; - /* dont need context but avoid docgen using this */ + /* don't need context but avoid docgen using this */ if (C == NULL || object_mouse_select_menu_data[i].idname[0] == '\0') { return DummyRNA_NULL_items; } @@ -1151,22 +1150,22 @@ void VIEW3D_OT_select_menu(wmOperatorType *ot) PropertyRNA *prop; /* identifiers */ - ot->name= "Select Menu"; + ot->name = "Select Menu"; ot->description = "Menu object selection"; - ot->idname= "VIEW3D_OT_select_menu"; + ot->idname = "VIEW3D_OT_select_menu"; /* api callbacks */ - ot->invoke= WM_menu_invoke; - ot->exec= object_select_menu_exec; + ot->invoke = WM_menu_invoke; + ot->exec = object_select_menu_exec; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; /* keyingset to use (dynamic enum) */ prop= RNA_def_enum(ot->srna, "name", DummyRNA_NULL_items, 0, "Object Name", ""); RNA_def_enum_funcs(prop, object_select_menu_enum_itemf); RNA_def_property_flag(prop, PROP_HIDDEN); - ot->prop= prop; + ot->prop = prop; RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first"); } @@ -1595,7 +1594,7 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short obce WM_event_add_notifier(C, NC_OBJECT|ND_BONE_ACTIVE, basact->object); /* in weightpaint, we use selected bone to select vertexgroup, so no switch to new active object */ - if (BASACT && BASACT->object->mode & OB_MODE_WEIGHT_PAINT) { + if (BASACT && (BASACT->object->mode & OB_MODE_WEIGHT_PAINT)) { /* prevent activating */ basact= NULL; } @@ -1801,7 +1800,7 @@ static int do_mesh_box_select(ViewContext *vc, rcti *rect, int select, int exten if (extend == 0 && select) EDBM_flag_disable_all(vc->em, BM_ELEM_SELECT); - /* for non zbuf projections, dont change the GL state */ + /* for non zbuf projections, don't change the GL state */ ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); glLoadMatrixf(vc->rv3d->viewmat); @@ -2064,10 +2063,10 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op) view3d_set_viewcontext(C, &vc); select= (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT); - rect.xmin= RNA_int_get(op->ptr, "xmin"); - rect.ymin= RNA_int_get(op->ptr, "ymin"); - rect.xmax= RNA_int_get(op->ptr, "xmax"); - rect.ymax= RNA_int_get(op->ptr, "ymax"); + rect.xmin = RNA_int_get(op->ptr, "xmin"); + rect.ymin = RNA_int_get(op->ptr, "ymin"); + rect.xmax = RNA_int_get(op->ptr, "xmax"); + rect.ymax = RNA_int_get(op->ptr, "ymax"); extend = RNA_boolean_get(op->ptr, "extend"); if (vc.obedit) { @@ -2137,19 +2136,19 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op) void VIEW3D_OT_select_border(wmOperatorType *ot) { /* identifiers */ - ot->name= "Border Select"; - ot->description= "Select items using border selection"; - ot->idname= "VIEW3D_OT_select_border"; + ot->name = "Border Select"; + ot->description = "Select items using border selection"; + ot->idname = "VIEW3D_OT_select_border"; /* api callbacks */ - ot->invoke= WM_border_select_invoke; - ot->exec= view3d_borderselect_exec; - ot->modal= WM_border_select_modal; - ot->poll= view3d_selectable_data; - ot->cancel= WM_border_select_cancel; + ot->invoke = WM_border_select_invoke; + ot->exec = view3d_borderselect_exec; + ot->modal = WM_border_select_modal; + ot->poll = view3d_selectable_data; + ot->cancel = WM_border_select_cancel; /* flags */ - ot->flag= OPTYPE_UNDO; + ot->flag = OPTYPE_UNDO; /* rna */ WM_operator_properties_gesture_border(ot, TRUE); @@ -2270,16 +2269,16 @@ static int view3d_select_invoke(bContext *C, wmOperator *op, wmEvent *event) void VIEW3D_OT_select(wmOperatorType *ot) { /* identifiers */ - ot->name= "Activate/Select"; - ot->description= "Activate/select item(s)"; - ot->idname= "VIEW3D_OT_select"; + ot->name = "Activate/Select"; + ot->description = "Activate/select item(s)"; + ot->idname = "VIEW3D_OT_select"; /* api callbacks */ - ot->invoke= view3d_select_invoke; - ot->poll= ED_operator_view3d_active; + ot->invoke = view3d_select_invoke; + ot->poll = ED_operator_view3d_active; /* flags */ - ot->flag= OPTYPE_UNDO; + ot->flag = OPTYPE_UNDO; /* properties */ RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first"); @@ -2727,18 +2726,18 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op) void VIEW3D_OT_select_circle(wmOperatorType *ot) { - ot->name= "Circle Select"; - ot->description= "Select items using circle selection"; - ot->idname= "VIEW3D_OT_select_circle"; + ot->name = "Circle Select"; + ot->description = "Select items using circle selection"; + ot->idname = "VIEW3D_OT_select_circle"; - ot->invoke= WM_gesture_circle_invoke; - ot->modal= WM_gesture_circle_modal; - ot->exec= view3d_circle_select_exec; - ot->poll= view3d_selectable_data; - ot->cancel= WM_gesture_circle_cancel; + ot->invoke = WM_gesture_circle_invoke; + ot->modal = WM_gesture_circle_modal; + ot->exec = view3d_circle_select_exec; + ot->poll = view3d_selectable_data; + ot->cancel = WM_gesture_circle_cancel; /* flags */ - ot->flag= OPTYPE_UNDO; + ot->flag = OPTYPE_UNDO; RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX); RNA_def_int(ot->srna, "y", 0, INT_MIN, INT_MAX, "Y", "", INT_MIN, INT_MAX); |