Fix T43872: Adding a constraint to a bone of a proxy armature resets all bones' transformations.

Temp hack for until new depsgraph is here. Thanks the Joshua and Sergey for their help.
This commit is contained in:
Bastien Montagne 2015-03-09 12:40:24 +01:00
parent fd94d2d80f
commit b21e0cccfa
Notes: blender-bot 2024-04-29 13:07:32 +02:00
Referenced by issue #43872, Adding a constraint to a bone of a proxy armature resets all bones' transformations.
1 changed files with 17 additions and 1 deletions

View File

@ -1165,7 +1165,17 @@ void ED_object_constraint_dependency_update(Main *bmain, Object *ob)
{
ED_object_constraint_update(ob);
if (ob->pose) ob->pose->flag |= POSE_RECALC; // checks & sorts pose channels
if (ob->pose) {
ob->pose->flag |= POSE_RECALC; /* Checks & sort pose channels. */
if (ob->proxy && ob->adt) {
/* We need to make use of ugly POSE_ANIMATION_WORKAROUND here too, else anim data are not reloaded
* after calling `BKE_pose_rebuild()`, which causes T43872.
* Note that this is a bit wide here, since we cannot be sure whether there are some locked proxy bones
* or not...
* XXX Temp hack until new depsgraph hopefully solves this. */
ob->adt->recalc |= ADT_RECALC_ANIM;
}
}
DAG_relations_tag_update(bmain);
}
@ -1725,6 +1735,12 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase
if ((ob->type == OB_ARMATURE) && (pchan)) {
ob->pose->flag |= POSE_RECALC; /* sort pose channels */
if (BKE_constraints_proxylocked_owner(ob, pchan) && ob->adt) {
/* We need to make use of ugly POSE_ANIMATION_WORKAROUND here too, else anim data are not reloaded
* after calling `BKE_pose_rebuild()`, which causes T43872.
* XXX Temp hack until new depsgraph hopefully solves this. */
ob->adt->recalc |= ADT_RECALC_ANIM;
}
DAG_id_tag_update(&ob->id, OB_RECALC_DATA | OB_RECALC_OB);
}
else