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:
-rw-r--r--source/blender/editors/include/ED_screen.h1
-rw-r--r--source/blender/editors/mesh/editmesh_bevel.c22
-rw-r--r--source/blender/editors/mesh/editmesh_inset.c12
-rw-r--r--source/blender/editors/physics/particle_edit.c8
-rw-r--r--source/blender/editors/screen/screen_ops.c7
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c254
6 files changed, 156 insertions, 148 deletions
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index d073eaa5607..eb364c35091 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -170,6 +170,7 @@ int ED_operator_editfont(struct bContext *C);
int ED_operator_editlattice(struct bContext *C);
int ED_operator_editmball(struct bContext *C);
int ED_operator_uvedit(struct bContext *C);
+int ED_operator_uvedit_space_image(struct bContext *C);
int ED_operator_uvmap(struct bContext *C);
int ED_operator_posemode_exclusive(struct bContext *C);
int ED_operator_posemode_context(struct bContext *C);
diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c
index d061f5fbcc8..3f4c3d3a21c 100644
--- a/source/blender/editors/mesh/editmesh_bevel.c
+++ b/source/blender/editors/mesh/editmesh_bevel.c
@@ -91,14 +91,14 @@ static void edbm_bevel_update_header(wmOperator *op, bContext *C)
}
}
-static int edbm_bevel_init(bContext *C, wmOperator *op, const bool is_modal)
+static bool edbm_bevel_init(bContext *C, wmOperator *op, const bool is_modal)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
BevelData *opdata;
if (em->bm->totvertsel == 0) {
- return 0;
+ return false;
}
op->customdata = opdata = MEM_mallocN(sizeof(BevelData), "beveldata_mesh_operator");
@@ -122,10 +122,10 @@ static int edbm_bevel_init(bContext *C, wmOperator *op, const bool is_modal)
v3d->twtype = 0;
}
- return 1;
+ return true;
}
-static int edbm_bevel_calc(wmOperator *op)
+static bool edbm_bevel_calc(wmOperator *op)
{
BevelData *opdata = op->customdata;
BMEditMesh *em = opdata->em;
@@ -139,12 +139,9 @@ static int edbm_bevel_calc(wmOperator *op)
EDBM_redo_state_restore(opdata->mesh_backup, em, false);
}
- if (!EDBM_op_init(em, &bmop, op,
- "bevel geom=%hev offset=%f segments=%i vertex_only=%b",
- BM_ELEM_SELECT, offset, segments, vertex_only))
- {
- return 0;
- }
+ EDBM_op_init(em, &bmop, op,
+ "bevel geom=%hev offset=%f segments=%i vertex_only=%b",
+ BM_ELEM_SELECT, offset, segments, vertex_only);
BMO_op_exec(em->bm, &bmop);
@@ -157,13 +154,13 @@ static int edbm_bevel_calc(wmOperator *op)
/* no need to de-select existing geometry */
if (!EDBM_op_finish(em, &bmop, op, true))
- return 0;
+ return false;
EDBM_mesh_normals_update(opdata->em);
EDBM_update_generic(opdata->em, true, true);
- return 1;
+ return true;
}
static void edbm_bevel_exit(bContext *C, wmOperator *op)
@@ -207,7 +204,6 @@ static int edbm_bevel_cancel(bContext *C, wmOperator *op)
static int edbm_bevel_exec(bContext *C, wmOperator *op)
{
if (!edbm_bevel_init(C, op, false)) {
- edbm_bevel_exit(C, op);
return OPERATOR_CANCELLED;
}
diff --git a/source/blender/editors/mesh/editmesh_inset.c b/source/blender/editors/mesh/editmesh_inset.c
index b54797337f4..523f4e11b81 100644
--- a/source/blender/editors/mesh/editmesh_inset.c
+++ b/source/blender/editors/mesh/editmesh_inset.c
@@ -107,14 +107,14 @@ static void edbm_inset_update_header(wmOperator *op, bContext *C)
}
-static int edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal)
+static bool edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal)
{
InsetData *opdata;
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
if (em->bm->totvertsel == 0) {
- return 0;
+ return false;
}
op->customdata = opdata = MEM_mallocN(sizeof(InsetData), "inset_operator_data");
@@ -141,7 +141,7 @@ static int edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal)
v3d->twtype = 0;
}
- return 1;
+ return true;
}
static void edbm_inset_exit(bContext *C, wmOperator *op)
@@ -183,7 +183,7 @@ static int edbm_inset_cancel(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
-static int edbm_inset_calc(wmOperator *op)
+static bool edbm_inset_calc(wmOperator *op)
{
InsetData *opdata;
BMEditMesh *em;
@@ -233,11 +233,11 @@ static int edbm_inset_calc(wmOperator *op)
}
if (!EDBM_op_finish(em, &bmop, op, true)) {
- return 0;
+ return false;
}
else {
EDBM_update_generic(em, true, true);
- return 1;
+ return true;
}
}
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index f00295a9033..4825416f6e9 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -132,8 +132,12 @@ int PE_hair_poll(bContext *C)
int PE_poll_view3d(bContext *C)
{
- return PE_poll(C) && CTX_wm_area(C)->spacetype == SPACE_VIEW3D &&
- CTX_wm_region(C)->regiontype == RGN_TYPE_WINDOW;
+ ScrArea *sa = CTX_wm_area(C);
+ ARegion *ar = CTX_wm_region(C);
+
+ return (PE_poll(C) &&
+ (sa && sa->spacetype == SPACE_VIEW3D) &&
+ (ar && ar->regiontype == RGN_TYPE_WINDOW));
}
void PE_free_ptcache_edit(PTCacheEdit *edit)
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 68dd6c65e36..e49e7ce53ff 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -421,6 +421,13 @@ int ED_operator_uvedit(bContext *C)
return ED_space_image_show_uvedit(sima, obedit);
}
+int ED_operator_uvedit_space_image(bContext *C)
+{
+ SpaceImage *sima = CTX_wm_space_image(C);
+ Object *obedit = CTX_data_edit_object(C);
+ return sima && ED_space_image_show_uvedit(sima, obedit);
+}
+
int ED_operator_uvmap(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index a3a1e6534bf..41bc849b2cc 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -83,7 +83,7 @@
#include "uvedit_intern.h"
-static void select_all_perform(Scene *scene, Image *ima, BMEditMesh *em, int action);
+static void uv_select_all_perform(Scene *scene, Image *ima, BMEditMesh *em, int action);
/************************* state testing ************************/
@@ -742,7 +742,7 @@ void uv_find_nearest_edge(Scene *scene, Image *ima, BMEditMesh *em, const float
}
}
-static void find_nearest_uv_face(Scene *scene, Image *ima, BMEditMesh *em, const float co[2], NearestHit *hit)
+static void uv_find_nearest_face(Scene *scene, Image *ima, BMEditMesh *em, const float co[2], NearestHit *hit)
{
MTexPoly *tf;
BMFace *efa;
@@ -776,7 +776,7 @@ static void find_nearest_uv_face(Scene *scene, Image *ima, BMEditMesh *em, const
}
}
-static int nearest_uv_between(BMEditMesh *em, BMFace *efa, int UNUSED(nverts), int id,
+static int uv_nearest_between(BMEditMesh *em, BMFace *efa, int UNUSED(nverts), int id,
const float co[2], const float uv[2])
{
BMLoop *l;
@@ -864,7 +864,7 @@ void uv_find_nearest_vert(Scene *scene, Image *ima, BMEditMesh *em,
if (dist <= mindist) {
if (dist == mindist)
- if (!nearest_uv_between(em, efa, efa->len, i, co, luv->uv)) {
+ if (!uv_nearest_between(em, efa, efa->len, i, co, luv->uv)) {
i++;
continue;
}
@@ -926,7 +926,7 @@ int ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, const float c
/*********************** loop select ***********************/
-static void select_edgeloop_uv_vertex_loop_flag(UvMapVert *first)
+static void uv_select_edgeloop_vertex_loop_flag(UvMapVert *first)
{
UvMapVert *iterv;
int count = 0;
@@ -942,7 +942,7 @@ static void select_edgeloop_uv_vertex_loop_flag(UvMapVert *first)
first->flag = 1;
}
-static UvMapVert *select_edgeloop_uv_vertex_map_get(UvVertMap *vmap, BMFace *efa, int a)
+static UvMapVert *uv_select_edgeloop_vertex_map_get(UvVertMap *vmap, BMFace *efa, int a)
{
UvMapVert *iterv, *first;
BMLoop *l;
@@ -960,7 +960,7 @@ static UvMapVert *select_edgeloop_uv_vertex_map_get(UvVertMap *vmap, BMFace *efa
return NULL;
}
-static int select_edgeloop_uv_edge_tag_faces(BMEditMesh *em, UvMapVert *first1, UvMapVert *first2, int *totface)
+static int uv_select_edgeloop_edge_tag_faces(BMEditMesh *em, UvMapVert *first1, UvMapVert *first2, int *totface)
{
UvMapVert *iterv1, *iterv2;
BMFace *efa;
@@ -1012,8 +1012,8 @@ static int select_edgeloop_uv_edge_tag_faces(BMEditMesh *em, UvMapVert *first1,
return 1;
}
-static int select_edgeloop(Scene *scene, Image *ima, BMEditMesh *em, NearestHit *hit,
- float limit[2], const bool extend)
+static int uv_select_edgeloop(Scene *scene, Image *ima, BMEditMesh *em, NearestHit *hit,
+ float limit[2], const bool extend)
{
BMFace *efa;
BMIter iter, liter;
@@ -1032,20 +1032,20 @@ static int select_edgeloop(Scene *scene, Image *ima, BMEditMesh *em, NearestHit
BM_mesh_elem_index_ensure(em->bm, BM_VERT | BM_FACE);
if (!extend) {
- select_all_perform(scene, ima, em, SEL_DESELECT);
+ uv_select_all_perform(scene, ima, em, SEL_DESELECT);
}
BM_mesh_elem_hflag_disable_all(em->bm, BM_FACE, BM_ELEM_TAG, FALSE);
/* set flags for first face and verts */
nverts = hit->efa->len;
- iterv1 = select_edgeloop_uv_vertex_map_get(vmap, hit->efa, hit->lindex);
- iterv2 = select_edgeloop_uv_vertex_map_get(vmap, hit->efa, (hit->lindex + 1) % nverts);
- select_edgeloop_uv_vertex_loop_flag(iterv1);
- select_edgeloop_uv_vertex_loop_flag(iterv2);
+ iterv1 = uv_select_edgeloop_vertex_map_get(vmap, hit->efa, hit->lindex);
+ iterv2 = uv_select_edgeloop_vertex_map_get(vmap, hit->efa, (hit->lindex + 1) % nverts);
+ uv_select_edgeloop_vertex_loop_flag(iterv1);
+ uv_select_edgeloop_vertex_loop_flag(iterv2);
starttotf = 0;
- select_edgeloop_uv_edge_tag_faces(em, iterv1, iterv2, &starttotf);
+ uv_select_edgeloop_edge_tag_faces(em, iterv1, iterv2, &starttotf);
/* sorry, first edge isn't even ok */
if (iterv1->flag == 0 && iterv2->flag == 0) looking = 0;
@@ -1064,20 +1064,20 @@ static int select_edgeloop(Scene *scene, Image *ima, BMEditMesh *em, NearestHit
nverts = efa->len;
for (a = 0; a < nverts; a++) {
/* check face not hidden and not tagged */
- iterv1 = select_edgeloop_uv_vertex_map_get(vmap, efa, a);
- iterv2 = select_edgeloop_uv_vertex_map_get(vmap, efa, (a + 1) % nverts);
+ iterv1 = uv_select_edgeloop_vertex_map_get(vmap, efa, a);
+ iterv2 = uv_select_edgeloop_vertex_map_get(vmap, efa, (a + 1) % nverts);
if (!iterv1 || !iterv2)
continue;
/* check if vertex is tagged and has right valence */
if (iterv1->flag || iterv2->flag) {
- if (select_edgeloop_uv_edge_tag_faces(em, iterv1, iterv2, &starttotf)) {
+ if (uv_select_edgeloop_edge_tag_faces(em, iterv1, iterv2, &starttotf)) {
looking = 1;
BM_elem_flag_enable(efa, BM_ELEM_TAG);
- select_edgeloop_uv_vertex_loop_flag(iterv1);
- select_edgeloop_uv_vertex_loop_flag(iterv2);
+ uv_select_edgeloop_vertex_loop_flag(iterv1);
+ uv_select_edgeloop_vertex_loop_flag(iterv2);
break;
}
}
@@ -1088,8 +1088,8 @@ static int select_edgeloop(Scene *scene, Image *ima, BMEditMesh *em, NearestHit
/* do the actual select/deselect */
nverts = hit->efa->len;
- iterv1 = select_edgeloop_uv_vertex_map_get(vmap, hit->efa, hit->lindex);
- iterv2 = select_edgeloop_uv_vertex_map_get(vmap, hit->efa, (hit->lindex + 1) % nverts);
+ iterv1 = uv_select_edgeloop_vertex_map_get(vmap, hit->efa, hit->lindex);
+ iterv2 = uv_select_edgeloop_vertex_map_get(vmap, hit->efa, (hit->lindex + 1) % nverts);
iterv1->flag = 1;
iterv2->flag = 1;
@@ -1105,7 +1105,7 @@ static int select_edgeloop(Scene *scene, Image *ima, BMEditMesh *em, NearestHit
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
a = 0;
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
- iterv1 = select_edgeloop_uv_vertex_map_get(vmap, efa, a);
+ iterv1 = uv_select_edgeloop_vertex_map_get(vmap, efa, a);
if (iterv1->flag) {
if (select) uvedit_uv_select_enable(em, scene, l, FALSE);
@@ -1124,7 +1124,7 @@ static int select_edgeloop(Scene *scene, Image *ima, BMEditMesh *em, NearestHit
/*********************** linked select ***********************/
-static void select_linked(Scene *scene, Image *ima, BMEditMesh *em, const float limit[2], NearestHit *hit, bool extend)
+static void uv_select_linked(Scene *scene, Image *ima, BMEditMesh *em, const float limit[2], NearestHit *hit, bool extend)
{
BMFace *efa;
BMLoop *l;
@@ -1328,7 +1328,7 @@ static float *uv_sel_co_from_eve(Scene *scene, Image *ima, BMEditMesh *em, BMVer
/* ******************** align operator **************** */
-static void weld_align_uv(bContext *C, int tool)
+static void uv_weld_align(bContext *C, int tool)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -1556,9 +1556,9 @@ static void weld_align_uv(bContext *C, int tool)
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
}
-static int align_exec(bContext *C, wmOperator *op)
+static int uv_align_exec(bContext *C, wmOperator *op)
{
- weld_align_uv(C, RNA_enum_get(op->ptr, "axis"));
+ uv_weld_align(C, RNA_enum_get(op->ptr, "axis"));
return OPERATOR_FINISHED;
}
@@ -1581,8 +1581,8 @@ static void UV_OT_align(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* api callbacks */
- ot->exec = align_exec;
- ot->poll = ED_operator_uvedit; /* requires space image */;
+ ot->exec = uv_align_exec;
+ ot->poll = ED_operator_uvedit;
/* properties */
RNA_def_enum(ot->srna, "axis", axis_items, 'a', "Axis", "Axis to align UV locations on");
@@ -1594,7 +1594,7 @@ typedef struct UVvert {
int weld;
} UVvert;
-static int remove_doubles_exec(bContext *C, wmOperator *op)
+static int uv_remove_doubles_exec(bContext *C, wmOperator *op)
{
const float threshold = RNA_float_get(op->ptr, "threshold");
const int use_unselected = RNA_boolean_get(op->ptr, "use_unselected");
@@ -1745,7 +1745,7 @@ static void UV_OT_remove_doubles(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* api callbacks */
- ot->exec = remove_doubles_exec;
+ ot->exec = uv_remove_doubles_exec;
ot->poll = ED_operator_uvedit;
RNA_def_float(ot->srna, "threshold", 0.02f, 0.0f, 10.0f,
@@ -1754,9 +1754,9 @@ static void UV_OT_remove_doubles(wmOperatorType *ot)
}
/* ******************** weld operator **************** */
-static int weld_exec(bContext *C, wmOperator *UNUSED(op))
+static int uv_weld_exec(bContext *C, wmOperator *UNUSED(op))
{
- weld_align_uv(C, 'w');
+ uv_weld_align(C, 'w');
return OPERATOR_FINISHED;
}
@@ -1770,14 +1770,14 @@ static void UV_OT_weld(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* api callbacks */
- ot->exec = weld_exec;
+ ot->exec = uv_weld_exec;
ot->poll = ED_operator_uvedit;
}
/* ******************** (de)select all operator **************** */
-static void select_all_perform(Scene *scene, Image *ima, BMEditMesh *em, int action)
+static void uv_select_all_perform(Scene *scene, Image *ima, BMEditMesh *em, int action)
{
ToolSettings *ts = scene->toolsettings;
BMFace *efa;
@@ -1853,7 +1853,7 @@ static void select_all_perform(Scene *scene, Image *ima, BMEditMesh *em, int act
}
}
-static int select_all_exec(bContext *C, wmOperator *op)
+static int uv_select_all_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Object *obedit = CTX_data_edit_object(C);
@@ -1862,7 +1862,7 @@ static int select_all_exec(bContext *C, wmOperator *op)
int action = RNA_enum_get(op->ptr, "action");
- select_all_perform(scene, ima, em, action);
+ uv_select_all_perform(scene, ima, em, action);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
@@ -1878,7 +1878,7 @@ static void UV_OT_select_all(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* api callbacks */
- ot->exec = select_all_exec;
+ ot->exec = uv_select_all_exec;
ot->poll = ED_operator_uvedit;
WM_operator_properties_select_all(ot);
@@ -1886,30 +1886,30 @@ static void UV_OT_select_all(wmOperatorType *ot)
/* ******************** mouse select operator **************** */
-static int sticky_select(float *limit, int hitv[4], int v, float *hituv[4], float *uv, int sticky, int hitlen)
+static bool uv_sticky_select(float *limit, int hitv[4], int v, float *hituv[4], float *uv, int sticky, int hitlen)
{
int i;
/* this function test if some vertex needs to selected
* in addition to the existing ones due to sticky select */
if (sticky == SI_STICKY_DISABLE)
- return 0;
+ return false;
for (i = 0; i < hitlen; i++) {
if (hitv[i] == v) {
if (sticky == SI_STICKY_LOC) {
if (fabsf(hituv[i][0] - uv[0]) < limit[0] && fabsf(hituv[i][1] - uv[1]) < limit[1])
- return 1;
+ return true;
}
else if (sticky == SI_STICKY_VERTEX)
- return 1;
+ return true;
}
}
- return 0;
+ return false;
}
-static int mouse_select(bContext *C, const float co[2], bool extend, bool loop)
+static int uv_mouse_select(bContext *C, const float co[2], bool extend, bool loop)
{
SpaceImage *sima = CTX_wm_space_image(C);
Scene *scene = CTX_data_scene(C);
@@ -2017,7 +2017,7 @@ static int mouse_select(bContext *C, const float co[2], bool extend, bool loop)
}
else if (selectmode == UV_SELECT_FACE) {
/* find face */
- find_nearest_uv_face(scene, ima, em, co, &hit);
+ uv_find_nearest_face(scene, ima, em, co, &hit);
if (hit.efa == NULL) {
BLI_array_free(hitv);
BLI_array_free(hituv);
@@ -2061,10 +2061,10 @@ static int mouse_select(bContext *C, const float co[2], bool extend, bool loop)
/* do selection */
if (loop) {
- flush = select_edgeloop(scene, ima, em, &hit, limit, extend);
+ flush = uv_select_edgeloop(scene, ima, em, &hit, limit, extend);
}
else if (selectmode == UV_SELECT_ISLAND) {
- select_linked(scene, ima, em, limit, &hit, extend);
+ uv_select_linked(scene, ima, em, limit, &hit, extend);
}
else if (extend) {
if (selectmode == UV_SELECT_VERTEX) {
@@ -2125,7 +2125,7 @@ static int mouse_select(bContext *C, const float co[2], bool extend, bool loop)
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
- if (sticky_select(limit, hitv, BM_elem_index_get(l->v), hituv, luv->uv, sticky, hitlen))
+ if (uv_sticky_select(limit, hitv, BM_elem_index_get(l->v), hituv, luv->uv, sticky, hitlen))
uvedit_uv_select_disable(em, scene, l);
}
}
@@ -2140,7 +2140,7 @@ static int mouse_select(bContext *C, const float co[2], bool extend, bool loop)
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
- if (sticky_select(limit, hitv, BM_elem_index_get(l->v), hituv, luv->uv, sticky, hitlen))
+ if (uv_sticky_select(limit, hitv, BM_elem_index_get(l->v), hituv, luv->uv, sticky, hitlen))
uvedit_uv_select_enable(em, scene, l, FALSE);
}
}
@@ -2151,7 +2151,7 @@ static int mouse_select(bContext *C, const float co[2], bool extend, bool loop)
}
else {
/* deselect all */
- select_all_perform(scene, ima, em, SEL_DESELECT);
+ uv_select_all_perform(scene, ima, em, SEL_DESELECT);
if (selectmode == UV_SELECT_VERTEX) {
/* select vertex */
@@ -2179,7 +2179,7 @@ static int mouse_select(bContext *C, const float co[2], bool extend, bool loop)
if (sticky == SI_STICKY_DISABLE) continue;
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
- if (sticky_select(limit, hitv, BM_elem_index_get(l->v), hituv, luv->uv, sticky, hitlen))
+ if (uv_sticky_select(limit, hitv, BM_elem_index_get(l->v), hituv, luv->uv, sticky, hitlen))
uvedit_uv_select_enable(em, scene, l, FALSE);
flush = 1;
@@ -2224,7 +2224,7 @@ static int mouse_select(bContext *C, const float co[2], bool extend, bool loop)
return OPERATOR_PASS_THROUGH | OPERATOR_FINISHED;
}
-static int select_exec(bContext *C, wmOperator *op)
+static int uv_select_exec(bContext *C, wmOperator *op)
{
float co[2];
bool extend, loop;
@@ -2233,10 +2233,10 @@ static int select_exec(bContext *C, wmOperator *op)
extend = RNA_boolean_get(op->ptr, "extend");
loop = false;
- return mouse_select(C, co, extend, loop);
+ return uv_mouse_select(C, co, extend, loop);
}
-static int select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
+static int uv_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
float co[2];
@@ -2244,7 +2244,7 @@ static int select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
RNA_float_set_array(op->ptr, "location", co);
- return select_exec(C, op);
+ return uv_select_exec(C, op);
}
static void UV_OT_select(wmOperatorType *ot)
@@ -2256,8 +2256,8 @@ static void UV_OT_select(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO;
/* api callbacks */
- ot->exec = select_exec;
- ot->invoke = select_invoke;
+ ot->exec = uv_select_exec;
+ ot->invoke = uv_select_invoke;
ot->poll = ED_operator_uvedit; /* requires space image */;
/* properties */
@@ -2269,7 +2269,7 @@ static void UV_OT_select(wmOperatorType *ot)
/* ******************** loop select operator **************** */
-static int select_loop_exec(bContext *C, wmOperator *op)
+static int uv_select_loop_exec(bContext *C, wmOperator *op)
{
float co[2];
bool extend, loop;
@@ -2278,10 +2278,10 @@ static int select_loop_exec(bContext *C, wmOperator *op)
extend = RNA_boolean_get(op->ptr, "extend");
loop = true;
- return mouse_select(C, co, extend, loop);
+ return uv_mouse_select(C, co, extend, loop);
}
-static int select_loop_invoke(bContext *C, wmOperator *op, const wmEvent *event)
+static int uv_select_loop_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
float co[2];
@@ -2289,7 +2289,7 @@ static int select_loop_invoke(bContext *C, wmOperator *op, const wmEvent *event)
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
RNA_float_set_array(op->ptr, "location", co);
- return select_loop_exec(C, op);
+ return uv_select_loop_exec(C, op);
}
static void UV_OT_select_loop(wmOperatorType *ot)
@@ -2301,8 +2301,8 @@ static void UV_OT_select_loop(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO;
/* api callbacks */
- ot->exec = select_loop_exec;
- ot->invoke = select_loop_invoke;
+ ot->exec = uv_select_loop_exec;
+ ot->invoke = uv_select_loop_invoke;
ot->poll = ED_operator_uvedit; /* requires space image */;
/* properties */
@@ -2314,7 +2314,7 @@ static void UV_OT_select_loop(wmOperatorType *ot)
/* ******************** linked select operator **************** */
-static int select_linked_internal(bContext *C, wmOperator *op, const wmEvent *event, int pick)
+static int uv_select_linked_internal(bContext *C, wmOperator *op, const wmEvent *event, int pick)
{
SpaceImage *sima = CTX_wm_space_image(C);
Scene *scene = CTX_data_scene(C);
@@ -2354,7 +2354,7 @@ static int select_linked_internal(bContext *C, wmOperator *op, const wmEvent *ev
hit_p = &hit;
}
- select_linked(scene, ima, em, limit, hit_p, extend);
+ uv_select_linked(scene, ima, em, limit, hit_p, extend);
DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
@@ -2362,9 +2362,9 @@ static int select_linked_internal(bContext *C, wmOperator *op, const wmEvent *ev
return OPERATOR_FINISHED;
}
-static int select_linked_exec(bContext *C, wmOperator *op)
+static int uv_select_linked_exec(bContext *C, wmOperator *op)
{
- return select_linked_internal(C, op, NULL, 0);
+ return uv_select_linked_internal(C, op, NULL, 0);
}
static void UV_OT_select_linked(wmOperatorType *ot)
@@ -2376,7 +2376,7 @@ static void UV_OT_select_linked(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* api callbacks */
- ot->exec = select_linked_exec;
+ ot->exec = uv_select_linked_exec;
ot->poll = ED_operator_uvedit; /* requires space image */
/* properties */
@@ -2384,14 +2384,14 @@ static void UV_OT_select_linked(wmOperatorType *ot)
"Extend", "Extend selection rather than clearing the existing selection");
}
-static int select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
+static int uv_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- return select_linked_internal(C, op, event, 1);
+ return uv_select_linked_internal(C, op, event, 1);
}
-static int select_linked_pick_exec(bContext *C, wmOperator *op)
+static int uv_select_linked_pick_exec(bContext *C, wmOperator *op)
{
- return select_linked_internal(C, op, NULL, 1);
+ return uv_select_linked_internal(C, op, NULL, 1);
}
static void UV_OT_select_linked_pick(wmOperatorType *ot)
@@ -2403,8 +2403,8 @@ static void UV_OT_select_linked_pick(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO;
/* api callbacks */
- ot->invoke = select_linked_pick_invoke;
- ot->exec = select_linked_pick_exec;
+ ot->invoke = uv_select_linked_pick_invoke;
+ ot->exec = uv_select_linked_pick_exec;
ot->poll = ED_operator_uvedit; /* requires space image */;
/* properties */
@@ -2417,9 +2417,9 @@ static void UV_OT_select_linked_pick(wmOperatorType *ot)
/* note: this is based on similar use case to MESH_OT_split(), which has a similar effect
* but in this case they are not joined to begin with (only having the behavior of being joined)
- * so its best to call this select_split() instead of just split(), but assigned to the same key
+ * so its best to call this uv_select_split() instead of just split(), but assigned to the same key
* as MESH_OT_split - Campbell */
-static int select_split_exec(bContext *C, wmOperator *op)
+static int uv_select_split_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
ToolSettings *ts = scene->toolsettings;
@@ -2498,13 +2498,13 @@ static void UV_OT_select_split(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* api callbacks */
- ot->exec = select_split_exec;
+ ot->exec = uv_select_split_exec;
ot->poll = ED_operator_uvedit; /* requires space image */;
}
/* ******************** unlink selection operator **************** */
-static int unlink_selection_exec(bContext *C, wmOperator *op)
+static int uv_unlink_selection_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
ToolSettings *ts = scene->toolsettings;
@@ -2564,7 +2564,7 @@ static void UV_OT_unlink_selected(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* api callbacks */
- ot->exec = unlink_selection_exec;
+ ot->exec = uv_unlink_selection_exec;
ot->poll = ED_operator_uvedit;
}
@@ -2725,7 +2725,7 @@ static void uv_faces_do_sticky(SpaceImage *sima, Scene *scene, Object *obedit, s
}
}
-static int border_select_exec(bContext *C, wmOperator *op)
+static int uv_border_select_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima = CTX_wm_space_image(C);
Scene *scene = CTX_data_scene(C);
@@ -2761,7 +2761,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
extend = RNA_boolean_get(op->ptr, "extend");
if (!extend)
- select_all_perform(scene, ima, em, SEL_DESELECT);
+ uv_select_all_perform(scene, ima, em, SEL_DESELECT);
/* do actual selection */
if (use_face_center && !pinned) {
@@ -2840,9 +2840,9 @@ static void UV_OT_select_border(wmOperatorType *ot)
/* api callbacks */
ot->invoke = WM_border_select_invoke;
- ot->exec = border_select_exec;
+ ot->exec = uv_border_select_exec;
ot->modal = WM_border_select_modal;
- ot->poll = ED_operator_uvedit; /* requires space image */;
+ ot->poll = ED_operator_uvedit_space_image; /* requires space image */;
ot->cancel = WM_border_select_cancel;
/* flags */
@@ -2865,7 +2865,7 @@ static int uv_inside_circle(const float uv[2], const float offset[2], const floa
return ((x * x + y * y) < 1.0f);
}
-static int select_uv_inside_ellipse(BMEditMesh *em, Scene *scene, const int select,
+static int uv_select_inside_ellipse(BMEditMesh *em, Scene *scene, const int select,
const float offset[2], const float ellipse[2], BMLoop *l, MLoopUV *luv)
{
if (uv_inside_circle(luv->uv, offset, ellipse)) {
@@ -2878,7 +2878,7 @@ static int select_uv_inside_ellipse(BMEditMesh *em, Scene *scene, const int sele
}
}
-static int circle_select_exec(bContext *C, wmOperator *op)
+static int uv_circle_select_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima = CTX_wm_space_image(C);
Scene *scene = CTX_data_scene(C);
@@ -2941,7 +2941,7 @@ static int circle_select_exec(bContext *C, wmOperator *op)
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
- change |= select_uv_inside_ellipse(em, scene, select, offset, ellipse, l, luv);
+ change |= uv_select_inside_ellipse(em, scene, select, offset, ellipse, l, luv);
}
}
}
@@ -2965,8 +2965,8 @@ static void UV_OT_circle_select(wmOperatorType *ot)
/* api callbacks */
ot->invoke = WM_gesture_circle_invoke;
ot->modal = WM_gesture_circle_modal;
- ot->exec = circle_select_exec;
- ot->poll = ED_operator_uvedit; /* requires space image */;
+ ot->exec = uv_circle_select_exec;
+ ot->poll = ED_operator_uvedit_space_image; /* requires space image */;
ot->cancel = WM_gesture_circle_cancel;
/* flags */
@@ -3095,7 +3095,7 @@ static void UV_OT_select_lasso(wmOperatorType *ot)
ot->invoke = WM_gesture_lasso_invoke;
ot->modal = WM_gesture_lasso_modal;
ot->exec = uv_lasso_select_exec;
- ot->poll = ED_operator_uvedit;
+ ot->poll = ED_operator_uvedit_space_image;
ot->cancel = WM_gesture_lasso_cancel;
/* flags */
@@ -3110,26 +3110,26 @@ static void UV_OT_select_lasso(wmOperatorType *ot)
/* ******************** snap cursor operator **************** */
-static void snap_uv_to_pixel(float uvco[2], float w, float h)
+static void uv_snap_to_pixel(float uvco[2], float w, float h)
{
uvco[0] = ((float)((int)((uvco[0] * w) + 0.5f))) / w;
uvco[1] = ((float)((int)((uvco[1] * h) + 0.5f))) / h;
}
-static void snap_cursor_to_pixels(SpaceImage *sima)
+static void uv_snap_cursor_to_pixels(SpaceImage *sima)
{
int width = 0, height = 0;
ED_space_image_get_size(sima, &width, &height);
- snap_uv_to_pixel(sima->cursor, width, height);
+ uv_snap_to_pixel(sima->cursor, width, height);
}
-static int snap_cursor_to_selection(Scene *scene, Image *ima, Object *obedit, SpaceImage *sima)
+static int uv_snap_cursor_to_selection(Scene *scene, Image *ima, Object *obedit, SpaceImage *sima)
{
return uvedit_center(scene, ima, obedit, sima->cursor, sima->around);
}
-static int snap_cursor_exec(bContext *C, wmOperator *op)
+static int uv_snap_cursor_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima = CTX_wm_space_image(C);
Scene *scene = CTX_data_scene(C);
@@ -3139,11 +3139,11 @@ static int snap_cursor_exec(bContext *C, wmOperator *op)
switch (RNA_enum_get(op->ptr, "target")) {
case 0:
- snap_cursor_to_pixels(sima);
+ uv_snap_cursor_to_pixels(sima);
change = 1;
break;
case 1:
- change = snap_cursor_to_selection(scene, ima, obedit, sima);
+ change = uv_snap_cursor_to_selection(scene, ima, obedit, sima);
break;
}
@@ -3169,8 +3169,8 @@ static void UV_OT_snap_cursor(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* api callbacks */
- ot->exec = snap_cursor_exec;
- ot->poll = ED_operator_uvedit; /* requires space image */;
+ ot->exec = uv_snap_cursor_exec;
+ ot->poll = ED_operator_uvedit_space_image; /* requires space image */;
/* properties */
RNA_def_enum(ot->srna, "target", target_items, 0, "Target", "Target to snap the selected UVs to");
@@ -3178,7 +3178,7 @@ static void UV_OT_snap_cursor(wmOperatorType *ot)
/* ******************** snap selection operator **************** */
-static int snap_uvs_to_cursor(Scene *scene, Image *ima, Object *obedit, SpaceImage *sima)
+static int uv_snap_uvs_to_cursor(Scene *scene, Image *ima, Object *obedit, SpaceImage *sima)
{
BMEditMesh *em = BMEdit_FromObject(obedit);
BMFace *efa;
@@ -3208,7 +3208,7 @@ static int snap_uvs_to_cursor(Scene *scene, Image *ima, Object *obedit, SpaceIma
return change;
}
-static int snap_uvs_to_adjacent_unselected(Scene *scene, Image *ima, Object *obedit)
+static int uv_snap_uvs_to_adjacent_unselected(Scene *scene, Image *ima, Object *obedit)
{
BMEditMesh *em = BMEdit_FromObject(obedit);
BMesh *bm = em->bm;
@@ -3266,7 +3266,7 @@ static int snap_uvs_to_adjacent_unselected(Scene *scene, Image *ima, Object *obe
return change;
}
-static int snap_uvs_to_pixels(SpaceImage *sima, Scene *scene, Object *obedit)
+static int uv_snap_uvs_to_pixels(SpaceImage *sima, Scene *scene, Object *obedit)
{
BMEditMesh *em = BMEdit_FromObject(obedit);
Image *ima = sima->image;
@@ -3294,7 +3294,7 @@ static int snap_uvs_to_pixels(SpaceImage *sima, Scene *scene, Object *obedit)
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
if (uvedit_uv_select_test(em, scene, l)) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
- snap_uv_to_pixel(luv->uv, w, h);
+ uv_snap_to_pixel(luv->uv, w, h);
}
}
@@ -3304,7 +3304,7 @@ static int snap_uvs_to_pixels(SpaceImage *sima, Scene *scene, Object *obedit)
return change;
}
-static int snap_selection_exec(bContext *C, wmOperator *op)
+static int uv_snap_selection_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima = CTX_wm_space_image(C);
Scene *scene = CTX_data_scene(C);
@@ -3314,13 +3314,13 @@ static int snap_selection_exec(bContext *C, wmOperator *op)
switch (RNA_enum_get(op->ptr, "target")) {
case 0:
- change = snap_uvs_to_pixels(sima, scene, obedit);
+ change = uv_snap_uvs_to_pixels(sima, scene, obedit);
break;
case 1:
- change = snap_uvs_to_cursor(scene, ima, obedit, sima);
+ change = uv_snap_uvs_to_cursor(scene, ima, obedit, sima);
break;
case 2:
- change = snap_uvs_to_adjacent_unselected(scene, ima, obedit);
+ change = uv_snap_uvs_to_adjacent_unselected(scene, ima, obedit);
break;
}
@@ -3349,8 +3349,8 @@ static void UV_OT_snap_selected(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* api callbacks */
- ot->exec = snap_selection_exec;
- ot->poll = ED_operator_uvedit; /* requires space image */;
+ ot->exec = uv_snap_selection_exec;
+ ot->poll = ED_operator_uvedit_space_image;
/* properties */
RNA_def_enum(ot->srna, "target", target_items, 0, "Target", "Target to snap the selected UVs to");
@@ -3358,7 +3358,7 @@ static void UV_OT_snap_selected(wmOperatorType *ot)
/* ******************** pin operator **************** */
-static int pin_exec(bContext *C, wmOperator *op)
+static int uv_pin_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Object *obedit = CTX_data_edit_object(C);
@@ -3407,7 +3407,7 @@ static void UV_OT_pin(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* api callbacks */
- ot->exec = pin_exec;
+ ot->exec = uv_pin_exec;
ot->poll = ED_operator_uvedit;
/* properties */
@@ -3416,7 +3416,7 @@ static void UV_OT_pin(wmOperatorType *ot)
/******************* select pinned operator ***************/
-static int select_pinned_exec(bContext *C, wmOperator *UNUSED(op))
+static int uv_select_pinned_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
Object *obedit = CTX_data_edit_object(C);
@@ -3458,7 +3458,7 @@ static void UV_OT_select_pinned(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* api callbacks */
- ot->exec = select_pinned_exec;
+ ot->exec = uv_select_pinned_exec;
ot->poll = ED_operator_uvedit;
}
@@ -3487,7 +3487,7 @@ static int bm_face_is_all_uv_sel(BMFace *f, bool select_test,
return TRUE;
}
-static int hide_exec(bContext *C, wmOperator *op)
+static int uv_hide_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima = CTX_wm_space_image(C);
Object *obedit = CTX_data_edit_object(C);
@@ -3594,7 +3594,7 @@ static void UV_OT_hide(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* api callbacks */
- ot->exec = hide_exec;
+ ot->exec = uv_hide_exec;
ot->poll = ED_operator_uvedit;
/* props */
@@ -3603,7 +3603,7 @@ static void UV_OT_hide(wmOperatorType *ot)
/****************** reveal operator ******************/
-static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
+static int uv_reveal_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceImage *sima = CTX_wm_space_image(C);
Object *obedit = CTX_data_edit_object(C);
@@ -3728,13 +3728,13 @@ static void UV_OT_reveal(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* api callbacks */
- ot->exec = reveal_exec;
+ ot->exec = uv_reveal_exec;
ot->poll = ED_operator_uvedit;
}
/******************** set 3d cursor operator ********************/
-static int set_2d_cursor_exec(bContext *C, wmOperator *op)
+static int uv_set_2d_cursor_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima = CTX_wm_space_image(C);
@@ -3748,7 +3748,7 @@ static int set_2d_cursor_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int set_2d_cursor_invoke(bContext *C, wmOperator *op, const wmEvent *event)
+static int uv_set_2d_cursor_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
float location[2];
@@ -3756,7 +3756,7 @@ static int set_2d_cursor_invoke(bContext *C, wmOperator *op, const wmEvent *even
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &location[0], &location[1]);
RNA_float_set_array(op->ptr, "location", location);
- return set_2d_cursor_exec(C, op);
+ return uv_set_2d_cursor_exec(C, op);
}
static void UV_OT_cursor_set(wmOperatorType *ot)
@@ -3767,9 +3767,9 @@ static void UV_OT_cursor_set(wmOperatorType *ot)
ot->idname = "UV_OT_cursor_set";
/* api callbacks */
- ot->exec = set_2d_cursor_exec;
- ot->invoke = set_2d_cursor_invoke;
- ot->poll = ED_operator_uvedit; /* requires space image */;
+ ot->exec = uv_set_2d_cursor_exec;
+ ot->invoke = uv_set_2d_cursor_invoke;
+ ot->poll = ED_operator_uvedit_space_image;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -3836,7 +3836,7 @@ static void UV_OT_tile_set(wmOperatorType *ot)
/* api callbacks */
ot->exec = set_tile_exec;
ot->invoke = set_tile_invoke;
- ot->poll = ED_operator_image_active; /* requires space image */;
+ ot->poll = ED_operator_image_active;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -3846,7 +3846,7 @@ static void UV_OT_tile_set(wmOperatorType *ot)
}
-static int seams_from_islands_exec(bContext *C, wmOperator *op)
+static int uv_seams_from_islands_exec(bContext *C, wmOperator *op)
{
UvVertMap *vmap;
Object *ob = CTX_data_edit_object(C);
@@ -3967,14 +3967,14 @@ static void UV_OT_seams_from_islands(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* api callbacks */
- ot->exec = seams_from_islands_exec;
+ ot->exec = uv_seams_from_islands_exec;
ot->poll = ED_operator_uvedit;
RNA_def_boolean(ot->srna, "mark_seams", 1, "Mark Seams", "Mark boundary edges as seams");
RNA_def_boolean(ot->srna, "mark_sharp", 0, "Mark Sharp", "Mark boundary edges as sharp");
}
-static int mark_seam_exec(bContext *C, wmOperator *UNUSED(op))
+static int uv_mark_seam_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob = CTX_data_edit_object(C);
Scene *scene = CTX_data_scene(C);
@@ -4016,7 +4016,7 @@ static void UV_OT_mark_seam(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* api callbacks */
- ot->exec = mark_seam_exec;
+ ot->exec = uv_mark_seam_exec;
ot->poll = ED_operator_uvedit;
}