Commit Graph

136 Commits

Author SHA1 Message Date
Sergey Sharybin f474576351 Camera tracking: interface cleanup and small buttons renaming
- Move tracking-related constraints to own section in list
  Currently there are only two constraints, so can look a bit odd,
  but it'll be other constraints like "Object Solver" and so.
- Move motion-tracking parameters from 3D viewport Display panel
  to it's own panel.
- Get rid of "Bundle" in 3d viewport. It's quite obvious that it's
  a 3D representation of tracks is used in 3D viewport and it shouldn't
  be so confusing for artists now.
- Also get rid of "Bundle" in Follow Track constraint.
  Old files can change a bit because of changes in DNA.
- Also get rid of "Bundles" in operator which creates vertices cloud
  from 3D position of tracks.
- Rename "Principal Point" to "Optical Center" in the interface.
2011-11-14 06:41:42 +00:00
Sergey Sharybin 27d42c63d9 Camera tracking integration
===========================

Commiting camera tracking integration gsoc project into trunk.

This commit includes:

- Bundled version of libmv library (with some changes against official repo,
  re-sync with libmv repo a bit later)
- New datatype ID called MovieClip which is optimized to work with movie
  clips (both of movie files and image sequences) and doing camera/motion
  tracking operations.
- New editor called Clip Editor which is currently used for motion/tracking
  stuff only, but which can be easily extended to work with masks too.

  This editor supports:
  * Loading movie files/image sequences
  * Build proxies with different size for loaded movie clip, also supports
    building undistorted proxies to increase speed of playback in
    undistorted mode.
  * Manual lens distortion mode calibration using grid and grease pencil
  * Supervised 2D tracking using two different algorithms KLT and SAD.
  * Basic algorithm for feature detection
  * Camera motion solving. scene orientation

- New constraints to "link" scene objects with solved motions from clip:

  * Follow Track (make object follow 2D motion of track with given name
    or parent object to reconstructed 3D position of track)
  * Camera Solver to make camera moving in the same way as reconstructed camera

This commit NOT includes changes from tomato branch:

- New nodes (they'll be commited as separated patch)
- Automatic image offset guessing for image input node and image editor
  (need to do more tests and gather more feedback)
- Code cleanup in libmv-capi. It's not so critical cleanup, just increasing
  readability and understanadability of code. Better to make this chaneg when
  Keir will finish his current patch.

More details about this project can be found on this page:
    http://wiki.blender.org/index.php/User:Nazg-gul/GSoC-2011

Further development of small features would be done in trunk, bigger/experimental
features would first be implemented in tomato branch.
2011-11-07 12:55:18 +00:00
Campbell Barton 7f4bb1f71b spelling corrections in comments and quiet warning 2011-10-15 14:14:22 +00:00
Campbell Barton 274b9c8fb8 whitespace cleanup 2011-09-25 12:31:21 +00:00
Joshua Leung db72192c22 Bye bye vile relics of extinct version control systems,
Causing a flurry of refresh file prompts post-commit,
Confusing local diffs and causing merge conflicts,
Stating the obvious; redundant and useless...

We shall not miss thou, blasted expand $keywords$
2011-08-12 07:20:49 +00:00
Joshua Leung 1788bc298c = Limit Distance Constraint - 'For Transform' Option =
The Limit Distance Constraint now has a "For Transform" option just
like all the other Limit constraints. This option controls whether the
constraint gets applied to interactive transforms in the 3D View too,
preventing controllers from getting large values without the animator
knowing.


Additional code changes:
* Split code to get constraint targets and grab their matrices for
solving out to a separate helper function:
get_constraint_targets_for_solving()
* Fixed a bug where "found constraint ...." prints would appear in the
console. Looks like some warning print that was forgotten

TODO:
* While coding this, I noticed potential division by zero bugs with
the Limit Distance constraint. Looking into these after this commit.
2011-05-24 12:12:12 +00:00
Nathan Letwory 22dbae84e5 DNA header files are now grouped under the same module. No further documentation done. 2011-02-17 20:48:12 +00:00
Ton Roosendaal 216f9af08e Two in one:
- Bugfix #25937
  Child-of constraint now behaves like regular parent-child
  relationship when all options are set. This prevents the 
  errors that can happen when decomposing non-uniform matrices.

- Todo item
  The area corner hotspots for splitting/merging were far too
  narrow. Now it uses a circular distance to detect whether
  the hotspot is active. Also cleaned up drawing code for it.
2011-02-06 17:36:42 +00:00
Ton Roosendaal 118667c1bf Small feature for debugging pleasure:
The svn revision nr is saved in Blender file header now.
Can only be retrieved with running blender -d now.
2011-01-02 13:33:32 +00:00
Campbell Barton b45c3363fd fix for some pedantic warnings. 2010-12-03 01:52:28 +00:00
Campbell Barton 708ef64663 include cleanup, no functional changes
- removed DNA_brush_types.h from DNA_scene_types.h (and some other similar cases)
- removed DNA_wave_types.h (never used)
- removed Main.wave
2010-08-04 04:01:27 +00:00
Joshua Leung 5d6bdd7c2e Various constraint code cleanups:
1) Fixed some weird formatting introduced during math-lib cleanups, and some other inconsistencies
2) Optimised the Maintain Volume constraint by taking the value calculations out

