diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/anim.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/editderivedmesh.c | 5 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_add.c | 36 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_select.c | 3 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_snap.c | 11 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.c | 3 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_orientations.c | 3 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_mesh_types.h | 3 |
9 files changed, 27 insertions, 44 deletions
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index f9954ff1dd0..4f68ab82329 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -924,7 +924,7 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl /* simple preventing of too deep nested groups */ if (level > MAX_DUPLI_RECUR) return; - em = me->edit_btmesh; + em = BMEdit_FromObject(par); if (em) { dm = editbmesh_get_derived_cage(scene, par, em, CD_MASK_BAREMESH); @@ -1050,7 +1050,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa if (level > MAX_DUPLI_RECUR) return; copy_m4_m4(pmat, par->obmat); - em = me->edit_btmesh; + em = BMEdit_FromObject(par); if (em) { dm = editbmesh_get_derived_cage(scene, par, em, CD_MASK_BAREMESH); diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 8d7f4e4117a..6b9e0921c3b 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -416,8 +416,7 @@ void constraint_mat_convertspace(Object *ob, bPoseChannel *pchan, float mat[][4] static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[][4]) { DerivedMesh *dm = NULL; - Mesh *me = ob->data; - BMEditMesh *em = me->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(ob); float vec[3] = {0.0f, 0.0f, 0.0f}; float normal[3] = {0.0f, 0.0f, 0.0f}, plane[3]; float imat[3][3], tmat[3][3]; diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c index c6ba6a0d841..1577faccf40 100644 --- a/source/blender/blenkernel/intern/editderivedmesh.c +++ b/source/blender/blenkernel/intern/editderivedmesh.c @@ -1747,5 +1747,10 @@ DerivedMesh *getEditDerivedBMesh(BMEditMesh *em, BMEditMesh *BMEdit_FromObject(Object *ob) { BLI_assert(ob->type == OB_MESH); +#ifndef NDEBUG +// if (((Mesh *)ob->data)->edit_btmesh) { +// BLI_assert(((Mesh *)ob->data)->edit_btmesh->me == ob->data); +// } +#endif return ((Mesh *)ob->data)->edit_btmesh; } diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index 9cbd9e0b7da..8b032bb1a3d 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -97,7 +97,6 @@ static void make_prim_finish(bContext *C, int *state, int enter_editmode) static int add_primitive_plane_exec(bContext *C, wmOperator *op) { Object *obedit; - Mesh *me; BMEditMesh *em; float loc[3], rot[3], mat[4][4], dia; int enter_editmode; @@ -108,8 +107,7 @@ static int add_primitive_plane_exec(bContext *C, wmOperator *op) make_prim_init(C, "Plane", &dia, mat, &state, loc, rot, layer); obedit = CTX_data_edit_object(C); - me = obedit->data; - em = me->edit_btmesh; + em = BMEdit_FromObject(obedit); if (!EDBM_op_call_and_selectf(em, op, "vertout", "create_grid xsegments=%i ysegments=%i size=%f mat=%m4", 1, 1, dia, mat)) @@ -143,7 +141,6 @@ void MESH_OT_primitive_plane_add(wmOperatorType *ot) static int add_primitive_cube_exec(bContext *C, wmOperator *op) { Object *obedit; - Mesh *me; BMEditMesh *em; float loc[3], rot[3], mat[4][4], dia; int enter_editmode; @@ -154,8 +151,7 @@ static int add_primitive_cube_exec(bContext *C, wmOperator *op) make_prim_init(C, "Cube", &dia, mat, &state, loc, rot, layer); obedit = CTX_data_edit_object(C); - me = obedit->data; - em = me->edit_btmesh; + em = BMEdit_FromObject(obedit); if (!EDBM_op_call_and_selectf(em, op, "vertout", "create_cube mat=%m4 size=%f", mat, dia * 2.0f)) { return OPERATOR_CANCELLED; @@ -194,7 +190,6 @@ static const EnumPropertyItem fill_type_items[] = { static int add_primitive_circle_exec(bContext *C, wmOperator *op) { Object *obedit; - Mesh *me; BMEditMesh *em; float loc[3], rot[3], mat[4][4], dia; int enter_editmode; @@ -208,8 +203,7 @@ static int add_primitive_circle_exec(bContext *C, wmOperator *op) make_prim_init(C, "Circle", &dia, mat, &state, loc, rot, layer); obedit = CTX_data_edit_object(C); - me = obedit->data; - em = me->edit_btmesh; + em = BMEdit_FromObject(obedit); if (!EDBM_op_call_and_selectf(em, op, "vertout", "create_circle segments=%i diameter=%f cap_ends=%b cap_tris=%b mat=%m4", @@ -253,7 +247,6 @@ void MESH_OT_primitive_circle_add(wmOperatorType *ot) static int add_primitive_cylinder_exec(bContext *C, wmOperator *op) { Object *obedit; - Mesh *me; BMEditMesh *em; float loc[3], rot[3], mat[4][4], dia; int enter_editmode; @@ -267,8 +260,7 @@ static int add_primitive_cylinder_exec(bContext *C, wmOperator *op) make_prim_init(C, "Cylinder", &dia, mat, &state, loc, rot, layer); obedit = CTX_data_edit_object(C); - me = obedit->data; - em = me->edit_btmesh; + em = BMEdit_FromObject(obedit); if (!EDBM_op_call_and_selectf( em, op, "vertout", @@ -318,7 +310,6 @@ void MESH_OT_primitive_cylinder_add(wmOperatorType *ot) static int add_primitive_cone_exec(bContext *C, wmOperator *op) { Object *obedit; - Mesh *me; BMEditMesh *em; float loc[3], rot[3], mat[4][4], dia; int enter_editmode; @@ -332,8 +323,7 @@ static int add_primitive_cone_exec(bContext *C, wmOperator *op) make_prim_init(C, "Cone", &dia, mat, &state, loc, rot, layer); obedit = CTX_data_edit_object(C); - me = obedit->data; - em = me->edit_btmesh; + em = BMEdit_FromObject(obedit); if (!EDBM_op_call_and_selectf( em, op, "vertout", @@ -382,7 +372,6 @@ void MESH_OT_primitive_cone_add(wmOperatorType *ot) static int add_primitive_grid_exec(bContext *C, wmOperator *op) { Object *obedit; - Mesh *me; BMEditMesh *em; float loc[3], rot[3], mat[4][4], dia; int enter_editmode; @@ -393,8 +382,7 @@ static int add_primitive_grid_exec(bContext *C, wmOperator *op) make_prim_init(C, "Grid", &dia, mat, &state, loc, rot, layer); obedit = CTX_data_edit_object(C); - me = obedit->data; - em = me->edit_btmesh; + em = BMEdit_FromObject(obedit); if (!EDBM_op_call_and_selectf(em, op, "vertout", "create_grid xsegments=%i ysegments=%i size=%f mat=%m4", @@ -438,7 +426,6 @@ void MESH_OT_primitive_grid_add(wmOperatorType *ot) static int add_primitive_monkey_exec(bContext *C, wmOperator *op) { Object *obedit; - Mesh *me; BMEditMesh *em; float loc[3], rot[3], mat[4][4], dia; int enter_editmode; @@ -452,8 +439,7 @@ static int add_primitive_monkey_exec(bContext *C, wmOperator *op) make_prim_init(C, "Monkey", &dia, mat, &state, loc, rot, layer); obedit = CTX_data_edit_object(C); - me = obedit->data; - em = me->edit_btmesh; + em = BMEdit_FromObject(obedit); if (!EDBM_op_call_and_selectf(em, op, "vertout", "create_monkey mat=%m4", mat)) { return OPERATOR_CANCELLED; @@ -484,7 +470,6 @@ void MESH_OT_primitive_monkey_add(wmOperatorType *ot) static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op) { Object *obedit; - Mesh *me; BMEditMesh *em; float loc[3], rot[3], mat[4][4], dia; int enter_editmode; @@ -495,8 +480,7 @@ static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op) make_prim_init(C, "Sphere", &dia, mat, &state, loc, rot, layer); obedit = CTX_data_edit_object(C); - me = obedit->data; - em = me->edit_btmesh; + em = BMEdit_FromObject(obedit); if (!EDBM_op_call_and_selectf(em, op, "vertout", "create_uvsphere segments=%i revolutions=%i diameter=%f mat=%m4", @@ -540,7 +524,6 @@ void MESH_OT_primitive_uv_sphere_add(wmOperatorType *ot) static int add_primitive_icosphere_exec(bContext *C, wmOperator *op) { Object *obedit; - Mesh *me; BMEditMesh *em; float loc[3], rot[3], mat[4][4], dia; int enter_editmode; @@ -551,8 +534,7 @@ static int add_primitive_icosphere_exec(bContext *C, wmOperator *op) make_prim_init(C, "Icosphere", &dia, mat, &state, loc, rot, layer); obedit = CTX_data_edit_object(C); - me = obedit->data; - em = me->edit_btmesh; + em = BMEdit_FromObject(obedit); if (!EDBM_op_call_and_selectf( em, op, "vertout", diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index c8b86354cb8..3ac011550be 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -2296,8 +2296,7 @@ void em_setup_viewcontext(bContext *C, ViewContext *vc) view3d_set_viewcontext(C, vc); if (vc->obedit) { - Mesh *me = vc->obedit->data; - vc->em = me->edit_btmesh; + vc->em = BMEdit_FromObject(vc->obedit); } } diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index fc97b9bbb36..4ca9bd95485 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -101,8 +101,8 @@ static void special_transvert_update(Object *obedit) DAG_id_tag_update(obedit->data, 0); if (obedit->type == OB_MESH) { - Mesh *me = obedit->data; - BM_mesh_normals_update(me->edit_btmesh->bm, TRUE); /* does face centers too */ + BMEditMesh *em = BMEdit_FromObject(obedit); + BM_mesh_normals_update(em->bm, TRUE); /* does face centers too */ } else if (ELEM(obedit->type, OB_CURVE, OB_SURF)) { Curve *cu = obedit->data; @@ -229,8 +229,7 @@ static void make_trans_verts(Object *obedit, float min[3], float max[3], int mod zero_v3(centroid); if (obedit->type == OB_MESH) { - Mesh *me = obedit->data; - BMEditMesh *em = me->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(obedit); BMesh *bm = em->bm; BMIter iter; void *userdata[2] = {em, NULL}; @@ -992,11 +991,11 @@ static int snap_curs_to_active(bContext *C, wmOperator *UNUSED(op)) if (obedit) { if (obedit->type == OB_MESH) { + BMEditMesh *em = BMEdit_FromObject(obedit); /* check active */ - Mesh *me = obedit->data; BMEditSelection ese; - if (BM_select_history_active_get(me->edit_btmesh->bm, &ese)) { + if (BM_select_history_active_get(em->bm, &ese)) { BM_editselection_center(&ese, curs); } diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index a21f8fd5f34..23af0d6f8d6 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -4753,8 +4753,7 @@ static void calcNonProportionalEdgeSlide(TransInfo *t, SlideData *sld, const flo static int createSlideVerts(TransInfo *t) { - Mesh *me = t->obedit->data; - BMEditMesh *em = me->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(t->obedit); BMesh *bm = em->bm; BMIter iter, iter2; BMEdge *e, *e1; diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 237f6b35eb0..a155ff7786a 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -565,8 +565,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], ob = obedit; if (ob->type == OB_MESH) { - Mesh *me = ob->data; - BMEditMesh *em = me->edit_btmesh; + BMEditMesh *em = BMEdit_FromObject(ob); BMVert *eve; BMEditSelection ese; float vec[3] = {0, 0, 0}; diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h index 5d55bb8a4db..e584cfd76ac 100644 --- a/source/blender/makesdna/DNA_mesh_types.h +++ b/source/blender/makesdna/DNA_mesh_types.h @@ -92,7 +92,8 @@ typedef struct Mesh { struct MCol *mcol; struct MSticky *msticky; struct Mesh *texcomesh; - + + /* When the object is available, the preferred access method is: BMEdit_FromObject(ob) */ struct BMEditMesh *edit_btmesh; /* not saved in file! */ struct CustomData vdata, edata, fdata; |