From f9cbb908a3fbd73970920def8356993b9e016d1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20T=C3=B6nne?= Date: Mon, 13 Oct 2014 19:51:46 +0200 Subject: Integrated limits for volume preservation in stretch-to constraints. Currently the volume variation feature in stretch constraints is unlimited. This has to be compensated by riggers by adding scale limit constraints, but these are unaware of the stretch orientation and can lead to flipping. Also the stretch calculation itself is not working properly and can lead to collapsing volume. The patch fixes this with several modifications: - Interpret the volume variation factor as exponent, which works better with large values for artistic purposes. - Add integrated limits to the volume "bulge" factor, so secondary constraints for compensation become unnecessary - Add a smoothness factor to make limits less visible. Eventually a generic volume preservation constraint would be nicer, because multiple constraints currently implement volume variation of their own. This feature could actually work very nicely independent from other constraint features. Differential Revision: https://developer.blender.org/D826 --- source/blender/makesdna/DNA_constraint_types.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'source/blender/makesdna') diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h index 0277956cac5..fb33879e2c1 100644 --- a/source/blender/makesdna/DNA_constraint_types.h +++ b/source/blender/makesdna/DNA_constraint_types.h @@ -284,10 +284,14 @@ typedef struct bFollowPathConstraint { /* Stretch to constraint */ typedef struct bStretchToConstraint { struct Object *tar; + int flag; int volmode; - int plane; + int plane; float orglength; float bulge; + float bulge_min; + float bulge_max; + float bulge_smooth; char subtarget[64]; /* MAX_ID_NAME-2 */ } bStretchToConstraint; @@ -820,6 +824,12 @@ typedef enum eObjectSolver_Flags { #define CONSTRAINT_DRAW_PIVOT 0x40 #define CONSTRAINT_DISABLE_LINKED_COLLISION 0x80 +/* ObjectSolver Constraint -> flag */ +typedef enum eStretchTo_Flags { + STRETCHTOCON_USE_BULGE_MIN = (1 << 0), + STRETCHTOCON_USE_BULGE_MAX = (1 << 1), +} eStretchTo_Flags; + /* important: these defines need to match up with PHY_DynamicTypes headerfile */ #define CONSTRAINT_RB_BALL 1 #define CONSTRAINT_RB_HINGE 2 -- cgit v1.2.3