Copy All Constraints Operators:
* Added one for bones too
* These are now included in the menus
* Removed some weird/extra code copying/changing/bleh the actcol/totcol stuff...
2010-05-27 11:56:31 +00:00
Joshua Leung 4ebc634168 == 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 10:50:06 +00:00
Campbell Barton 1e9bf0cfdb spaces -> tabs, (4 spaces == 1 tab, only for white space preceding text) 2010-03-22 09:30:00 +00:00
Roland Hess d617294c49 New "Maintain Volume" constraint. When attached to a bone, you specify a "free" axis. Upon scaling, this free axis scales normally, but the constraint forces the other two axes to adjust themselves appropriately so that overall bone volume is maintained. So, setting "Y" as the free axis (the default) creates a bone that automatically squashes and stretches when scaling. Thanks to Aligorith, Fweeb, Cessen and others for the feedback. 2010-03-16 12:55:56 +00:00
Campbell Barton 081c1205a3 correct fsf address 2010-02-12 13:34:04 +00:00
Joshua Leung 53596fc6b8 Bugfix #20940: Offset always resets to 1 in follow path constraint
Made the 'Offset Factor' setting use a separate variable from the 'Offset' setting in the DNA stuff. While we could get away with this sort of thing in the past, it turns out that with the Datablocks viewer these days, settings sharing an internal var but with different ranges/behaviour doesn't work well anymore, since later instances override earlier ones.
2010-02-03 09:05:31 +00:00
Joshua Leung a7d268d38e Cessen Rigging Request: "Copy Transforms" Constraint
This constraint simply copies the transformation matrix of the target, and assigns it to the owner.
2010-01-02 04:14:17 +00:00
Joshua Leung 6555eca6fe 2009-11-23 00:03:51 +00:00
Joshua Leung a12c2a8561 Constraints: Code cleanup
* Removing duplicate api functions
* Shuffled around newly added api functions to make the ordering more consistent
* Fixes for a few bugs in the api functions as I checked over them
* Replaced most of the #defines for flags and modes with enums
2009-11-16 12:33:42 +00:00
Brecht Van Lommel 37e4a311b0 Math Lib
* Convert all code to use new functions.
* Branch maintainers may want to skip this commit, and run this
  conversion script instead, if they use a lot of math functions
  in new code:
  http://www.pasteall.org/9052/python
2009-11-10 20:43:45 +00:00
Joshua Leung 06d5d53a24 Bugfixes + Spline IK Tweaks:
* #19819: 'Select' operator for Hooks was crashing when Hooks didn't have any vertices assigned yet

* Default twist resolution mode for curves is now 'Minimise'. This seems to work better for Curve Deforms and other purposes. Can be changed if other ways are better after some more testing.

* Spline IK now has more options for controlling how the x and z axis scaling is determined. There is now a choice between using the radius of the curve, the x+z scaling from the bones, or no scaling (default). This does break old files a bit, but this is to have a more stable base for later.
2009-11-05 10:09:45 +00:00
Joshua Leung 334a80a4f8 Spline IK Experimental Features:
1) "Even Divisions" - This option ignores the length of bones when considering how they should fit along the curve. This is useful for getting a smoother curve fit without having to worry about getting the bone lengths spot on. By default, this is disabled.

2) "Keep Max Length" - This option prevents the bone chain from extending past its natural length when the spline is stretched beyond that length. When the spline length is substatially shorter though, this bones get scaled to zero; making this option possibly useful for doing "growing tips". 
This is essentially a 'no scale' option, although the behaviour when the curve is shorter is really a compromise since the curve cannot be accurately satisfied + left intact without some scaling being applied due to the way this works.

3) "Radius to Thickness" - The average radius of the spline between at the head+tail of each bone determines the x+z scaling of the bone.
2009-11-02 10:04:37 +00:00
Joshua Leung 2068eaf1b7 Rigging Goodies: Spline IK Constraint
At last, this commit introduces the Spline IK Constraint to Blender. Spline IK is a constraint that makes n bones follow the shape of a specified curve. 

Simply add a chain of bones, add a curve, add a Spline IK Constraint to the tip bone and set the number of bones in the chain to make it work. Or, try the following test file:
http://download.blender.org/ftp/incoming/250_splineik_spine01.blend

Screenshots of this in action (as proof):
http://download.blender.org/ftp/incoming/b250_splineik_001_before.png
http://download.blender.org/ftp/incoming/b250_splineik_001_after.png

I've implemented this in a similar way to how standard IK solvers are done. However, this code is currently not an IK plugin, since I imagine that it would be useful to be able to combine the 2 types of IK. This can be easily changed though :)

Finally, a few notes on what to expect still:
* Constraint blending currently doesn't affect this. Getting that to work correctly will take a bit more work still.
* Options for not affecting the root joint (to make it easier to attach the chain to a stump or whatever), and non-uniform scaling options have yet to be added. I've marked the places where they can be added though
* Control over the twisting of the chain still needs investigation. 

