Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/uvedit/uvedit_ops.c')
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c118
1 files changed, 59 insertions, 59 deletions
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index fceb1532077..6d5a1925dd5 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -108,13 +108,13 @@ bool ED_uvedit_test(Object *obedit)
if (!obedit)
return 0;
-
+
if (obedit->type != OB_MESH)
return 0;
em = BKE_editmesh_from_object(obedit);
ret = EDBM_uv_check(em);
-
+
return ret;
}
@@ -167,7 +167,7 @@ bool ED_object_get_active_image(
if (r_ntree) *r_ntree = ntree;
return true;
}
-
+
if (r_ima) *r_ima = NULL;
if (r_iuser) *r_iuser = NULL;
if (r_node) *r_node = node;
@@ -364,7 +364,7 @@ bool uvedit_edge_select_test(
return BM_elem_flag_test(l->e, BM_ELEM_SELECT);
}
else {
- return BM_elem_flag_test(l->v, BM_ELEM_SELECT) &&
+ return BM_elem_flag_test(l->v, BM_ELEM_SELECT) &&
BM_elem_flag_test(l->next->v, BM_ELEM_SELECT);
}
}
@@ -417,7 +417,7 @@ void uvedit_edge_select_enable(
luv1 = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
luv2 = BM_ELEM_CD_GET_VOID_P(l->next, cd_loop_uv_offset);
-
+
luv1->flag |= MLOOPUV_VERTSEL;
luv2->flag |= MLOOPUV_VERTSEL;
}
@@ -445,7 +445,7 @@ void uvedit_edge_select_disable(
luv1 = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
luv2 = BM_ELEM_CD_GET_VOID_P(l->next, cd_loop_uv_offset);
-
+
luv1->flag &= ~MLOOPUV_VERTSEL;
luv2->flag &= ~MLOOPUV_VERTSEL;
}
@@ -667,7 +667,7 @@ static bool UNUSED_FUNCTION(ED_uvedit_median)(Scene *scene, Image *ima, Object *
bool ED_uvedit_center_multi(Scene *scene, Image *ima, Object **objects_edit, uint objects_len, float cent[2], char mode)
{
bool changed = false;
-
+
if (mode == V3D_AROUND_CENTER_BOUNDS) { /* bounding box */
float min[2], max[2];
if (ED_uvedit_minmax_multi(scene, ima, objects_edit, objects_len, min, max)) {
@@ -920,11 +920,11 @@ bool ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, const float
mindist = 1e10f;
copy_v2_v2(r_uv, co);
-
+
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
if (!uvedit_face_visible_test(scene, obedit, ima, efa))
continue;
-
+
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
dist = len_manhattan_v2v2(co, luv->uv);
@@ -958,7 +958,7 @@ static void uv_select_edgeloop_vertex_loop_flag(UvMapVert *first)
count++;
}
-
+
if (count < 5)
first->flag = 1;
}
@@ -974,7 +974,7 @@ static UvMapVert *uv_select_edgeloop_vertex_map_get(UvVertMap *vmap, BMFace *efa
if (iterv->f == BM_elem_index_get(efa))
return first;
}
-
+
return NULL;
}
@@ -1113,7 +1113,7 @@ static int uv_select_edgeloop(
else {
select = true;
}
-
+
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
iterv_curr = uv_select_edgeloop_vertex_map_get(vmap, efa, l);
@@ -1724,7 +1724,7 @@ static void UV_OT_align(wmOperatorType *ot)
ot->description = "Align selected UV vertices to an axis";
ot->idname = "UV_OT_align";
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* api callbacks */
ot->exec = uv_align_exec;
ot->poll = ED_operator_uvedit;
@@ -1919,7 +1919,7 @@ static void UV_OT_weld(wmOperatorType *ot)
ot->description = "Weld selected UV vertices together";
ot->idname = "UV_OT_weld";
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* api callbacks */
ot->exec = uv_weld_exec;
ot->poll = ED_operator_uvedit;
@@ -2073,7 +2073,7 @@ static void UV_OT_select_all(wmOperatorType *ot)
ot->description = "Change selection of all UV vertices";
ot->idname = "UV_OT_select_all";
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* api callbacks */
ot->exec = uv_select_all_exec;
ot->poll = ED_operator_uvedit;
@@ -2225,7 +2225,7 @@ static int uv_mouse_select_multi(
hituv[i] = luv->uv;
hitv[i] = BM_elem_index_get(l->v);
}
-
+
hitlen = hit.efa->len;
}
else if (selectmode == UV_SELECT_ISLAND) {
@@ -2330,7 +2330,7 @@ static int uv_mouse_select_multi(
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
if (!uvedit_face_visible_test(scene, obedit, ima, efa))
continue;
-
+
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
if (sticky == SI_STICKY_DISABLE) continue;
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
@@ -2416,7 +2416,7 @@ static void UV_OT_select(wmOperatorType *ot)
ot->description = "Select UV vertices";
ot->idname = "UV_OT_select";
ot->flag = OPTYPE_UNDO;
-
+
/* api callbacks */
ot->exec = uv_select_exec;
ot->invoke = uv_select_invoke;
@@ -2465,7 +2465,7 @@ static void UV_OT_select_loop(wmOperatorType *ot)
ot->description = "Select a loop of connected UV vertices";
ot->idname = "UV_OT_select_loop";
ot->flag = OPTYPE_UNDO;
-
+
/* api callbacks */
ot->exec = uv_select_loop_exec;
ot->invoke = uv_select_loop_invoke;
@@ -2568,7 +2568,7 @@ static void UV_OT_select_linked(wmOperatorType *ot)
ot->description = "Select all UV vertices linked to the active UV map";
ot->idname = "UV_OT_select_linked";
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* api callbacks */
ot->exec = uv_select_linked_exec;
ot->poll = ED_operator_uvedit; /* requires space image */
@@ -2775,19 +2775,19 @@ static void uv_select_flush_from_tag_sticky_loc_internal(
*/
static void uv_select_flush_from_tag_face(SpaceImage *sima, Scene *scene, Object *obedit, const bool select)
{
- /* Selecting UV Faces with some modes requires us to change
+ /* Selecting UV Faces with some modes requires us to change
* the selection in other faces (depending on the sticky mode).
- *
+ *
* This only needs to be done when the Mesh is not used for
* selection (so for sticky modes, vertex or location based). */
-
+
ToolSettings *ts = scene->toolsettings;
BMEditMesh *em = BKE_editmesh_from_object(obedit);
BMFace *efa;
BMLoop *l;
BMIter iter, liter;
const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
-
+
if ((ts->uv_flag & UV_SYNC_SELECTION) == 0 && sima->sticky == SI_STICKY_VERTEX) {
/* Tag all verts as untouched, then touch the ones that have a face center
* in the loop and select all MLoopUV's that use a touched vert. */
@@ -2816,19 +2816,19 @@ static void uv_select_flush_from_tag_face(SpaceImage *sima, Scene *scene, Object
struct UvVertMap *vmap;
float limit[2];
unsigned int efa_index;
-
+
uvedit_pixel_to_float(sima, limit, 0.05);
-
+
BM_mesh_elem_table_ensure(em->bm, BM_FACE);
vmap = BM_uv_vert_map_create(em->bm, limit, false, false);
if (vmap == NULL) {
return;
}
-
+
BM_ITER_MESH_INDEX (efa, &iter, em->bm, BM_FACES_OF_MESH, efa_index) {
if (BM_elem_flag_test(efa, BM_ELEM_TAG)) {
/* tf = BM_ELEM_CD_GET_VOID_P(efa, cd_poly_tex_offset); */ /* UNUSED */
-
+
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
uv_select_flush_from_tag_sticky_loc_internal(
scene, em, vmap, efa_index, l,
@@ -2837,7 +2837,7 @@ static void uv_select_flush_from_tag_face(SpaceImage *sima, Scene *scene, Object
}
}
BM_uv_vert_map_free(vmap);
-
+
}
else { /* SI_STICKY_DISABLE or ts->uv_flag & UV_SYNC_SELECTION */
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
@@ -3068,17 +3068,17 @@ static void UV_OT_select_border(wmOperatorType *ot)
ot->name = "Border Select";
ot->description = "Select UV vertices using border selection";
ot->idname = "UV_OT_select_border";
-
+
/* api callbacks */
ot->invoke = WM_gesture_border_invoke;
ot->exec = uv_border_select_exec;
ot->modal = WM_gesture_border_modal;
ot->poll = ED_operator_uvedit_space_image; /* requires space image */;
ot->cancel = WM_gesture_border_cancel;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* properties */
RNA_def_boolean(ot->srna, "pinned", 0, "Pinned", "Border select pinned UVs only");
@@ -3137,7 +3137,7 @@ static int uv_circle_select_exec(bContext *C, wmOperator *op)
ellipse[1] = height * zoomy / radius;
UI_view2d_region_to_view(&ar->v2d, x, y, &offset[0], &offset[1]);
-
+
/* do selection */
if (use_face_center) {
changed = false;
@@ -3193,14 +3193,14 @@ static void UV_OT_circle_select(wmOperatorType *ot)
ot->name = "Circle Select";
ot->description = "Select UV vertices using circle selection";
ot->idname = "UV_OT_circle_select";
-
+
/* api callbacks */
ot->invoke = WM_gesture_circle_invoke;
ot->modal = WM_gesture_circle_modal;
ot->exec = uv_circle_select_exec;
ot->poll = ED_operator_uvedit_space_image; /* requires space image */;
ot->cancel = WM_gesture_circle_cancel;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -3416,7 +3416,7 @@ static int uv_snap_cursor_exec(bContext *C, wmOperator *op)
if (!changed)
return OPERATOR_CANCELLED;
-
+
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_IMAGE, sima);
return OPERATOR_FINISHED;
@@ -3434,7 +3434,7 @@ static void UV_OT_snap_cursor(wmOperatorType *ot)
ot->description = "Snap cursor to target type";
ot->idname = "UV_OT_snap_cursor";
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* api callbacks */
ot->exec = uv_snap_cursor_exec;
ot->poll = ED_operator_uvedit_space_image; /* requires space image */;
@@ -3513,7 +3513,7 @@ static bool uv_snap_uvs_to_adjacent_unselected(Scene *scene, Image *ima, Object
MLoopUV *luv;
bool changed = false;
const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
-
+
/* index every vert that has a selected UV using it, but only once so as to
* get unique indices and to count how much to malloc */
BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
@@ -3575,7 +3575,7 @@ static bool uv_snap_uvs_to_pixels(SpaceImage *sima, Scene *scene, Object *obedit
ED_space_image_get_size(sima, &width, &height);
w = (float)width;
h = (float)height;
-
+
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
if (!uvedit_face_visible_test(scene, obedit, ima, efa))
continue;
@@ -3647,7 +3647,7 @@ static void UV_OT_snap_selected(wmOperatorType *ot)
ot->description = "Snap selected UV vertices to target type";
ot->idname = "UV_OT_snap_selected";
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* api callbacks */
ot->exec = uv_snap_selection_exec;
ot->poll = ED_operator_uvedit_space_image;
@@ -3673,7 +3673,7 @@ static int uv_pin_exec(bContext *C, wmOperator *op)
BMIter iter, liter;
MLoopUV *luv;
const bool clear = RNA_boolean_get(op->ptr, "clear");
-
+
const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
@@ -3682,7 +3682,7 @@ static int uv_pin_exec(bContext *C, wmOperator *op)
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
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;
@@ -3693,7 +3693,7 @@ static int uv_pin_exec(bContext *C, wmOperator *op)
}
}
}
-
+
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
return OPERATOR_FINISHED;
@@ -3706,7 +3706,7 @@ static void UV_OT_pin(wmOperatorType *ot)
ot->description = "Set/clear selected UV vertices as anchored between multiple unwrap operations";
ot->idname = "UV_OT_pin";
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* api callbacks */
ot->exec = uv_pin_exec;
ot->poll = ED_operator_uvedit;
@@ -3731,7 +3731,7 @@ static int uv_select_pinned_exec(bContext *C, wmOperator *UNUSED(op))
BMLoop *l;
BMIter iter, liter;
MLoopUV *luv;
-
+
const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
@@ -3740,12 +3740,12 @@ static int uv_select_pinned_exec(bContext *C, wmOperator *UNUSED(op))
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
-
+
if (luv->flag & MLOOPUV_PINNED)
uvedit_uv_select_enable(em, scene, l, false, cd_loop_uv_offset);
}
}
-
+
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
return OPERATOR_FINISHED;
@@ -3758,7 +3758,7 @@ static void UV_OT_select_pinned(wmOperatorType *ot)
ot->description = "Select all pinned UV vertices";
ot->idname = "UV_OT_select_pinned";
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* api callbacks */
ot->exec = uv_select_pinned_exec;
ot->poll = ED_operator_uvedit;
@@ -3878,7 +3878,7 @@ static int uv_hide_exec(bContext *C, wmOperator *op)
/* flush vertex selection changes */
if (em->selectmode != SCE_SELECT_FACE)
EDBM_selectmode_flush_ex(em, SCE_SELECT_VERTEX | SCE_SELECT_EDGE);
-
+
BM_select_history_validate(em->bm);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
@@ -3894,7 +3894,7 @@ static void UV_OT_hide(wmOperatorType *ot)
ot->description = "Hide (un)selected UV vertices";
ot->idname = "UV_OT_hide";
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* api callbacks */
ot->exec = uv_hide_exec;
ot->poll = ED_operator_uvedit;
@@ -3961,7 +3961,7 @@ static int uv_reveal_exec(bContext *C, wmOperator *op)
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
totsel += BM_elem_flag_test(l->v, BM_ELEM_SELECT);
}
-
+
if (!totsel) {
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
@@ -4018,7 +4018,7 @@ static int uv_reveal_exec(bContext *C, wmOperator *op)
}
}
}
-
+
/* re-select tagged faces */
BM_mesh_elem_hflag_enable_test(em->bm, BM_FACE, BM_ELEM_SELECT, true, false, BM_ELEM_TAG);
@@ -4034,7 +4034,7 @@ static void UV_OT_reveal(wmOperatorType *ot)
ot->description = "Reveal all hidden UV vertices";
ot->idname = "UV_OT_reveal";
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* api callbacks */
ot->exec = uv_reveal_exec;
ot->poll = ED_operator_uvedit;
@@ -4063,9 +4063,9 @@ static int uv_set_2d_cursor_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
RNA_float_get_array(op->ptr, "location", sima->cursor);
-
+
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_IMAGE, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -4095,7 +4095,7 @@ static void UV_OT_cursor_set(wmOperatorType *ot)
ot->name = "Set 2D Cursor";
ot->description = "Set 2D cursor location";
ot->idname = "UV_OT_cursor_set";
-
+
/* api callbacks */
ot->exec = uv_set_2d_cursor_exec;
ot->invoke = uv_set_2d_cursor_invoke;
@@ -4381,7 +4381,7 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf)
{
wmKeyMap *keymap;
wmKeyMapItem *kmi;
-
+
keymap = WM_keymap_find(keyconf, "UV Editor", 0, 0);
keymap->poll = ED_operator_uvedit_can_uv_sculpt;
@@ -4391,7 +4391,7 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf)
/* Mark edge seam */
WM_keymap_add_item(keymap, "UV_OT_mark_seam", EKEY, KM_PRESS, KM_CTRL, 0);
-
+
/* pick selection */
RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_select", SELECTMOUSE, KM_PRESS, 0, 0)->ptr, "extend", false);
RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", true);
@@ -4462,7 +4462,7 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf)
/* cursor */
WM_keymap_add_item(keymap, "UV_OT_cursor_set", ACTIONMOUSE, KM_PRESS, 0, 0);
-
+
/* menus */
WM_keymap_add_menu(keymap, "IMAGE_MT_uvs_snap", SKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_menu(keymap, "IMAGE_MT_uvs_select_mode", TABKEY, KM_PRESS, KM_CTRL, 0);