diff options
Diffstat (limited to 'source/blender/editors/mesh/editmesh_add.c')
-rw-r--r-- | source/blender/editors/mesh/editmesh_add.c | 69 |
1 files changed, 28 insertions, 41 deletions
diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index fbeb1636114..b84ba39fc8e 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -223,9 +223,8 @@ static int make_fgon_exec(bContext *C, wmOperator *op) EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data)); if( make_fgon(em, op, 1) ) { - DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA); - - WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); + DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); BKE_mesh_end_editmesh(obedit->data, em); return OPERATOR_FINISHED; @@ -256,9 +255,8 @@ static int clear_fgon_exec(bContext *C, wmOperator *op) EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data)); if( make_fgon(em, op, 0) ) { - DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA); - - WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); + DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); BKE_mesh_end_editmesh(obedit->data, em); return OPERATOR_FINISHED; @@ -546,7 +544,7 @@ void addfaces_from_edgenet(EditMesh *em) EM_select_flush(em); -// XXX DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); +// XXX DAG_id_flush_update(obedit->data, OB_RECALC_DATA); } static void addedgeface_mesh(Mesh *me, BMEditMesh *bem, wmOperator *op) @@ -569,7 +567,7 @@ static void addedgeface_mesh(Mesh *me, BMEditMesh *bem, wmOperator *op) len = BMO_GetSlot(&bmop, "edgeout")->len; ok = EDBM_FinishOp(bem, &bmop, op, 1); - if (!ok) return OPERATOR_CANCELLED; + if (!ok) return; if (len) return; } @@ -590,7 +588,7 @@ static void addedgeface_mesh(Mesh *me, BMEditMesh *bem, wmOperator *op) len = BMO_GetSlot(&bmop, "regionout")->len; ok = EDBM_FinishOp(bem, &bmop, op, 1); - if (!ok) return OPERATOR_CANCELLED; + if (!ok) return; if (len) return; } @@ -617,7 +615,7 @@ static void addedgeface_mesh(Mesh *me, BMEditMesh *bem, wmOperator *op) EM_select_edge(eed, 1); BKE_mesh_end_editmesh(me, em); - // XXX DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); + // XXX DAG_id_flush_update(obedit->data, OB_RECALC_DATA); return; } else if(amount > 4) { @@ -712,7 +710,6 @@ static void addedgeface_mesh(Mesh *me, BMEditMesh *bem, wmOperator *op) BKE_mesh_end_editmesh(me, em); } - /* ************************ primitives ******************* */ // HACK: these can also be found in cmoview.tga.c, but are here so that they can be found by linker @@ -1208,7 +1205,6 @@ static float new_primitive_matrix(bContext *C, float primmat[][4]) static int add_primitive_plane_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); float dia, mat[4][4]; @@ -1218,8 +1214,8 @@ static int add_primitive_plane_exec(bContext *C, wmOperator *op) make_prim(obedit, PRIM_PLANE, mat, 4, 0, 0, dia, 0.0f, 0, 1); - DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); + DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); return OPERATOR_FINISHED; } @@ -1241,7 +1237,6 @@ void MESH_OT_primitive_plane_add(wmOperatorType *ot) static int add_primitive_cube_exec(bContext *C, wmOperator *op) { - Scene *scene = CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); float dia, mat[4][4]; @@ -1251,8 +1246,8 @@ static int add_primitive_cube_exec(bContext *C, wmOperator *op) make_prim(obedit, PRIM_CUBE, mat, 4, 0, 0, dia, 1.0f, 1, 1); - DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); + DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); return OPERATOR_FINISHED; } @@ -1274,7 +1269,6 @@ void MESH_OT_primitive_cube_add(wmOperatorType *ot) static int add_primitive_circle_exec(bContext *C, wmOperator *op) { - Scene *scene = CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); float dia, mat[4][4]; @@ -1284,8 +1278,8 @@ static int add_primitive_circle_exec(bContext *C, wmOperator *op) make_prim(obedit, PRIM_CIRCLE, mat, RNA_int_get(op->ptr, "vertices"), 0, 0, dia, 0.0f, 0, RNA_boolean_get(op->ptr, "fill")); - DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); + DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); return OPERATOR_FINISHED; } @@ -1312,7 +1306,6 @@ void MESH_OT_primitive_circle_add(wmOperatorType *ot) static int add_primitive_cylinder_exec(bContext *C, wmOperator *op) { - Scene *scene = CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); float dia, mat[4][4]; @@ -1322,8 +1315,8 @@ static int add_primitive_cylinder_exec(bContext *C, wmOperator *op) make_prim(obedit, PRIM_CYLINDER, mat, RNA_int_get(op->ptr, "vertices"), 0, 0, dia, RNA_float_get(op->ptr, "depth"), 1, 1); - DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); + DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); return OPERATOR_FINISHED; } @@ -1350,7 +1343,6 @@ void MESH_OT_primitive_cylinder_add(wmOperatorType *ot) static int add_primitive_tube_exec(bContext *C, wmOperator *op) { - Scene *scene = CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); float dia, mat[4][4]; @@ -1360,8 +1352,8 @@ static int add_primitive_tube_exec(bContext *C, wmOperator *op) make_prim(obedit, PRIM_CYLINDER, mat, RNA_int_get(op->ptr, "vertices"), 0, 0, dia, RNA_float_get(op->ptr, "depth"), 1, 0); - DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); + DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); return OPERATOR_FINISHED; } @@ -1388,7 +1380,6 @@ void MESH_OT_primitive_tube_add(wmOperatorType *ot) static int add_primitive_cone_exec(bContext *C, wmOperator *op) { - Scene *scene = CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); float dia, mat[4][4]; @@ -1398,8 +1389,8 @@ static int add_primitive_cone_exec(bContext *C, wmOperator *op) make_prim(obedit, PRIM_CONE, mat, RNA_int_get(op->ptr, "vertices"), 0, 0, dia, RNA_float_get(op->ptr, "depth"), 0, RNA_boolean_get(op->ptr, "cap_end")); - DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); + DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); return OPERATOR_FINISHED; } @@ -1428,7 +1419,6 @@ void MESH_OT_primitive_cone_add(wmOperatorType *ot) static int add_primitive_grid_exec(bContext *C, wmOperator *op) { - Scene *scene = CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); float dia, mat[4][4]; @@ -1438,8 +1428,8 @@ static int add_primitive_grid_exec(bContext *C, wmOperator *op) make_prim(obedit, PRIM_GRID, mat, RNA_int_get(op->ptr, "x_subdivisions"), RNA_int_get(op->ptr, "y_subdivisions"), 0, dia, 0.0f, 0, 1); - DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); + DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); return OPERATOR_FINISHED; } @@ -1466,7 +1456,6 @@ void MESH_OT_primitive_grid_add(wmOperatorType *ot) static int add_primitive_monkey_exec(bContext *C, wmOperator *op) { - Scene *scene = CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); float mat[4][4]; @@ -1474,8 +1463,8 @@ static int add_primitive_monkey_exec(bContext *C, wmOperator *op) make_prim(obedit, PRIM_MONKEY, mat, 0, 0, 2, 0.0f, 0.0f, 0, 0); - DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); + DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); return OPERATOR_FINISHED; } @@ -1497,7 +1486,6 @@ void MESH_OT_primitive_monkey_add(wmOperatorType *ot) static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op) { - Scene *scene = CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); float dia, mat[4][4]; @@ -1507,8 +1495,8 @@ static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op) make_prim(obedit, PRIM_UVSPHERE, mat, RNA_int_get(op->ptr, "rings"), RNA_int_get(op->ptr, "segments"), 0, dia, 0.0f, 0, 0); - DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); + DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); return OPERATOR_FINISHED; } @@ -1535,7 +1523,6 @@ void MESH_OT_primitive_uv_sphere_add(wmOperatorType *ot) static int add_primitive_icosphere_exec(bContext *C, wmOperator *op) { - Scene *scene = CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); float dia, mat[4][4]; @@ -1545,8 +1532,8 @@ static int add_primitive_icosphere_exec(bContext *C, wmOperator *op) make_prim(obedit, PRIM_ICOSPHERE, mat, 0, 0, RNA_int_get(op->ptr, "subdivisions"), dia, 0.0f, 0, 0); - DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); + DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); return OPERATOR_FINISHED; } |