Have fun!
2009-11-01 11:29:40 +00:00
Joshua Leung ae3cf92491 New Track To Constraint: "Damped"
This is effectively a C-port of Nathan Vegdahl's "No Twist" TrackTo PyConstraint, and has been added as a separate type of constraint to be consistent with the existing constraints (Locked Track, and Track To). 

In general, this works considerably better than the existing "Track To" constraint, since it works by determining the smallest rotation necessary to get the current orientation of the owner to an orientation which would be tracking the target. It is also a much more straightforward approach than the weird old method the old Track To uses.

I've made a few tweaks to the code to deal with the (hopefully rare) cases where the target and the constrained are coincident. These don't appear to cause too much trouble in general.

TODO:
- Probably the naming of the constraints will change, to better convey their purposes. Naming suggestions welcome.
2009-10-30 06:33:40 +00:00
Benoit Bolsee 96d2dc7d09 iTaSC: Selection of constrained axis for CopyPose constraint
This commit implements more of the CopyPose capabilities in
Blender. It is now possible to select which axis will be
constrained in position and orientation to obtain
interesting effects. Another option selects if the axis
are relative to the end effector or to the target.

Unlocking a position axis means that the coordinate along
this axis is not constrained and can take any value.
Unlocking the Y axis of the End Effector produces an
'aiming' effect: the end effector is oriented towards
the target but without stretching.

Unlocking a rotation axis means that the end effector can
freely rotation along that axis. Unlocking the Y axis
produces a 'tangent' effect: the end effector aligns with
the Y axis of the target but can rotate along that axis.

A 'floor' effect is possible if the position Z axis of the
target is unlocked. More effects are possible an can be
combined.
2009-10-14 18:51:00 +00:00
Benoit Bolsee 1483fafd13 Merge of itasc branch. Project files, scons and cmake should be working. Makefile updated but not tested. Comes with Eigen2 2.0.6 C++ matrix library. 2009-09-24 21:22:24 +00:00
Campbell Barton f130f16fef Use curve radius for paths
- use_radius option, off by default for 2.4x files, on by default on new curves.
- curve deform modifiers (think tentacles)
- follow path (parent mode and constraint)
- curve guides
- added back Alt+S to scale point radius
- Mat3Scale and Mat4Scale arithb.c functions to make a new uniform scale matrix.

- TODO, effectors, looks like they have no way to scale from the radius yet.
2009-09-12 16:25:49 +00:00
Joshua Leung 5ce8b1f704 2.5 - FollowPath Constraint + File Loading Bugfix
* Added a new option ('Fixed Position') for Follow Path constraint which allows you to constrain an object/bone to some fixed position along the curve. Unlike the default mode of operation, this doesn't depend on time unless you explicitly animate the offset percentage parameter associated with this.

* Made old (pre 2.5) files saved with armatures in pose mode load in pose mode again.
2009-09-08 09:41:15 +00:00
Joshua Leung 01b4caa701 2.5 - Rotation order is now taken into account for constraints
* Added a 'rotOrder' parameter for constraint evaluation objects and constraint targets, which describes the rotation mode used for the matrices there. 

Todos:
* Constraint targets default to using XYZ only for now. This will need be be addressed eventually.
* Copy Rotation constraint currently cannot use the new rotation order code for the target matrix. What's surprising is that even though it's just using XYZ as the old code did, it doesn't work, and yet everything else works nicely. Silly constraint! (it is almost impossible to improve this constraint further without breaking a rig out there)
2009-09-02 10:45:11 +00:00
Brecht Van Lommel 874c29cea8 2.50: svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r19323:HEAD
Notes:
* blenderbuttons and ICON_SNAP_PEEL_OBJECT were not merged.
2009-04-20 15:06:46 +00:00
Erwin Coumans 0749bf7be7 Fix bug in rigid body constraint buttons drawing, and while we are at it, add 'Collision' button to disable collisions between bodies, linked between constraint. 2008-10-10 05:12:57 +00:00
Joshua Leung 32b733dafb Patch #17500: fixes: multiple IK's on bone + targetless IK
Submitted by: Teppo Kansala (teppoka)

See patch report for details of fixes.
https://projects.blender.org/tracker/index.php?func=detail&aid=17500&group_id=9&atid=127

Note: the patch submitter's test files were quite nice, and would be good to have in our regression suite.
2008-09-29 04:00:42 +00:00
Joshua Leung b2be0a181f Bugfix #17334:
This bug-report revealed a critical error made in the menus for Constraints Owner/Target spaces. It seems that the wrong values have been used for 'pose space' and 'local with parent' space. This has now been rectified, so that old rigs won't break (just that the labels will be a bit different).
2008-07-27 11:41:39 +00:00
Chris Want 5d0a207ecb Patch from GSR that a) fixes a whole bunch of GPL/BL license
blocks that were previously missed; and b) greatly increase my
ohloh stats!
2008-04-16 22:40:48 +00:00
Joshua Leung 264c8d94f9 == Limit Distance Constraint ==
Added a new constraint, "Limit Distance". This constraint defines a 'virtual sphere' around the target which the owner can be made to stay inside, outside, or on the surface of it. 

