From 798cdaeeb6927cb9ca42597fa23845eac04c02b2 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sun, 15 Jul 2018 20:39:02 +0300 Subject: Implement an Armature constraint that mimics the modifier. The main use one can imagine for this is adding tweak controls to parts of a model that are already deformed by multiple other major bones. It is natural to expect such locations to deform as if the tweaks aren't there by default; however currently there is no easy way to make a bone follow multiple other bones. This adds a new constraint that implements the math behind the Armature modifier, with support for explicit weights, bone envelopes, and dual quaternion blending. It can also access bones from multiple armatures at the same time (mainly because it's easier to code it that way.) This also fixes dquat_to_mat4, which wasn't used anywhere before. Differential Revision: https://developer.blender.org/D3664 --- source/blender/makesdna/DNA_constraint_types.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'source/blender/makesdna/DNA_constraint_types.h') diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h index fd98774e948..15555a2bd50 100644 --- a/source/blender/makesdna/DNA_constraint_types.h +++ b/source/blender/makesdna/DNA_constraint_types.h @@ -94,6 +94,8 @@ typedef struct bConstraintTarget { short flag; /* runtime settings (for editor, etc.) */ short type; /* type of target (eConstraintObType) */ short rotOrder; /* rotation order for target (as defined in BLI_math.h) */ + float weight; /* weight for armature deform */ + char pad[4]; } bConstraintTarget; /* bConstraintTarget -> flag */ @@ -180,6 +182,13 @@ typedef struct bSplineIKConstraint { float bulge_smooth; } bSplineIKConstraint; +/* Armature Constraint */ +typedef struct bArmatureConstraint { + int flag; /* general settings/state indicators accessed by bitmapping */ + char pad[4]; + + ListBase targets; /* a list of targets that this constraint has (bConstraintTarget-s) */ +} bArmatureConstraint; /* Single-target subobject constraints --------------------- */ @@ -504,6 +513,7 @@ typedef enum eBConstraint_Types { CONSTRAINT_TYPE_CAMERASOLVER = 27, /* Camera Solver Constraint */ CONSTRAINT_TYPE_OBJECTSOLVER = 28, /* Object Solver Constraint */ CONSTRAINT_TYPE_TRANSFORM_CACHE = 29, /* Transform Cache Constraint */ + CONSTRAINT_TYPE_ARMATURE = 30, /* Armature Deform Constraint */ /* NOTE: no constraints are allowed to be added after this */ NUM_CONSTRAINT_TYPES @@ -747,6 +757,13 @@ typedef enum eSplineIK_XZScaleModes { CONSTRAINT_SPLINEIK_XZS_VOLUMETRIC = 3 } eSplineIK_XZScaleModes; +/* bArmatureConstraint -> flag */ +typedef enum eArmature_Flags { + CONSTRAINT_ARMATURE_QUATERNION = (1<<0), /* use dual quaternion blending */ + CONSTRAINT_ARMATURE_ENVELOPE = (1<<1), /* use envelopes */ + CONSTRAINT_ARMATURE_CUR_LOCATION = (1<<2), /* use current bone location */ +} eArmature_Flags; + /* MinMax (floor) flags */ typedef enum eFloor_Flags { MINMAX_STICKY = (1<<0), -- cgit v1.2.3