Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-09-05 00:51:09 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-09-05 00:51:09 +0400
commit7df35db1b1364dcd81dd8247ad3707d40a78fd59 (patch)
treefb967409fddbb02ee70fbdfa1e404fae115a312e /source/blender/editors/mesh/editmesh_add.c
parent5342f7930fb26855b92f337ace45f2ee51153957 (diff)
2.5
Notifiers --------- Various fixes for wrong use of notifiers, and some new notifiers to make things a bit more clear and consistent, with two notable changes: * Geometry changes are now done with NC_GEOM, rather than NC_OBJECT|ND_GEOM_, so an object does need to be available. * Space data now use NC_SPACE|ND_SPACE_*, instead of data notifiers or even NC_WINDOW in some cases. Note that NC_SPACE should only be used for notifying about changes in space data, we don't want to go back to allqueue(REDRAW..). Depsgraph --------- The dependency graph now has a different flush call: DAG_object_flush_update(scene, ob, flag) is replaced by: DAG_id_flush_update(id, flag) It still works basically the same, one difference is that it now also accepts object data (e.g. Mesh), again to avoid requiring an Object to be available. Other ID types will simply do nothing at the moment. Docs ---- I made some guidelines for how/when to do which kinds of updates and notifiers. I can't specify totally exact how to make these decisions, but these are basically the guidelines I use. So, new and updated docs are here: http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
Diffstat (limited to 'source/blender/editors/mesh/editmesh_add.c')
-rw-r--r--source/blender/editors/mesh/editmesh_add.c78
1 files changed, 32 insertions, 46 deletions
diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c
index 19078d2f6ff..4af5ddf56fa 100644
--- a/source/blender/editors/mesh/editmesh_add.c
+++ b/source/blender/editors/mesh/editmesh_add.c
@@ -217,8 +217,8 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event)
}
//retopo_do_all();
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, vc.obedit);
- DAG_object_flush_update(vc.scene, vc.obedit, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, vc.obedit->data);
+ DAG_id_flush_update(vc.obedit->data, OB_RECALC_DATA);
return OPERATOR_FINISHED;
}
@@ -343,9 +343,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;
@@ -376,9 +375,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;
@@ -666,7 +664,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(EditMesh *em, wmOperator *op)
@@ -695,7 +693,7 @@ static void addedgeface_mesh(EditMesh *em, wmOperator *op)
eed= addedgelist(em, neweve[0], neweve[1], NULL);
EM_select_edge(eed, 1);
- // 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) {
@@ -792,9 +790,8 @@ static int addedgeface_mesh_exec(bContext *C, wmOperator *op)
addedgeface_mesh(em, op);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
-
- DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA);
+ 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;
@@ -1311,7 +1308,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];
@@ -1321,8 +1317,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;
}
@@ -1344,7 +1340,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];
@@ -1354,8 +1349,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;
}
@@ -1377,7 +1372,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];
@@ -1387,8 +1381,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;
}
@@ -1415,7 +1409,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];
@@ -1425,8 +1418,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;
}
@@ -1453,7 +1446,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];
@@ -1463,8 +1455,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;
}
@@ -1491,7 +1483,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];
@@ -1501,8 +1492,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;
}
@@ -1531,7 +1522,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];
@@ -1541,8 +1531,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;
}
@@ -1569,7 +1559,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];
@@ -1577,8 +1566,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;
}
@@ -1600,7 +1589,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];
@@ -1610,8 +1598,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;
}
@@ -1638,7 +1626,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];
@@ -1648,8 +1635,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;
}
@@ -1677,7 +1664,6 @@ void MESH_OT_primitive_ico_sphere_add(wmOperatorType *ot)
static int mesh_duplicate_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh(ob->data);
@@ -1685,8 +1671,8 @@ static int mesh_duplicate_exec(bContext *C, wmOperator *op)
BKE_mesh_end_editmesh(ob->data, em);
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, ob);
+ DAG_id_flush_update(ob->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
return OPERATOR_FINISHED;
}