This constraint is best used when applied using the Ctrl-Alt-C hotkey, as the radius is set correctly that way. 
One usage, is to prevent the target of an IK-chain from straying away from the chain. Care should be taken to not use a member of the IK-chain as the target though.

Description of Variables:
* 'Dist' - Radius of virtual sphere
* 'R' - Click on this to recalculate the 'Dist' value (note: like the 'R' button in the StretchTo constraint, this is currently buggy)
' Mode' - This menu gives different options for how the limiting sphere should act. The mode names are self explanatory.
* 'Soft' and 'SoftDistance' - currently not functional (so settings are hidden). These are used to define a smaller radius around the sphere of influence where a non-linear relationship between input and resulting locations occurs to prevent the owner 'crashing' into the sphere.
2008-01-25 11:23:36 +00:00
Joshua Leung 5e58f5d463 == Local Constraints for Proxies (Peach Request) ==
Proxy protected bones can now get local (per-file) constraints added to them, which will be preserved after a file load. This is necessary for adding constraints to proxy-protected bones for special purposes while animating (i.e.  adding CopyLocs to IK-hand controls to pick up an object). 

These must be added after any constraints from the proxy, as proxy constraints may come and go without warning. As such, the UI forbids this from happening by removing the relevant button.

I've also made UI-changes to show which constraints come from the proxy (the buttons to move the constraint up/down and delete it, are replace with two icons - a the proxy 'ghost' icon and a lock). Also, trying to change any settings of proxy-protected constraint will show an error.


Notes:
* Object constraints are still not playing nice with proxies yet. They didn't before this commit either...
2008-01-04 11:21:50 +00:00
Joshua Leung faf638238d == Auto-IK ==
-- Peach request (from wiki feature request list) --

When translating a bone using Auto-IK, you can now use the ScrollWheel on the Mouse or the Page Up/Down keys to adjust the chain length. 

Notes:
* Up decreases the length, while Down increases it.
* The previously used chain-length is stored per scene
* Currently, it might be too sensitive. Also, it would help to have some kind of indication of the current chain-length somewhere...
* The chain length specified this way determines the MAXIMUM chain length possible for all chains (if 0, then the default chain-length is used). Chains are clamped to have a chain length which does not exceed the default chain length. This restriction may be removed following further feedback...
2007-12-15 07:35:16 +00:00
Joshua Leung 5c13e82140 Two transform tweaks:
* [Peach Request] AutoIK now respects axis locking (rotation locks).
- Temporary DOF-Locks are turned on for those bones that are part of an AutoIK chain while transforming. These locks get cleared after transforming.
- This works for all bones except the root bone of the chain, which doesn't seem to be able to be locked.

