Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/uvedit/uvedit_ops.c
| Context not available. | |||||
| static int uv_pin_exec(bContext *C, wmOperator *op) | static int uv_pin_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| Object *obedit = CTX_data_edit_object(C); | |||||
| Image *ima = CTX_data_edit_image(C); | Image *ima = CTX_data_edit_image(C); | ||||
| BMEditMesh *em = BKE_editmesh_from_object(obedit); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| BMFace *efa; | uint objects_len = 0; | ||||
| BMLoop *l; | Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len); | ||||
| BMIter iter, liter; | |||||
| MLoopUV *luv; | for (uint ob_index = 0; ob_index < objects_len; ob_index++) { | ||||
| const bool clear = RNA_boolean_get(op->ptr, "clear"); | |||||
| Object *obedit = objects[ob_index]; | |||||
| const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV); | BMEditMesh *em = BKE_editmesh_from_object(obedit); | ||||
| BMFace *efa; | |||||
| BMLoop *l; | |||||
| BMIter iter, liter; | |||||
| MLoopUV *luv; | |||||
| if (em->bm->totfacesel == 0) { | |||||
| BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { | |||||
| if (!uvedit_face_visible_test(scene, obedit, ima, efa)) | |||||
| continue; | continue; | ||||
| } | |||||
| BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { | const bool clear = RNA_boolean_get(op->ptr, "clear"); | ||||
| luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); | |||||
| const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV); | |||||
| if (!clear) { | |||||
| if (uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) | BM_ITER_MESH(efa, &iter, em->bm, BM_FACES_OF_MESH) { | ||||
| luv->flag |= MLOOPUV_PINNED; | if (!uvedit_face_visible_test(scene, obedit, ima, efa)) | ||||
| } | continue; | ||||
| else { | |||||
| if (uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) | BM_ITER_ELEM(l, &liter, efa, BM_LOOPS_OF_FACE) { | ||||
| luv->flag &= ~MLOOPUV_PINNED; | luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); | ||||
| if (!clear) { | |||||
| if (uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) | |||||
| luv->flag |= MLOOPUV_PINNED; | |||||
| } | |||||
| else { | |||||
| if (uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) | |||||
| luv->flag &= ~MLOOPUV_PINNED; | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); | |||||
| } | } | ||||
| MEM_freeN(objects); | |||||
| WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); | |||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| Context not available. | |||||