Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2010-05-27 14:50:06 +0400
committerJoshua Leung <aligorith@gmail.com>2010-05-27 14:50:06 +0400
commit4ebc634168e0349c07c74fdf61defaad05db70f9 (patch)
tree0b75054def0d074a4cb245fee44e2974b4a76d4d /source/blender/makesdna/DNA_constraint_types.h
parent135f8be2c7933bb06b817ae204f867aff96040cc (diff)
== Pivot Constraint ==
This constraint allows an object or bone to have their rotations applied as if their origin/pivot-point was located elsewhere. The most obvious uses include foot-roll, see-saws, but could also include more complicated rolling-box examples. == Usage Examples == === Foot Roll === 1. Add 'Pivot' Constraint to the bone without any target. 2. Set the 'Y' value of the offset to the length of the bone. Usually this should be negative (if you rig with feet facing 'forwards' along -Y axis). This gives you a pivot point relative to the bone's (preconstraint) location, which should be at the tip of the bone here. Disabling the 'Use Relative Offset' would make this offset be relative to 0,0,0 instead of to the owner/bone-head. 3. Ensure that the 'Pivot When' setting is set to '-X Rot', (default) which means that the pivot will only used when the rotation on the X-Axis is negative to get tip-toe 'roll'. === See Saw === 1. Add a 'Pivot' constraint too see-saw plank object, this time with a target that you wish to have as the pivot-point. It's possible to do this without too (as before), but is less intuitive. 2. Optionally, if you want the plank slightly raised, set the z-offset value, which should make the pivot-point used to be relative to the target with the z-offset applied. 3. Ensure that 'Pivot When' is set to 'Always', which means that the pivot will always be used, irrespective of the rotation. == Notes == * The 'Pivot When' setting has been integrated in the constraint, since this is something that will often be required for these setups. Having to set up additional drivers to drive the constraint to do this kindof beats the purpose of providing this. * The 'Offset' functionality is probably not presented as clearly as it could be. We may need to go over this again. * For foot-roll - if any scaling of the foot is required, simply set up a driver on the y-offset to make this dynamically respond to the "scale" RNA property of the bones (don't use the "Transform Channel" vartype since that won't work correct here). However, this shouldn't be common enough to warrant special treatment.
Diffstat (limited to 'source/blender/makesdna/DNA_constraint_types.h')
-rw-r--r--source/blender/makesdna/DNA_constraint_types.h54
1 files changed, 49 insertions, 5 deletions
diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h
index 6c7bda171eb..00694a7ea1f 100644
--- a/source/blender/makesdna/DNA_constraint_types.h
+++ b/source/blender/makesdna/DNA_constraint_types.h
@@ -174,6 +174,7 @@ typedef struct bSplineIKConstraint {
/* Single-target subobject constraints --------------------- */
+
/* Track To Constraint */
typedef struct bTrackToConstraint {
Object *tar;
@@ -336,6 +337,24 @@ typedef struct bTransformConstraint {
float to_max[3];
} bTransformConstraint;
+/* Pivot Constraint */
+typedef struct bPivotConstraint {
+ /* Pivot Point:
+ * Either target object + offset, or just offset is used
+ */
+ Object *tar; /* target object (optional) */
+ char subtarget[32]; /* subtarget name (optional) */
+ float offset[3]; /* offset from the target to use, regardless of whether it exists */
+
+ /* Rotation-driven activation:
+ * This option provides easier one-stop setups for footrolls
+ */
+ short rotAxis; /* rotation axes to consider for this (ePivotConstraint_Axis) */
+
+ /* General flags */
+ short flag; /* ePivotConstraint_Flag */
+} bPivotConstraint;
+
/* transform limiting constraints - zero target ---------------------------- */
/* Limit Location Constraint */
typedef struct bLocLimitConstraint {
@@ -419,6 +438,7 @@ typedef enum eBConstraint_Types {
CONSTRAINT_TYPE_SPLINEIK, /* Spline-IK - Align 'n' bones to a curve */
CONSTRAINT_TYPE_TRANSLIKE, /* Copy transform matrix */
CONSTRAINT_TYPE_SAMEVOL, /* Maintain volume during scaling */
+ CONSTRAINT_TYPE_PIVOT, /* Pivot Constraint */
/* NOTE: no constraints are allowed to be added after this */
NUM_CONSTRAINT_TYPES
@@ -469,11 +489,6 @@ typedef enum eConstraintChannel_Flags {
/* -------------------------------------- */
-/**
- * The flags for ROTLIKE, LOCLIKE and SIZELIKE should be kept identical
- * (that is, same effect, different name). It simplifies the Python API access a lot.
- */
-
/* bRotateLikeConstraint.flag */
typedef enum eCopyRotation_Flags {
ROTLIKE_X = (1<<0),
@@ -688,6 +703,35 @@ typedef enum eChildOf_Flags {
CHILDOF_SIZEZ = (1<<8),
} eChildOf_Flags;
+/* Pivot Constraint */
+ /* Restrictions for Pivot Constraint axis to consider for enabling constraint */
+typedef enum ePivotConstraint_Axis {
+ /* do not consider this activity-clamping */
+ PIVOTCON_AXIS_NONE = -1,
+
+ /* consider -ve x-axis rotations */
+ PIVOTCON_AXIS_X_NEG,
+ /* consider -ve y-axis rotations */
+ PIVOTCON_AXIS_Y_NEG,
+ /* consider -ve z-axis rotations */
+ PIVOTCON_AXIS_Z_NEG,
+
+ /* consider +ve x-axis rotations */
+ PIVOTCON_AXIS_X,
+ /* consider +ve y-axis rotations */
+ PIVOTCON_AXIS_Y,
+ /* consider +ve z-axis rotations */
+ PIVOTCON_AXIS_Z,
+} ePivotConstraint_Axis;
+
+ /* settings for Pivot Constraint in general */
+typedef enum ePivotConstraint_Flag {
+ /* offset is to be interpreted as being a fixed-point in space */
+ PIVOTCON_FLAG_OFFSET_ABS = (1<<0),
+ /* rotation-based activation uses negative rotation to drive result */
+ PIVOTCON_FLAG_ROTACT_NEG = (1<<1),
+} ePivotConstraint_Flag;
+
/* Rigid-Body Constraint */
#define CONSTRAINT_DRAW_PIVOT 0x40
#define CONSTRAINT_DISABLE_LINKED_COLLISION 0x80