* Limit Location constraint can now optionally affect Translations too (i.e. NKEY panel values won't change). 
- LimitRot,LimitScale support (for their respective transforms) will be done at a later date
- This only works if the constraint is using World/Local space (the other spaces are not supported yet).
- I've added a temporary button in the LimitLoc panel to enable this option (it is disabled by default). This button will be properly assigned a place in that panel sometime.
2007-12-05 11:19:36 +00:00
Ton Roosendaal 36f7da7046 Tiny feature, but loadsa code, and big impact for the Blender riggers:
-> Constraint Influence Ipo now can be local, linked to constraint itself

You enable this in the IpoWindow header, with the Action icon to the left
of the Ipo Type menu. The button tooltips give the clue as well.

Tech note: the Ipo now can get directly linked to a constraint, and is
being called during regular pose constraint solving.
Actions (and drivers in actions) are being calculated *before* pose 
constraint solving. Result of actions then is written in bones, which
then solves the entire pose.
This means you can have a driver on both the constraint, as on the action
channel for the constraint! Not that I'm going to debug that easily :)

Additional fix: Joshua added a copy/paste IpoCurve feature, but he broke
the functionality to be able to paste in an empty ipo channel. That now
works again
2007-11-28 12:11:06 +00:00
Joshua Leung 89317afbdf 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 04:17:03 +00:00
Brecht Van Lommel 30be716fc8 Pole Target for IK
==================

This adds an extra target to the IK solver constraint to define the
roll of the IK chain.

http://www.blender.org/development/current-projects/changes-since-244/inverse-kinematics/

Also fixes a crashes using ctrl+I to set an IK constraint on a bone
due to the recent constraints refactor.
2007-10-24 14:58:31 +00:00
Joshua Leung 6422a740c2 == 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-21 23:00:29 +00:00
Joshua Leung 7cf9c31272 == Clamp To Constraint ==
Now there's an option for the owner to follow the path of the target cyclically. Previously, if the owner moved past the extents of the side of the bounding-box used for the calculations, the object was placed on the curve at the nearest extent. 

This option is only really useful if the curve itself is cyclic, although you can still use it otherwise. To enable, just turn on the cyclic option.
2007-09-26 07:33:31 +00:00
Joshua Leung 74ca178199 == Transformation Constraint ==
This commit adds a new constraint to Blender: the Transformation Constraint. This constraint gives you more freedom to choose how transforms are copied from one object/bone to another object/bone. 

You can assign the Loc/Rot/Scale channels of a source to the Loc/Rot/Scale channels of a destination, specifying the range of motion (per axis) from the source to consider, and the range of motion (per axis) that will be applied to the destination. Also, for each destination axis, you can choose which of the source axes to copy from. 

A similar constraint was coded by Jason Blary (snark), as Patch #4991. This constraint is basically rewritten from scratch, although there are some elements of the original patch which may be borrowed in future.

Various notes:
* PyAPI access has been coded. 
* Space conversion is also enabled for this constraint.
* Also the useless get_constraint_col function has been removed
* Doing a rotation copy with a ratio that is not 1:1 doesn't always work correctly yet (like for the Copy Rotation constraint).
2007-07-21 07:26:15 +00:00
Erwin Coumans 3792ae1560 bugfixes for generic (experimental) Bullet rigidbody constraint: use cone-twist instead (needs a few more minor fixes)
Note: Visual Studio projectfiles and other buildsystems need to add extern/bullet2/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp to the project!
2007-07-16 05:56:51 +00:00
Joshua Leung af55d208f4 == 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 03:35:37 +00:00
Joshua Leung 01e8789f3f == PyConstraints ==
At last! The ability to code constraints in Python. This opens up many interesting rigging possibilities, as well as making prototyping constraints easier.

* A PyConstraint script must begin with the line 
#BPYCONSTRAINT
* It must also define a doConstraint function, which performs the core actions of the constraint.
* PyConstraints use IDProperties to store custom properties for each PyConstraint instance. The scripter can choose which of these ID-Properties to expose to a user to control the behaviour of the constraint. This must be done using the Draw.PupBlock method.

Credits to Joe Eager (joeedh) for coding the original patch on which this is based. I've made heavy revisions to large parts of the patch.

For more detailed information, and some demo scripts, see the following page:
http://aligorith.googlepages.com/pyconstraints2
2007-06-18 07:41:21 +00:00
Joshua Leung b1c8a1eefb == Clamp To Constraint ==
* PyApi access to this constraint
* Also, a minor tweak to one of the comments about one of this constraint's variables.
2007-04-07 04:21:12 +00:00
Joshua Leung 655f9a61de == Clamp-To Constraint (was Patch #4818) ==
This (new) constraint limits the location of an object/bone to the range of locations
on a given curve. It works by comparing the location of the owner on one axis, to
the extents of the curve's bounding-box on the same axis, to find the location on
the curve.

Usage Notes:
* 'Ob:' field must point to a valid curve object
* This curve should have 'Path' turned on in order for this constraint to work. You
don't really need to do this as it will be taken care of by the code.
* 'Auto' toggle automically determines which axis should be used for the distance estimations/calculations. It is the default option, but may not work that well for
some cases.
* X/Y/Z toggles can be used to select the axis to use for these calculations. Try
to choose the axis along which the curve stretches out for most.

Python Notes:
Python API access for this constraint is not included in this commit. Will be coming
soon.
2007-04-07 03:32:57 +00:00
Martin Poirier f42bc12285 === BPY ===
Adding Python counterparts to the Invert params for Copy Rot and Copy Loc.

I had to align the constants being used, so if you had files using those options (introduced after 2.43), you'll have to modify the INVERT settings for ROTLIKE constraints (didn't feel like making a minor version bump for this, if people thing otherwise, please say so).

Based on a patch by Juho Vepsäläinen (bebraw)
2007-04-06 19:42:46 +00:00
Joshua Leung 269e943d58 == Copy Location Constraint ==
I've added two new options for this constraint:
* Copy Bone Tip Location
* Apply owner's location on top of copied location ('Offset')
2007-03-24 03:00:54 +00:00
Martin Poirier 31f79cf5b4 === Constraints ===
Patch by Juho Vepsäläinen (bebraw)
[ #5850 ] Inverted axis' buttons to Copy Rotation and Copy Location constraints

This patch adds the options to invert the value being copied from each axis of the Copy Rot/Copy Loc constraints.


This commit also includes some slight code sanitization and tool tips cleanup (for the two track constraints, the tool tips were really unuseful).
2007-03-18 14:53:17 +00:00
Erwin Coumans 92379ec21f contribution from RCRuiz:
drawing of rigidbody constraint pivots, and allow passing of full constraint frame.
2006-12-16 05:50:38 +00:00
Joshua Leung 6c138fc6a9 == Action Editor ==
Now it is possible to 'protect' action channels and constraint channels.
* When a channel is 'protected', the only operation possible on keyframes
is selection. All other operations are not able to be performed.
* The padlock to the right of each channel's name toggles the protection
status of that channel. You can only alter the protection status of one
channel at a time.

Todos:
* Menus still pop up when trying to do stuff to keyframes even if
all the keyframes selected are from protected channels.
* Shapekey channels shown in action editor should also get locks
2006-12-06 02:37:32 +00:00
Martin Poirier 4a2eceff20 === [ #5094 ] TrackTo Constraint with an animatable "up" direction ===
Patch by Matthew Plough: This adds an option to the Track To constraint to use the target's Z axis for Up axis reference instead of the global Z axis.

Off by default for backward compat.
2006-12-03 18:38:51 +00:00
Erwin Coumans 28bbf2d616 - added support for generic 6DOF constraint
- only 6DOF constraint shows buttons for limits
- added python support for rigidbody constraint (untested, but required for COLLADA Physics support)
2006-12-02 03:48:36 +00:00
Erwin Coumans 2572b9f72c Reserved some Bullet 2.x constraint data.
Although we will delay the main Rigid Body user interface after 2.43 release early 2007, I need some constraint data/UI to make progress with COLLADA Physics.
Added RigidBody constraint UI
LR_ALTKEY+LR_CTRLKEY+LR_SHIFTKEY+ P will bake rigidbody
Contribution by RCRuiz, Ramon Carlos.
2006-11-30 00:19:27 +00:00
Joshua Leung f645e51256 Two minor code cleanups.
* Removed un-needed cases for limit loc/rot/scale constraints from expand_constraints, which caused a few compiler warnings

* Removed an odd character in one of the comments for constraints. (Hopefully there wasn't any specific reason why it had to be there)
2006-11-09 09:01:20 +00:00
Brecht Van Lommel b48c514db8 Added an option in the IK constraint to disable stretching, useful
in rigs with layered IK constraints. Also removed the tolerance
setting, this value wasn't used in the solver anymore.
2006-11-06 23:51:37 +00:00
Roland Hess 3c8fe64910 This commit adds backwards compatability for the new floor constraint
feature. Old files that had "sticky" set would not show "sticky" under
the new system. Not that anyone ever actually used "sticky".

Also, these commits only add support for rotated external target objects,
not target bones inside the same armature.
2006-09-22 16:42:39 +00:00
Roland Hess 4725ca6c02 This commit adds local target rotation support to the floor constraint,
making it much more useful. Requested and taunted for frequently by
Plumiferos folks. Click on "Use Rot" to take target object rotations
into account.

Good for using rotated empties, etc., as a sloped floor.
2006-09-22 15:57:58 +00:00
Martin Poirier e341a4e1f4 Patch: Constraints to Limit Transforms (#4662) by Joshua Leung (aligorith)
This adds three new constraints to limit the range of location, rotation and scaling values.
2006-08-13 14:18:15 +00:00
Peter Schlaile 5f571e4ded ==Bugfix==
Made the frame boost from short to int (30000 -> 300000 frames) complete
by walking through the source and finally changing all frame-variables
to ints.

This should finally fix the framecounter warp around seen in some buttons.

If you step on any further problems that may arise starting from frame
32768 please just give me a hint and I'll fix it.

(Sorry about that, didn't know enough about Blender, when I did it the first
time...)
2006-05-06 15:26:53 +00:00
Martin Poirier da6b87abb1 Path: [ #2789 ] Add a "copy size" constraint
At long last!
This new constraint is pretty simple. Following in the footsteps of such giants as Copy Loc and Copy Rot, it lets you constrain the size of an object/bone to another object/bone, with per axis restrictions.
2006-02-19 17:42:20 +00:00
Ton Roosendaal 8c2c8bbfaa New Constraint option for Pose: "Local" Copy Location/Rotation.
The locality is restricted to action or user-transform only. Or as it goes
in the code now: by setting a constraint local, it executes the constraint
before it calculates the influence of Action or user transforms.

ALso note that this works in Evil Eulerians. Meaning that when you only
want to copy the X,Y or Z compenent of a euler, it can give unpredictable
results when the other euler values are set, this because euler axis
rotations work on top of each other.
2005-11-16 14:32:57 +00:00
Ton Roosendaal ea8b08c2cc Two new IK features.
1) Target-less IK

If you add an IK constraint without a target set (no object or bone target),
it now can be grabbed and moved with IK, using its own Bone tip or root as
target itself. This way you can use IK for posing, without having the IK
executed while it animates or while a Pose is being solved for real IK.

After grabbing "Target-less IK", it applies the resulted motion in the
pose-channels, which then can be used to insert keypositions.

The Target-less IK bone can still be rotated without IK, also its chain
can be edited as usual.

UI: The CTRL+I menu gives this as an option too. In the 3D window it is
drawn with orangish color.

Note that IK is not resistant to non-uniform scaling yet.

2) Auto-IK

When the option "Automatic IK" is set, in Edit Buttons Armature Panel,
it creates automatic temporal Target-less IK for the Bone you grab or
translate.

The rules are:

- it only works when a single Bone is selected
- if the Bone is a root bone (no parent), it adds IK to the end of the
  chain(s)
- otherwise it adds the IK to the active Bone
- the temporal IK chain only consists of connected Bones.

This method is still a bit experimental. Maybe it should become a special
grabbing option (like SHIFT+G in Pose Mode). It also only works OK for rigs
that fit for it well... when a rig already is fully setup with IK it can't
do much good. :)
2005-10-30 13:50:42 +00:00
Ton Roosendaal 8a21421e54 New; Rotation Constraint allows to only copy X,Y,Z axis rotations.
Note this is based on eulers, so might give the common issues. :)
For most cases it goes fine though, especially with only 1 axis constraint.
2005-10-25 19:13:04 +00:00
Martin Poirier 1dba65e296 Roland Hess' Floor Constraint patch: https://projects.blender.org/tracker/?func=detail&aid=2993&group_id=9&atid=127
Minor modifications to simplify the code in evaluate_constraint.

The "Stick" feature will need more work as it gives bad results when skipping frames, jumping around on the timeline and when going backward in time.

Suggestion: Would be nice if it could use the local space too, not just global space planes.
2005-09-07 00:11:39 +00:00
Ton Roosendaal 85efe767f0 Integration of new IK lib features in Armature Poses.
Best is to forget yesterday's commit and old docs. New docs are underway...

Here's how IK works now;

- IK chains can go all the way to the furthest parent Bone. Disregarding
  the old option "IK to Parent" and disgregarding whether a Bone has an
  offset to its parent (offsets now work for IK, so you can also make
  T-bones).
- The old "IK to Parent" option now only does what it should do: it denotes
  whether a Bone is directly connected to a Parent Bone, or not.
  In the UI and in code this option is now called "Connected".
- You can also define yourself which Bone will become the "Root" for an IK
  chain. This can be any Parent of the IK tip (where the IK constraint is).
  By default it goes all the way, unless you set a value for the new IK
  Constraint Panel option "Chain Lenght".
- "Tree IK" now is detected automatic, when multiple IK Roots are on the
  same Bone, and when there's a branched structure.
  Multiple IK's on a single chain (no branches) is still executed as usual,
  doing the IK's sequentially.
- Note: Branched structures, with _partial_ overlapping IK chains, that don't
  share the same Root will possibly disconnect branches.
- When you select a Bone with IK, it now draws a yellow dashed line to its
  Root.
- The IK options "Location Weight" and "Rotation Weight" are relative,
  in case there's a Tree IK structure. These weights cannot be set to
  zero. To animate or disable IK Targets, use the "Influence" slider.
- This new IK is backwards and upwards compatible for Blender files.
  Of course, the new features won't show in older Blender binaries! :)

Other changes & notes;

- In PoseMode, the Constraint Panel now also draws in Editing Buttons, next
  to the Bones Panel.
- IK Constraint Panel was redesigned... it's still a bit squished
- Buttons "No X DoF" is now called "Lock X". This to follow convention to
  name options positive.
- Added Undo push for Make/Clear Parent in Editmode Armature
- Use CTRL+P "Make Parent" on a single selected Bone to make it become
  connected (ALT+P had already "Disconnect").

On todo next; Visualizing & review of Bone DoF limits and stiffness
2005-08-28 12:23:06 +00:00
Ton Roosendaal eb1f65768a IK work-in-progress commit;
- Removed old convention that only allowed one "IK" connection for Bones
  in a joint. Was highly frustrating for editing trees or branches.
  In a next commit, there will be a different method to define IK target
  and IK root, so this option actually will become "Connect Bone" or so.

- the IK group name is gone, now is just an option "Tree IK". When IK
  chains share a root they'll form a tree.
  Todo is preventing conflicts here (will be for editor to define IK Root)

- Adding new IK constraint with CTRL+I activates Constraint
2005-08-27 17:04:29 +00:00
Ton Roosendaal ac619bace6 Third and last commit for Brecht's IK work.
Full logs for changes will be added later. Worth to note now;
- support for 'tree IK' added
- DOF and stiffness per IK bone (in pose only)
- Orientation IK support (target rotates -> chain follows)

This is still WIP. Buttons might change, button ranges will change, and the
way 'IK groups' are working will change. You can play with this, but don't
expect saved files to work still by end of this day! :)
2005-08-27 12:48:45 +00:00
Ton Roosendaal dfb654ba60 Huge commit, but not much features... had to shuffle a lot of code around.
Main target was cleanup of editconstraint.c and removal of the ugly
ob->activecon (active constraint channel), which was set by the "Show"
button in the Constraint Panel.
Better is to introduce an 'Active Constraint' itself, which stores in
the Constraint itself. By using this setting, and by checking the active
Bone, the UI can update reliably now. This only shows now in IpoWindow
btw (for constraint ipos). The active Constraint is drawn in the Buttons
with a slightly brighter backdrop. Any action in that Panel selects a
constraint now (even click in backdrop).

So now we have pose channels & constraint channels nicely behaving. Now the
darn Action channels... :)

