Fix #119945: Dependency Graph not updated properly when adding constraints through python

The issue was that when adding a constraint through
python to an object that is already animated,
the constraint did not evaluate properly at first.
The fix is to update the depsgraph when creating a
constraint through the API.
Such an update already happened when running the
operator to create a constraint.

Pull Request: https://projects.blender.org/blender/blender/pulls/122198
This commit is contained in:
Christoph Lendenfeld 2024-05-28 11:08:26 +02:00 • committed by Philipp Oeser
parent 3afc0e5ed7
commit b11ffad1df

View file

@ -1685,6 +1685,9 @@ static bConstraint *rna_Object_constraints_new(Object *object, Main *bmain, int
ED_object_constraint_tag_update(bmain, object, new_con);
WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_ADDED, object);
/* The Depsgraph needs to be updated to reflect the new relationship that was added. */
DEG_relations_tag_update(bmain);
return new_con;
}