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/space_buttons
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/space_buttons')
-rw-r--r--source/blender/editors/space_buttons/buttons_ops.c19
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c17
2 files changed, 20 insertions, 16 deletions
diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index 954a52c54aa..8cdc6b0cd2b 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -260,7 +260,6 @@ void OBJECT_OT_material_slot_remove(wmOperatorType *ot)
static int material_slot_assign_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
if(!ob)
@@ -298,8 +297,8 @@ static int material_slot_assign_exec(bContext *C, wmOperator *op)
}
}
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
+ DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
return OPERATOR_FINISHED;
}
@@ -377,7 +376,7 @@ static int material_slot_de_select(bContext *C, int select)
}
}
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, ob);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, ob->data);
return OPERATOR_FINISHED;
}
@@ -648,7 +647,7 @@ static int new_particle_settings_exec(bContext *C, wmOperator *op)
psys_check_boid_data(psys);
DAG_scene_sort(scene);
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+ DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
@@ -695,7 +694,7 @@ static int new_particle_target_exec(bContext *C, wmOperator *op)
BLI_addtail(&psys->targets, pt);
DAG_scene_sort(scene);
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+ DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
@@ -742,7 +741,7 @@ static int remove_particle_target_exec(bContext *C, wmOperator *op)
pt->flag |= PTARGET_CURRENT;
DAG_scene_sort(scene);
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+ DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
@@ -766,7 +765,6 @@ void PARTICLE_OT_remove_target(wmOperatorType *ot)
static int target_move_up_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
ParticleSystem *psys= ptr.data;
Object *ob = ptr.id.data;
@@ -781,7 +779,7 @@ static int target_move_up_exec(bContext *C, wmOperator *op)
BLI_remlink(&psys->targets, pt);
BLI_insertlink(&psys->targets, pt->prev->prev, pt);
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+ DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
break;
}
@@ -806,7 +804,6 @@ void PARTICLE_OT_target_move_up(wmOperatorType *ot)
static int target_move_down_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
ParticleSystem *psys= ptr.data;
Object *ob = ptr.id.data;
@@ -820,7 +817,7 @@ static int target_move_down_exec(bContext *C, wmOperator *op)
BLI_remlink(&psys->targets, pt);
BLI_insertlink(&psys->targets, pt->next, pt);
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+ DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
break;
}
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index 71f8642afd4..5d1dbe47345 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -335,7 +335,6 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
case ND_TRANSFORM:
case ND_BONE_ACTIVE:
case ND_BONE_SELECT:
- case ND_GEOM_SELECT:
case ND_CONSTRAINT:
ED_area_tag_redraw(sa);
break;
@@ -346,6 +345,13 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
break;
}
break;
+ case NC_GEOM:
+ switch(wmn->data) {
+ case ND_SELECT:
+ ED_area_tag_redraw(sa);
+ break;
+ }
+ break;
case NC_MATERIAL:
ED_area_tag_redraw(sa);
@@ -358,14 +364,15 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
}
break;
case NC_WORLD:
- ED_area_tag_redraw(sa);
- sbuts->preview= 1;
case NC_LAMP:
- ED_area_tag_redraw(sa);
- sbuts->preview= 1;
case NC_TEXTURE:
ED_area_tag_redraw(sa);
sbuts->preview= 1;
+ break;
+ case NC_SPACE:
+ if(wmn->data == ND_SPACE_PROPERTIES)
+ ED_area_tag_redraw(sa);
+ break;
}
if(wmn->data == ND_KEYS)