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/armature
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/armature')
-rw-r--r--source/blender/editors/armature/editarmature.c25
-rw-r--r--source/blender/editors/armature/poselib.c6
-rw-r--r--source/blender/editors/armature/poseobject.c18
3 files changed, 21 insertions, 28 deletions
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index 9f83733a640..65051c384b3 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -340,7 +340,7 @@ void ED_armature_from_edit(Scene *scene, Object *obedit)
armature_rebuild_pose(obt, arm);
}
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+ DAG_id_flush_update(&obedit->id, OB_RECALC_DATA);
}
@@ -1054,8 +1054,8 @@ static int separate_armature_exec (bContext *C, wmOperator *op)
/* 4) fix links before depsgraph flushes */ // err... or after?
separated_armature_fix_links(oldob, newob);
- DAG_object_flush_update(scene, oldob, OB_RECALC_DATA); /* this is the original one */
- DAG_object_flush_update(scene, newob, OB_RECALC_DATA); /* this is the separated one */
+ DAG_id_flush_update(&oldob->id, OB_RECALC_DATA); /* this is the original one */
+ DAG_id_flush_update(&newob->id, OB_RECALC_DATA); /* this is the separated one */
/* 5) restore original conditions */
@@ -1890,7 +1890,7 @@ void mouse_armature(bContext *C, short mval[2], int extend)
if(nearBone->flag & BONE_SELECTED) nearBone->flag |= BONE_ACTIVE;
}
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, vc.obedit);
+ WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, vc.obedit);
}
}
@@ -4335,7 +4335,7 @@ int ED_do_pose_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, shor
if (ob->mode & OB_MODE_WEIGHT_PAINT) {
if (nearBone->flag & BONE_ACTIVE) {
vertexgroup_select_by_name(OBACT, nearBone->name);
- DAG_object_flush_update(scene, OBACT, OB_RECALC_DATA);
+ DAG_id_flush_update(&OBACT->id, OB_RECALC_DATA);
}
}
@@ -4765,7 +4765,6 @@ void create_vgroups_from_armature(Scene *scene, Object *ob, Object *par, int mod
static int pose_clear_scale_exec(bContext *C, wmOperator *op)
{
- Scene *scene = CTX_data_scene(C);
Object *ob= CTX_data_active_object(C);
/* only clear those channels that are not locked */
@@ -4782,7 +4781,7 @@ static int pose_clear_scale_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+ DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
/* note, notifier might evolve */
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, ob);
@@ -4807,7 +4806,6 @@ void POSE_OT_scale_clear(wmOperatorType *ot)
static int pose_clear_loc_exec(bContext *C, wmOperator *op)
{
- Scene *scene = CTX_data_scene(C);
Object *ob= CTX_data_active_object(C);
/* only clear those channels that are not locked */
@@ -4824,7 +4822,7 @@ static int pose_clear_loc_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+ DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
/* note, notifier might evolve */
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, ob);
@@ -4849,7 +4847,6 @@ void POSE_OT_loc_clear(wmOperatorType *ot)
static int pose_clear_rot_exec(bContext *C, wmOperator *op)
{
- Scene *scene = CTX_data_scene(C);
Object *ob= CTX_data_active_object(C);
/* only clear those channels that are not locked */
@@ -4899,7 +4896,7 @@ static int pose_clear_rot_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+ DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
/* note, notifier might evolve */
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, ob);
@@ -5337,7 +5334,6 @@ void ED_armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep)
static int armature_flip_names_exec (bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_edit_object(C);
bArmature *arm;
char newname[32];
@@ -5357,7 +5353,7 @@ static int armature_flip_names_exec (bContext *C, wmOperator *op)
CTX_DATA_END;
/* since we renamed stuff... */
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+ DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
/* note, notifier might evolve */
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob);
@@ -5383,7 +5379,6 @@ void ARMATURE_OT_flip_names (wmOperatorType *ot)
static int armature_autoside_names_exec (bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_edit_object(C);
bArmature *arm;
char newname[32];
@@ -5404,7 +5399,7 @@ static int armature_autoside_names_exec (bContext *C, wmOperator *op)
CTX_DATA_END;
/* since we renamed stuff... */
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+ DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
/* note, notifier might evolve */
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob);
diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c
index 021bec05a3b..56d714fd058 100644
--- a/source/blender/editors/armature/poselib.c
+++ b/source/blender/editors/armature/poselib.c
@@ -843,7 +843,7 @@ static void poselib_preview_apply (bContext *C, wmOperator *op)
*/
// FIXME: shouldn't this use the builtin stuff?
if ((pld->arm->flag & ARM_DELAYDEFORM)==0)
- DAG_object_flush_update(pld->scene, pld->ob, OB_RECALC_DATA); /* sets recalc flags */
+ DAG_id_flush_update(&pld->ob->id, OB_RECALC_DATA); /* sets recalc flags */
else
where_is_pose(pld->scene, pld->ob);
}
@@ -1346,7 +1346,7 @@ static void poselib_preview_cleanup (bContext *C, wmOperator *op)
* - note: code copied from transform_generics.c -> recalcData()
*/
if ((arm->flag & ARM_DELAYDEFORM)==0)
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA); /* sets recalc flags */
+ DAG_id_flush_update(&ob->id, OB_RECALC_DATA); /* sets recalc flags */
else
where_is_pose(scene, ob);
@@ -1360,7 +1360,7 @@ static void poselib_preview_cleanup (bContext *C, wmOperator *op)
action_set_activemarker(act, marker, 0);
/* Update event for pose and deformation children */
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+ DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
/* updates */
if (IS_AUTOKEY_MODE(scene, NORMAL)) {
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c
index 9a72fce2bcf..2673640b213 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -893,7 +893,7 @@ void pose_copy_menu(Scene *scene)
ob->pose->flag |= POSE_RECALC;
}
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA); // and all its relations
+ DAG_id_flush_update(&ob->id, OB_RECALC_DATA); // and all its relations
BIF_undo_push("Copy Pose Attributes");
@@ -1067,7 +1067,7 @@ static int pose_paste_exec (bContext *C, wmOperator *op)
}
/* Update event for pose and deformation children */
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+ DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
if (IS_AUTOKEY_ON(scene)) {
// XXX remake_action_ipos(ob->action);
@@ -1124,7 +1124,7 @@ void pose_adds_vgroups(Scene *scene, Object *meshobj, int heatweights)
// and all its relations
- DAG_object_flush_update(scene, meshobj, OB_RECALC_DATA);
+ DAG_id_flush_update(&meshobj->id, OB_RECALC_DATA);
}
/* ********************************************** */
@@ -1540,7 +1540,6 @@ void pose_select_grouped_menu (Scene *scene)
static int pose_flip_names_exec (bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_active_object(C);
bArmature *arm;
char newname[32];
@@ -1560,7 +1559,7 @@ static int pose_flip_names_exec (bContext *C, wmOperator *op)
CTX_DATA_END;
/* since we renamed stuff... */
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+ DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
/* note, notifier might evolve */
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob);
@@ -1587,7 +1586,6 @@ void POSE_OT_flip_names (wmOperatorType *ot)
static int pose_autoside_names_exec (bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_active_object(C);
bArmature *arm;
char newname[32];
@@ -1608,7 +1606,7 @@ static int pose_autoside_names_exec (bContext *C, wmOperator *op)
CTX_DATA_END;
/* since we renamed stuff... */
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+ DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
/* note, notifier might evolve */
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob);
@@ -1677,7 +1675,7 @@ void pose_activate_flipped_bone(Scene *scene)
/* in weightpaint we select the associated vertex group too */
if(ob->mode & OB_MODE_WEIGHT_PAINT) {
vertexgroup_select_by_name(OBACT, name);
- DAG_object_flush_update(scene, OBACT, OB_RECALC_DATA);
+ DAG_id_flush_update(&OBACT->id, OB_RECALC_DATA);
}
// XXX notifiers need to be sent to other editors to update
@@ -2116,7 +2114,7 @@ void pose_relax(Scene *scene)
pchan->bone->flag &= ~ BONE_TRANSFORM;
/* do depsgraph flush */
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+ DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
BIF_undo_push("Relax Pose");
}
@@ -2211,7 +2209,7 @@ void pose_clear_user_transforms(Scene *scene, Object *ob)
rest_pose(ob->pose);
}
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+ DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
BIF_undo_push("Clear User Transform");
}