diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-03-13 10:06:05 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-03-13 10:07:10 +0300 |
commit | 3106f18176f49a3b388e8e1f587d46d232a4a35e (patch) | |
tree | 92a1dffc343d329ab06376442c1fc5cefc0d2d5a /source/blender/editors | |
parent | 17793a66c684aa86559de90d4cb5af7e65a06f66 (diff) |
Cleanup: long lines, use doxy sections
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/include/ED_uvedit.h | 86 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_ops.c | 325 |
2 files changed, 294 insertions, 117 deletions
diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h index 354a9655a48..d2d4732eedb 100644 --- a/source/blender/editors/include/ED_uvedit.h +++ b/source/blender/editors/include/ED_uvedit.h @@ -49,48 +49,63 @@ struct wmKeyConfig; void ED_operatortypes_uvedit(void); void ED_keymap_uvedit(struct wmKeyConfig *keyconf); -void ED_uvedit_assign_image(struct Main *bmain, struct Scene *scene, struct Object *obedit, struct Image *ima, struct Image *previma); +void ED_uvedit_assign_image( + struct Main *bmain, struct Scene *scene, struct Object *obedit, struct Image *ima, struct Image *previma); bool ED_uvedit_minmax(struct Scene *scene, struct Image *ima, struct Object *obedit, float min[2], float max[2]); void ED_uvedit_select_all(struct BMesh *bm); -bool ED_object_get_active_image(struct Object *ob, int mat_nr, - struct Image **r_ima, struct ImageUser **r_iuser, struct bNode **r_node, struct bNodeTree **r_ntree); +bool ED_object_get_active_image( + struct Object *ob, int mat_nr, + struct Image **r_ima, struct ImageUser **r_iuser, struct bNode **r_node, struct bNodeTree **r_ntree); void ED_object_assign_active_image(struct Main *bmain, struct Object *ob, int mat_nr, struct Image *ima); bool ED_uvedit_test(struct Object *obedit); /* visibility and selection */ bool uvedit_face_visible_test(struct Scene *scene, struct Image *ima, struct BMFace *efa, struct MTexPoly *tf); -bool uvedit_face_select_test(struct Scene *scene, struct BMFace *efa, - const int cd_loop_uv_offset); -bool uvedit_edge_select_test(struct Scene *scene, struct BMLoop *l, - const int cd_loop_uv_offset); -bool uvedit_uv_select_test(struct Scene *scene, struct BMLoop *l, - const int cd_loop_uv_offset); +bool uvedit_face_select_test( + struct Scene *scene, struct BMFace *efa, + const int cd_loop_uv_offset); +bool uvedit_edge_select_test( + struct Scene *scene, struct BMLoop *l, + const int cd_loop_uv_offset); +bool uvedit_uv_select_test( + struct Scene *scene, struct BMLoop *l, + const int cd_loop_uv_offset); /* uv face */ -bool uvedit_face_select_set(struct Scene *scene, struct BMEditMesh *em, struct BMFace *efa, const bool select, - const bool do_history, const int cd_loop_uv_offset); -bool uvedit_face_select_enable(struct Scene *scene, struct BMEditMesh *em, struct BMFace *efa, - const bool do_history, const int cd_loop_uv_offset); -bool uvedit_face_select_disable(struct Scene *scene, struct BMEditMesh *em, struct BMFace *efa, - const int cd_loop_uv_offset); +bool uvedit_face_select_set( + struct Scene *scene, struct BMEditMesh *em, struct BMFace *efa, const bool select, + const bool do_history, const int cd_loop_uv_offset); +bool uvedit_face_select_enable( + struct Scene *scene, struct BMEditMesh *em, struct BMFace *efa, + const bool do_history, const int cd_loop_uv_offset); +bool uvedit_face_select_disable( + struct Scene *scene, struct BMEditMesh *em, struct BMFace *efa, + const int cd_loop_uv_offset); /* uv edge */ -void uvedit_edge_select_set(struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l, const bool select, - const bool do_history, const int cd_loop_uv_offset); -void uvedit_edge_select_enable(struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l, - const bool do_history, const int cd_loop_uv_offset); -void uvedit_edge_select_disable(struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l, - const int cd_loop_uv_offset); +void uvedit_edge_select_set( + struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l, const bool select, + const bool do_history, const int cd_loop_uv_offset); +void uvedit_edge_select_enable( + struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l, + const bool do_history, const int cd_loop_uv_offset); +void uvedit_edge_select_disable( + struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l, + const int cd_loop_uv_offset); /* uv vert */ -void uvedit_uv_select_set(struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l, const bool select, - const bool do_history, const int cd_loop_uv_offset); -void uvedit_uv_select_enable(struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l, - const bool do_history, const int cd_loop_uv_offset); -void uvedit_uv_select_disable(struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l, - const int cd_loop_uv_offset); - -bool ED_uvedit_nearest_uv(struct Scene *scene, struct Object *obedit, struct Image *ima, - const float co[2], float r_uv[2]); +void uvedit_uv_select_set( + struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l, const bool select, + const bool do_history, const int cd_loop_uv_offset); +void uvedit_uv_select_enable( + struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l, + const bool do_history, const int cd_loop_uv_offset); +void uvedit_uv_select_disable( + struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l, + const int cd_loop_uv_offset); + +bool ED_uvedit_nearest_uv( + struct Scene *scene, struct Object *obedit, struct Image *ima, + const float co[2], float r_uv[2]); void ED_uvedit_get_aspect(struct Scene *scene, struct Object *ob, struct BMesh *em, float *aspx, float *aspy); @@ -100,7 +115,9 @@ void ED_uvedit_live_unwrap_re_solve(void); void ED_uvedit_live_unwrap_end(short cancel); void ED_uvedit_live_unwrap(struct Scene *scene, struct Object *obedit); -void ED_uvedit_pack_islands(struct Scene *scene, struct Object *ob, struct BMesh *bm, bool selected, bool correct_aspect, bool do_rotate); +void ED_uvedit_pack_islands( + struct Scene *scene, struct Object *ob, struct BMesh *bm, + bool selected, bool correct_aspect, bool do_rotate); void ED_uvedit_unwrap_cube_project( struct BMesh *bm, float cube_size, bool use_select, const float center[3]); @@ -109,8 +126,11 @@ void ED_unwrap_lscm(struct Scene *scene, struct Object *obedit, const short sel) /* uvedit_draw.c */ -void ED_image_draw_cursor(struct ARegion *ar, const float cursor[2]); -void ED_uvedit_draw_main(struct SpaceImage *sima, struct ARegion *ar, struct Scene *scene, struct Object *obedit, struct Object *obact); +void ED_image_draw_cursor( + struct ARegion *ar, const float cursor[2]); +void ED_uvedit_draw_main( + struct SpaceImage *sima, struct ARegion *ar, struct Scene *scene, + struct Object *obedit, struct Object *obact); /* uvedit_buttons.c */ void ED_uvedit_buttons_register(struct ARegionType *art); diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index c0e9b0d1404..3ab2274f82e 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -29,7 +29,6 @@ * \ingroup eduv */ - #include <stdlib.h> #include <string.h> #include <math.h> @@ -92,7 +91,9 @@ static void uv_select_all_perform(Scene *scene, Image *ima, BMEditMesh *em, int static void uv_select_flush_from_tag_face(SpaceImage *sima, Scene *scene, Object *obedit, const bool select); static void uv_select_flush_from_tag_loop(SpaceImage *sima, Scene *scene, Object *obedit, const bool select); -/************************* state testing ************************/ +/* -------------------------------------------------------------------- */ +/** \name State Testing + * \{ */ bool ED_uvedit_test(Object *obedit) { @@ -133,15 +134,21 @@ static int UNUSED_FUNCTION(ED_operator_uvmap_mesh) (bContext *C) return 0; } -/**************************** object active image *****************************/ + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Object Active Image + * \{ */ static bool is_image_texture_node(bNode *node) { return ELEM(node->type, SH_NODE_TEX_IMAGE, SH_NODE_TEX_ENVIRONMENT); } -bool ED_object_get_active_image(Object *ob, int mat_nr, - Image **r_ima, ImageUser **r_iuser, bNode **r_node, bNodeTree **r_ntree) +bool ED_object_get_active_image( + Object *ob, int mat_nr, + Image **r_ima, ImageUser **r_iuser, bNode **r_node, bNodeTree **r_ntree) { Material *ma = give_current_material(ob, mat_nr); bNodeTree *ntree = (ma && ma->use_nodes) ? ma->nodetree : NULL; @@ -174,7 +181,11 @@ void ED_object_assign_active_image(Main *bmain, Object *ob, int mat_nr, Image *i } } -/************************* assign image ************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Assign Image + * \{ */ //#define USE_SWITCH_ASPECT @@ -316,7 +327,11 @@ static bool uvedit_set_tile(Object *obedit, Image *ima, int curtile) return true; } -/*********************** space conversion *********************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Space Conversion + * \{ */ static void uvedit_pixel_to_float(SpaceImage *sima, float *dist, float pixeldist) { @@ -334,7 +349,11 @@ static void uvedit_pixel_to_float(SpaceImage *sima, float *dist, float pixeldist dist[1] = pixeldist / height; } -/*************** visibility and selection utilities **************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Visibility and Selection Utilities + * \{ */ static void uvedit_vertex_select_tagged(BMEditMesh *em, Scene *scene, bool select, int cd_loop_uv_offset) { @@ -371,8 +390,9 @@ bool uvedit_face_visible_test(Scene *scene, Image *ima, BMFace *efa, MTexPoly *t return uvedit_face_visible_nolocal(scene, efa); } -bool uvedit_face_select_test(Scene *scene, BMFace *efa, - const int cd_loop_uv_offset) +bool uvedit_face_select_test( + Scene *scene, BMFace *efa, + const int cd_loop_uv_offset) { ToolSettings *ts = scene->toolsettings; if (ts->uv_flag & UV_SYNC_SELECTION) { @@ -393,8 +413,9 @@ bool uvedit_face_select_test(Scene *scene, BMFace *efa, } } -bool uvedit_face_select_set(struct Scene *scene, struct BMEditMesh *em, struct BMFace *efa, const bool select, - const bool do_history, const int cd_loop_uv_offset) +bool uvedit_face_select_set( + struct Scene *scene, struct BMEditMesh *em, struct BMFace *efa, const bool select, + const bool do_history, const int cd_loop_uv_offset) { if (select) { return uvedit_face_select_enable(scene, em, efa, do_history, cd_loop_uv_offset); @@ -404,8 +425,9 @@ bool uvedit_face_select_set(struct Scene *scene, struct BMEditMesh *em, struct B } } -bool uvedit_face_select_enable(Scene *scene, BMEditMesh *em, BMFace *efa, const bool do_history, - const int cd_loop_uv_offset) +bool uvedit_face_select_enable( + Scene *scene, BMEditMesh *em, BMFace *efa, const bool do_history, + const int cd_loop_uv_offset) { ToolSettings *ts = scene->toolsettings; @@ -431,8 +453,9 @@ bool uvedit_face_select_enable(Scene *scene, BMEditMesh *em, BMFace *efa, const return false; } -bool uvedit_face_select_disable(Scene *scene, BMEditMesh *em, BMFace *efa, - const int cd_loop_uv_offset) +bool uvedit_face_select_disable( + Scene *scene, BMEditMesh *em, BMFace *efa, + const int cd_loop_uv_offset) { ToolSettings *ts = scene->toolsettings; @@ -455,8 +478,9 @@ bool uvedit_face_select_disable(Scene *scene, BMEditMesh *em, BMFace *efa, return false; } -bool uvedit_edge_select_test(Scene *scene, BMLoop *l, - const int cd_loop_uv_offset) +bool uvedit_edge_select_test( + Scene *scene, BMLoop *l, + const int cd_loop_uv_offset) { ToolSettings *ts = scene->toolsettings; @@ -482,8 +506,9 @@ bool uvedit_edge_select_test(Scene *scene, BMLoop *l, } } -void uvedit_edge_select_set(BMEditMesh *em, Scene *scene, BMLoop *l, const bool select, - const bool do_history, const int cd_loop_uv_offset) +void uvedit_edge_select_set( + BMEditMesh *em, Scene *scene, BMLoop *l, const bool select, + const bool do_history, const int cd_loop_uv_offset) { if (select) { @@ -494,8 +519,9 @@ void uvedit_edge_select_set(BMEditMesh *em, Scene *scene, BMLoop *l, const bool } } -void uvedit_edge_select_enable(BMEditMesh *em, Scene *scene, BMLoop *l, const bool do_history, - const int cd_loop_uv_offset) +void uvedit_edge_select_enable( + BMEditMesh *em, Scene *scene, BMLoop *l, const bool do_history, + const int cd_loop_uv_offset) { ToolSettings *ts = scene->toolsettings; @@ -525,8 +551,9 @@ void uvedit_edge_select_enable(BMEditMesh *em, Scene *scene, BMLoop *l, const bo } } -void uvedit_edge_select_disable(BMEditMesh *em, Scene *scene, BMLoop *l, - const int cd_loop_uv_offset) +void uvedit_edge_select_disable( + BMEditMesh *em, Scene *scene, BMLoop *l, + const int cd_loop_uv_offset) { ToolSettings *ts = scene->toolsettings; @@ -552,8 +579,9 @@ void uvedit_edge_select_disable(BMEditMesh *em, Scene *scene, BMLoop *l, } } -bool uvedit_uv_select_test(Scene *scene, BMLoop *l, - const int cd_loop_uv_offset) +bool uvedit_uv_select_test( + Scene *scene, BMLoop *l, + const int cd_loop_uv_offset) { ToolSettings *ts = scene->toolsettings; @@ -569,8 +597,9 @@ bool uvedit_uv_select_test(Scene *scene, BMLoop *l, } } -void uvedit_uv_select_set(BMEditMesh *em, Scene *scene, BMLoop *l, const bool select, - const bool do_history, const int cd_loop_uv_offset) +void uvedit_uv_select_set( + BMEditMesh *em, Scene *scene, BMLoop *l, const bool select, + const bool do_history, const int cd_loop_uv_offset) { if (select) { uvedit_uv_select_enable(em, scene, l, do_history, cd_loop_uv_offset); @@ -580,8 +609,9 @@ void uvedit_uv_select_set(BMEditMesh *em, Scene *scene, BMLoop *l, const bool se } } -void uvedit_uv_select_enable(BMEditMesh *em, Scene *scene, BMLoop *l, - const bool do_history, const int cd_loop_uv_offset) +void uvedit_uv_select_enable( + BMEditMesh *em, Scene *scene, BMLoop *l, + const bool do_history, const int cd_loop_uv_offset) { ToolSettings *ts = scene->toolsettings; @@ -601,8 +631,9 @@ void uvedit_uv_select_enable(BMEditMesh *em, Scene *scene, BMLoop *l, } } -void uvedit_uv_select_disable(BMEditMesh *em, Scene *scene, BMLoop *l, - const int cd_loop_uv_offset) +void uvedit_uv_select_disable( + BMEditMesh *em, Scene *scene, BMLoop *l, + const int cd_loop_uv_offset) { ToolSettings *ts = scene->toolsettings; @@ -618,7 +649,11 @@ void uvedit_uv_select_disable(BMEditMesh *em, Scene *scene, BMLoop *l, } } -/*********************** live unwrap utilities ***********************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Live Unwrap Utilities + * \{ */ void uvedit_live_unwrap_update(SpaceImage *sima, Scene *scene, Object *obedit) { @@ -629,7 +664,12 @@ void uvedit_live_unwrap_update(SpaceImage *sima, Scene *scene, Object *obedit) } } -/*********************** geometric utilities ***********************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Geometric Utilities + * \{ */ + void uv_poly_center(BMFace *f, float r_cent[2], const int cd_loop_uv_offset) { BMLoop *l; @@ -758,7 +798,11 @@ static bool uvedit_center(Scene *scene, Image *ima, Object *obedit, float cent[2 return changed; } -/************************** find nearest ****************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Find Nearest Elements + * \{ */ bool uv_find_nearest_edge( Scene *scene, Image *ima, BMEditMesh *em, const float co[2], @@ -849,8 +893,9 @@ bool uv_find_nearest_face( return found; } -static bool uv_nearest_between(const BMLoop *l, const float co[2], - const int cd_loop_uv_offset) +static bool uv_nearest_between( + const BMLoop *l, const float co[2], + const int cd_loop_uv_offset) { const float *uv_prev = ((MLoopUV *)BM_ELEM_CD_GET_VOID_P(l->prev, cd_loop_uv_offset))->uv; const float *uv_curr = ((MLoopUV *)BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset))->uv; @@ -968,7 +1013,11 @@ bool ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, const float return found; } -/*********************** loop select ***********************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Loop Select + * \{ */ static void uv_select_edgeloop_vertex_loop_flag(UvMapVert *first) { @@ -1156,7 +1205,11 @@ static int uv_select_edgeloop( return (select) ? 1 : -1; } -/*********************** linked select ***********************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Select Linked + * \{ */ static void uv_select_linked( Scene *scene, Image *ima, BMEditMesh *em, const float limit[2], UvNearestHit *hit_final, @@ -1377,6 +1430,12 @@ static float *uv_sel_co_from_eve(Scene *scene, Image *ima, BMEditMesh *em, BMVer return NULL; } +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Select More/Less Operator + * \{ */ + static int uv_select_more_less(bContext *C, const bool select) { Scene *scene = CTX_data_scene(C); @@ -1517,7 +1576,11 @@ static void UV_OT_select_less(wmOperatorType *ot) ot->poll = ED_operator_uvedit_space_image; } -/* ******************** align operator **************** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Weld Align Operator + * \{ */ static void uv_weld_align(bContext *C, int tool) { @@ -1629,8 +1692,10 @@ static void uv_weld_align(bContext *C, int tool) /* flush vertex tags to edges */ BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) { - BM_elem_flag_set(eed, BM_ELEM_TAG, (BM_elem_flag_test(eed->v1, BM_ELEM_TAG) && - BM_elem_flag_test(eed->v2, BM_ELEM_TAG))); + BM_elem_flag_set( + eed, BM_ELEM_TAG, + (BM_elem_flag_test(eed->v1, BM_ELEM_TAG) && + BM_elem_flag_test(eed->v2, BM_ELEM_TAG))); } /* find a vertex with only one tagged edge */ @@ -1776,7 +1841,12 @@ static void UV_OT_align(wmOperatorType *ot) /* properties */ RNA_def_enum(ot->srna, "axis", axis_items, 'a', "Axis", "Axis to align UV locations on"); } -/* ******************** weld near operator **************** */ + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Remove Doubles Operator + * \{ */ typedef struct UVvert { MLoopUV *uv_loop; @@ -1816,7 +1886,7 @@ static int uv_remove_doubles_exec(bContext *C, wmOperator *op) MLoopUV **loop_arr = NULL; BLI_array_declare(loop_arr); - /* TODO, use qsort as with MESH_OT_remove_doubles, this isn't optimal */ + /* TODO, use kd-tree as with MESH_OT_remove_doubles, this isn't optimal */ BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { tf = BM_ELEM_CD_GET_VOID_P(efa, cd_poly_tex_offset); if (!uvedit_face_visible_test(scene, ima, efa, tf)) @@ -1941,7 +2011,12 @@ static void UV_OT_remove_doubles(wmOperatorType *ot) "Merge Distance", "Maximum distance between welded vertices", 0.0f, 1.0f); RNA_def_boolean(ot->srna, "use_unselected", 0, "Unselected", "Merge selected to other unselected vertices"); } -/* ******************** weld operator **************** */ + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Weld Near Operator + * \{ */ static int uv_weld_exec(bContext *C, wmOperator *UNUSED(op)) { @@ -1963,8 +2038,11 @@ static void UV_OT_weld(wmOperatorType *ot) ot->poll = ED_operator_uvedit; } +/** \} */ -/* ******************** (de)select all operator **************** */ +/* -------------------------------------------------------------------- */ +/** \name (De)Select All Operator + * \{ */ static void uv_select_all_perform(Scene *scene, Image *ima, BMEditMesh *em, int action) { @@ -2073,7 +2151,11 @@ static void UV_OT_select_all(wmOperatorType *ot) WM_operator_properties_select_all(ot); } -/* ******************** mouse select operator **************** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Mouse Select Operator + * \{ */ static bool uv_sticky_select(float *limit, int hitv[], int v, float *hituv[], float *uv, int sticky, int hitlen) { @@ -2398,7 +2480,11 @@ static void UV_OT_select(wmOperatorType *ot) "Location", "Mouse location in normalized coordinates, 0.0 to 1.0 is within the image bounds", -100.0f, 100.0f); } -/* ******************** loop select operator **************** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Loop Select Operator + * \{ */ static int uv_select_loop_exec(bContext *C, wmOperator *op) { @@ -2443,7 +2529,11 @@ static void UV_OT_select_loop(wmOperatorType *ot) "Location", "Mouse location in normalized coordinates, 0.0 to 1.0 is within the image bounds", -100.0f, 100.0f); } -/* ******************** linked select operator **************** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Select Linked Operator + * \{ */ static int uv_select_linked_internal(bContext *C, wmOperator *op, const wmEvent *event, int pick) { @@ -2654,17 +2744,21 @@ static void uv_select_sync_flush(ToolSettings *ts, BMEditMesh *em, const short s } } - +/** \} */ /* -------------------------------------------------------------------- */ -/* Utility functions to flush the uv-selection from tags */ +/** \name Select/Tag Flushing Utils + * + * Utility functions to flush the uv-selection from tags. + * \{ */ /** * helper function for #uv_select_flush_from_tag_loop and uv_select_flush_from_tag_face */ -static void uv_select_flush_from_tag_sticky_loc_internal(Scene *scene, BMEditMesh *em, UvVertMap *vmap, - const unsigned int efa_index, BMLoop *l, - const bool select, const int cd_loop_uv_offset) +static void uv_select_flush_from_tag_sticky_loc_internal( + Scene *scene, BMEditMesh *em, UvVertMap *vmap, + const unsigned int efa_index, BMLoop *l, + const bool select, const int cd_loop_uv_offset) { UvMapVert *start_vlist = NULL, *vlist_iter; BMFace *efa_vlist; @@ -2768,8 +2862,9 @@ static void uv_select_flush_from_tag_face(SpaceImage *sima, Scene *scene, Object /* 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, - select, cd_loop_uv_offset); + uv_select_flush_from_tag_sticky_loc_internal( + scene, em, vmap, efa_index, l, + select, cd_loop_uv_offset); } } } @@ -2855,8 +2950,9 @@ static void uv_select_flush_from_tag_loop(SpaceImage *sima, Scene *scene, Object BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { if (BM_elem_flag_test(l, BM_ELEM_TAG)) { - uv_select_flush_from_tag_sticky_loc_internal(scene, em, vmap, efa_index, l, - select, cd_loop_uv_offset); + uv_select_flush_from_tag_sticky_loc_internal( + scene, em, vmap, efa_index, l, + select, cd_loop_uv_offset); } } } @@ -2874,7 +2970,11 @@ static void uv_select_flush_from_tag_loop(SpaceImage *sima, Scene *scene, Object } } -/* ******************** border select operator **************** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Border Select Operator + * \{ */ static int uv_border_select_exec(bContext *C, wmOperator *op) { @@ -2892,9 +2992,10 @@ static int uv_border_select_exec(bContext *C, wmOperator *op) MLoopUV *luv; rctf rectf; bool changed, pinned, select, extend; - const bool use_face_center = (ts->uv_flag & UV_SYNC_SELECTION) ? - (ts->selectmode == SCE_SELECT_FACE) : - (ts->uv_selectmode == UV_SELECT_FACE); + const bool use_face_center = ( + (ts->uv_flag & UV_SYNC_SELECTION) ? + (ts->selectmode == SCE_SELECT_FACE) : + (ts->uv_selectmode == UV_SELECT_FACE)); const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV); const int cd_poly_tex_offset = CustomData_get_offset(&em->bm->pdata, CD_MTEXPOLY); @@ -3007,7 +3108,11 @@ static void UV_OT_select_border(wmOperatorType *ot) WM_operator_properties_gesture_border_select(ot); } -/* ******************** circle select operator **************** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Circle Select Operator + * \{ */ static int uv_inside_circle(const float uv[2], const float offset[2], const float ellipse[2]) { @@ -3034,9 +3139,10 @@ static int uv_circle_select_exec(bContext *C, wmOperator *op) float zoomx, zoomy, offset[2], ellipse[2]; const bool select = !RNA_boolean_get(op->ptr, "deselect"); bool changed = false; - const bool use_face_center = (ts->uv_flag & UV_SYNC_SELECTION) ? - (ts->selectmode == SCE_SELECT_FACE) : - (ts->uv_selectmode == UV_SELECT_FACE); + const bool use_face_center = ( + (ts->uv_flag & UV_SYNC_SELECTION) ? + (ts->selectmode == SCE_SELECT_FACE) : + (ts->uv_selectmode == UV_SELECT_FACE)); const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV); @@ -3125,11 +3231,15 @@ static void UV_OT_circle_select(wmOperatorType *ot) WM_operator_properties_gesture_circle_select(ot); } +/** \} */ -/* ******************** lasso select operator **************** */ +/* -------------------------------------------------------------------- */ +/** \name Lasso Select Operator + * \{ */ -static bool do_lasso_select_mesh_uv(bContext *C, const int mcords[][2], short moves, - const bool select, const bool extend) +static bool do_lasso_select_mesh_uv( + bContext *C, const int mcords[][2], short moves, + const bool select, const bool extend) { SpaceImage *sima = CTX_wm_space_image(C); Image *ima = CTX_data_edit_image(C); @@ -3193,9 +3303,10 @@ static bool do_lasso_select_mesh_uv(bContext *C, const int mcords[][2], short mo BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { if ((select) != (uvedit_uv_select_test(scene, l, cd_loop_uv_offset))) { MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); - if (UI_view2d_view_to_region_clip(&ar->v2d, - luv->uv[0], luv->uv[1], - &screen_uv[0], &screen_uv[1]) && + if (UI_view2d_view_to_region_clip( + &ar->v2d, + luv->uv[0], luv->uv[1], + &screen_uv[0], &screen_uv[1]) && BLI_rcti_isect_pt_v(&rect, screen_uv) && BLI_lasso_is_point_inside(mcords, moves, screen_uv[0], screen_uv[1], V2D_IS_CLIPPED)) { @@ -3264,9 +3375,11 @@ static void UV_OT_select_lasso(wmOperatorType *ot) WM_operator_properties_gesture_lasso_select(ot); } +/** \} */ - -/* ******************** snap cursor operator **************** */ +/* -------------------------------------------------------------------- */ +/** \name Snap Cursor Operator + * \{ */ static void uv_snap_to_pixel(float uvco[2], float w, float h) { @@ -3334,7 +3447,11 @@ static void UV_OT_snap_cursor(wmOperatorType *ot) RNA_def_enum(ot->srna, "target", target_items, 0, "Target", "Target to snap the selected UVs to"); } -/* ******************** snap selection operator **************** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Snap Selection Operator + * \{ */ static bool uv_snap_uvs_to_cursor(Scene *scene, Image *ima, Object *obedit, const float cursor[2]) { @@ -3555,7 +3672,11 @@ static void UV_OT_snap_selected(wmOperatorType *ot) RNA_def_enum(ot->srna, "target", target_items, 0, "Target", "Target to snap the selected UVs to"); } -/* ******************** pin operator **************** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Pin UV's Operator + * \{ */ static int uv_pin_exec(bContext *C, wmOperator *op) { @@ -3613,7 +3734,11 @@ static void UV_OT_pin(wmOperatorType *ot) RNA_def_boolean(ot->srna, "clear", 0, "Clear", "Clear pinning for the selection instead of setting it"); } -/******************* select pinned operator ***************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Select Pinned UV's Operator + * \{ */ static int uv_select_pinned_exec(bContext *C, wmOperator *UNUSED(op)) { @@ -3661,15 +3786,20 @@ static void UV_OT_select_pinned(wmOperatorType *ot) ot->poll = ED_operator_uvedit; } -/********************** hide operator *********************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Hide Operator + * \{ */ /* check if we are selected or unselected based on 'bool_test' arg, * needed for select swap support */ #define UV_SEL_TEST(luv, bool_test) ((((luv)->flag & MLOOPUV_VERTSEL) == MLOOPUV_VERTSEL) == bool_test) /* is every UV vert selected or unselected depending on bool_test */ -static bool bm_face_is_all_uv_sel(BMFace *f, bool select_test, - const int cd_loop_uv_offset) +static bool bm_face_is_all_uv_sel( + BMFace *f, bool select_test, + const int cd_loop_uv_offset) { BMLoop *l_iter; BMLoop *l_first; @@ -3799,7 +3929,11 @@ static void UV_OT_hide(wmOperatorType *ot) RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected"); } -/****************** reveal operator ******************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Reveal Operator + * \{ */ static int uv_reveal_exec(bContext *C, wmOperator *op) { @@ -3934,7 +4068,11 @@ static void UV_OT_reveal(wmOperatorType *ot) RNA_def_boolean(ot->srna, "select", true, "Select", ""); } -/******************** set 3d cursor operator ********************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Set 2D Cursor Operator + * \{ */ static int uv_set_2d_cursor_poll(bContext *C) { @@ -3997,7 +4135,11 @@ static void UV_OT_cursor_set(wmOperatorType *ot) "Cursor location in normalized (0.0-1.0) coordinates", -10.0f, 10.0f); } -/********************** set tile operator **********************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Set Tile Operator + * \{ */ static int set_tile_exec(bContext *C, wmOperator *op) { @@ -4063,6 +4205,11 @@ static void UV_OT_tile_set(wmOperatorType *ot) RNA_def_int_vector(ot->srna, "tile", 2, NULL, 0, INT_MAX, "Tile", "Tile coordinate", 0, 10); } +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Seam from UV Islands Operator + * \{ */ static int uv_seams_from_islands_exec(bContext *C, wmOperator *op) { @@ -4198,6 +4345,12 @@ static void UV_OT_seams_from_islands(wmOperatorType *ot) RNA_def_boolean(ot->srna, "mark_sharp", 0, "Mark Sharp", "Mark boundary edges as sharp"); } +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Mark Seam Operator + * \{ */ + static int uv_mark_seam_exec(bContext *C, wmOperator *op) { Object *ob = CTX_data_edit_object(C); @@ -4270,8 +4423,11 @@ static void UV_OT_mark_seam(wmOperatorType *ot) RNA_def_boolean(ot->srna, "clear", false, "Clear Seams", "Clear instead of marking seams"); } +/** \} */ -/* ************************** registration **********************************/ +/* -------------------------------------------------------------------- */ +/** \name Operator Registration & Keymap + * \{ */ void ED_operatortypes_uvedit(void) { @@ -4407,3 +4563,4 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf) transform_keymap_for_space(keyconf, keymap, SPACE_IMAGE); } +/** \} */ |