diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-02-03 11:55:59 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-02-03 12:35:44 +0400 |
commit | d900f5be55d0812eb5c7dfd3ea47020c3edafd41 (patch) | |
tree | 7d5035e3dbafdcd4988e7ed57068e48c951a989a /source/blender/editors/uvedit | |
parent | a948ae2c5167c49819241572d3aacb4e4bf5b6d7 (diff) |
Code cleanup: use bools where possible
Diffstat (limited to 'source/blender/editors/uvedit')
-rw-r--r-- | source/blender/editors/uvedit/uvedit_ops.c | 8 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_smart_stitch.c | 16 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_unwrap_ops.c | 38 |
3 files changed, 31 insertions, 31 deletions
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 0d1778ea69f..8e980bdd4d2 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -3460,7 +3460,7 @@ static int uv_pin_exec(bContext *C, wmOperator *op) BMIter iter, liter; MTexPoly *tface; MLoopUV *luv; - int clear = RNA_boolean_get(op->ptr, "clear"); + const bool clear = RNA_boolean_get(op->ptr, "clear"); 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); @@ -3589,7 +3589,7 @@ static int uv_hide_exec(bContext *C, wmOperator *op) BMIter iter, liter; MLoopUV *luv; MTexPoly *tf; - int swap = RNA_boolean_get(op->ptr, "unselected"); + const bool swap = RNA_boolean_get(op->ptr, "unselected"); Image *ima = sima ? sima->image : NULL; const int use_face_center = (ts->uv_selectmode == UV_SELECT_FACE); @@ -3950,8 +3950,8 @@ static int uv_seams_from_islands_exec(bContext *C, wmOperator *op) BMEditMesh *em; BMEdge *editedge; float limit[2] = {STD_UV_CONNECT_LIMIT, STD_UV_CONNECT_LIMIT}; - char mark_seams = RNA_boolean_get(op->ptr, "mark_seams"); - char mark_sharp = RNA_boolean_get(op->ptr, "mark_sharp"); + const bool mark_seams = RNA_boolean_get(op->ptr, "mark_seams"); + const bool mark_sharp = RNA_boolean_get(op->ptr, "mark_sharp"); BMesh *bm; BMIter iter; diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index c931c843a23..f60972abdcb 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -114,7 +114,7 @@ typedef struct IslandStitchData { /* flag an island to be considered for determining static island */ char stitchableCandidate; /* if edge rotation is used, flag so that vertex rotation is not used */ - char use_edge_rotation; + bool use_edge_rotation; } IslandStitchData; /* just for averaging UVs */ @@ -142,17 +142,17 @@ typedef struct UvEdge { typedef struct StitchState { float aspect; /* use limit flag */ - char use_limit; + bool use_limit; /* limit to operator, same as original operator */ float limit_dist; /* snap uv islands together during stitching */ - char snap_islands; + bool snap_islands; /* stich at midpoints or at islands */ - char midpoints; + bool midpoints; /* editmesh, cached for use in modal handler */ BMEditMesh *em; /* clear seams of stitched edges after stitch */ - char clear_seams; + bool clear_seams; /* element map for getting info about uv connectivity */ UvElementMap *element_map; /* edge container */ @@ -271,10 +271,10 @@ static void stitch_update_header(StitchState *state, bContext *C) if (sa) { BLI_snprintf(msg, HEADER_LENGTH, str, state->mode == STITCH_VERT ? "Vertex" : "Edge", - state->snap_islands ? "On" : "Off", - state->midpoints ? "On" : "Off", + WM_bool_as_string(state->snap_islands), + WM_bool_as_string(state->midpoints), state->limit_dist, - state->use_limit ? "On" : "Off"); + WM_bool_as_string(state->use_limit)); ED_area_headerprint(sa, msg); } diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 8a05b33d105..c0a5e505f38 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -86,10 +86,10 @@ #include "uvedit_intern.h" #include "uvedit_parametrizer.h" -static void modifier_unwrap_state(Object *obedit, Scene *scene, short *use_subsurf) +static void modifier_unwrap_state(Object *obedit, Scene *scene, bool *r_use_subsurf) { ModifierData *md; - short subsurf = scene->toolsettings->uvcalc_flag & UVCALC_USESUBSURF; + bool subsurf = (scene->toolsettings->uvcalc_flag & UVCALC_USESUBSURF) != 0; md = obedit->modifiers.first; @@ -101,7 +101,7 @@ static void modifier_unwrap_state(Object *obedit, Scene *scene, short *use_subsu subsurf = FALSE; } - *use_subsurf = subsurf; + *r_use_subsurf = subsurf; } static bool ED_uvedit_ensure_uvs(bContext *C, Scene *scene, Object *obedit) @@ -256,8 +256,8 @@ static void construct_param_handle_face_add(ParamHandle *handle, Scene *scene, } static ParamHandle *construct_param_handle(Scene *scene, Object *ob, BMEditMesh *em, - short implicit, short fill, short sel, - short correct_aspect) + const bool implicit, const bool fill, const bool sel, + const bool correct_aspect) { BMesh *bm = em->bm; ParamHandle *handle; @@ -516,7 +516,7 @@ static bool minimize_stretch_init(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BKE_editmesh_from_object(obedit); MinStretch *ms; - int fill_holes = RNA_boolean_get(op->ptr, "fill_holes"); + const bool fill_holes = RNA_boolean_get(op->ptr, "fill_holes"); bool implicit = true; if (!uvedit_have_selection(scene, em, implicit)) { @@ -802,9 +802,9 @@ static ParamHandle *liveHandle = NULL; void ED_uvedit_live_unwrap_begin(Scene *scene, Object *obedit) { BMEditMesh *em = BKE_editmesh_from_object(obedit); - short abf = scene->toolsettings->unwrapper == 0; - short fillholes = scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES; - short use_subsurf; + const bool abf = (scene->toolsettings->unwrapper == 0); + const bool fillholes = (scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES) != 0; + bool use_subsurf; modifier_unwrap_state(obedit, scene, &use_subsurf); @@ -1068,9 +1068,9 @@ static void uv_map_clip_correct(Scene *scene, Object *ob, BMEditMesh *em, wmOper BMIter iter, liter; MLoopUV *luv; float dx, dy, min[2], max[2]; - int correct_aspect = RNA_boolean_get(op->ptr, "correct_aspect"); - int clip_to_bounds = RNA_boolean_get(op->ptr, "clip_to_bounds"); - int scale_to_bounds = RNA_boolean_get(op->ptr, "scale_to_bounds"); + const bool correct_aspect = RNA_boolean_get(op->ptr, "correct_aspect"); + const bool clip_to_bounds = RNA_boolean_get(op->ptr, "clip_to_bounds"); + const bool scale_to_bounds = RNA_boolean_get(op->ptr, "scale_to_bounds"); const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV); @@ -1135,9 +1135,9 @@ void ED_unwrap_lscm(Scene *scene, Object *obedit, const short sel) BMEditMesh *em = BKE_editmesh_from_object(obedit); ParamHandle *handle; - const short fill_holes = scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES; - const short correct_aspect = !(scene->toolsettings->uvcalc_flag & UVCALC_NO_ASPECT_CORRECT); - short use_subsurf; + const bool fill_holes = (scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES) != 0; + const bool correct_aspect = (scene->toolsettings->uvcalc_flag & UVCALC_NO_ASPECT_CORRECT) != 0; + bool use_subsurf; modifier_unwrap_state(obedit, scene, &use_subsurf); @@ -1164,10 +1164,10 @@ static int unwrap_exec(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BKE_editmesh_from_object(obedit); int method = RNA_enum_get(op->ptr, "method"); - int fill_holes = RNA_boolean_get(op->ptr, "fill_holes"); - int correct_aspect = RNA_boolean_get(op->ptr, "correct_aspect"); - int use_subsurf = RNA_boolean_get(op->ptr, "use_subsurf_data"); - short use_subsurf_final; + const bool fill_holes = RNA_boolean_get(op->ptr, "fill_holes"); + const bool correct_aspect = RNA_boolean_get(op->ptr, "correct_aspect"); + const bool use_subsurf = RNA_boolean_get(op->ptr, "use_subsurf_data"); + bool use_subsurf_final; float obsize[3]; bool implicit = false; |