Commit Graph

9 Commits

Author SHA1 Message Date
Campbell Barton 41d2d6da0c Cleanup: pep8 (indentation, spacing, long lines) 2020-10-02 11:59:16 +10:00
Sebastian Parborg 331f383337 Fix blender constraints automated tests when using march=native
More agressive optimization made the results differ a bit more than the
current error margin would allow. Bump the error margin to be 1e-6
instead of the previous 0.5e-7.
2020-09-24 18:33:36 +02:00
Sybren A. Stüvel 026eba8523 Fix T76941: "Set Inverse" in Child Of constraint broken with armatures
When the Child Of constraint is owned by a bone, before the constraint is
run the matrix is converted from world to pose space. However, setting the
inverse should also take the armature object's transform into account.
2020-05-25 15:46:08 +02:00
Brecht Van Lommel 6cab53eaaa Tests: fix some tests passing even if there are Python errors
Blender was not configured to exit with non-zero return code on Python errors.
A bunch of tests worked around this but not all. This removes the need for such
workarounds.
2020-04-28 12:50:16 +02:00
Sybren A. Stüvel 10162d68e3 Constraints: replace 'Set Inverse' operator with an eval-time update
This fixes {T70269}.

Before this commit there was complicated code to try and compute the
correct parent inverse matrix for the 'Child Of' and 'Object Solver'
constraints outside the constraint evaluation. This was done mostly
correctly, but did have some issues. The Set Inverse operator now defers
this computation to be performed during constraint evaluation by just
setting a flag. If the constraint is disabled, and thus tagging it for
update in the depsgraph is not enough to trigger immediate evaluation,
evaluation is forced by temporarily enabling it.

This fix changes the way how the inverse matrix works when some of the
channels of the constraint are disabled. Before this commit, the channel
flags were used to filter both the parent and the inverse matrix. This
meant that it was impossible to make an inverse matrix that would
actually fully neutralize the effect of the constraint. Now only the
parent matrix is filtered, while inverse is applied fully. As a result,
pressing the 'Set Inverse' matrix produces the same transformation as
disabling the constraint. This is also reflected in the changed values
in the 'Child Of' unit test.

This change is not backward compatible, but it should be OK because the
old way was effectively unusable, so it is unlikely anybody relied on
it.

The change in matrix for the Object Solver constraint is due to a
different method of computing it, which caused a slightly different
floating point error that was slightly bigger than allowed by the test,
so I updated the matrix values there as well.

This patch was original written by @angavrilov and subsequently updated
by me.

Differential Revision: https://developer.blender.org/D6091
2020-02-27 10:37:59 +01:00
Sybren A. Stüvel 4f48179437 Constraints: fixed Object Solver 'Clear Inverse' operator
The 'Clear Inverse' operator didn't properly update the constraint, so
it didn't do anything until the entire depsgraph was updated. It's now
properly tagged for update.
2020-02-25 17:22:23 +01:00
Sybren A. Stüvel 65aa55babc Tests: Constraints, enable layer collections before testing
In the collections unit test file developers can now disable layer
collections and declutter the 3D Viewport while working in
`constraints.blend`, without influencing the actual unit tests themselves.
2020-02-25 17:22:23 +01:00
Sybren A. Stüvel 9cdf01085f Constraints: added unit test for Child Of with bone target
No functional changes.
2020-02-25 14:48:32 +01:00
Sybren A. Stüvel 7bc893c827 Start of unit test framework for constraints
Currently this only tests the Child Of constraint. My aim is to cover
constraints with tests before they are refactored/altered.

No functional changes.
2020-02-25 13:30:42 +01:00