Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_view3d/view3d_select.c
| Show First 20 Lines • Show All 2,048 Lines • ▼ Show 20 Lines | if (obcenter) { | ||||
| if (enumerate) { | if (enumerate) { | ||||
| basact = object_mouse_select_menu(C, &vc, NULL, 0, mval, extend, deselect, toggle); | basact = object_mouse_select_menu(C, &vc, NULL, 0, mval, extend, deselect, toggle); | ||||
| } | } | ||||
| else { | else { | ||||
| base = startbase; | base = startbase; | ||||
| while (base) { | while (base) { | ||||
| if (BASE_SELECTABLE(v3d, base)) { | if (BASE_SELECTABLE(v3d, base)) { | ||||
| float screen_co[2]; | float screen_co[2]; | ||||
| if (ED_view3d_project_float_global(region, | if (ED_view3d_project_float_global( | ||||
| base->object->obmat[3], | region, base->object->obmat[3], screen_co, V3D_PROJ_TEST_CLIP_DEFAULT) == | ||||
| screen_co, | V3D_PROJ_RET_OK) { | ||||
| V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN | | |||||
| V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK) { | |||||
| float dist_temp = len_manhattan_v2v2(mval_fl, screen_co); | float dist_temp = len_manhattan_v2v2(mval_fl, screen_co); | ||||
| if (base == oldbasact) { | if (base == oldbasact) { | ||||
| dist_temp += 10.0f; | dist_temp += 10.0f; | ||||
| } | } | ||||
| if (dist_temp < dist) { | if (dist_temp < dist) { | ||||
| dist = dist_temp; | dist = dist_temp; | ||||
| basact = base; | basact = base; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,979 Lines • ▼ Show 20 Lines | static bool object_circle_select(ViewContext *vc, | ||||
| } | } | ||||
| const bool select = (sel_op != SEL_OP_SUB); | const bool select = (sel_op != SEL_OP_SUB); | ||||
| const int select_flag = select ? BASE_SELECTED : 0; | const int select_flag = select ? BASE_SELECTED : 0; | ||||
| Base *base; | Base *base; | ||||
| for (base = FIRSTBASE(view_layer); base; base = base->next) { | for (base = FIRSTBASE(view_layer); base; base = base->next) { | ||||
| if (BASE_SELECTABLE(v3d, base) && ((base->flag & BASE_SELECTED) != select_flag)) { | if (BASE_SELECTABLE(v3d, base) && ((base->flag & BASE_SELECTED) != select_flag)) { | ||||
| float screen_co[2]; | float screen_co[2]; | ||||
| if (ED_view3d_project_float_global(vc->region, | if (ED_view3d_project_float_global( | ||||
| base->object->obmat[3], | vc->region, base->object->obmat[3], screen_co, V3D_PROJ_TEST_CLIP_DEFAULT) == | ||||
| screen_co, | V3D_PROJ_RET_OK) { | ||||
| V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN | | |||||
| V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK) { | |||||
| if (len_squared_v2v2(mval_fl, screen_co) <= radius_squared) { | if (len_squared_v2v2(mval_fl, screen_co) <= radius_squared) { | ||||
| ED_object_base_select(base, select ? BA_SELECT : BA_DESELECT); | ED_object_base_select(base, select ? BA_SELECT : BA_DESELECT); | ||||
| changed = true; | changed = true; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 109 Lines • Show Last 20 Lines | |||||