Further in this commit:

- interface.c: Button ROUNDBOX now does button callback too.
               Button NUMSLI didn't do the callback on a click only

- Cleaned up include files in yafray, got annoyed it compiled over all the
  time.

- removed unused variables from Constraint struct
2005-08-24 20:18:03 +00:00
Daniel Dunbar b03a20d272 - got rid of silly #define ..._BIT, #define ... (1<<..._BIT) stuff
- switched almost all uiDefBut(..., TOG|BIT|..) to use UiDefButBit and the
   name of the actual bit define instead of just a magic constant, this makes
   searching the code much nicer. most of the credit here goes to LetterRip
   who did almost all of the conversions, I mostly just checked them over.
2005-08-03 18:48:22 +00:00
Ton Roosendaal 4d273d8d5b Armature-Pose IK goodies!
- Added option to the IK buttons, to have it use the 'tip' as end of the
  IK chain. I never really understood this old convention (IK didn't work
  on the Bone itself).
  Old files still will read OK though. But I made the "To Tip" a default
  when adding new IK constraints.

- Hotkey CTRL+I: add IK, with option to have it adding an Empty target,
  or use a selected Bone as target. With the new non-modal PoseMode, it
  gives instant access to playing with the IK chain.

- Hotkey ALT+I: clears IK, on all selected Bones

