diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-04 10:39:04 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-04 10:39:04 +0300 |
commit | 95011f6d484b369db92ae13c674a6522d664ea8f (patch) | |
tree | 91ba2719c9f3096fad0f1f768aa7b1c4d79aa32a /source/blender/editors/mesh | |
parent | 0911acb5cf49c5ba05b1df045b41697704aa288a (diff) | |
parent | 44505b38df557a5711703613685a1dec9fc2c3d9 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r-- | source/blender/editors/mesh/editface.c | 28 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_bevel.c | 12 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_knife.c | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_loopcut.c | 32 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_select.c | 6 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_data.c | 32 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_navmesh.c | 8 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_ops.c | 36 | ||||
-rw-r--r-- | source/blender/editors/mesh/meshtools.c | 100 |
10 files changed, 129 insertions, 129 deletions
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index 6d1f478249a..7e31b6a3774 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -64,7 +64,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) @@ -106,7 +106,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; @@ -122,10 +122,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); @@ -258,7 +258,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; @@ -311,7 +311,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; @@ -338,19 +338,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; @@ -360,7 +360,7 @@ bool paintface_mouse_select(struct bContext *C, Object *ob, const int mval[2], b mpoly++; } } - + me->act_face = (int)index; if (extend) { @@ -378,7 +378,7 @@ 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); @@ -399,7 +399,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)) { @@ -455,7 +455,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 @@ -520,7 +520,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 e75b133b5bd..c51a57e27b3 100644 --- a/source/blender/editors/mesh/editmesh_bevel.c +++ b/source/blender/editors/mesh/editmesh_bevel.c @@ -85,7 +85,7 @@ typedef struct { typedef struct { 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; @@ -174,7 +174,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; @@ -338,7 +338,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) ? @@ -552,7 +552,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; @@ -594,7 +594,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)); @@ -603,7 +603,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 67e2a67c852..be54bba7aa4 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -1806,7 +1806,7 @@ static void knife_input_ray_segment(KnifeTool_OpData *kcd, const float mval[2], ED_view3d_unproject(kcd->vc.ar, mval[0], mval[1], ofs, r_origin_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 26bac996381..3e787b2055a 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -77,7 +77,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; @@ -109,7 +109,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); @@ -172,7 +172,7 @@ static void edgering_find_order(BMEdge *lasteed, BMEdge *eed, break; } } - + /* this should never happen */ if (!l) { v[0][0] = eed->v1; @@ -181,7 +181,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) { @@ -446,7 +446,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) */ @@ -494,7 +494,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); } @@ -508,7 +508,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); MEM_freeN(lcd->objects); @@ -776,7 +776,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; @@ -791,11 +791,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; @@ -897,7 +897,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; } @@ -911,11 +911,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; @@ -932,14 +932,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/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index fd8efcd84e3..634c65485e9 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -678,10 +678,10 @@ BMEdge *EDBM_edge_find_nearest_ex( { FAKE_SELECT_MODE_BEGIN(vc, fake_select_mode, select_mode, SCE_SELECT_EDGE); ED_view3d_backbuf_validate_with_select_mode(vc, select_mode); - + index = ED_view3d_backbuf_sample_rect(vc, vc->mval, dist_px, bm_solidoffs, bm_wireoffs, &dist_test); eed = index ? BM_edge_at_index_find_or_table(bm, index - 1) : NULL; - + FAKE_SELECT_MODE_END(vc, fake_select_mode); } @@ -1061,7 +1061,7 @@ static bool unified_findnearest( mval_prev[0] = vc->mval[0]; mval_prev[1] = vc->mval[1]; - + /* Only one element type will be non-null. */ BLI_assert(((hit.v.ele != NULL) + (hit.e.ele != NULL) + (hit.f.ele != NULL)) <= 1); diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 3a67abdb9a0..5c6b6da54a6 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -5310,7 +5310,7 @@ static int edbm_dissolve_degenerate_exec(bContext *C, wmOperator *op) } /* objects */ const float thresh = RNA_float_get(op->ptr, "threshold"); - + for (uint ob_index = 0; ob_index < objects_len; ob_index++) { Object *obedit = objects[ob_index]; BMEditMesh *em = BKE_editmesh_from_object(obedit); diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index 28481bbbee3..d2410c7d97b 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -255,7 +255,7 @@ void ED_mesh_uv_loop_reset(struct bContext *C, struct Mesh *me) CustomData *ldata = GET_CD_DATA(me, ldata); const int layernum = CustomData_get_active_layer(ldata, CD_MLOOPUV); ED_mesh_uv_loop_reset_ex(me, layernum); - + WM_event_add_notifier(C, NC_GEOM | ND_DATA, me); } @@ -301,7 +301,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->ldata, CD_MLOOPUV, layernum_dst); CustomData_set_layer_active(&me->fdata, CD_MTFACE, layernum_dst); @@ -517,7 +517,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; } @@ -527,7 +527,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; @@ -545,7 +545,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; @@ -558,7 +558,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; @@ -576,7 +576,7 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, const wmEvent *e } if (me->edit_btmesh == NULL) return OPERATOR_CANCELLED; - + if (exitmode) { EDBM_mesh_load(obedit); EDBM_mesh_free(me->edit_btmesh); @@ -591,9 +591,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; } @@ -603,14 +603,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"); @@ -630,7 +630,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; } @@ -640,7 +640,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; @@ -668,7 +668,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; @@ -694,7 +694,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_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 2a86b8caacc..b3c507affb7 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -98,12 +98,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); @@ -220,7 +220,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"); @@ -317,14 +317,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); @@ -372,13 +372,13 @@ 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); @@ -395,14 +395,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); @@ -436,9 +436,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); @@ -456,7 +456,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); @@ -464,7 +464,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 */ @@ -475,13 +475,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 802922ab799..786b27ee816 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -286,7 +286,7 @@ 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"); @@ -306,23 +306,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; @@ -331,7 +331,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; @@ -346,23 +346,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); @@ -375,14 +375,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) */ @@ -394,8 +394,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) { @@ -419,7 +419,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 */ @@ -481,7 +481,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); @@ -522,10 +522,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); @@ -546,7 +546,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]; @@ -573,13 +573,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); @@ -599,7 +599,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) @@ -613,14 +613,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 @@ -628,7 +628,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"); @@ -636,7 +636,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; @@ -645,32 +645,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(depsgraph, 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; } @@ -739,12 +739,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'); } @@ -802,7 +802,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) || @@ -810,11 +810,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); @@ -831,14 +831,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; } @@ -849,7 +849,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) { @@ -921,19 +921,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; - + } } } @@ -982,7 +982,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; } |