Depsgraph: Avoid unneeded relations update when canceling transform

This was originally done for T46320 in order to re-store depsgraph state
after all the constraint modifications.

However, it relations were updated if there's any IK chain the the pose,
which is a bit too annoying.
This commit is contained in:
Sergey Sharybin
2016-05-09 16:03:07 +02:00
parent 5ae4487351
commit df07303fbb

View File

@@ -820,6 +820,7 @@ static void pose_grab_with_ik_clear(Object *ob)
bKinematicConstraint *data; bKinematicConstraint *data;
bPoseChannel *pchan; bPoseChannel *pchan;
bConstraint *con, *next; bConstraint *con, *next;
bool need_dependency_update = false;
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
/* clear all temporary lock flags */ /* clear all temporary lock flags */
@@ -834,6 +835,7 @@ static void pose_grab_with_ik_clear(Object *ob)
data = con->data; data = con->data;
if (data->flag & CONSTRAINT_IK_TEMP) { if (data->flag & CONSTRAINT_IK_TEMP) {
/* iTaSC needs clear for removed constraints */ /* iTaSC needs clear for removed constraints */
need_dependency_update = true;
BIK_clear_data(ob->pose); BIK_clear_data(ob->pose);
BLI_remlink(&pchan->constraints, con); BLI_remlink(&pchan->constraints, con);
@@ -849,10 +851,10 @@ static void pose_grab_with_ik_clear(Object *ob)
} }
#ifdef WITH_LEGACY_DEPSGRAPH #ifdef WITH_LEGACY_DEPSGRAPH
if (!DEG_depsgraph_use_legacy()) if (!DEG_depsgraph_use_legacy() && need_dependency_update)
#endif #endif
{ {
/* TODO(sergey): Consuder doing partial update only. */ /* TODO(sergey): Consider doing partial update only. */
DAG_relations_tag_update(G.main); DAG_relations_tag_update(G.main);
} }
} }