From 44505b38df557a5711703613685a1dec9fc2c3d9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 4 Jun 2018 09:31:30 +0200 Subject: Cleanup: strip trailing space in editors --- source/blender/editors/mesh/editface.c | 30 +++---- source/blender/editors/mesh/editmesh_bevel.c | 12 +-- source/blender/editors/mesh/editmesh_knife.c | 4 +- source/blender/editors/mesh/editmesh_loopcut.c | 38 ++++----- source/blender/editors/mesh/mesh_data.c | 32 ++++---- source/blender/editors/mesh/mesh_mirror.c | 2 +- source/blender/editors/mesh/mesh_navmesh.c | 8 +- source/blender/editors/mesh/mesh_ops.c | 42 +++++----- source/blender/editors/mesh/meshtools.c | 104 ++++++++++++------------- 9 files changed, 136 insertions(+), 136 deletions(-) (limited to 'source/blender/editors/mesh') diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index c453284a617..899f1924222 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -65,7 +65,7 @@ void paintface_flush_flags(Object *ob, short flag) const int *index_array = NULL; int totpoly; int i; - + BLI_assert((flag & ~(SELECT | ME_HIDE)) == 0); if (me == NULL) @@ -110,7 +110,7 @@ void paintface_hide(Object *ob, const bool unselected) Mesh *me; MPoly *mpoly; int a; - + me = BKE_mesh_from_object(ob); if (me == NULL || me->totpoly == 0) return; @@ -126,10 +126,10 @@ void paintface_hide(Object *ob, const bool unselected) if (mpoly->flag & ME_HIDE) { mpoly->flag &= ~ME_FACE_SEL; } - + mpoly++; } - + BKE_mesh_flush_hidden_from_polys(me); paintface_flush_flags(ob, SELECT | ME_HIDE); @@ -262,7 +262,7 @@ void paintface_deselect_all_visible(Object *ob, int action, bool flush_flags) me = BKE_mesh_from_object(ob); if (me == NULL) return; - + if (action == SEL_TOGGLE) { action = SEL_SELECT; @@ -315,7 +315,7 @@ bool paintface_minmax(Object *ob, float r_min[3], float r_max[3]) if (!me || !me->mloopuv) { return ok; } - + copy_m3_m4(bmat, ob->obmat); mvert = me->mvert; @@ -342,19 +342,19 @@ bool paintface_mouse_select(struct bContext *C, Object *ob, const int mval[2], b Mesh *me; MPoly *mpoly, *mpoly_sel; unsigned int a, index; - + /* Get the face under the cursor */ me = BKE_mesh_from_object(ob); if (!ED_mesh_pick_face(C, ob, mval, &index, ED_MESH_PICK_DEFAULT_FACE_SIZE)) return false; - + if (index >= me->totpoly) return false; mpoly_sel = me->mpoly + index; if (mpoly_sel->flag & ME_HIDE) return false; - + /* clear flags */ mpoly = me->mpoly; a = me->totpoly; @@ -364,7 +364,7 @@ bool paintface_mouse_select(struct bContext *C, Object *ob, const int mval[2], b mpoly++; } } - + me->act_face = (int)index; if (extend) { @@ -382,9 +382,9 @@ bool paintface_mouse_select(struct bContext *C, Object *ob, const int mval[2], b else { mpoly_sel->flag |= ME_FACE_SEL; } - + /* image window redraw */ - + paintface_flush_flags(ob, SELECT); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob->data); ED_region_tag_redraw(CTX_wm_region(C)); // XXX - should redraw all 3D views @@ -403,7 +403,7 @@ int do_paintface_box_select(ViewContext *vc, rcti *rect, bool select, bool exten const int size[2] = { BLI_rcti_size_x(rect) + 1, BLI_rcti_size_y(rect) + 1}; - + me = BKE_mesh_from_object(ob); if ((me == NULL) || (me->totpoly == 0) || (size[0] * size[1] <= 0)) { @@ -459,7 +459,7 @@ int do_paintface_box_select(ViewContext *vc, rcti *rect, bool select, bool exten IMB_freeImBuf(ibuf); MEM_freeN(selar); -#ifdef __APPLE__ +#ifdef __APPLE__ glReadBuffer(GL_BACK); #endif @@ -522,7 +522,7 @@ void paintvert_deselect_all_visible(Object *ob, int action, bool flush_flags) me = BKE_mesh_from_object(ob); if (me == NULL) return; - + if (action == SEL_TOGGLE) { action = SEL_SELECT; diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c index c8d33a9cc60..bf349a4c678 100644 --- a/source/blender/editors/mesh/editmesh_bevel.c +++ b/source/blender/editors/mesh/editmesh_bevel.c @@ -79,7 +79,7 @@ typedef struct { BMEditMesh *em; float initial_length[NUM_VALUE_KINDS]; float scale[NUM_VALUE_KINDS]; - NumInput num_input[NUM_VALUE_KINDS]; + NumInput num_input[NUM_VALUE_KINDS]; float shift_value[NUM_VALUE_KINDS]; /* The current value when shift is pressed. Negative when shift not active. */ bool is_modal; @@ -155,7 +155,7 @@ static bool edbm_bevel_init(bContext *C, wmOperator *op, const bool is_modal) opdata->shift_value[i] = -1.0f; opdata->initial_length[i] = -1.0f; /* note: scale for OFFSET_VALUE will get overwritten in edbm_bevel_invoke */ - opdata->scale[i] = value_scale_per_inch[i] / pixels_per_inch; + opdata->scale[i] = value_scale_per_inch[i] / pixels_per_inch; initNumInput(&opdata->num_input[i]); opdata->num_input[i].idx_max = 0; @@ -305,7 +305,7 @@ static void edbm_bevel_calc_initial_length(wmOperator *op, const wmEvent *event, len = len_v2(mlen); vmode = opdata->value_mode; if (mode_changed || opdata->initial_length[vmode] == -1.0f) { - /* If current value is not default start value, adjust len so that + /* If current value is not default start value, adjust len so that * the scaling and offset in edbm_bevel_mouse_set_value will * start at current value */ value = (vmode == SEGMENTS_VALUE) ? @@ -519,7 +519,7 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, const wmEvent *event) (opdata->value_mode == OFFSET_VALUE || opdata->value_mode == OFFSET_VALUE_PERCENT)) { edbm_bevel_mouse_set_value(op, event); - } + } edbm_bevel_calc(op); edbm_bevel_update_header(C, op); handled = true; @@ -561,7 +561,7 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, const wmEvent *event) case VKEY: if (event->val == KM_RELEASE) break; - + { PropertyRNA *prop = RNA_struct_find_property(op->ptr, "vertex_only"); RNA_property_boolean_set(op->ptr, prop, !RNA_property_boolean_get(op->ptr, prop)); @@ -570,7 +570,7 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, const wmEvent *event) edbm_bevel_update_header(C, op); handled = true; break; - + } /* Modal numinput inactive, try to handle numeric inputs last... */ diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index da441221646..8eb3ad84919 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -1045,7 +1045,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) knifetool_draw_angle_snapping(kcd); glColor3ubv(kcd->colors.line); - + glLineWidth(2.0); glBegin(GL_LINES); @@ -1791,7 +1791,7 @@ static void knife_input_ray_segment(KnifeTool_OpData *kcd, const float mval[2], ED_view3d_unproject(&mats, r_origin_ofs, mval[0], mval[1], ofs); /* transform into object space */ - invert_m4_m4(kcd->ob->imat, kcd->ob->obmat); + invert_m4_m4(kcd->ob->imat, kcd->ob->obmat); mul_m4_v3(kcd->ob->imat, r_origin); mul_m4_v3(kcd->ob->imat, r_origin_ofs); diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index 785d81d75ff..f07073cd3d7 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -73,7 +73,7 @@ typedef struct RingSelOpData { ARegion *ar; /* region that ringsel was activated in */ void *draw_handle; /* for drawing preview loop */ - + float (*edges)[2][3]; int totedge; @@ -99,7 +99,7 @@ static void ringsel_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) { View3D *v3d = CTX_wm_view3d(C); RingSelOpData *lcd = arg; - + if ((lcd->totedge > 0) || (lcd->totpoint > 0)) { if (v3d && v3d->zbuf) glDisable(GL_DEPTH_TEST); @@ -148,7 +148,7 @@ static void edgering_find_order(BMEdge *lasteed, BMEdge *eed, break; } } - + /* this should never happen */ if (!l) { v[0][0] = eed->v1; @@ -157,7 +157,7 @@ static void edgering_find_order(BMEdge *lasteed, BMEdge *eed, v[1][1] = lasteed->v2; return; } - + l2 = BM_loop_other_edge_loop(l, eed->v1); rev = (l2 == l->prev); while (l2->v != lasteed->v1 && l2->v != lasteed->v2) { @@ -371,7 +371,7 @@ static void edgering_select(RingSelOpData *lcd) BMEdge *eed_start = lcd->eed; BMWalker walker; BMEdge *eed; - + if (!eed_start) return; @@ -417,7 +417,7 @@ static void ringsel_finish(bContext *C, wmOperator *op) BMVert *v_eed_orig[2] = {lcd->eed->v1, lcd->eed->v2}; edgering_select(lcd); - + if (lcd->do_cut) { const bool is_macro = (op->opm != NULL); /* a single edge (rare, but better support) */ @@ -465,7 +465,7 @@ static void ringsel_finish(bContext *C, wmOperator *op) BM_select_history_store(em->bm, lcd->eed->v1); /* low priority TODO, get vertrex close to mouse */ if (em->selectmode & SCE_SELECT_EDGE) BM_select_history_store(em->bm, lcd->eed); - + EDBM_selectmode_flush(lcd->em); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, lcd->ob->data); } @@ -479,7 +479,7 @@ static void ringsel_exit(bContext *UNUSED(C), wmOperator *op) /* deactivate the extra drawing stuff in 3D-View */ ED_region_draw_cb_exit(lcd->ar->type, lcd->draw_handle); - + edgering_preview_free(lcd); ED_region_tag_redraw(lcd->ar); @@ -498,7 +498,7 @@ static int ringsel_init(bContext *C, wmOperator *op, bool do_cut) /* alloc new customdata */ lcd = op->customdata = MEM_callocN(sizeof(RingSelOpData), "ringsel Modal Op Data"); - + /* assign the drawing handle for drawing preview line... */ lcd->ar = CTX_wm_region(C); lcd->draw_handle = ED_region_draw_cb_activate(lcd->ar->type, ringsel_draw, lcd, REGION_DRAW_POST_VIEW); @@ -508,7 +508,7 @@ static int ringsel_init(bContext *C, wmOperator *op, bool do_cut) lcd->do_cut = do_cut; lcd->cuts = RNA_int_get(op->ptr, "number_cuts"); lcd->smoothness = RNA_float_get(op->ptr, "smoothness"); - + initNumInput(&lcd->num); lcd->num.idx_max = 1; lcd->num.val_flag[0] |= NUM_NO_NEGATIVE | NUM_NO_FRACTION; @@ -679,7 +679,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event) case LEFTMOUSE: /* confirm */ // XXX hardcoded if (event->val == KM_PRESS) return loopcut_finish(lcd, C, op); - + ED_region_tag_redraw(lcd->ar); handled = true; break; @@ -694,11 +694,11 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event) /* cancel */ ED_region_tag_redraw(lcd->ar); ED_area_headerprint(CTX_wm_area(C), NULL); - + ringcut_cancel(C, op); return OPERATOR_CANCELLED; } - + ED_region_tag_redraw(lcd->ar); handled = true; break; @@ -800,7 +800,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event) str_rep, str_rep + NUM_STR_REP_LEN); ED_area_headerprint(CTX_wm_area(C), buf); } - + /* keep going until the user confirms */ return OPERATOR_RUNNING_MODAL; } @@ -814,11 +814,11 @@ void MESH_OT_edgering_select(wmOperatorType *ot) ot->name = "Edge Ring Select"; ot->idname = "MESH_OT_edgering_select"; ot->description = "Select an edge ring"; - + /* callbacks */ ot->invoke = ringsel_invoke; - ot->poll = ED_operator_editmesh_region_view3d; - + ot->poll = ED_operator_editmesh_region_view3d; + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -835,14 +835,14 @@ void MESH_OT_loopcut(wmOperatorType *ot) ot->name = "Loop Cut"; ot->idname = "MESH_OT_loopcut"; ot->description = "Add a new loop between existing loops"; - + /* callbacks */ ot->invoke = ringcut_invoke; ot->exec = loopcut_exec; ot->modal = loopcut_modal; ot->cancel = ringcut_cancel; ot->poll = ED_operator_editmesh_region_view3d; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index ba271da7110..f3ccdf32938 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -254,7 +254,7 @@ void ED_mesh_uv_loop_reset(struct bContext *C, struct Mesh *me) CustomData *pdata = GET_CD_DATA(me, pdata); const int layernum = CustomData_get_active_layer(pdata, CD_MTEXPOLY); ED_mesh_uv_loop_reset_ex(me, layernum); - + WM_event_add_notifier(C, NC_GEOM | ND_DATA, me); } @@ -313,7 +313,7 @@ int ED_mesh_uv_texture_add(Mesh *me, const char *name, const bool active_set) CustomData_add_layer_named(&me->ldata, CD_MLOOPUV, CD_DEFAULT, NULL, me->totloop, name); CustomData_add_layer_named(&me->fdata, CD_MTFACE, CD_DEFAULT, NULL, me->totface, name); } - + if (active_set || layernum_dst == 0) { CustomData_set_layer_active(&me->pdata, CD_MTEXPOLY, layernum_dst); CustomData_set_layer_active(&me->ldata, CD_MLOOPUV, layernum_dst); @@ -541,7 +541,7 @@ static int mesh_uv_texture_add_exec(bContext *C, wmOperator *UNUSED(op)) BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, NULL); } - + return OPERATOR_FINISHED; } @@ -551,7 +551,7 @@ void MESH_OT_uv_texture_add(wmOperatorType *ot) ot->name = "Add UV Map"; ot->description = "Add UV Map"; ot->idname = "MESH_OT_uv_texture_add"; - + /* api callbacks */ ot->poll = layers_poll; ot->exec = mesh_uv_texture_add_exec; @@ -570,7 +570,7 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, const wmEvent *e Mesh *me; Object *obedit; int exitmode = 0; - + if (v3d == NULL) { BKE_report(op->reports, RPT_ERROR, "No 3D View Available"); return OPERATOR_CANCELLED; @@ -583,7 +583,7 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, const wmEvent *e BKE_report(op->reports, RPT_ERROR, "Not an object or mesh"); return OPERATOR_CANCELLED; } - + ima = (Image *)WM_operator_drop_load_path(C, op, ID_IM); if (!ima) { return OPERATOR_CANCELLED; @@ -601,7 +601,7 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, const wmEvent *e } if (me->edit_btmesh == NULL) return OPERATOR_CANCELLED; - + ED_uvedit_assign_image(bmain, scene, obedit, ima, NULL); if (exitmode) { @@ -618,9 +618,9 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, const wmEvent *e /* dummie drop support; ensure view shows a result :) */ if (v3d) v3d->flag2 |= V3D_SOLID_TEX; - + WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); - + return OPERATOR_FINISHED; } @@ -630,14 +630,14 @@ void MESH_OT_drop_named_image(wmOperatorType *ot) ot->name = "Drop Image to Mesh UV Map"; ot->description = "Assign Image to active UV Map, or create an UV Map"; ot->idname = "MESH_OT_drop_named_image"; - + /* api callbacks */ ot->poll = layers_poll; ot->invoke = drop_named_image_invoke; - + /* flags */ ot->flag = OPTYPE_UNDO | OPTYPE_INTERNAL; - + /* properties */ RNA_def_string(ot->srna, "name", "Image", MAX_ID_NAME - 2, "Name", "Image name to assign"); RNA_def_string(ot->srna, "filepath", "Path", FILE_MAX, "Filepath", "Path to image file"); @@ -657,7 +657,7 @@ static int mesh_uv_texture_remove_exec(bContext *C, wmOperator *UNUSED(op)) BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, NULL); } - + return OPERATOR_FINISHED; } @@ -667,7 +667,7 @@ void MESH_OT_uv_texture_remove(wmOperatorType *ot) ot->name = "Remove UV Map"; ot->description = "Remove UV Map"; ot->idname = "MESH_OT_uv_texture_remove"; - + /* api callbacks */ ot->poll = layers_poll; ot->exec = mesh_uv_texture_remove_exec; @@ -695,7 +695,7 @@ void MESH_OT_vertex_color_add(wmOperatorType *ot) ot->name = "Add Vertex Color"; ot->description = "Add vertex color layer"; ot->idname = "MESH_OT_vertex_color_add"; - + /* api callbacks */ ot->poll = layers_poll; ot->exec = mesh_vertex_color_add_exec; @@ -721,7 +721,7 @@ void MESH_OT_vertex_color_remove(wmOperatorType *ot) ot->name = "Remove Vertex Color"; ot->description = "Remove vertex color layer"; ot->idname = "MESH_OT_vertex_color_remove"; - + /* api callbacks */ ot->exec = mesh_vertex_color_remove_exec; ot->poll = layers_poll; diff --git a/source/blender/editors/mesh/mesh_mirror.c b/source/blender/editors/mesh/mesh_mirror.c index 96b9f054252..20ece9c3336 100644 --- a/source/blender/editors/mesh/mesh_mirror.c +++ b/source/blender/editors/mesh/mesh_mirror.c @@ -93,7 +93,7 @@ int ED_mesh_mirror_spatial_table(Object *ob, BMEditMesh *em, DerivedMesh *dm, co else { MVert *mvert = dm ? dm->getVertArray(dm) : me->mvert; int i; - + for (i = 0; i < totvert; i++, mvert++) { BLI_kdtree_insert(MirrKdStore.tree, i, mvert->co); } diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c index 0d6c7320a95..5cfb269cbc3 100644 --- a/source/blender/editors/mesh/mesh_navmesh.c +++ b/source/blender/editors/mesh/mesh_navmesh.c @@ -383,7 +383,7 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh, /* create custom data layer to save polygon idx */ CustomData_add_layer_named(&em->bm->pdata, CD_RECAST, CD_CALLOC, NULL, 0, "createRepresentation recastData"); CustomData_bmesh_init_pool(&em->bm->pdata, 0, BM_FACE); - + /* create verts and faces for detailed mesh */ meshes = recast_polyMeshDetailGetMeshes(dmesh, &nmeshes); polys = recast_polyMeshGetPolys(pmesh, NULL, &nvp); @@ -445,7 +445,7 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh, WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); - ED_object_editmode_exit(C, EM_FREEDATA); + ED_object_editmode_exit(C, EM_FREEDATA); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit); if (createob) { @@ -616,14 +616,14 @@ static int navmesh_face_add_exec(bContext *C, wmOperator *UNUSED(op)) BMEditMesh *em = BKE_editmesh_from_object(obedit); BMFace *ef; BMIter iter; - + if (CustomData_has_layer(&em->bm->pdata, CD_RECAST)) { int targetPolyIdx = findFreeNavPolyIndex(em); if (targetPolyIdx > 0) { /* set target poly idx to selected faces */ /*XXX this originally went last to first, but that isn't possible anymore*/ - + BM_ITER_MESH (ef, &iter, em->bm, BM_FACES_OF_MESH) { if (BM_elem_flag_test(ef, BM_ELEM_SELECT)) { int *recastDataBlock = (int *)CustomData_bmesh_get(&em->bm->pdata, ef->head.data, CD_RECAST); diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 33498eb113a..3c8e18027f4 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -94,12 +94,12 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_loop_to_region); WM_operatortype_append(MESH_OT_region_to_loop); WM_operatortype_append(MESH_OT_select_axis); - + WM_operatortype_append(MESH_OT_uvs_rotate); WM_operatortype_append(MESH_OT_uvs_reverse); WM_operatortype_append(MESH_OT_colors_rotate); WM_operatortype_append(MESH_OT_colors_reverse); - + WM_operatortype_append(MESH_OT_fill); WM_operatortype_append(MESH_OT_fill_grid); WM_operatortype_append(MESH_OT_fill_holes); @@ -147,7 +147,7 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_rip_edge); WM_operatortype_append(MESH_OT_blend_from_shape); WM_operatortype_append(MESH_OT_shape_propagate_to_all); - + WM_operatortype_append(MESH_OT_uv_texture_add); WM_operatortype_append(MESH_OT_uv_texture_remove); WM_operatortype_append(MESH_OT_vertex_color_add); @@ -219,7 +219,7 @@ void ED_operatormacros_mesh(void) { wmOperatorType *ot; wmOperatorTypeMacro *otmacro; - + ot = WM_operatortype_append_macro("MESH_OT_loopcut_slide", "Loop Cut and Slide", "Cut mesh loop and slide it", OPTYPE_UNDO | OPTYPE_REGISTER); WM_operatortype_macro_define(ot, "MESH_OT_loopcut"); @@ -292,14 +292,14 @@ void ED_operatormacros_mesh(void) /* note mesh keymap also for other space? */ void ED_keymap_mesh(wmKeyConfig *keyconf) -{ +{ wmKeyMap *keymap; wmKeyMapItem *kmi; int i; - + keymap = WM_keymap_find(keyconf, "Mesh", 0, 0); keymap->poll = ED_operator_editmesh; - + WM_keymap_add_item(keymap, "MESH_OT_loopcut_slide", RKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "MESH_OT_offset_edge_loops_slide", RKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0); WM_keymap_add_item(keymap, "MESH_OT_inset", IKEY, KM_PRESS, 0, 0); @@ -347,20 +347,20 @@ void ED_keymap_mesh(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "MESH_OT_select_prev_item", PADMINUS, KM_PRESS, KM_CTRL | KM_SHIFT, 0); WM_keymap_add_item(keymap, "MESH_OT_select_non_manifold", MKEY, KM_PRESS, (KM_CTRL | KM_SHIFT | KM_ALT), 0); - + WM_keymap_add_item(keymap, "MESH_OT_select_linked", LKEY, KM_PRESS, KM_CTRL, 0); kmi = WM_keymap_add_item(keymap, "MESH_OT_select_linked_pick", LKEY, KM_PRESS, 0, 0); RNA_boolean_set(kmi->ptr, "deselect", false); kmi = WM_keymap_add_item(keymap, "MESH_OT_select_linked_pick", LKEY, KM_PRESS, KM_SHIFT, 0); RNA_boolean_set(kmi->ptr, "deselect", true); - + WM_keymap_add_item(keymap, "MESH_OT_faces_select_linked_flat", FKEY, KM_PRESS, (KM_CTRL | KM_SHIFT | KM_ALT), 0); WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_select_similar", GKEY, KM_PRESS, KM_SHIFT, 0); - + /* selection mode */ WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_select_mode", TABKEY, KM_PRESS, KM_CTRL, 0); - + /* hide */ kmi = WM_keymap_add_item(keymap, "MESH_OT_hide", HKEY, KM_PRESS, 0, 0); RNA_boolean_set(kmi->ptr, "unselected", false); @@ -373,14 +373,14 @@ void ED_keymap_mesh(wmKeyConfig *keyconf) RNA_boolean_set(kmi->ptr, "inside", false); kmi = WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0); RNA_boolean_set(kmi->ptr, "inside", true); - + WM_keymap_add_item(keymap, "VIEW3D_OT_edit_mesh_extrude_move_normal", EKEY, KM_PRESS, 0, 0); /* python operator */ WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_extrude", EKEY, KM_PRESS, KM_ALT, 0); - + WM_keymap_add_item(keymap, "TRANSFORM_OT_edge_crease", EKEY, KM_PRESS, KM_SHIFT, 0); - + WM_keymap_add_item(keymap, "MESH_OT_spin", RKEY, KM_PRESS, KM_ALT, 0); - + WM_keymap_add_item(keymap, "MESH_OT_fill", FKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "MESH_OT_beautify_fill", FKEY, KM_PRESS, KM_SHIFT | KM_ALT, 0); @@ -414,9 +414,9 @@ void ED_keymap_mesh(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "MESH_OT_edge_face_add", FKEY, KM_PRESS, 0, 0); // WM_keymap_add_item(keymap, "MESH_OT_skin", FKEY, KM_PRESS, KM_CTRL|KM_ALT, 0); /* python, removed */ WM_keymap_add_item(keymap, "MESH_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0); - + WM_keymap_add_menu(keymap, "INFO_MT_mesh_add", AKEY, KM_PRESS, KM_SHIFT, 0); - + WM_keymap_add_item(keymap, "MESH_OT_separate", PKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "MESH_OT_split", YKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "MESH_OT_vert_connect_path", JKEY, KM_PRESS, 0, 0); @@ -434,7 +434,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "MESH_OT_dissolve_mode", XKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "MESH_OT_dissolve_mode", DELKEY, KM_PRESS, KM_CTRL, 0); - + kmi = WM_keymap_add_item(keymap, "MESH_OT_knife_tool", KKEY, KM_PRESS, 0, 0); RNA_boolean_set(kmi->ptr, "use_occlude_geometry", true); RNA_boolean_set(kmi->ptr, "only_selected", false); @@ -442,7 +442,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf) kmi = WM_keymap_add_item(keymap, "MESH_OT_knife_tool", KKEY, KM_PRESS, KM_SHIFT, 0); RNA_boolean_set(kmi->ptr, "use_occlude_geometry", false); RNA_boolean_set(kmi->ptr, "only_selected", true); - + WM_keymap_add_item(keymap, "OBJECT_OT_vertex_parent_set", PKEY, KM_PRESS, KM_CTRL, 0); /* menus */ @@ -453,13 +453,13 @@ void ED_keymap_mesh(wmKeyConfig *keyconf) WM_keymap_add_menu(keymap, "VIEW3D_MT_hook", HKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_menu(keymap, "VIEW3D_MT_uv_map", UKEY, KM_PRESS, 0, 0); WM_keymap_add_menu(keymap, "VIEW3D_MT_vertex_group", GKEY, KM_PRESS, KM_CTRL, 0); - + /* useful stuff from object-mode */ for (i = 0; i <= 5; i++) { kmi = WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", ZEROKEY + i, KM_PRESS, KM_CTRL, 0); RNA_int_set(kmi->ptr, "level", i); } - + ED_keymap_proportional_cycle(keyconf, keymap); ED_keymap_proportional_editmode(keyconf, keymap, true); diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index d3d29b61182..6953473a792 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -282,13 +282,13 @@ int join_mesh_exec(bContext *C, wmOperator *op) BKE_report(op->reports, RPT_WARNING, "Cannot join while in edit mode"); return OPERATOR_CANCELLED; } - + /* ob is the object we are adding geometry to */ if (!ob || ob->type != OB_MESH) { BKE_report(op->reports, RPT_WARNING, "Active object is not a mesh"); return OPERATOR_CANCELLED; } - + /* count & check */ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) { @@ -300,23 +300,23 @@ int join_mesh_exec(bContext *C, wmOperator *op) totloop += me->totloop; totpoly += me->totpoly; totmat += base->object->totcol; - + if (base->object == ob) ok = true; - + /* check for shapekeys */ if (me->key) haskey++; } } CTX_DATA_END; - - /* that way the active object is always selected */ + + /* that way the active object is always selected */ if (ok == false) { BKE_report(op->reports, RPT_WARNING, "Active object is not a selected mesh"); return OPERATOR_CANCELLED; } - + /* only join meshes if there are verts to join, there aren't too many, and we only had one mesh selected */ me = (Mesh *)ob->data; key = me->key; @@ -325,7 +325,7 @@ int join_mesh_exec(bContext *C, wmOperator *op) BKE_report(op->reports, RPT_WARNING, "No mesh data to join"); return OPERATOR_CANCELLED; } - + if (totvert > MESH_MAX_VERTS) { BKE_reportf(op->reports, RPT_WARNING, "Joining results in %d vertices, limit is %ld", totvert, MESH_MAX_VERTS); return OPERATOR_CANCELLED; @@ -340,23 +340,23 @@ int join_mesh_exec(bContext *C, wmOperator *op) matmap = MEM_callocN(sizeof(*matmap) * totmat, "join_mesh matmap"); } totcol = ob->totcol; - + /* obact materials in new main array, is nicer start! */ for (a = 0; a < ob->totcol; a++) { matar[a] = give_current_material(ob, a + 1); id_us_plus((ID *)matar[a]); /* increase id->us : will be lowered later */ } - + /* - if destination mesh had shapekeys, move them somewhere safe, and set up placeholders * with arrays that are large enough to hold shapekey data for all meshes - * - if destination mesh didn't have shapekeys, but we encountered some in the meshes we're + * - if destination mesh didn't have shapekeys, but we encountered some in the meshes we're * joining, set up a new keyblock and assign to the mesh */ if (key) { /* make a duplicate copy that will only be used here... (must remember to free it!) */ nkey = BKE_key_copy(bmain, key); - + /* for all keys in old block, clear data-arrays */ for (kb = key->block.first; kb; kb = kb->next) { if (kb->data) MEM_freeN(kb->data); @@ -369,14 +369,14 @@ int join_mesh_exec(bContext *C, wmOperator *op) key = me->key = BKE_key_add((ID *)me); key->type = KEY_RELATIVE; } - + /* first pass over objects - copying materials and vertexgroups across */ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) { /* only act if a mesh, and not the one we're joining to */ if ((ob != base->object) && (base->object->type == OB_MESH)) { me = base->object->data; - + /* Join this object's vertex groups to the base one's */ for (dg = base->object->defbase.first; dg; dg = dg->next) { /* See if this group exists in the object (if it doesn't, add it to the end) */ @@ -388,8 +388,8 @@ int join_mesh_exec(bContext *C, wmOperator *op) } if (ob->defbase.first && ob->actdef == 0) ob->actdef = 1; - - + + if (me->totvert) { /* Add this object's materials to the base one's if they don't exist already (but only if limits not exceeded yet) */ if (totcol < MAXMAT) { @@ -413,7 +413,7 @@ int join_mesh_exec(bContext *C, wmOperator *op) } } } - + /* if this mesh has shapekeys, check if destination mesh already has matching entries too */ if (me->key && key) { /* for remapping KeyBlock.relative */ @@ -475,7 +475,7 @@ int join_mesh_exec(bContext *C, wmOperator *op) edgeofs = 0; loopofs = 0; polyofs = 0; - + /* inverse transform for all selected meshes in this object */ invert_m4_m4(imat, ob->obmat); @@ -516,10 +516,10 @@ int join_mesh_exec(bContext *C, wmOperator *op) } } CTX_DATA_END; - + /* return to mesh we're merging to */ me = ob->data; - + CustomData_free(&me->vdata, me->totvert); CustomData_free(&me->edata, me->totedge); CustomData_free(&me->ldata, me->totloop); @@ -540,7 +540,7 @@ int join_mesh_exec(bContext *C, wmOperator *op) /* update normals in case objects with non-uniform scale are joined */ BKE_mesh_calc_normals(me); - + /* old material array */ for (a = 1; a <= ob->totcol; a++) { ma = ob->mat[a - 1]; @@ -567,13 +567,13 @@ int join_mesh_exec(bContext *C, wmOperator *op) /* other mesh users */ test_all_objects_materials(bmain, (ID *)me); - + /* free temp copy of destination shapekeys (if applicable) */ if (nkey) { /* We can assume nobody is using that ID currently. */ BKE_libblock_free_ex(bmain, nkey, false, false); } - + /* ensure newly inserted keys are time sorted */ if (key && (key->type != KEY_RELATIVE)) { BKE_key_sort(key); @@ -593,7 +593,7 @@ int join_mesh_exec(bContext *C, wmOperator *op) /*********************** JOIN AS SHAPES ***************************/ -/* Append selected meshes vertex locations as shapes of the active mesh, +/* Append selected meshes vertex locations as shapes of the active mesh, * return 0 if no join is made (error) and 1 of the join is done */ int join_mesh_shapes_exec(bContext *C, wmOperator *op) @@ -606,14 +606,14 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op) Key *key = me->key; KeyBlock *kb; bool ok = false, nonequal_verts = false; - + CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) { if (base->object == ob) continue; - + if (base->object->type == OB_MESH) { selme = (Mesh *)base->object->data; - + if (selme->totvert == me->totvert) ok = true; else @@ -621,7 +621,7 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op) } } CTX_DATA_END; - + if (!ok) { if (nonequal_verts) BKE_report(op->reports, RPT_WARNING, "Selected meshes must have equal numbers of vertices"); @@ -629,7 +629,7 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op) BKE_report(op->reports, RPT_WARNING, "No additional selected meshes with equal vertex count to join"); return OPERATOR_CANCELLED; } - + if (key == NULL) { key = me->key = BKE_key_add((ID *)me); key->type = KEY_RELATIVE; @@ -638,32 +638,32 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op) kb = BKE_keyblock_add(key, NULL); BKE_keyblock_convert_from_mesh(me, kb); } - + /* now ready to add new keys from selected meshes */ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) { if (base->object == ob) continue; - + if (base->object->type == OB_MESH) { selme = (Mesh *)base->object->data; - + if (selme->totvert == me->totvert) { dm = mesh_get_derived_deform(scene, base->object, CD_MASK_BAREMESH); - + if (!dm) continue; - + kb = BKE_keyblock_add(key, base->object->id.name + 2); - + DM_to_meshkey(dm, me, kb); - + dm->release(dm); } } } CTX_DATA_END; - + WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene); - + return OPERATOR_FINISHED; } @@ -707,12 +707,12 @@ static int mesh_get_x_mirror_vert_spatial(Object *ob, DerivedMesh *dm, int index Mesh *me = ob->data; MVert *mvert = dm ? dm->getVertArray(dm) : me->mvert; float vec[3]; - + mvert = &mvert[index]; vec[0] = -mvert->co[0]; vec[1] = mvert->co[1]; vec[2] = mvert->co[2]; - + return ED_mesh_mirror_spatial_table(ob, NULL, dm, vec, 'u'); } @@ -738,7 +738,7 @@ static BMVert *editbmesh_get_x_mirror_vert_spatial(Object *ob, BMEditMesh *em, c { float vec[3]; int i; - + /* ignore nan verts */ if ((isfinite(co[0]) == false) || (isfinite(co[1]) == false) || @@ -746,11 +746,11 @@ static BMVert *editbmesh_get_x_mirror_vert_spatial(Object *ob, BMEditMesh *em, c { return NULL; } - + vec[0] = -co[0]; vec[1] = co[1]; vec[2] = co[2]; - + i = ED_mesh_mirror_spatial_table(ob, em, NULL, vec, 'u'); if (i != -1) { return BM_vert_at_index(em->bm, i); @@ -767,14 +767,14 @@ static BMVert *editbmesh_get_x_mirror_vert_topo(Object *ob, struct BMEditMesh *e if (index == -1) { BMIter iter; BMVert *v; - + index = 0; BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) { if (v == eve) break; index++; } - + if (index == em->bm->totvert) { return NULL; } @@ -785,7 +785,7 @@ static BMVert *editbmesh_get_x_mirror_vert_topo(Object *ob, struct BMEditMesh *e if (poinval != -1) return (BMVert *)(poinval); return NULL; -} +} BMVert *editbmesh_get_x_mirror_vert(Object *ob, struct BMEditMesh *em, BMVert *eve, const float co[3], int index, const bool use_topology) { @@ -857,19 +857,19 @@ static float *editmesh_get_mirror_uv(BMEditMesh *em, int axis, float *uv, float { BMIter iter; BMFace *efa; - + BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { uv_poly_center(efa, cent, cd_loop_uv_offset); - + if ( (fabsf(cent[0] - cent_vec[0]) < 0.001f) && (fabsf(cent[1] - cent_vec[1]) < 0.001f) ) { BMIter liter; BMLoop *l; - + BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { MLoopUV *luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV); if ( (fabsf(luv->uv[0] - vec[0]) < 0.001f) && (fabsf(luv->uv[1] - vec[1]) < 0.001f) ) { return luv->uv; - + } } } @@ -918,7 +918,7 @@ static int mirror_facerotation(MFace *a, MFace *b) else if (a->v2 == b->v1 && a->v3 == b->v2 && a->v1 == b->v3) return 2; } - + return -1; } @@ -983,7 +983,7 @@ int *mesh_get_x_mirror_faces(Object *ob, BMEditMesh *em, DerivedMesh *dm) BLI_ghash_free(fhash, NULL, NULL); MEM_freeN(mirrorverts); - + return mirrorfaces; } -- cgit v1.2.3