Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/uvedit/uvedit_ops.c
| Show First 20 Lines • Show All 1,472 Lines • ▼ Show 20 Lines | static int uv_select_more_less(bContext *C, const bool select) | ||||
| BMLoop *l; | BMLoop *l; | ||||
| BMIter iter, liter; | BMIter iter, liter; | ||||
| ToolSettings *ts = scene->toolsettings; | ToolSettings *ts = scene->toolsettings; | ||||
| uint objects_len = 0; | uint objects_len = 0; | ||||
| Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs( | Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs( | ||||
| view_layer, ((View3D *)NULL), &objects_len); | view_layer, ((View3D *)NULL), &objects_len); | ||||
| const bool is_uv_face_selectmode = (ts->uv_selectmode == UV_SELECT_FACE); | |||||
| for (uint ob_index = 0; ob_index < objects_len; ob_index++) { | for (uint ob_index = 0; ob_index < objects_len; ob_index++) { | ||||
| Object *obedit = objects[ob_index]; | Object *obedit = objects[ob_index]; | ||||
| BMEditMesh *em = BKE_editmesh_from_object(obedit); | BMEditMesh *em = BKE_editmesh_from_object(obedit); | ||||
| bool changed = false; | bool changed = false; | ||||
| const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV); | const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV); | ||||
| if (ts->uv_flag & UV_SYNC_SELECTION) { | if (ts->uv_flag & UV_SYNC_SELECTION) { | ||||
| if (select) { | if (select) { | ||||
| EDBM_select_more(em, true); | EDBM_select_more(em, true); | ||||
| } | } | ||||
| else { | else { | ||||
| EDBM_select_less(em, true); | EDBM_select_less(em, true); | ||||
| } | } | ||||
| DEG_id_tag_update(obedit->data, ID_RECALC_SELECT); | DEG_id_tag_update(obedit->data, ID_RECALC_SELECT); | ||||
| WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); | WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (ts->uv_selectmode == UV_SELECT_FACE) { | if (is_uv_face_selectmode) { | ||||
| /* clear tags */ | /* clear tags */ | ||||
| BM_mesh_elem_hflag_disable_all(em->bm, BM_FACE, BM_ELEM_TAG, false); | BM_mesh_elem_hflag_disable_all(em->bm, BM_FACE, BM_ELEM_TAG, false); | ||||
| /* mark loops to be selected */ | /* mark loops to be selected */ | ||||
| BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { | BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { | ||||
| if (uvedit_face_visible_test(scene, obedit, ima, efa)) { | if (uvedit_face_visible_test(scene, obedit, ima, efa)) { | ||||
| ▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | else { | ||||
| changed = true; | changed = true; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if (changed) { | if (changed) { | ||||
| if (is_uv_face_selectmode) { | |||||
| /* Select tagged faces. */ | |||||
| uv_select_flush_from_tag_face(sima, scene, obedit, select); | |||||
| } | |||||
| else { | |||||
| /* Select tagged loops. */ | /* Select tagged loops. */ | ||||
| uv_select_flush_from_tag_loop(sima, scene, obedit, select); | uv_select_flush_from_tag_loop(sima, scene, obedit, select); | ||||
| } | |||||
| DEG_id_tag_update(obedit->data, ID_RECALC_SELECT); | DEG_id_tag_update(obedit->data, ID_RECALC_SELECT); | ||||
| WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); | WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); | ||||
| } | } | ||||
| } | } | ||||
| MEM_freeN(objects); | MEM_freeN(objects); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 3,678 Lines • Show Last 20 Lines | |||||