- Hotkey ALT+C: clears Constraints on all selected Bones (incl IK)
2005-07-24 11:36:05 +00:00
Ton Roosendaal 02ab203c98 Made action constraints to become backwards compatible. In the old version
it used the 'global' (Pose Space) rotation to define the action timing.
That was of course hardly useful, reason for many weird patched rigs.
Nevertheless, sometimes it can be useful, and it's nice to see old files
nicely work still. So: "Local" is an option now.

Note: if you changed last week files because of the new action constraint,
set the new "Local" option in the object-buttons Constraint panel.
2005-07-18 17:27:17 +00:00
Ton Roosendaal 28a1e8277b 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 17:35:38 +00:00
Martin Poirier ae9347662b Stretch To constraint
Read today's meeting minutes for a description.

Bjornmose: We'll need some example and screenshots for the dev pages of blender3d.org. If you can do some, neat, if not, I'll do them.

Matt, Emilie and Chris: Please review UI addition. Pixel alignement and all that fun stuff has not be overly looked for (though I did some cleaning by adding alignment blocks).
2004-09-05 20:21:16 +00:00
Jens Ole Wund bd768e00f3 claiming this to be mine .. to remain compatible to tuhopuu development
CONSTRAINT_TYPE_STRETCHTO	15
bjornmose
2004-08-26 22:00:14 +00:00
Nathan Letwory 00291b5cf4 [GameEngine] Commit all Kester's changes made to the gameengine to restore 2.25 like physics.
[SCons] Build with Solid as default when enabling the gameengine in the build process
[SCons] Build solid and qhull from the extern directory and link statically against them

