Depsgraph: Add query for whether graph is up to date

Depsgraph: Only invoke callbacks when there are changes

Only affects when an evaluated dependency graph is requested via
context.

Makes it cheap to call when there are no changes made to the graph

Transform: Ensure depsgraph is evaluated when needed

Fix based on D4455 from Campbell, utilizes some recently
introduced functions and allows to not have any extra checks
in the transform code.

Fixes T61904
Fixes T62135

Reviewers: brecht

Maniphest Tasks: T62135, T61904

Differential Revision: https://developer.blender.org/D4967
This commit is contained in:
Sergey Sharybin 2019-05-28 16:05:32 +02:00
parent b683e965ab
commit e256bc2250
Notes: blender-bot 2023-02-14 06:00:45 +01:00
Referenced by issue #62135, duplicate-move on parented objects, doesn't move in world space
Referenced by issue #61904, Edit mesh for shape key ,change tool option menu values cause crash
1 changed files with 5 additions and 0 deletions

View File

@ -3052,6 +3052,8 @@ static void createTransEditVerts(TransInfo *t)
if (modifiers_getCageIndex(t->scene, tc->obedit, NULL, 1) != -1) {
int totleft = -1;
if (modifiers_isCorrectableDeformed(t->scene, tc->obedit)) {
BKE_scene_graph_evaluated_ensure(t->depsgraph, CTX_data_main(t->context));
/* Use evaluated state because we need b-bone cache. */
Scene *scene_eval = (Scene *)DEG_get_evaluated_id(t->depsgraph, &t->scene->id);
Object *obedit_eval = (Object *)DEG_get_evaluated_id(t->depsgraph, &tc->obedit->id);
@ -9651,6 +9653,9 @@ void createTransData(bContext *C, TransInfo *t)
has_transform_context = false;
}
else {
/* Needed for correct Object.obmat after duplication, see: T62135. */
BKE_scene_graph_evaluated_ensure(t->depsgraph, CTX_data_main(t->context));
createTransObject(C, t);
countAndCleanTransDataContainer(t);
t->flag |= T_OBJECT;