2023-05-31 16:19:06 +02:00
|
|
|
/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2019-02-17 22:08:12 +01:00
|
|
|
/** \file
|
|
|
|
* \ingroup DNA
|
2022-02-09 08:31:42 +01:00
|
|
|
* Constraint DNA data.
|
2011-02-17 21:48:12 +01:00
|
|
|
*/
|
|
|
|
|
2012-02-17 19:59:41 +01:00
|
|
|
#pragma once
|
2011-12-30 08:25:49 +01:00
|
|
|
|
2002-10-12 13:37:38 +02:00
|
|
|
#include "DNA_ID.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "DNA_defs.h"
|
== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon.
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too)
2007-10-22 01:00:29 +02:00
|
|
|
#include "DNA_listBase.h"
|
2002-10-12 13:37:38 +02:00
|
|
|
|
|
|
|
struct Action;
|
2007-11-28 13:11:06 +01:00
|
|
|
struct Ipo;
|
2019-01-28 11:08:24 +01:00
|
|
|
struct Text;
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2005-08-24 22:18:03 +02:00
|
|
|
/* channels reside in Object or Action (ListBase) constraintChannels */
|
2021-08-26 04:27:17 +02:00
|
|
|
/* XXX: deprecated... old AnimSys. */
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 05:35:37 +02:00
|
|
|
typedef struct bConstraintChannel {
|
2002-10-12 13:37:38 +02:00
|
|
|
struct bConstraintChannel *next, *prev;
|
2009-11-01 12:29:40 +01:00
|
|
|
struct Ipo *ipo;
|
2002-10-12 13:37:38 +02:00
|
|
|
short flag;
|
|
|
|
char name[30];
|
|
|
|
} bConstraintChannel;
|
|
|
|
|
2024-03-26 07:54:30 +01:00
|
|
|
/** A Constraint. */
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 05:35:37 +02:00
|
|
|
typedef struct bConstraint {
|
2002-10-12 13:37:38 +02:00
|
|
|
struct bConstraint *next, *prev;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-07 12:19:13 +01:00
|
|
|
/** Constraint data (a valid constraint type). */
|
|
|
|
void *data;
|
2021-06-24 07:56:58 +02:00
|
|
|
/** Constraint type. */
|
2019-01-07 12:19:13 +01:00
|
|
|
short type;
|
2021-06-24 07:56:58 +02:00
|
|
|
/** Flag - General Settings. */
|
2019-01-07 12:19:13 +01:00
|
|
|
short flag;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-07 12:19:13 +01:00
|
|
|
/** Space that owner should be evaluated in. */
|
|
|
|
char ownspace;
|
|
|
|
/** Space that target should be evaluated in (only used if 1 target). */
|
|
|
|
char tarspace;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-30 01:34:29 +01:00
|
|
|
/* An "expand" bit for each of the constraint's (sub)panels (uiPanelDataExpansion). */
|
2020-06-19 18:40:48 +02:00
|
|
|
short ui_expand_flag;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-12-03 10:42:29 +01:00
|
|
|
/** Object to use as target for Custom Space of owner. */
|
|
|
|
struct Object *space_object;
|
|
|
|
/** Subtarget for Custom Space of owner - pchan or vgroup name, MAX_ID_NAME-2. */
|
|
|
|
char space_subtarget[64];
|
|
|
|
|
|
|
|
/** Constraint name, MAX_NAME. */
|
|
|
|
char name[64];
|
|
|
|
|
2021-02-13 07:44:51 +01:00
|
|
|
/** Amount of influence exerted by constraint (0.0-1.0). */
|
2019-01-07 12:19:13 +01:00
|
|
|
float enforce;
|
2021-02-13 07:44:51 +01:00
|
|
|
/** Point along `subtarget` bone where the actual target is. 0=head (default for all), 1=tail. */
|
2019-01-07 12:19:13 +01:00
|
|
|
float headtail;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-07 12:19:13 +01:00
|
|
|
/* old animation system, deprecated for 2.5. */
|
|
|
|
/** Local influence ipo or driver */
|
|
|
|
struct Ipo *ipo DNA_DEPRECATED;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-09-24 03:31:23 +02:00
|
|
|
/* Below are read-only fields that are set at runtime
|
|
|
|
* by the solver for use in the GE (only IK at the moment). */
|
2019-01-07 12:19:13 +01:00
|
|
|
/** Residual error on constraint expressed in blender unit. */
|
|
|
|
float lin_error;
|
|
|
|
/** Residual error on constraint expressed in radiant. */
|
|
|
|
float rot_error;
|
2002-10-12 13:37:38 +02:00
|
|
|
} bConstraint;
|
|
|
|
|
2021-06-24 07:56:58 +02:00
|
|
|
/* Multiple-target constraints --------------------- */
|
== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon.
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too)
2007-10-22 01:00:29 +02:00
|
|
|
|
|
|
|
/* This struct defines a constraint target.
|
|
|
|
* It is used during constraint solving regardless of how many targets the
|
|
|
|
* constraint has.
|
|
|
|
*/
|
|
|
|
typedef struct bConstraintTarget {
|
|
|
|
struct bConstraintTarget *next, *prev;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-07 12:19:13 +01:00
|
|
|
/** Object to use as target. */
|
|
|
|
struct Object *tar;
|
|
|
|
/** Subtarget - pchan or vgroup name, MAX_ID_NAME-2. */
|
|
|
|
char subtarget[64];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-07 12:19:13 +01:00
|
|
|
/** Matrix used during constraint solving - should be cleared before each use. */
|
|
|
|
float matrix[4][4];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-07 12:19:13 +01:00
|
|
|
/** Space that target should be evaluated in (overrides bConstraint->tarspace). */
|
|
|
|
short space;
|
|
|
|
/** Runtime settings (for editor, etc.). */
|
|
|
|
short flag;
|
|
|
|
/** Type of target (eConstraintObType). */
|
|
|
|
short type;
|
Cleanup: reduce amount of math-related includes
Using ClangBuildAnalyzer on the whole Blender build, it was pointing
out that BLI_math.h is the heaviest "header hub" (i.e. non tiny file
that is included a lot).
However, there's very little (actually zero) source files in Blender
that need "all the math" (base, colors, vectors, matrices,
quaternions, intersection, interpolation, statistics, solvers and
time). A common use case is source files needing just vectors, or
just vectors & matrices, or just colors etc. Actually, 181 files
were including the whole math thing without needing it at all.
This change removes BLI_math.h completely, and instead in all the
places that need it, includes BLI_math_vector.h or BLI_math_color.h
and so on.
Change from that:
- BLI_math_color.h was included 1399 times -> now 408 (took 114.0sec
to parse -> now 36.3sec)
- BLI_simd.h 1403 -> 418 (109.7sec -> 34.9sec).
Full rebuild of Blender (Apple M1, Xcode, RelWithDebInfo) is not
affected much (342sec -> 334sec). Most of benefit would be when
someone's changing BLI_simd.h or BLI_math_color.h or similar files,
that now there's 3x fewer files result in a recompile.
Pull Request #110944
2023-08-09 10:39:20 +02:00
|
|
|
/** Rotation order for target (as defined in BLI_math_rotation.h). */
|
2019-01-07 12:19:13 +01:00
|
|
|
short rotOrder;
|
|
|
|
/** Weight for armature deform. */
|
|
|
|
float weight;
|
2019-02-27 05:07:50 +01:00
|
|
|
char _pad[4];
|
== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon.
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too)
2007-10-22 01:00:29 +02:00
|
|
|
} bConstraintTarget;
|
|
|
|
|
|
|
|
/* bConstraintTarget -> flag */
|
2017-10-17 04:43:10 +02:00
|
|
|
typedef enum eConstraintTargetFlag {
|
2022-06-03 15:28:09 +02:00
|
|
|
/** Temporary target-struct that needs to be freed after use. */
|
2019-03-18 04:21:37 +01:00
|
|
|
CONSTRAINT_TAR_TEMP = (1 << 0),
|
2022-06-03 15:28:09 +02:00
|
|
|
/** Temporary target for the custom space reference. */
|
|
|
|
CONSTRAINT_TAR_CUSTOM_SPACE = (1 << 1),
|
2017-10-17 04:43:10 +02:00
|
|
|
} eConstraintTargetFlag;
|
== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon.
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too)
2007-10-22 01:00:29 +02:00
|
|
|
|
|
|
|
/* bConstraintTarget/bConstraintOb -> type */
|
2017-10-17 04:43:10 +02:00
|
|
|
typedef enum eConstraintObType {
|
2019-01-15 13:14:35 +01:00
|
|
|
/** string is "" */
|
|
|
|
CONSTRAINT_OBTYPE_OBJECT = 1,
|
|
|
|
/** string is bone-name */
|
|
|
|
CONSTRAINT_OBTYPE_BONE = 2,
|
|
|
|
/** string is vertex-group name */
|
|
|
|
CONSTRAINT_OBTYPE_VERT = 3,
|
|
|
|
/** string is vertex-group name - is not available until curves get vgroups */
|
2020-02-20 00:21:23 +01:00
|
|
|
/* CONSTRAINT_OBTYPE_CV = 4, */ /* UNUSED */
|
2017-10-17 04:43:10 +02:00
|
|
|
} eConstraintObType;
|
== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon.
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too)
2007-10-22 01:00:29 +02:00
|
|
|
|
|
|
|
/* Python Script Constraint */
|
2018-06-17 17:04:09 +02:00
|
|
|
typedef struct bPythonConstraint {
|
2019-01-07 12:19:13 +01:00
|
|
|
/** Text-buffer (containing script) to execute. */
|
|
|
|
struct Text *text;
|
|
|
|
/** 'id-properties' used to store custom properties for constraint. */
|
|
|
|
IDProperty *prop;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-07 12:19:13 +01:00
|
|
|
/** General settings/state indicators accessed by bitmapping. */
|
|
|
|
int flag;
|
|
|
|
/** Number of targets - usually only 1-3 are needed. */
|
|
|
|
int tarnum;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-07 12:19:13 +01:00
|
|
|
/** A list of targets that this constraint has (bConstraintTarget-s). */
|
|
|
|
ListBase targets;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-07 12:19:13 +01:00
|
|
|
/**
|
|
|
|
* Target from previous implementation
|
|
|
|
* (version-patch sets this to NULL on file-load).
|
|
|
|
*/
|
|
|
|
struct Object *tar;
|
|
|
|
/**
|
2019-08-01 05:53:25 +02:00
|
|
|
* Subtarget from previous implementation
|
2019-01-07 12:19:13 +01:00
|
|
|
* (version-patch sets this to "" on file-load), MAX_ID_NAME-2.
|
|
|
|
*/
|
|
|
|
char subtarget[64];
|
2007-06-18 09:41:21 +02:00
|
|
|
} bPythonConstraint;
|
|
|
|
|
2009-11-01 12:29:40 +01:00
|
|
|
/* Inverse-Kinematics (IK) constraint
|
2011-12-28 12:08:38 +01:00
|
|
|
* This constraint supports a variety of mode determine by the type field
|
2017-10-17 04:43:10 +02:00
|
|
|
* according to eConstraint_IK_Type.
|
2011-12-28 12:08:38 +01:00
|
|
|
* Some fields are used by all types, some are specific to some types
|
|
|
|
* This is indicated in the comments for each field
|
2009-09-24 23:22:24 +02:00
|
|
|
*/
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 05:35:37 +02:00
|
|
|
typedef struct bKinematicConstraint {
|
2019-01-07 12:19:13 +01:00
|
|
|
/** All: target object in case constraint needs a target. */
|
|
|
|
struct Object *tar;
|
|
|
|
/** All: Maximum number of iterations to try. */
|
|
|
|
short iterations;
|
|
|
|
/** All & CopyPose: some options Like CONSTRAINT_IK_TIP. */
|
|
|
|
short flag;
|
|
|
|
/** All: index to rootbone, if zero go all the way to mother bone. */
|
|
|
|
short rootbone;
|
|
|
|
/** CopyPose: for auto-ik, maximum length of chain. */
|
|
|
|
short max_rootbone;
|
|
|
|
/** All: String to specify sub-object target, MAX_ID_NAME-2. */
|
|
|
|
char subtarget[64];
|
|
|
|
/** All: Pole vector target. */
|
|
|
|
struct Object *poletar;
|
|
|
|
/** All: Pole vector sub-object target, MAX_ID_NAME-2. */
|
|
|
|
char polesubtarget[64];
|
|
|
|
/** All: Pole vector rest angle. */
|
|
|
|
float poleangle;
|
|
|
|
/** All: Weight of constraint in IK tree. */
|
|
|
|
float weight;
|
|
|
|
/** CopyPose: Amount of rotation a target applies on chain. */
|
|
|
|
float orientweight;
|
|
|
|
/** CopyPose: for target-less IK. */
|
|
|
|
float grabtarget[3];
|
2022-09-16 10:13:19 +02:00
|
|
|
/** Sub-type of IK constraint: #eConstraint_IK_Type. */
|
2019-01-07 12:19:13 +01:00
|
|
|
short type;
|
|
|
|
/** Distance: how to limit in relation to clamping sphere: LIMITDIST_... */
|
|
|
|
short mode;
|
|
|
|
/** Distance: distance (radius of clamping sphere) from target. */
|
|
|
|
float dist;
|
2002-10-12 13:37:38 +02:00
|
|
|
} bKinematicConstraint;
|
|
|
|
|
2017-10-17 04:43:10 +02:00
|
|
|
typedef enum eConstraint_IK_Type {
|
2019-01-15 13:14:35 +01:00
|
|
|
/** 'standard' IK constraint: match position and/or orientation of target */
|
|
|
|
CONSTRAINT_IK_COPYPOSE = 0,
|
|
|
|
/** maintain distance with target */
|
2019-01-15 13:57:49 +01:00
|
|
|
CONSTRAINT_IK_DISTANCE = 1,
|
2017-10-17 04:43:10 +02:00
|
|
|
} eConstraint_IK_Type;
|
Patch #7767: Constraint Subtargets can now target anywhere on a bone, not just the head or tail
Patch by: Roland Hess (harkyman)
For example, a constraint can be sub-targeted at the 50% (or 31.2% or 85% etc.) point of its target bone, giving you enormous rigging flexibility and removing the need for complex contraptions to do such things as:
- A bone whose base slides only between to points on a rig (CopyLoc with a variable, animated subtarget point)
- Bones that attach to multiple points along another bone (CopyLocs, each with a different head/tail percentage)
- Bones that need to stretch to a point midway between specific spots on two other bones (old way: too crazy to mention; new way: stretch bone between points on end bones, then another stretch to the midpoint of the first stretch)
It is only used for the constraint types for which it is relevant: CopyLoc, TrackTo, StretchTo and MinMax, TrackTo, and Floor.
Notes:
- This is accessed by the Head/Tail number-slider.
- This value can be animated per constraint
- The old "Copy Bone Tail" option for the CopyLoc constraint has been automatically converted to 1.0 Head/Bone values for the affected constraints
- In the code, this value is in the bConstraint struct, so it is available for all constraints, even though only a few implement it.
2007-11-12 05:17:03 +01:00
|
|
|
|
2018-06-17 17:04:09 +02:00
|
|
|
/* Spline IK Constraint
|
2009-11-01 12:29:40 +01:00
|
|
|
* Aligns 'n' bones to the curvature defined by the curve,
|
2018-06-01 18:19:39 +02:00
|
|
|
* with the chain ending on the bone that owns this constraint,
|
2009-11-01 12:29:40 +01:00
|
|
|
* and starting on the nth parent.
|
|
|
|
*/
|
|
|
|
typedef struct bSplineIKConstraint {
|
|
|
|
/* target(s) */
|
2019-01-07 12:19:13 +01:00
|
|
|
/** Curve object (with follow path enabled) which drives the bone chain. */
|
|
|
|
struct Object *tar;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-11-01 12:29:40 +01:00
|
|
|
/* binding details */
|
2019-01-07 12:19:13 +01:00
|
|
|
/**
|
|
|
|
* Array of numpoints items,
|
|
|
|
* denoting parametric positions along curve that joints should follow.
|
|
|
|
*/
|
|
|
|
float *points;
|
|
|
|
/** Number of points to bound in points array. */
|
|
|
|
short numpoints;
|
|
|
|
/** Number of bones ('n') that are in the chain. */
|
|
|
|
short chainlen;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-10-21 07:46:41 +02:00
|
|
|
/* settings */
|
2019-01-07 12:19:13 +01:00
|
|
|
/** General settings for constraint. */
|
|
|
|
short flag;
|
|
|
|
/** Method used for determining the x & z scaling of the bones. */
|
|
|
|
short xzScaleMode;
|
2019-04-15 19:25:41 +02:00
|
|
|
/** Method used for determining the y scaling of the bones. */
|
|
|
|
short yScaleMode;
|
|
|
|
short _pad[3];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-01-13 06:06:53 +01:00
|
|
|
/* volume preservation settings */
|
|
|
|
float bulge;
|
|
|
|
float bulge_min;
|
|
|
|
float bulge_max;
|
|
|
|
float bulge_smooth;
|
2009-11-01 12:29:40 +01:00
|
|
|
} bSplineIKConstraint;
|
|
|
|
|
2018-07-15 19:39:02 +02:00
|
|
|
/* Armature Constraint */
|
|
|
|
typedef struct bArmatureConstraint {
|
2019-01-07 12:19:13 +01:00
|
|
|
/** General settings/state indicators accessed by bitmapping. */
|
|
|
|
int flag;
|
2019-02-27 05:07:50 +01:00
|
|
|
char _pad[4];
|
2018-07-15 19:39:02 +02:00
|
|
|
|
2019-01-07 12:19:13 +01:00
|
|
|
/** A list of targets that this constraint has (bConstraintTarget-s). */
|
|
|
|
ListBase targets;
|
2018-07-15 19:39:02 +02:00
|
|
|
} bArmatureConstraint;
|
2009-11-01 12:29:40 +01:00
|
|
|
|
2023-03-07 04:58:15 +01:00
|
|
|
/* Single-target sub-object constraints --------------------- */
|
== 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.
2010-05-27 12:50:06 +02:00
|
|
|
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 05:35:37 +02:00
|
|
|
/* Track To Constraint */
|
|
|
|
typedef struct bTrackToConstraint {
|
2010-08-04 06:01:27 +02:00
|
|
|
struct Object *tar;
|
2019-01-07 12:19:13 +01:00
|
|
|
/**
|
2022-06-16 23:33:06 +02:00
|
|
|
* NOTE(@theeth): I'll be using reserved1 and reserved2 as Track and Up flags,
|
2019-01-07 12:19:13 +01:00
|
|
|
* not sure if that's what they were intended for anyway.
|
|
|
|
* Not sure either if it would create backward incompatibility if I were to rename them.
|
|
|
|
*/
|
|
|
|
int reserved1;
|
2004-03-22 23:02:18 +01:00
|
|
|
int reserved2;
|
2006-12-03 19:38:51 +01:00
|
|
|
int flags;
|
2019-02-27 05:07:50 +01:00
|
|
|
char _pad[4];
|
2019-01-07 12:19:13 +01:00
|
|
|
/** MAX_ID_NAME-2. */
|
|
|
|
char subtarget[64];
|
2002-10-12 13:37:38 +02:00
|
|
|
} bTrackToConstraint;
|
|
|
|
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 05:35:37 +02:00
|
|
|
/* Copy Rotation Constraint */
|
|
|
|
typedef struct bRotateLikeConstraint {
|
2010-08-04 06:01:27 +02:00
|
|
|
struct Object *tar;
|
2002-10-12 13:37:38 +02:00
|
|
|
int flag;
|
2019-09-01 12:19:11 +02:00
|
|
|
char euler_order;
|
2019-09-04 11:06:59 +02:00
|
|
|
char mix_mode;
|
|
|
|
char _pad[2];
|
2019-01-07 12:19:13 +01:00
|
|
|
/** MAX_ID_NAME-2. */
|
|
|
|
char subtarget[64];
|
2002-10-12 13:37:38 +02:00
|
|
|
} bRotateLikeConstraint;
|
|
|
|
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 05:35:37 +02:00
|
|
|
/* Copy Location Constraint */
|
|
|
|
typedef struct bLocateLikeConstraint {
|
2010-08-04 06:01:27 +02:00
|
|
|
struct Object *tar;
|
2002-10-12 13:37:38 +02:00
|
|
|
int flag;
|
|
|
|
int reserved1;
|
2019-01-07 12:19:13 +01:00
|
|
|
/** MAX_ID_NAME-2. */
|
|
|
|
char subtarget[64];
|
2002-10-12 13:37:38 +02:00
|
|
|
} bLocateLikeConstraint;
|
|
|
|
|
2010-01-02 05:14:17 +01:00
|
|
|
/* Copy Scale Constraint */
|
|
|
|
typedef struct bSizeLikeConstraint {
|
2010-08-04 06:01:27 +02:00
|
|
|
struct Object *tar;
|
2010-01-02 05:14:17 +01:00
|
|
|
int flag;
|
2019-05-08 11:08:54 +02:00
|
|
|
float power;
|
2019-01-07 12:19:13 +01:00
|
|
|
/** MAX_ID_NAME-2. */
|
|
|
|
char subtarget[64];
|
2010-01-02 05:14:17 +01:00
|
|
|
} bSizeLikeConstraint;
|
|
|
|
|
2010-03-16 13:55:56 +01:00
|
|
|
/* Maintain Volume Constraint */
|
|
|
|
typedef struct bSameVolumeConstraint {
|
Maintain Volume: introduce an option switching between modes.
After a lot of thinking about this, I decided that all operation modes
that I've tried over the past couple of years, including the original
2.79 one, have their uses after all. Thus the only reasonable solution
is to add yet another option.
The modes are:
- Strict: The current 2.80 mode, which overrides the original scaling
of the non-free axes to strictly preserve the volume. This is the most
obvious way one would expect a 'Maintain Volume' constraint to work.
- Uniform: The original 2.79 mode, which assumes that all axes have been
scaled the same as the free one when computing the volume. This seems
strange, but the net effect is that when simply scaling the object
uniformly with S, the volume is preserved; however, scaling the non-
free axes individually allows deviating from the locked volume.
This was obviously intended as a more or less convenient UI tool.
- Single Axis: My own variant of the intent of the Uniform scale, which
does volume-preserving if the object is scaled just on the Free axis,
while passing the non-free axis scaling through. I.e. instead of
uniform S scaling, the user has to scale the object just on its
primary axis to achieve constant volume. This can allow reducing the
number of animation curves when only constant volume scaling is needed,
or be an easier to control tool inside a complex rig.
2019-05-06 20:47:51 +02:00
|
|
|
char free_axis;
|
|
|
|
char mode;
|
|
|
|
char _pad[2];
|
2010-03-16 13:55:56 +01:00
|
|
|
float volume;
|
|
|
|
} bSameVolumeConstraint;
|
|
|
|
|
2010-01-02 05:14:17 +01:00
|
|
|
/* Copy Transform Constraint */
|
|
|
|
typedef struct bTransLikeConstraint {
|
2010-08-04 06:01:27 +02:00
|
|
|
struct Object *tar;
|
2020-11-04 17:29:27 +01:00
|
|
|
int flag;
|
2019-09-04 13:59:18 +02:00
|
|
|
char mix_mode;
|
2020-11-04 17:29:27 +01:00
|
|
|
char _pad[3];
|
2019-01-07 12:19:13 +01:00
|
|
|
/** MAX_ID_NAME-2. */
|
|
|
|
char subtarget[64];
|
2010-01-02 05:14:17 +01:00
|
|
|
} bTransLikeConstraint;
|
|
|
|
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 05:35:37 +02:00
|
|
|
/* Floor Constraint */
|
|
|
|
typedef struct bMinMaxConstraint {
|
2010-08-04 06:01:27 +02:00
|
|
|
struct Object *tar;
|
2005-09-07 02:11:39 +02:00
|
|
|
int minmaxflag;
|
== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon.
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too)
2007-10-22 01:00:29 +02:00
|
|
|
float offset;
|
|
|
|
int flag;
|
2019-01-07 12:19:13 +01:00
|
|
|
/** MAX_ID_NAME-2. */
|
|
|
|
char subtarget[64];
|
2019-06-28 14:59:50 +02:00
|
|
|
int _pad;
|
2005-09-07 02:11:39 +02:00
|
|
|
} bMinMaxConstraint;
|
|
|
|
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 05:35:37 +02:00
|
|
|
/* Action Constraint */
|
|
|
|
typedef struct bActionConstraint {
|
2010-08-04 06:01:27 +02:00
|
|
|
struct Object *tar;
|
2019-01-07 12:19:13 +01:00
|
|
|
/** What transform 'channel' drives the result. */
|
|
|
|
short type;
|
|
|
|
/** Was used in versions prior to the Constraints recode. */
|
|
|
|
short local;
|
== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon.
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too)
2007-10-22 01:00:29 +02:00
|
|
|
int start;
|
|
|
|
int end;
|
2002-10-12 13:37:38 +02:00
|
|
|
float min;
|
|
|
|
float max;
|
2012-06-12 08:22:23 +02:00
|
|
|
int flag;
|
Action Constraint: introduce a mix mode setting.
Currently the action channels are applied after the existing
transformation, as if the action controlled a child of the
bone. This is not very natural, but more importantly, the
transform tools are not designed to work conveniently with an
additional 'pseudo-child' transformation, resulting in effects
like an unexpected pivot location.
Implementing a Before mode that integrates the action channels
as if applied to a parent allows using the special transform
tool code intended for dealing with such constraints.
Note that in either mode, Action constraints should be added
in reverse order, putting a new constraint before the existing
ones that the Action was keyframed to work together.
In order to implement the option, extract a utility from
the Copy Transform constraint code for combining transforms
with special anti-shear scale handling that matches the
Aligned Inherit Scale mode.
The Before mode also requires switching the constraint to
the Local owner space, while the After mode can still use the
World space for efficiency as before. Since the constraint
doesn't have an Owner space option in the UI, this has to be
handled in an RNA setter.
For full backward compatibility, the original simple matrix
multiplication mode is preserved as the third option, but it
is not recommended due to creating shear.
Differential Revision: https://developer.blender.org/D6297
2019-11-23 11:11:39 +01:00
|
|
|
char mix_mode;
|
2020-09-16 15:52:43 +02:00
|
|
|
char _pad[3];
|
|
|
|
float eval_time; /* Only used when flag ACTCON_USE_EVAL_TIME is set. */
|
2002-10-12 13:37:38 +02:00
|
|
|
struct bAction *act;
|
2019-01-07 12:19:13 +01:00
|
|
|
/** MAX_ID_NAME-2. */
|
|
|
|
char subtarget[64];
|
2002-10-12 13:37:38 +02:00
|
|
|
} bActionConstraint;
|
|
|
|
|
2003-10-21 15:22:07 +02:00
|
|
|
/* Locked Axis Tracking constraint */
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 05:35:37 +02:00
|
|
|
typedef struct bLockTrackConstraint {
|
2010-08-04 06:01:27 +02:00
|
|
|
struct Object *tar;
|
2003-10-21 15:22:07 +02:00
|
|
|
int trackflag;
|
|
|
|
int lockflag;
|
2019-01-07 12:19:13 +01:00
|
|
|
/** MAX_ID_NAME-2. */
|
|
|
|
char subtarget[64];
|
2003-10-21 15:22:07 +02:00
|
|
|
} bLockTrackConstraint;
|
|
|
|
|
2009-10-30 07:33:40 +01:00
|
|
|
/* Damped Tracking constraint */
|
|
|
|
typedef struct bDampTrackConstraint {
|
2010-08-04 06:01:27 +02:00
|
|
|
struct Object *tar;
|
2009-10-30 07:33:40 +01:00
|
|
|
int trackflag;
|
2019-02-27 05:07:50 +01:00
|
|
|
char _pad[4];
|
2019-01-07 12:19:13 +01:00
|
|
|
/** MAX_ID_NAME-2. */
|
|
|
|
char subtarget[64];
|
2009-10-30 07:33:40 +01:00
|
|
|
} bDampTrackConstraint;
|
|
|
|
|
2003-10-21 15:22:07 +02:00
|
|
|
/* Follow Path constraints */
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 05:35:37 +02:00
|
|
|
typedef struct bFollowPathConstraint {
|
2019-01-07 12:19:13 +01:00
|
|
|
/** Must be path object. */
|
|
|
|
struct Object *tar;
|
2018-06-17 17:04:09 +02:00
|
|
|
|
2019-01-07 12:19:13 +01:00
|
|
|
/** Offset in time on the path (in frames), when NOT using 'fixed position'. */
|
|
|
|
float offset;
|
|
|
|
/** Parametric offset factor defining position along path, when using 'fixed position'. */
|
|
|
|
float offset_fac;
|
2018-06-17 17:04:09 +02:00
|
|
|
|
2003-10-21 15:22:07 +02:00
|
|
|
int followflag;
|
2018-06-17 17:04:09 +02:00
|
|
|
|
2010-02-03 10:05:31 +01:00
|
|
|
short trackflag;
|
|
|
|
short upflag;
|
2002-10-12 13:37:38 +02:00
|
|
|
} bFollowPathConstraint;
|
|
|
|
|
2004-09-05 22:21:16 +02:00
|
|
|
/* Stretch to constraint */
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 05:35:37 +02:00
|
|
|
typedef struct bStretchToConstraint {
|
2010-08-04 06:01:27 +02:00
|
|
|
struct Object *tar;
|
2014-10-13 19:51:46 +02:00
|
|
|
int flag;
|
2018-06-17 17:04:09 +02:00
|
|
|
int volmode;
|
2014-10-13 19:51:46 +02:00
|
|
|
int plane;
|
2004-09-05 22:21:16 +02:00
|
|
|
float orglength;
|
|
|
|
float bulge;
|
2014-10-13 19:51:46 +02:00
|
|
|
float bulge_min;
|
|
|
|
float bulge_max;
|
|
|
|
float bulge_smooth;
|
2019-01-07 12:19:13 +01:00
|
|
|
/** MAX_ID_NAME-2. */
|
|
|
|
char subtarget[64];
|
2004-09-05 22:21:16 +02:00
|
|
|
} bStretchToConstraint;
|
2004-03-22 23:02:18 +01:00
|
|
|
|
2006-11-30 01:19:27 +01:00
|
|
|
/* Rigid Body constraint */
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 05:35:37 +02:00
|
|
|
typedef struct bRigidBodyJointConstraint {
|
2010-08-04 06:01:27 +02:00
|
|
|
struct Object *tar;
|
|
|
|
struct Object *child;
|
2006-11-30 01:19:27 +01:00
|
|
|
int type;
|
|
|
|
float pivX;
|
|
|
|
float pivY;
|
|
|
|
float pivZ;
|
|
|
|
float axX;
|
|
|
|
float axY;
|
|
|
|
float axZ;
|
|
|
|
float minLimit[6];
|
|
|
|
float maxLimit[6];
|
|
|
|
float extraFz;
|
|
|
|
short flag;
|
2019-02-27 05:07:50 +01:00
|
|
|
char _pad[6];
|
2006-11-30 01:19:27 +01:00
|
|
|
} bRigidBodyJointConstraint;
|
|
|
|
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 05:35:37 +02:00
|
|
|
/* Clamp-To Constraint */
|
2007-04-07 05:32:57 +02:00
|
|
|
typedef struct bClampToConstraint {
|
2019-01-07 12:19:13 +01:00
|
|
|
/** 'target' must be a curve. */
|
|
|
|
struct Object *tar;
|
2021-07-23 08:56:00 +02:00
|
|
|
/** Which axis/plane to compare owner's location on. */
|
2019-01-07 12:19:13 +01:00
|
|
|
int flag;
|
|
|
|
/** For legacy reasons, this is flag2. used for any extra settings. */
|
|
|
|
int flag2;
|
2007-04-07 05:32:57 +02:00
|
|
|
} bClampToConstraint;
|
|
|
|
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 05:35:37 +02:00
|
|
|
/* Child Of Constraint */
|
|
|
|
typedef struct bChildOfConstraint {
|
2019-01-07 12:19:13 +01:00
|
|
|
/** Object which will act as parent (or target comes from). */
|
|
|
|
struct Object *tar;
|
|
|
|
/** Settings. */
|
|
|
|
int flag;
|
2019-02-27 05:07:50 +01:00
|
|
|
char _pad[4];
|
2019-01-07 12:19:13 +01:00
|
|
|
/** Parent-inverse matrix to use. */
|
|
|
|
float invmat[4][4];
|
2023-05-24 12:27:13 +02:00
|
|
|
/** String to specify a sub-object target, `MAX_ID_NAME - 2`. */
|
2019-01-07 12:19:13 +01:00
|
|
|
char subtarget[64];
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 05:35:37 +02:00
|
|
|
} bChildOfConstraint;
|
|
|
|
|
2007-07-21 09:26:15 +02:00
|
|
|
/* Generic Transform->Transform Constraint */
|
|
|
|
typedef struct bTransformConstraint {
|
2019-01-07 12:19:13 +01:00
|
|
|
/** Target (i.e. 'driver' object/bone). */
|
|
|
|
struct Object *tar;
|
|
|
|
/** MAX_ID_NAME-2. */
|
|
|
|
char subtarget[64];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-07 12:19:13 +01:00
|
|
|
/** Can be loc(0), rot(1) or size(2). */
|
|
|
|
short from, to;
|
|
|
|
/** Defines which target-axis deform is copied by each owner-axis. */
|
|
|
|
char map[3];
|
|
|
|
/** Extrapolate motion? if 0, confine to ranges. */
|
|
|
|
char expo;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-09-01 12:19:11 +02:00
|
|
|
/** Input rotation type - uses the same values as driver targets. */
|
|
|
|
char from_rotation_mode;
|
|
|
|
/** Output euler order override. */
|
|
|
|
char to_euler_order;
|
|
|
|
|
2019-09-06 10:54:34 +02:00
|
|
|
/** Mixing modes for location, rotation, and scale. */
|
|
|
|
char mix_mode_loc;
|
|
|
|
char mix_mode_rot;
|
|
|
|
char mix_mode_scale;
|
|
|
|
|
|
|
|
char _pad[3];
|
2019-09-01 12:19:11 +02:00
|
|
|
|
2019-01-07 12:19:13 +01:00
|
|
|
/** From_min/max defines range of target transform. */
|
|
|
|
float from_min[3];
|
|
|
|
/** To map on to to_min/max range. */
|
|
|
|
float from_max[3];
|
2021-07-23 08:56:00 +02:00
|
|
|
/** Range of motion on owner caused by target. */
|
2019-01-07 12:19:13 +01:00
|
|
|
float to_min[3];
|
2012-10-21 07:46:41 +02:00
|
|
|
float to_max[3];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-07 12:19:13 +01:00
|
|
|
/** From_min/max defines range of target transform. */
|
|
|
|
float from_min_rot[3];
|
|
|
|
/** To map on to to_min/max range. */
|
|
|
|
float from_max_rot[3];
|
2021-07-23 08:56:00 +02:00
|
|
|
/** Range of motion on owner caused by target. */
|
2019-01-07 12:19:13 +01:00
|
|
|
float to_min_rot[3];
|
2014-04-28 13:20:37 +02:00
|
|
|
float to_max_rot[3];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-07 12:19:13 +01:00
|
|
|
/** From_min/max defines range of target transform. */
|
|
|
|
float from_min_scale[3];
|
|
|
|
/** To map on to to_min/max range. */
|
|
|
|
float from_max_scale[3];
|
2021-07-23 08:56:00 +02:00
|
|
|
/** Range of motion on owner caused by target. */
|
2019-01-07 12:19:13 +01:00
|
|
|
float to_min_scale[3];
|
2014-04-28 13:20:37 +02:00
|
|
|
float to_max_scale[3];
|
2007-07-21 09:26:15 +02:00
|
|
|
} bTransformConstraint;
|
|
|
|
|
== 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.
2010-05-27 12:50:06 +02:00
|
|
|
/* Pivot Constraint */
|
|
|
|
typedef struct bPivotConstraint {
|
|
|
|
/* Pivot Point:
|
2018-11-14 02:53:15 +01:00
|
|
|
* Either target object + offset, or just offset is used
|
== 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.
2010-05-27 12:50:06 +02:00
|
|
|
*/
|
2019-01-07 12:19:13 +01:00
|
|
|
/** Target object (optional). */
|
|
|
|
struct Object *tar;
|
|
|
|
/** Subtarget name (optional), MAX_ID_NAME-2. */
|
|
|
|
char subtarget[64];
|
|
|
|
/** Offset from the target to use, regardless of whether it exists. */
|
|
|
|
float offset[3];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
== 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.
2010-05-27 12:50:06 +02:00
|
|
|
/* Rotation-driven activation:
|
2020-03-06 01:40:37 +01:00
|
|
|
* This option provides easier one-stop setups for foot-rolls.
|
== 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.
2010-05-27 12:50:06 +02:00
|
|
|
*/
|
2019-01-07 15:00:40 +01:00
|
|
|
/** Rotation axes to consider for this (#ePivotConstraint_Axis). */
|
2019-01-07 12:19:13 +01:00
|
|
|
short rotAxis;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
== 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.
2010-05-27 12:50:06 +02:00
|
|
|
/* General flags */
|
2019-01-07 15:00:40 +01:00
|
|
|
/** #ePivotConstraint_Flag. */
|
2019-01-07 12:19:13 +01:00
|
|
|
short flag;
|
== 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.
2010-05-27 12:50:06 +02:00
|
|
|
} bPivotConstraint;
|
|
|
|
|
2021-06-24 07:56:58 +02:00
|
|
|
/* transform limiting constraints - zero target ---------------------------- */
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 05:35:37 +02:00
|
|
|
/* Limit Location Constraint */
|
|
|
|
typedef struct bLocLimitConstraint {
|
|
|
|
float xmin, xmax;
|
|
|
|
float ymin, ymax;
|
|
|
|
float zmin, zmax;
|
|
|
|
short flag;
|
|
|
|
short flag2;
|
|
|
|
} bLocLimitConstraint;
|
|
|
|
|
|
|
|
/* Limit Rotation Constraint */
|
|
|
|
typedef struct bRotLimitConstraint {
|
|
|
|
float xmin, xmax;
|
|
|
|
float ymin, ymax;
|
|
|
|
float zmin, zmax;
|
|
|
|
short flag;
|
2007-12-05 12:19:36 +01:00
|
|
|
short flag2;
|
2020-11-22 12:17:21 +01:00
|
|
|
char euler_order;
|
|
|
|
char _pad[3];
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 05:35:37 +02:00
|
|
|
} bRotLimitConstraint;
|
|
|
|
|
2012-06-08 23:04:48 +02:00
|
|
|
/* Limit Scale Constraint */
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 05:35:37 +02:00
|
|
|
typedef struct bSizeLimitConstraint {
|
|
|
|
float xmin, xmax;
|
|
|
|
float ymin, ymax;
|
|
|
|
float zmin, zmax;
|
|
|
|
short flag;
|
2007-12-05 12:19:36 +01:00
|
|
|
short flag2;
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 05:35:37 +02:00
|
|
|
} bSizeLimitConstraint;
|
|
|
|
|
2008-01-25 12:23:36 +01:00
|
|
|
/* Limit Distance Constraint */
|
|
|
|
typedef struct bDistLimitConstraint {
|
2010-08-04 06:01:27 +02:00
|
|
|
struct Object *tar;
|
2019-01-07 12:19:13 +01:00
|
|
|
/** MAX_ID_NAME-2. */
|
|
|
|
char subtarget[64];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-07 12:19:13 +01:00
|
|
|
/** Distance (radius of clamping sphere) from target. */
|
|
|
|
float dist;
|
|
|
|
/** Distance from clamping-sphere to start applying 'fade'. */
|
|
|
|
float soft;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-07 12:19:13 +01:00
|
|
|
/** Settings. */
|
|
|
|
short flag;
|
|
|
|
/** How to limit in relation to clamping sphere. */
|
|
|
|
short mode;
|
2019-02-27 05:07:50 +01:00
|
|
|
char _pad[4];
|
2008-01-25 12:23:36 +01:00
|
|
|
} bDistLimitConstraint;
|
|
|
|
|
2009-10-30 07:33:40 +01:00
|
|
|
/* ShrinkWrap Constraint */
|
2009-04-20 17:06:46 +02:00
|
|
|
typedef struct bShrinkwrapConstraint {
|
2010-08-04 06:01:27 +02:00
|
|
|
struct Object *target;
|
2019-01-07 12:19:13 +01:00
|
|
|
/** Distance to kept from target. */
|
|
|
|
float dist;
|
|
|
|
/** Shrink type (look on MOD shrinkwrap for values). */
|
|
|
|
short shrinkType;
|
|
|
|
/** Axis to project/constrain. */
|
|
|
|
char projAxis;
|
|
|
|
/** Space to project axis in. */
|
|
|
|
char projAxisSpace;
|
|
|
|
/** Distance to search. */
|
|
|
|
float projLimit;
|
|
|
|
/** Inside/outside/on surface (see MOD shrinkwrap). */
|
|
|
|
char shrinkMode;
|
|
|
|
/** Options. */
|
|
|
|
char flag;
|
|
|
|
/** Axis to align to normal. */
|
|
|
|
char trackAxis;
|
2019-02-27 05:07:50 +01:00
|
|
|
char _pad;
|
2009-04-20 17:06:46 +02:00
|
|
|
} bShrinkwrapConstraint;
|
|
|
|
|
2011-11-07 13:55:18 +01:00
|
|
|
/* Follow Track constraints */
|
|
|
|
typedef struct bFollowTrackConstraint {
|
|
|
|
struct MovieClip *clip;
|
2019-01-07 12:19:13 +01:00
|
|
|
/** MAX_NAME. */
|
|
|
|
char track[64];
|
2012-08-09 18:57:02 +02:00
|
|
|
int flag;
|
|
|
|
int frame_method;
|
2019-01-07 12:19:13 +01:00
|
|
|
/** MAX_NAME. */
|
|
|
|
char object[64];
|
2011-12-15 21:38:23 +01:00
|
|
|
struct Object *camera;
|
2012-01-04 18:20:08 +01:00
|
|
|
struct Object *depth_ob;
|
2011-11-07 13:55:18 +01:00
|
|
|
} bFollowTrackConstraint;
|
|
|
|
|
|
|
|
/* Camera Solver constraints */
|
|
|
|
typedef struct bCameraSolverConstraint {
|
|
|
|
struct MovieClip *clip;
|
2019-02-27 05:07:50 +01:00
|
|
|
int flag;
|
|
|
|
char _pad[4];
|
2011-11-07 13:55:18 +01:00
|
|
|
} bCameraSolverConstraint;
|
2009-04-20 17:06:46 +02:00
|
|
|
|
2011-12-05 19:57:17 +01:00
|
|
|
/* Camera Solver constraints */
|
|
|
|
typedef struct bObjectSolverConstraint {
|
|
|
|
struct MovieClip *clip;
|
2019-02-27 05:07:50 +01:00
|
|
|
int flag;
|
|
|
|
char _pad[4];
|
2019-01-07 12:19:13 +01:00
|
|
|
/** MAX_NAME. */
|
|
|
|
char object[64];
|
|
|
|
/** Parent-inverse matrix to use. */
|
|
|
|
float invmat[4][4];
|
2011-12-15 21:38:23 +01:00
|
|
|
struct Object *camera;
|
2011-12-05 19:57:17 +01:00
|
|
|
} bObjectSolverConstraint;
|
|
|
|
|
Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.
A more in-depth documentation is to be found on the wiki, as well as a
guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.
Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.
Reviewers: sergey, campbellbarton, mont29
Reviewed By: sergey, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D2060
2016-08-06 06:20:37 +02:00
|
|
|
/* Transform matrix cache constraint */
|
|
|
|
typedef struct bTransformCacheConstraint {
|
|
|
|
struct CacheFile *cache_file;
|
2019-01-07 12:19:13 +01:00
|
|
|
/** FILE_MAX. */
|
|
|
|
char object_path[1024];
|
2019-04-04 15:07:37 +02:00
|
|
|
|
|
|
|
/* Runtime. */
|
|
|
|
struct CacheReader *reader;
|
|
|
|
char reader_object_path[1024];
|
Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.
A more in-depth documentation is to be found on the wiki, as well as a
guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.
Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.
Reviewers: sergey, campbellbarton, mont29
Reviewed By: sergey, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D2060
2016-08-06 06:20:37 +02:00
|
|
|
} bTransformCacheConstraint;
|
|
|
|
|
== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon.
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too)
2007-10-22 01:00:29 +02:00
|
|
|
/* ------------------------------------------ */
|
|
|
|
|
2018-06-17 17:04:09 +02:00
|
|
|
/* bConstraint->type
|
2018-11-14 02:53:15 +01:00
|
|
|
* - Do not ever change the order of these, or else files could get
|
|
|
|
* broken as their correct value cannot be resolved
|
== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon.
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too)
2007-10-22 01:00:29 +02:00
|
|
|
*/
|
2009-11-16 13:33:42 +01:00
|
|
|
typedef enum eBConstraint_Types {
|
2019-01-15 13:14:35 +01:00
|
|
|
/** Invalid/legacy constraint */
|
|
|
|
CONSTRAINT_TYPE_NULL = 0,
|
|
|
|
CONSTRAINT_TYPE_CHILDOF = 1,
|
2012-06-15 16:11:05 +02:00
|
|
|
CONSTRAINT_TYPE_TRACKTO = 2,
|
|
|
|
CONSTRAINT_TYPE_KINEMATIC = 3,
|
|
|
|
CONSTRAINT_TYPE_FOLLOWPATH = 4,
|
2019-01-15 13:14:35 +01:00
|
|
|
CONSTRAINT_TYPE_ROTLIMIT = 5,
|
|
|
|
CONSTRAINT_TYPE_LOCLIMIT = 6,
|
|
|
|
CONSTRAINT_TYPE_SIZELIMIT = 7,
|
2012-06-15 16:11:05 +02:00
|
|
|
CONSTRAINT_TYPE_ROTLIKE = 8,
|
|
|
|
CONSTRAINT_TYPE_LOCLIKE = 9,
|
|
|
|
CONSTRAINT_TYPE_SIZELIKE = 10,
|
2019-01-15 13:14:35 +01:00
|
|
|
CONSTRAINT_TYPE_PYTHON = 11,
|
2012-06-15 16:11:05 +02:00
|
|
|
CONSTRAINT_TYPE_ACTION = 12,
|
2019-01-15 13:14:35 +01:00
|
|
|
CONSTRAINT_TYPE_LOCKTRACK = 13,
|
|
|
|
CONSTRAINT_TYPE_DISTLIMIT = 14,
|
|
|
|
CONSTRAINT_TYPE_STRETCHTO = 15,
|
|
|
|
/** floor constraint */
|
|
|
|
CONSTRAINT_TYPE_MINMAX = 16,
|
2018-04-16 14:07:42 +02:00
|
|
|
/* CONSTRAINT_TYPE_DEPRECATED = 17 */
|
2019-01-15 13:14:35 +01:00
|
|
|
CONSTRAINT_TYPE_CLAMPTO = 18,
|
|
|
|
/** transformation (loc/rot/size -> loc/rot/size) constraint */
|
|
|
|
CONSTRAINT_TYPE_TRANSFORM = 19,
|
|
|
|
/** shrinkwrap (loc/rot) constraint */
|
|
|
|
CONSTRAINT_TYPE_SHRINKWRAP = 20,
|
2023-03-30 15:54:32 +02:00
|
|
|
/** Tracking constraint that minimizes twisting */
|
2019-01-15 13:14:35 +01:00
|
|
|
CONSTRAINT_TYPE_DAMPTRACK = 21,
|
|
|
|
CONSTRAINT_TYPE_SPLINEIK = 22,
|
|
|
|
/** Copy transform matrix */
|
|
|
|
CONSTRAINT_TYPE_TRANSLIKE = 23,
|
|
|
|
/** Maintain volume during scaling */
|
|
|
|
CONSTRAINT_TYPE_SAMEVOL = 24,
|
|
|
|
CONSTRAINT_TYPE_PIVOT = 25,
|
|
|
|
CONSTRAINT_TYPE_FOLLOWTRACK = 26,
|
|
|
|
CONSTRAINT_TYPE_CAMERASOLVER = 27,
|
|
|
|
CONSTRAINT_TYPE_OBJECTSOLVER = 28,
|
|
|
|
CONSTRAINT_TYPE_TRANSFORM_CACHE = 29,
|
|
|
|
CONSTRAINT_TYPE_ARMATURE = 30,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-03-30 15:54:32 +02:00
|
|
|
/* This should be the last entry in this list. */
|
2019-04-16 16:40:47 +02:00
|
|
|
NUM_CONSTRAINT_TYPES,
|
2018-06-17 17:04:09 +02:00
|
|
|
} eBConstraint_Types;
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2007-07-21 09:26:15 +02:00
|
|
|
/* bConstraint->flag */
|
2019-03-18 04:21:37 +01:00
|
|
|
/* flags 0x2 (1 << 1) and 0x8 (1 << 3) were used in past */
|
|
|
|
/* flag 0x20 (1 << 5) was used to indicate that a constraint was evaluated
|
2023-09-06 06:23:01 +02:00
|
|
|
* using a 'local' hack for pose-bones only. */
|
2009-11-16 13:33:42 +01:00
|
|
|
typedef enum eBConstraint_Flags {
|
2020-10-23 01:37:52 +02:00
|
|
|
#ifdef DNA_DEPRECATED_ALLOW
|
2020-06-19 18:40:48 +02:00
|
|
|
/* Expansion for old box constraint layouts. Just for versioning. */
|
|
|
|
CONSTRAINT_EXPAND_DEPRECATED = (1 << 0),
|
2020-10-23 01:37:52 +02:00
|
|
|
#endif
|
2024-01-09 16:39:10 +01:00
|
|
|
/* Constraint is disabled because it is considered invalid. `is_valid` in RNA. */
|
2019-03-18 04:21:37 +01:00
|
|
|
CONSTRAINT_DISABLE = (1 << 2),
|
2019-01-15 13:14:35 +01:00
|
|
|
/* to indicate which Ipo should be shown, maybe for 3d access later too */
|
2019-03-18 04:21:37 +01:00
|
|
|
CONSTRAINT_ACTIVE = (1 << 4),
|
2019-01-15 13:14:35 +01:00
|
|
|
/* to indicate that the owner's space should only be changed into ownspace, but not out of it */
|
2019-03-18 04:21:37 +01:00
|
|
|
CONSTRAINT_SPACEONCE = (1 << 6),
|
2019-01-15 13:14:35 +01:00
|
|
|
/* influence ipo is on constraint itself, not in action channel */
|
2019-03-18 04:21:37 +01:00
|
|
|
CONSTRAINT_OWN_IPO = (1 << 7),
|
2024-01-09 16:39:10 +01:00
|
|
|
/* Constraint is disabled by the user or the animation system (eye icon in the interface). */
|
2019-03-18 04:21:37 +01:00
|
|
|
CONSTRAINT_OFF = (1 << 9),
|
2019-01-15 13:14:35 +01:00
|
|
|
/* use bbone curve shape when calculating headtail values (also used by dependency graph!) */
|
2019-03-18 04:21:37 +01:00
|
|
|
CONSTRAINT_BBONE_SHAPE = (1 << 10),
|
2019-01-15 13:14:35 +01:00
|
|
|
/* That constraint has been inserted in local override (i.e. it can be fully edited!). */
|
2019-06-14 23:16:04 +02:00
|
|
|
CONSTRAINT_OVERRIDE_LIBRARY_LOCAL = (1 << 11),
|
2021-06-24 07:56:58 +02:00
|
|
|
/* use full transformation (not just segment locations) - only set at runtime. */
|
2018-07-09 21:25:44 +02:00
|
|
|
CONSTRAINT_BBONE_SHAPE_FULL = (1 << 12),
|
2009-11-16 13:33:42 +01:00
|
|
|
} eBConstraint_Flags;
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 05:35:37 +02:00
|
|
|
|
2007-07-21 09:26:15 +02:00
|
|
|
/* bConstraint->ownspace/tarspace */
|
2009-11-16 13:33:42 +01:00
|
|
|
typedef enum eBConstraint_SpaceTypes {
|
2021-11-13 03:07:13 +01:00
|
|
|
/** Default for all - world-space. */
|
== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon.
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too)
2007-10-22 01:00:29 +02:00
|
|
|
CONSTRAINT_SPACE_WORLD = 0,
|
2020-12-03 10:42:29 +01:00
|
|
|
/** For all - custom space. */
|
|
|
|
CONSTRAINT_SPACE_CUSTOM = 5,
|
2020-03-06 01:40:37 +01:00
|
|
|
/**
|
|
|
|
* For objects (relative to parent/without parent influence),
|
|
|
|
* for bones (along normals of bone, without parent/rest-positions).
|
|
|
|
*/
|
2012-06-15 16:11:05 +02:00
|
|
|
CONSTRAINT_SPACE_LOCAL = 1,
|
2019-03-14 23:41:13 +01:00
|
|
|
/** For posechannels - pose space. */
|
2012-06-15 16:11:05 +02:00
|
|
|
CONSTRAINT_SPACE_POSE = 2,
|
2019-03-14 23:41:13 +01:00
|
|
|
/** For posechannels - local with parent. */
|
2012-06-15 16:11:05 +02:00
|
|
|
CONSTRAINT_SPACE_PARLOCAL = 3,
|
2021-06-27 22:15:57 +02:00
|
|
|
/** For posechannels - local converted to the owner bone orientation. */
|
|
|
|
CONSTRAINT_SPACE_OWNLOCAL = 6,
|
2019-03-14 23:41:13 +01:00
|
|
|
/** For files from between 2.43-2.46 (should have been parlocal). */
|
2019-04-16 16:40:47 +02:00
|
|
|
CONSTRAINT_SPACE_INVALID = 4, /* do not exchange for anything! */
|
2009-11-16 13:33:42 +01:00
|
|
|
} eBConstraint_SpaceTypes;
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 19:35:38 +02:00
|
|
|
|
2019-09-01 12:19:11 +02:00
|
|
|
/* Common enum for constraints that support override. */
|
|
|
|
typedef enum eConstraint_EulerOrder {
|
|
|
|
/** Automatic euler mode. */
|
|
|
|
CONSTRAINT_EULER_AUTO = 0,
|
|
|
|
|
|
|
|
/** Explicit euler rotation modes - must sync with BLI_math_rotation.h defines. */
|
|
|
|
CONSTRAINT_EULER_XYZ = 1,
|
2020-04-24 07:49:25 +02:00
|
|
|
CONSTRAINT_EULER_XZY = 2,
|
|
|
|
CONSTRAINT_EULER_YXZ = 3,
|
|
|
|
CONSTRAINT_EULER_YZX = 4,
|
|
|
|
CONSTRAINT_EULER_ZXY = 5,
|
|
|
|
CONSTRAINT_EULER_ZYX = 6,
|
2019-09-01 12:19:11 +02:00
|
|
|
} eConstraint_EulerOrder;
|
|
|
|
|
== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon.
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too)
2007-10-22 01:00:29 +02:00
|
|
|
/* -------------------------------------- */
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2022-04-05 00:00:20 +02:00
|
|
|
/** #bRotateLikeConstraint.flag */
|
2009-11-16 13:33:42 +01:00
|
|
|
typedef enum eCopyRotation_Flags {
|
2019-03-18 04:21:37 +01:00
|
|
|
ROTLIKE_X = (1 << 0),
|
|
|
|
ROTLIKE_Y = (1 << 1),
|
|
|
|
ROTLIKE_Z = (1 << 2),
|
|
|
|
ROTLIKE_X_INVERT = (1 << 4),
|
|
|
|
ROTLIKE_Y_INVERT = (1 << 5),
|
|
|
|
ROTLIKE_Z_INVERT = (1 << 6),
|
2019-12-16 23:42:12 +01:00
|
|
|
#ifdef DNA_DEPRECATED_ALLOW
|
2019-03-18 04:21:37 +01:00
|
|
|
ROTLIKE_OFFSET = (1 << 7),
|
2019-09-04 11:06:59 +02:00
|
|
|
#endif
|
2009-11-16 13:33:42 +01:00
|
|
|
} eCopyRotation_Flags;
|
2005-10-25 21:13:04 +02:00
|
|
|
|
2022-04-05 00:00:20 +02:00
|
|
|
/** #bRotateLikeConstraint.mix_mode */
|
2019-09-04 11:06:59 +02:00
|
|
|
typedef enum eCopyRotation_MixMode {
|
|
|
|
/* Replace rotation channel values. */
|
|
|
|
ROTLIKE_MIX_REPLACE = 0,
|
|
|
|
/* Legacy Offset mode - don't use. */
|
2020-04-24 07:49:25 +02:00
|
|
|
ROTLIKE_MIX_OFFSET = 1,
|
2019-09-04 11:06:59 +02:00
|
|
|
/* Add Euler components together. */
|
2020-04-24 07:49:25 +02:00
|
|
|
ROTLIKE_MIX_ADD = 2,
|
2019-09-04 11:06:59 +02:00
|
|
|
/* Multiply the copied rotation on the left. */
|
2020-04-24 07:49:25 +02:00
|
|
|
ROTLIKE_MIX_BEFORE = 3,
|
2019-09-04 11:06:59 +02:00
|
|
|
/* Multiply the copied rotation on the right. */
|
2020-04-24 07:49:25 +02:00
|
|
|
ROTLIKE_MIX_AFTER = 4,
|
2019-09-04 11:06:59 +02:00
|
|
|
} eCopyRotation_MixMode;
|
|
|
|
|
2022-04-05 00:00:20 +02:00
|
|
|
/** #bLocateLikeConstraint.flag */
|
2009-11-16 13:33:42 +01:00
|
|
|
typedef enum eCopyLocation_Flags {
|
2019-03-18 04:21:37 +01:00
|
|
|
LOCLIKE_X = (1 << 0),
|
|
|
|
LOCLIKE_Y = (1 << 1),
|
|
|
|
LOCLIKE_Z = (1 << 2),
|
2019-03-14 23:41:13 +01:00
|
|
|
/** LOCLIKE_TIP is a deprecated option... use headtail=1.0f instead */
|
2019-03-18 04:21:37 +01:00
|
|
|
LOCLIKE_TIP = (1 << 3),
|
|
|
|
LOCLIKE_X_INVERT = (1 << 4),
|
|
|
|
LOCLIKE_Y_INVERT = (1 << 5),
|
|
|
|
LOCLIKE_Z_INVERT = (1 << 6),
|
|
|
|
LOCLIKE_OFFSET = (1 << 7),
|
2009-11-16 13:33:42 +01:00
|
|
|
} eCopyLocation_Flags;
|
2018-06-17 17:04:09 +02:00
|
|
|
|
2022-04-05 00:00:20 +02:00
|
|
|
/** #bSizeLikeConstraint.flag */
|
2009-11-16 13:33:42 +01:00
|
|
|
typedef enum eCopyScale_Flags {
|
2019-03-18 04:21:37 +01:00
|
|
|
SIZELIKE_X = (1 << 0),
|
|
|
|
SIZELIKE_Y = (1 << 1),
|
|
|
|
SIZELIKE_Z = (1 << 2),
|
|
|
|
SIZELIKE_OFFSET = (1 << 3),
|
|
|
|
SIZELIKE_MULTIPLY = (1 << 4),
|
2019-08-28 15:56:27 +02:00
|
|
|
SIZELIKE_UNIFORM = (1 << 5),
|
2009-11-16 13:33:42 +01:00
|
|
|
} eCopyScale_Flags;
|
|
|
|
|
2022-04-05 00:00:20 +02:00
|
|
|
/** #bTransLikeConstraint.flag */
|
2020-11-04 17:29:27 +01:00
|
|
|
typedef enum eCopyTransforms_Flags {
|
|
|
|
/* Remove shear from the target matrix. */
|
|
|
|
TRANSLIKE_REMOVE_TARGET_SHEAR = (1 << 0),
|
|
|
|
} eCopyTransforms_Flags;
|
|
|
|
|
2022-04-05 00:00:20 +02:00
|
|
|
/** #bTransLikeConstraint.mix_mode */
|
2019-09-04 13:59:18 +02:00
|
|
|
typedef enum eCopyTransforms_MixMode {
|
|
|
|
/* Replace rotation channel values. */
|
|
|
|
TRANSLIKE_MIX_REPLACE = 0,
|
|
|
|
/* Multiply the copied transformation on the left, with anti-shear scale handling. */
|
2020-04-24 07:49:25 +02:00
|
|
|
TRANSLIKE_MIX_BEFORE = 1,
|
2019-09-04 13:59:18 +02:00
|
|
|
/* Multiply the copied transformation on the right, with anti-shear scale handling. */
|
2020-04-24 07:49:25 +02:00
|
|
|
TRANSLIKE_MIX_AFTER = 2,
|
2020-11-04 17:29:27 +01:00
|
|
|
/* Multiply the copied transformation on the left, handling loc/rot/scale separately. */
|
|
|
|
TRANSLIKE_MIX_BEFORE_SPLIT = 3,
|
|
|
|
/* Multiply the copied transformation on the right, handling loc/rot/scale separately. */
|
|
|
|
TRANSLIKE_MIX_AFTER_SPLIT = 4,
|
|
|
|
/* Multiply the copied transformation on the left, using simple matrix multiplication. */
|
|
|
|
TRANSLIKE_MIX_BEFORE_FULL = 5,
|
|
|
|
/* Multiply the copied transformation on the right, using simple matrix multiplication. */
|
|
|
|
TRANSLIKE_MIX_AFTER_FULL = 6,
|
2019-09-04 13:59:18 +02:00
|
|
|
} eCopyTransforms_MixMode;
|
|
|
|
|
2014-04-07 12:10:37 +02:00
|
|
|
/* bTransformConstraint.to/from */
|
|
|
|
typedef enum eTransform_ToFrom {
|
|
|
|
TRANS_LOCATION = 0,
|
|
|
|
TRANS_ROTATION = 1,
|
|
|
|
TRANS_SCALE = 2,
|
|
|
|
} eTransform_ToFrom;
|
|
|
|
|
2022-04-05 00:00:20 +02:00
|
|
|
/** #bTransformConstraint.mix_mode_loc */
|
2019-09-06 10:54:34 +02:00
|
|
|
typedef enum eTransform_MixModeLoc {
|
|
|
|
/* Add component values together (default). */
|
|
|
|
TRANS_MIXLOC_ADD = 0,
|
|
|
|
/* Replace component values. */
|
2020-04-24 07:49:25 +02:00
|
|
|
TRANS_MIXLOC_REPLACE = 1,
|
2019-09-06 10:54:34 +02:00
|
|
|
} eTransform_MixModeLoc;
|
|
|
|
|
2022-04-05 00:00:20 +02:00
|
|
|
/** #bTransformConstraint.mix_mode_rot */
|
2019-09-06 10:54:34 +02:00
|
|
|
typedef enum eTransform_MixModeRot {
|
|
|
|
/* Add component values together (default). */
|
|
|
|
TRANS_MIXROT_ADD = 0,
|
|
|
|
/* Replace component values. */
|
2020-04-24 07:49:25 +02:00
|
|
|
TRANS_MIXROT_REPLACE = 1,
|
2019-09-06 10:54:34 +02:00
|
|
|
/* Multiply the generated rotation on the left. */
|
2020-04-24 07:49:25 +02:00
|
|
|
TRANS_MIXROT_BEFORE = 2,
|
2019-09-06 10:54:34 +02:00
|
|
|
/* Multiply the generated rotation on the right. */
|
2020-04-24 07:49:25 +02:00
|
|
|
TRANS_MIXROT_AFTER = 3,
|
2019-09-06 10:54:34 +02:00
|
|
|
} eTransform_MixModeRot;
|
|
|
|
|
2022-04-05 00:00:20 +02:00
|
|
|
/** #bTransformConstraint.mix_mode_scale */
|
2019-09-06 10:54:34 +02:00
|
|
|
typedef enum eTransform_MixModeScale {
|
|
|
|
/* Replace component values (default). */
|
|
|
|
TRANS_MIXSCALE_REPLACE = 0,
|
|
|
|
/* Multiply component values together. */
|
2020-04-24 07:49:25 +02:00
|
|
|
TRANS_MIXSCALE_MULTIPLY = 1,
|
2019-09-06 10:54:34 +02:00
|
|
|
} eTransform_MixModeScale;
|
|
|
|
|
2022-04-05 00:00:20 +02:00
|
|
|
/** #bSameVolumeConstraint.free_axis */
|
Maintain Volume: introduce an option switching between modes.
After a lot of thinking about this, I decided that all operation modes
that I've tried over the past couple of years, including the original
2.79 one, have their uses after all. Thus the only reasonable solution
is to add yet another option.
The modes are:
- Strict: The current 2.80 mode, which overrides the original scaling
of the non-free axes to strictly preserve the volume. This is the most
obvious way one would expect a 'Maintain Volume' constraint to work.
- Uniform: The original 2.79 mode, which assumes that all axes have been
scaled the same as the free one when computing the volume. This seems
strange, but the net effect is that when simply scaling the object
uniformly with S, the volume is preserved; however, scaling the non-
free axes individually allows deviating from the locked volume.
This was obviously intended as a more or less convenient UI tool.
- Single Axis: My own variant of the intent of the Uniform scale, which
does volume-preserving if the object is scaled just on the Free axis,
while passing the non-free axis scaling through. I.e. instead of
uniform S scaling, the user has to scale the object just on its
primary axis to achieve constant volume. This can allow reducing the
number of animation curves when only constant volume scaling is needed,
or be an easier to control tool inside a complex rig.
2019-05-06 20:47:51 +02:00
|
|
|
typedef enum eSameVolume_Axis {
|
2010-03-16 13:55:56 +01:00
|
|
|
SAMEVOL_X = 0,
|
2012-06-15 16:11:05 +02:00
|
|
|
SAMEVOL_Y = 1,
|
2019-01-15 13:57:49 +01:00
|
|
|
SAMEVOL_Z = 2,
|
Maintain Volume: introduce an option switching between modes.
After a lot of thinking about this, I decided that all operation modes
that I've tried over the past couple of years, including the original
2.79 one, have their uses after all. Thus the only reasonable solution
is to add yet another option.
The modes are:
- Strict: The current 2.80 mode, which overrides the original scaling
of the non-free axes to strictly preserve the volume. This is the most
obvious way one would expect a 'Maintain Volume' constraint to work.
- Uniform: The original 2.79 mode, which assumes that all axes have been
scaled the same as the free one when computing the volume. This seems
strange, but the net effect is that when simply scaling the object
uniformly with S, the volume is preserved; however, scaling the non-
free axes individually allows deviating from the locked volume.
This was obviously intended as a more or less convenient UI tool.
- Single Axis: My own variant of the intent of the Uniform scale, which
does volume-preserving if the object is scaled just on the Free axis,
while passing the non-free axis scaling through. I.e. instead of
uniform S scaling, the user has to scale the object just on its
primary axis to achieve constant volume. This can allow reducing the
number of animation curves when only constant volume scaling is needed,
or be an easier to control tool inside a complex rig.
2019-05-06 20:47:51 +02:00
|
|
|
} eSameVolume_Axis;
|
|
|
|
|
2022-04-05 00:00:20 +02:00
|
|
|
/** #bSameVolumeConstraint.mode */
|
Maintain Volume: introduce an option switching between modes.
After a lot of thinking about this, I decided that all operation modes
that I've tried over the past couple of years, including the original
2.79 one, have their uses after all. Thus the only reasonable solution
is to add yet another option.
The modes are:
- Strict: The current 2.80 mode, which overrides the original scaling
of the non-free axes to strictly preserve the volume. This is the most
obvious way one would expect a 'Maintain Volume' constraint to work.
- Uniform: The original 2.79 mode, which assumes that all axes have been
scaled the same as the free one when computing the volume. This seems
strange, but the net effect is that when simply scaling the object
uniformly with S, the volume is preserved; however, scaling the non-
free axes individually allows deviating from the locked volume.
This was obviously intended as a more or less convenient UI tool.
- Single Axis: My own variant of the intent of the Uniform scale, which
does volume-preserving if the object is scaled just on the Free axis,
while passing the non-free axis scaling through. I.e. instead of
uniform S scaling, the user has to scale the object just on its
primary axis to achieve constant volume. This can allow reducing the
number of animation curves when only constant volume scaling is needed,
or be an easier to control tool inside a complex rig.
2019-05-06 20:47:51 +02:00
|
|
|
typedef enum eSameVolume_Mode {
|
|
|
|
/* Strictly maintain the volume, overriding non-free axis scale. */
|
|
|
|
SAMEVOL_STRICT = 0,
|
|
|
|
/* Maintain the volume when scale is uniform, pass non-uniform other axis scale through. */
|
|
|
|
SAMEVOL_UNIFORM = 1,
|
|
|
|
/* Maintain the volume when scaled only on the free axis, pass other axis scale through. */
|
|
|
|
SAMEVOL_SINGLE_AXIS = 2,
|
|
|
|
} eSameVolume_Mode;
|
2010-03-16 13:55:56 +01:00
|
|
|
|
2022-04-05 00:00:20 +02:00
|
|
|
/** #bActionConstraint.flag */
|
2012-06-12 13:54:31 +02:00
|
|
|
typedef enum eActionConstraint_Flags {
|
|
|
|
/* Bones use "object" part of target action, instead of "same bone name" part */
|
2018-06-17 17:04:09 +02:00
|
|
|
ACTCON_BONE_USE_OBJECT_ACTION = (1 << 0),
|
2020-09-16 15:52:43 +02:00
|
|
|
/* Ignore the transform of 'tar' and use 'eval_time' instead: */
|
|
|
|
ACTCON_USE_EVAL_TIME = (1 << 1),
|
2012-06-12 13:54:31 +02:00
|
|
|
} eActionConstraint_Flags;
|
2012-06-12 08:22:23 +02:00
|
|
|
|
2022-04-05 00:00:20 +02:00
|
|
|
/** #bActionConstraint.mix_mode */
|
Action Constraint: introduce a mix mode setting.
Currently the action channels are applied after the existing
transformation, as if the action controlled a child of the
bone. This is not very natural, but more importantly, the
transform tools are not designed to work conveniently with an
additional 'pseudo-child' transformation, resulting in effects
like an unexpected pivot location.
Implementing a Before mode that integrates the action channels
as if applied to a parent allows using the special transform
tool code intended for dealing with such constraints.
Note that in either mode, Action constraints should be added
in reverse order, putting a new constraint before the existing
ones that the Action was keyframed to work together.
In order to implement the option, extract a utility from
the Copy Transform constraint code for combining transforms
with special anti-shear scale handling that matches the
Aligned Inherit Scale mode.
The Before mode also requires switching the constraint to
the Local owner space, while the After mode can still use the
World space for efficiency as before. Since the constraint
doesn't have an Owner space option in the UI, this has to be
handled in an RNA setter.
For full backward compatibility, the original simple matrix
multiplication mode is preserved as the third option, but it
is not recommended due to creating shear.
Differential Revision: https://developer.blender.org/D6297
2019-11-23 11:11:39 +01:00
|
|
|
typedef enum eActionConstraint_MixMode {
|
|
|
|
/* Multiply the action transformation on the right. */
|
|
|
|
ACTCON_MIX_AFTER_FULL = 0,
|
2021-08-02 18:08:12 +02:00
|
|
|
/* Multiply the action transformation on the left. */
|
|
|
|
ACTCON_MIX_BEFORE_FULL = 3,
|
Action Constraint: introduce a mix mode setting.
Currently the action channels are applied after the existing
transformation, as if the action controlled a child of the
bone. This is not very natural, but more importantly, the
transform tools are not designed to work conveniently with an
additional 'pseudo-child' transformation, resulting in effects
like an unexpected pivot location.
Implementing a Before mode that integrates the action channels
as if applied to a parent allows using the special transform
tool code intended for dealing with such constraints.
Note that in either mode, Action constraints should be added
in reverse order, putting a new constraint before the existing
ones that the Action was keyframed to work together.
In order to implement the option, extract a utility from
the Copy Transform constraint code for combining transforms
with special anti-shear scale handling that matches the
Aligned Inherit Scale mode.
The Before mode also requires switching the constraint to
the Local owner space, while the After mode can still use the
World space for efficiency as before. Since the constraint
doesn't have an Owner space option in the UI, this has to be
handled in an RNA setter.
For full backward compatibility, the original simple matrix
multiplication mode is preserved as the third option, but it
is not recommended due to creating shear.
Differential Revision: https://developer.blender.org/D6297
2019-11-23 11:11:39 +01:00
|
|
|
/* Multiply the action transformation on the right, with anti-shear scale handling. */
|
2020-04-24 07:49:25 +02:00
|
|
|
ACTCON_MIX_AFTER = 1,
|
Action Constraint: introduce a mix mode setting.
Currently the action channels are applied after the existing
transformation, as if the action controlled a child of the
bone. This is not very natural, but more importantly, the
transform tools are not designed to work conveniently with an
additional 'pseudo-child' transformation, resulting in effects
like an unexpected pivot location.
Implementing a Before mode that integrates the action channels
as if applied to a parent allows using the special transform
tool code intended for dealing with such constraints.
Note that in either mode, Action constraints should be added
in reverse order, putting a new constraint before the existing
ones that the Action was keyframed to work together.
In order to implement the option, extract a utility from
the Copy Transform constraint code for combining transforms
with special anti-shear scale handling that matches the
Aligned Inherit Scale mode.
The Before mode also requires switching the constraint to
the Local owner space, while the After mode can still use the
World space for efficiency as before. Since the constraint
doesn't have an Owner space option in the UI, this has to be
handled in an RNA setter.
For full backward compatibility, the original simple matrix
multiplication mode is preserved as the third option, but it
is not recommended due to creating shear.
Differential Revision: https://developer.blender.org/D6297
2019-11-23 11:11:39 +01:00
|
|
|
/* Multiply the action transformation on the left, with anti-shear scale handling. */
|
2020-04-24 07:49:25 +02:00
|
|
|
ACTCON_MIX_BEFORE = 2,
|
2021-08-02 18:08:12 +02:00
|
|
|
/* Separately combine Translation, Rotation and Scale, with rotation on the right. */
|
|
|
|
ACTCON_MIX_AFTER_SPLIT = 4,
|
|
|
|
/* Separately combine Translation, Rotation and Scale, with rotation on the left. */
|
|
|
|
ACTCON_MIX_BEFORE_SPLIT = 5,
|
Action Constraint: introduce a mix mode setting.
Currently the action channels are applied after the existing
transformation, as if the action controlled a child of the
bone. This is not very natural, but more importantly, the
transform tools are not designed to work conveniently with an
additional 'pseudo-child' transformation, resulting in effects
like an unexpected pivot location.
Implementing a Before mode that integrates the action channels
as if applied to a parent allows using the special transform
tool code intended for dealing with such constraints.
Note that in either mode, Action constraints should be added
in reverse order, putting a new constraint before the existing
ones that the Action was keyframed to work together.
In order to implement the option, extract a utility from
the Copy Transform constraint code for combining transforms
with special anti-shear scale handling that matches the
Aligned Inherit Scale mode.
The Before mode also requires switching the constraint to
the Local owner space, while the After mode can still use the
World space for efficiency as before. Since the constraint
doesn't have an Owner space option in the UI, this has to be
handled in an RNA setter.
For full backward compatibility, the original simple matrix
multiplication mode is preserved as the third option, but it
is not recommended due to creating shear.
Differential Revision: https://developer.blender.org/D6297
2019-11-23 11:11:39 +01:00
|
|
|
} eActionConstraint_MixMode;
|
|
|
|
|
2009-11-16 13:33:42 +01:00
|
|
|
/* Locked-Axis Values (Locked Track) */
|
|
|
|
typedef enum eLockAxis_Modes {
|
2012-06-15 16:11:05 +02:00
|
|
|
LOCK_X = 0,
|
|
|
|
LOCK_Y = 1,
|
2019-01-15 13:57:49 +01:00
|
|
|
LOCK_Z = 2,
|
2009-11-16 13:33:42 +01:00
|
|
|
} eLockAxis_Modes;
|
|
|
|
|
|
|
|
/* Up-Axis Values (TrackTo and Locked Track) */
|
|
|
|
typedef enum eUpAxis_Modes {
|
2012-06-15 16:11:05 +02:00
|
|
|
UP_X = 0,
|
|
|
|
UP_Y = 1,
|
2019-01-15 13:57:49 +01:00
|
|
|
UP_Z = 2,
|
2009-11-16 13:33:42 +01:00
|
|
|
} eUpAxis_Modes;
|
|
|
|
|
2011-01-02 14:33:32 +01:00
|
|
|
/* Tracking axis (TrackTo, Locked Track, Damped Track) and minmax (floor) constraint */
|
2009-11-16 13:33:42 +01:00
|
|
|
typedef enum eTrackToAxis_Modes {
|
|
|
|
TRACK_X = 0,
|
2012-06-15 16:11:05 +02:00
|
|
|
TRACK_Y = 1,
|
|
|
|
TRACK_Z = 2,
|
|
|
|
TRACK_nX = 3,
|
|
|
|
TRACK_nY = 4,
|
2019-04-16 16:40:47 +02:00
|
|
|
TRACK_nZ = 5,
|
2009-11-16 13:33:42 +01:00
|
|
|
} eTrackToAxis_Modes;
|
2005-08-24 22:18:03 +02:00
|
|
|
|
2018-07-08 12:47:26 +02:00
|
|
|
/* Shrinkwrap flags */
|
|
|
|
typedef enum eShrinkwrap_Flags {
|
2021-10-18 02:16:24 +02:00
|
|
|
/* Also ray-cast in the opposite direction. */
|
2018-07-08 12:47:26 +02:00
|
|
|
CON_SHRINKWRAP_PROJECT_OPPOSITE = (1 << 0),
|
|
|
|
/* Invert the cull mode when projecting opposite. */
|
|
|
|
CON_SHRINKWRAP_PROJECT_INVERT_CULL = (1 << 1),
|
2018-10-03 18:09:43 +02:00
|
|
|
/* Align the specified axis to the target normal. */
|
|
|
|
CON_SHRINKWRAP_TRACK_NORMAL = (1 << 2),
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-08 12:47:26 +02:00
|
|
|
/* Ignore front faces in project; same value as MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE */
|
|
|
|
CON_SHRINKWRAP_PROJECT_CULL_FRONTFACE = (1 << 3),
|
|
|
|
/* Ignore back faces in project; same value as MOD_SHRINKWRAP_CULL_TARGET_BACKFACE */
|
|
|
|
CON_SHRINKWRAP_PROJECT_CULL_BACKFACE = (1 << 4),
|
|
|
|
} eShrinkwrap_Flags;
|
|
|
|
|
|
|
|
#define CON_SHRINKWRAP_PROJECT_CULL_MASK \
|
|
|
|
(CON_SHRINKWRAP_PROJECT_CULL_FRONTFACE | CON_SHRINKWRAP_PROJECT_CULL_BACKFACE)
|
|
|
|
|
2009-09-08 11:41:15 +02:00
|
|
|
/* FollowPath flags */
|
2009-11-16 13:33:42 +01:00
|
|
|
typedef enum eFollowPath_Flags {
|
2019-03-18 04:21:37 +01:00
|
|
|
FOLLOWPATH_FOLLOW = (1 << 0),
|
|
|
|
FOLLOWPATH_STATIC = (1 << 1),
|
|
|
|
FOLLOWPATH_RADIUS = (1 << 2),
|
2009-11-16 13:33:42 +01:00
|
|
|
} eFollowPath_Flags;
|
2009-09-08 11:41:15 +02:00
|
|
|
|
2006-12-03 19:38:51 +01:00
|
|
|
/* bTrackToConstraint->flags */
|
2009-11-16 13:33:42 +01:00
|
|
|
typedef enum eTrackTo_Flags {
|
2019-03-18 04:21:37 +01:00
|
|
|
TARGET_Z_UP = (1 << 0),
|
2009-11-16 13:33:42 +01:00
|
|
|
} eTrackTo_Flags;
|
|
|
|
|
2018-09-24 17:27:41 +02:00
|
|
|
/* Stretch To Constraint -> volmode */
|
2009-11-16 13:33:42 +01:00
|
|
|
typedef enum eStretchTo_VolMode {
|
|
|
|
VOLUME_XZ = 0,
|
2012-06-15 16:11:05 +02:00
|
|
|
VOLUME_X = 1,
|
|
|
|
VOLUME_Z = 2,
|
2019-01-15 13:57:49 +01:00
|
|
|
NO_VOLUME = 3,
|
2009-11-16 13:33:42 +01:00
|
|
|
} eStretchTo_VolMode;
|
|
|
|
|
|
|
|
/* Stretch To Constraint -> plane mode */
|
|
|
|
typedef enum eStretchTo_PlaneMode {
|
|
|
|
PLANE_X = 0,
|
2019-11-06 15:11:32 +01:00
|
|
|
SWING_Y = 1,
|
2019-01-15 13:57:49 +01:00
|
|
|
PLANE_Z = 2,
|
2009-11-16 13:33:42 +01:00
|
|
|
} eStretchTo_PlaneMode;
|
2003-10-21 15:22:07 +02:00
|
|
|
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 05:35:37 +02:00
|
|
|
/* Clamp-To Constraint ->flag */
|
2009-11-16 13:33:42 +01:00
|
|
|
typedef enum eClampTo_Modes {
|
|
|
|
CLAMPTO_AUTO = 0,
|
2012-06-15 16:11:05 +02:00
|
|
|
CLAMPTO_X = 1,
|
|
|
|
CLAMPTO_Y = 2,
|
2019-01-15 13:57:49 +01:00
|
|
|
CLAMPTO_Z = 3,
|
2009-11-16 13:33:42 +01:00
|
|
|
} eClampTo_Modes;
|
2007-04-07 05:32:57 +02:00
|
|
|
|
2007-09-26 09:33:31 +02:00
|
|
|
/* ClampTo Constraint ->flag2 */
|
2009-11-16 13:33:42 +01:00
|
|
|
typedef enum eClampTo_Flags {
|
2019-03-18 04:21:37 +01:00
|
|
|
CLAMPTO_CYCLIC = (1 << 0),
|
2009-11-16 13:33:42 +01:00
|
|
|
} eClampTo_Flags;
|
2007-09-26 09:33:31 +02:00
|
|
|
|
2005-07-24 13:36:05 +02:00
|
|
|
/* bKinematicConstraint->flag */
|
2009-11-16 13:33:42 +01:00
|
|
|
typedef enum eKinematic_Flags {
|
2019-03-18 04:21:37 +01:00
|
|
|
CONSTRAINT_IK_TIP = (1 << 0),
|
|
|
|
CONSTRAINT_IK_ROT = (1 << 1),
|
2008-09-29 06:00:42 +02:00
|
|
|
/* targetless */
|
2019-03-18 04:21:37 +01:00
|
|
|
CONSTRAINT_IK_AUTO = (1 << 2),
|
2008-09-29 06:00:42 +02:00
|
|
|
/* autoik */
|
2019-03-18 04:21:37 +01:00
|
|
|
CONSTRAINT_IK_TEMP = (1 << 3),
|
|
|
|
CONSTRAINT_IK_STRETCH = (1 << 4),
|
|
|
|
CONSTRAINT_IK_POS = (1 << 5),
|
|
|
|
CONSTRAINT_IK_SETANGLE = (1 << 6),
|
|
|
|
CONSTRAINT_IK_GETANGLE = (1 << 7),
|
2009-10-14 20:51:00 +02:00
|
|
|
/* limit axis */
|
2019-03-18 04:21:37 +01:00
|
|
|
CONSTRAINT_IK_NO_POS_X = (1 << 8),
|
|
|
|
CONSTRAINT_IK_NO_POS_Y = (1 << 9),
|
|
|
|
CONSTRAINT_IK_NO_POS_Z = (1 << 10),
|
|
|
|
CONSTRAINT_IK_NO_ROT_X = (1 << 11),
|
|
|
|
CONSTRAINT_IK_NO_ROT_Y = (1 << 12),
|
|
|
|
CONSTRAINT_IK_NO_ROT_Z = (1 << 13),
|
2009-10-14 20:51:00 +02:00
|
|
|
/* axis relative to target */
|
2019-03-18 04:21:37 +01:00
|
|
|
CONSTRAINT_IK_TARGETAXIS = (1 << 14),
|
2009-11-16 13:33:42 +01:00
|
|
|
} eKinematic_Flags;
|
2009-10-14 20:51:00 +02:00
|
|
|
|
2009-11-01 12:29:40 +01:00
|
|
|
/* bSplineIKConstraint->flag */
|
2009-11-16 13:33:42 +01:00
|
|
|
typedef enum eSplineIK_Flags {
|
2009-11-01 12:29:40 +01:00
|
|
|
/* chain has been attached to spline */
|
2015-01-13 06:06:53 +01:00
|
|
|
CONSTRAINT_SPLINEIK_BOUND = (1 << 0),
|
2009-11-02 11:04:37 +01:00
|
|
|
/* root of chain is not influenced by the constraint */
|
2015-01-13 06:06:53 +01:00
|
|
|
CONSTRAINT_SPLINEIK_NO_ROOT = (1 << 1),
|
2019-12-16 23:42:12 +01:00
|
|
|
#ifdef DNA_DEPRECATED_ALLOW
|
2009-11-02 11:04:37 +01:00
|
|
|
/* bones in the chain should not scale to fit the curve */
|
2015-01-13 06:06:53 +01:00
|
|
|
CONSTRAINT_SPLINEIK_SCALE_LIMITED = (1 << 2),
|
2019-04-15 19:25:41 +02:00
|
|
|
#endif
|
2009-11-02 11:04:37 +01:00
|
|
|
/* evenly distribute the bones along the path regardless of length */
|
2015-01-13 06:06:53 +01:00
|
|
|
CONSTRAINT_SPLINEIK_EVENSPLITS = (1 << 3),
|
2009-11-23 01:03:51 +01:00
|
|
|
/* don't adjust the x and z scaling of the bones by the curve radius */
|
2015-01-13 06:06:53 +01:00
|
|
|
CONSTRAINT_SPLINEIK_NO_CURVERAD = (1 << 4),
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-01-13 06:06:53 +01:00
|
|
|
/* for "volumetric" xz scale mode, limit the minimum or maximum scale values */
|
|
|
|
CONSTRAINT_SPLINEIK_USE_BULGE_MIN = (1 << 5),
|
|
|
|
CONSTRAINT_SPLINEIK_USE_BULGE_MAX = (1 << 6),
|
2019-05-07 18:52:10 +02:00
|
|
|
|
|
|
|
/* apply volume preservation over original scaling of the bone */
|
|
|
|
CONSTRAINT_SPLINEIK_USE_ORIGINAL_SCALE = (1 << 7),
|
2009-11-16 13:33:42 +01:00
|
|
|
} eSplineIK_Flags;
|
2009-11-05 11:09:45 +01:00
|
|
|
|
|
|
|
/* bSplineIKConstraint->xzScaleMode */
|
2009-11-16 13:33:42 +01:00
|
|
|
typedef enum eSplineIK_XZScaleModes {
|
2009-11-05 11:09:45 +01:00
|
|
|
/* no x/z scaling */
|
2009-11-16 13:33:42 +01:00
|
|
|
CONSTRAINT_SPLINEIK_XZS_NONE = 0,
|
2009-11-05 11:09:45 +01:00
|
|
|
/* bones in the chain should take their x/z scales from the original scaling */
|
2012-06-15 16:11:05 +02:00
|
|
|
CONSTRAINT_SPLINEIK_XZS_ORIGINAL = 1,
|
2009-11-23 01:03:51 +01:00
|
|
|
/* x/z scales are the inverse of the y-scale */
|
2015-01-13 06:06:53 +01:00
|
|
|
CONSTRAINT_SPLINEIK_XZS_INVERSE = 2,
|
|
|
|
/* x/z scales are computed using a volume preserving technique (from Stretch To constraint) */
|
2019-01-15 13:57:49 +01:00
|
|
|
CONSTRAINT_SPLINEIK_XZS_VOLUMETRIC = 3,
|
2009-11-16 13:33:42 +01:00
|
|
|
} eSplineIK_XZScaleModes;
|
2005-07-24 13:36:05 +02:00
|
|
|
|
2019-04-15 19:25:41 +02:00
|
|
|
/* bSplineIKConstraint->yScaleMode */
|
|
|
|
typedef enum eSplineIK_YScaleModes {
|
|
|
|
/* no y scaling */
|
|
|
|
CONSTRAINT_SPLINEIK_YS_NONE = 0,
|
|
|
|
/* bones in the chain should be scaled to fit the length of the curve */
|
|
|
|
CONSTRAINT_SPLINEIK_YS_FIT_CURVE = 1,
|
|
|
|
/* bones in the chain should take their y scales from the original scaling */
|
|
|
|
CONSTRAINT_SPLINEIK_YS_ORIGINAL = 2,
|
|
|
|
} eSplineIK_YScaleModes;
|
|
|
|
|
2018-07-15 19:39:02 +02:00
|
|
|
/* bArmatureConstraint -> flag */
|
|
|
|
typedef enum eArmature_Flags {
|
2019-01-15 13:14:35 +01:00
|
|
|
/** use dual quaternion blending */
|
2019-03-18 04:21:37 +01:00
|
|
|
CONSTRAINT_ARMATURE_QUATERNION = (1 << 0),
|
2019-01-15 13:14:35 +01:00
|
|
|
/** use envelopes */
|
2019-03-18 04:21:37 +01:00
|
|
|
CONSTRAINT_ARMATURE_ENVELOPE = (1 << 1),
|
2019-01-15 13:14:35 +01:00
|
|
|
/** use current bone location */
|
2019-03-18 04:21:37 +01:00
|
|
|
CONSTRAINT_ARMATURE_CUR_LOCATION = (1 << 2),
|
2018-07-15 19:39:02 +02:00
|
|
|
} eArmature_Flags;
|
|
|
|
|
2006-09-22 17:57:58 +02:00
|
|
|
/* MinMax (floor) flags */
|
2009-11-16 13:33:42 +01:00
|
|
|
typedef enum eFloor_Flags {
|
2019-06-28 14:59:50 +02:00
|
|
|
/* MINMAX_STICKY = (1 << 0), */ /* Deprecated. */
|
|
|
|
/* MINMAX_STUCK = (1 << 1), */ /* Deprecated. */
|
2019-03-18 04:21:37 +01:00
|
|
|
MINMAX_USEROT = (1 << 2),
|
2009-11-16 13:33:42 +01:00
|
|
|
} eFloor_Flags;
|
|
|
|
|
|
|
|
/* transform limiting constraints -> flag2 */
|
|
|
|
typedef enum eTransformLimits_Flags2 {
|
2007-12-05 12:19:36 +01:00
|
|
|
/* not used anymore - for older Limit Location constraints only */
|
2020-02-20 00:21:23 +01:00
|
|
|
/* LIMIT_NOPARENT = (1 << 0), */ /* UNUSED */
|
2007-12-05 12:19:36 +01:00
|
|
|
/* for all Limit constraints - allow to be used during transform? */
|
2019-03-18 04:21:37 +01:00
|
|
|
LIMIT_TRANSFORM = (1 << 1),
|
2009-11-16 13:33:42 +01:00
|
|
|
} eTransformLimits_Flags2;
|
|
|
|
|
2024-03-07 22:20:36 +01:00
|
|
|
/* transform limiting constraints -> flag. */
|
2009-11-16 13:33:42 +01:00
|
|
|
typedef enum eTransformLimits_Flags {
|
2019-03-18 04:21:37 +01:00
|
|
|
LIMIT_XMIN = (1 << 0),
|
|
|
|
LIMIT_XMAX = (1 << 1),
|
|
|
|
LIMIT_YMIN = (1 << 2),
|
|
|
|
LIMIT_YMAX = (1 << 3),
|
|
|
|
LIMIT_ZMIN = (1 << 4),
|
|
|
|
LIMIT_ZMAX = (1 << 5),
|
2009-11-16 13:33:42 +01:00
|
|
|
} eTransformLimits_Flags;
|
|
|
|
|
2024-03-07 22:20:36 +01:00
|
|
|
/* limit rotation constraint -> flag. */
|
2009-11-16 13:33:42 +01:00
|
|
|
typedef enum eRotLimit_Flags {
|
2019-03-18 04:21:37 +01:00
|
|
|
LIMIT_XROT = (1 << 0),
|
|
|
|
LIMIT_YROT = (1 << 1),
|
|
|
|
LIMIT_ZROT = (1 << 2),
|
2009-11-16 13:33:42 +01:00
|
|
|
} eRotLimit_Flags;
|
2008-01-25 12:23:36 +01:00
|
|
|
|
|
|
|
/* distance limit constraint */
|
|
|
|
/* bDistLimitConstraint->flag */
|
2009-11-16 13:33:42 +01:00
|
|
|
typedef enum eDistLimit_Flag {
|
2021-07-20 07:01:05 +02:00
|
|
|
/* "soft" cushion effect when reaching the limit sphere */ /* NOT IMPLEMENTED! */
|
2019-03-18 04:21:37 +01:00
|
|
|
LIMITDIST_USESOFT = (1 << 0),
|
2011-05-24 14:12:12 +02:00
|
|
|
/* as for all Limit constraints - allow to be used during transform? */
|
2019-03-18 04:21:37 +01:00
|
|
|
LIMITDIST_TRANSFORM = (1 << 1),
|
2009-11-16 13:33:42 +01:00
|
|
|
} eDistLimit_Flag;
|
2008-01-25 12:23:36 +01:00
|
|
|
|
|
|
|
/* bDistLimitConstraint->mode */
|
2009-11-16 13:33:42 +01:00
|
|
|
typedef enum eDistLimit_Modes {
|
2012-06-15 16:11:05 +02:00
|
|
|
LIMITDIST_INSIDE = 0,
|
|
|
|
LIMITDIST_OUTSIDE = 1,
|
2019-01-15 13:57:49 +01:00
|
|
|
LIMITDIST_ONSURFACE = 2,
|
2009-11-16 13:33:42 +01:00
|
|
|
} eDistLimit_Modes;
|
2018-06-17 17:04:09 +02:00
|
|
|
|
2007-06-18 09:41:21 +02:00
|
|
|
/* python constraint -> flag */
|
2009-11-16 13:33:42 +01:00
|
|
|
typedef enum ePyConstraint_Flags {
|
2019-03-18 04:21:37 +01:00
|
|
|
PYCON_USETARGETS = (1 << 0),
|
|
|
|
PYCON_SCRIPTERROR = (1 << 1),
|
2009-11-16 13:33:42 +01:00
|
|
|
} ePyConstraint_Flags;
|
2007-06-18 09:41:21 +02:00
|
|
|
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 05:35:37 +02:00
|
|
|
/* ChildOf Constraint -> flag */
|
2009-11-16 13:33:42 +01:00
|
|
|
typedef enum eChildOf_Flags {
|
2019-03-18 04:21:37 +01:00
|
|
|
CHILDOF_LOCX = (1 << 0),
|
|
|
|
CHILDOF_LOCY = (1 << 1),
|
|
|
|
CHILDOF_LOCZ = (1 << 2),
|
|
|
|
CHILDOF_ROTX = (1 << 3),
|
|
|
|
CHILDOF_ROTY = (1 << 4),
|
|
|
|
CHILDOF_ROTZ = (1 << 5),
|
|
|
|
CHILDOF_SIZEX = (1 << 6),
|
|
|
|
CHILDOF_SIZEY = (1 << 7),
|
|
|
|
CHILDOF_SIZEZ = (1 << 8),
|
2019-01-15 13:57:49 +01:00
|
|
|
CHILDOF_ALL = 511,
|
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:24:11 +01:00
|
|
|
/* Temporary flag used by the Set Inverse operator. */
|
|
|
|
CHILDOF_SET_INVERSE = (1 << 9),
|
2009-11-16 13:33:42 +01:00
|
|
|
} eChildOf_Flags;
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 05:35:37 +02:00
|
|
|
|
2023-07-31 02:15:30 +02:00
|
|
|
/**
|
|
|
|
* Pivot Constraint
|
2023-07-05 05:58:04 +02:00
|
|
|
*
|
|
|
|
* Restrictions for Pivot Constraint axis to consider for enabling constraint.
|
|
|
|
*/
|
== 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.
2010-05-27 12:50:06 +02:00
|
|
|
typedef enum ePivotConstraint_Axis {
|
2023-07-05 05:58:04 +02:00
|
|
|
/** Do not consider this activity-clamping. */
|
2012-10-21 07:46:41 +02:00
|
|
|
PIVOTCON_AXIS_NONE = -1,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-07-05 05:58:04 +02:00
|
|
|
/** Consider -VE X-axis rotations. */
|
2012-06-15 16:11:05 +02:00
|
|
|
PIVOTCON_AXIS_X_NEG = 0,
|
2023-07-05 05:58:04 +02:00
|
|
|
/** Consider -VE Y-axis rotations. */
|
2012-06-15 16:11:05 +02:00
|
|
|
PIVOTCON_AXIS_Y_NEG = 1,
|
2023-07-05 05:58:04 +02:00
|
|
|
/** Consider -VE Z-axis rotations. */
|
2012-06-15 16:11:05 +02:00
|
|
|
PIVOTCON_AXIS_Z_NEG = 2,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-07-05 05:58:04 +02:00
|
|
|
/** Consider +VE X-axis rotations. */
|
2012-06-15 16:11:05 +02:00
|
|
|
PIVOTCON_AXIS_X = 3,
|
2023-07-05 05:58:04 +02:00
|
|
|
/** Consider +VE Y-axis rotations. */
|
2012-06-15 16:11:05 +02:00
|
|
|
PIVOTCON_AXIS_Y = 4,
|
2023-07-05 05:58:04 +02:00
|
|
|
/** Consider +VE Z-axis rotations. */
|
2019-01-15 13:57:49 +01:00
|
|
|
PIVOTCON_AXIS_Z = 5,
|
== 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.
2010-05-27 12:50:06 +02:00
|
|
|
} ePivotConstraint_Axis;
|
|
|
|
|
|
|
|
/* settings for Pivot Constraint in general */
|
|
|
|
typedef enum ePivotConstraint_Flag {
|
|
|
|
/* offset is to be interpreted as being a fixed-point in space */
|
2019-03-18 04:21:37 +01:00
|
|
|
PIVOTCON_FLAG_OFFSET_ABS = (1 << 0),
|
== 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.
2010-05-27 12:50:06 +02:00
|
|
|
/* rotation-based activation uses negative rotation to drive result */
|
2019-03-18 04:21:37 +01:00
|
|
|
PIVOTCON_FLAG_ROTACT_NEG = (1 << 1),
|
== 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.
2010-05-27 12:50:06 +02:00
|
|
|
} ePivotConstraint_Flag;
|
|
|
|
|
2011-11-07 13:55:18 +01:00
|
|
|
typedef enum eFollowTrack_Flags {
|
2019-03-18 04:21:37 +01:00
|
|
|
FOLLOWTRACK_ACTIVECLIP = (1 << 0),
|
|
|
|
FOLLOWTRACK_USE_3D_POSITION = (1 << 1),
|
|
|
|
FOLLOWTRACK_USE_UNDISTORTION = (1 << 2),
|
2011-11-07 13:55:18 +01:00
|
|
|
} eFollowTrack_Flags;
|
|
|
|
|
2012-08-09 18:57:02 +02:00
|
|
|
typedef enum eFollowTrack_FrameMethod {
|
|
|
|
FOLLOWTRACK_FRAME_STRETCH = 0,
|
|
|
|
FOLLOWTRACK_FRAME_FIT = 1,
|
2019-01-15 13:57:49 +01:00
|
|
|
FOLLOWTRACK_FRAME_CROP = 2,
|
2012-08-09 18:57:02 +02:00
|
|
|
} eFollowTrack_FrameMethod;
|
|
|
|
|
2011-11-07 13:55:18 +01:00
|
|
|
/* CameraSolver Constraint -> flag */
|
|
|
|
typedef enum eCameraSolver_Flags {
|
2019-03-18 04:21:37 +01:00
|
|
|
CAMERASOLVER_ACTIVECLIP = (1 << 0),
|
2011-11-07 13:55:18 +01:00
|
|
|
} eCameraSolver_Flags;
|
|
|
|
|
2011-12-05 19:57:17 +01:00
|
|
|
/* ObjectSolver Constraint -> flag */
|
|
|
|
typedef enum eObjectSolver_Flags {
|
2019-03-18 04:21:37 +01:00
|
|
|
OBJECTSOLVER_ACTIVECLIP = (1 << 0),
|
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:24:11 +01:00
|
|
|
/* Temporary flag used by the Set Inverse operator. */
|
|
|
|
OBJECTSOLVER_SET_INVERSE = (1 << 1),
|
2011-12-05 19:57:17 +01:00
|
|
|
} eObjectSolver_Flags;
|
|
|
|
|
2014-10-13 19:51:46 +02:00
|
|
|
/* ObjectSolver Constraint -> flag */
|
|
|
|
typedef enum eStretchTo_Flags {
|
|
|
|
STRETCHTOCON_USE_BULGE_MIN = (1 << 0),
|
|
|
|
STRETCHTOCON_USE_BULGE_MAX = (1 << 1),
|
|
|
|
} eStretchTo_Flags;
|