That was about it.

There are a few things that needs double checking:

* Makefiles
* Projectfiles
* All the other systems than Linux and Windows on which the build (with scons) has been successfully tested.
2004-03-22 22:02:18 +00:00
Martin Poirier 7f90973344 Fix a problem that has been bugging me for a while. Tracking axis by default are different for Lamp and Camera than for the rest. For the constraint, it wasn't using the correct ones for them, so obviously, it didn't track correctly by default.
Fixed by checking the object type and changing the up and track axis accordingly.

Also added some comments in the DNA file (recompiling makedna because of comments is fun!)
2004-01-01 19:21:06 +00:00
Martin Poirier baf23c7648 Fixed the lag with Follow Path and optimized constraint loops with Track To and Lock Track. I was plainly disabling the refresh of the target, but that caused a lag (3D window, not Render). Now, it raises a flag when it find a loop, so it only disables the refreshing when it needs to.
This is a temporary fix, but a complete fix will require a rewrite of of some part of the where_is_object function, and that would take too much time before 2.31.
2003-11-13 23:04:46 +00:00
Martin Poirier 4efdabfbbc Constraint stuff from tuhopuu including (but probably not limited too):
Axis options for TrackTo
LockTrack
FollowPath

Auto creation of TrackTo constraint from Ctrl-T (old track still an option)

Auto creation of FollowPath when parenting to path (Normal parent still an option)

Backward compatibility stuff to convert the per object axis settings to per constraint when a Track constraint is present.

Function to convert old track to constraint (commented out)

Revamped the constraints interface with Matt's work from tuhopuu and the stuff we were discussing earlier.

--------------------
For coders:

unique_constraint_name and *new_constraint_data  moved to the kernel (constraint.c)

new Projf function in arithb gives the projection of a vector on another vector

add_new_constraint now takes a constraint type (int) parameter

add_constraint_to_object(bConstraint *con, Object *ob) to link a constraint to an object

add_constraint_to_client(bConstraint *con) to link constraint to current client (object or bone)

add_influence_key_to_constraint (bConstraint *con) to (eventually) add a keyframe to the influence IPO of a constraint
2003-10-21 13:22:07 +00:00
Kent Mein f1c4f705a1 Removed the config.h thing from the .h's in the source dir.
So we should be all set now :)

Kent
--
mein@cs.umn.edu
2002-12-27 13:11:01 +00:00
Kent Mein b9a19f1ea7 Did all of the .h's in source
(adding)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

also the Makefile.in's were from previous patch adding
the system depend stuff to configure.ac

Kent
--
mein@cs.umn.edu
2002-11-25 11:16:17 +00:00
Hans Lambermont 12315f4d0e Initial revision 2002-10-12 11:37:38 +00:00