Commit Graph

4729 Commits

Author SHA1 Message Date
Brecht Van Lommel
275c214195 IK rotation limits fixes:
- Z-axis rotation limits were not working, was using wrong flag.
- Don't allow min limit to go over max, or vice versa.
- Fix for jacobian getting overwritten with IK clamping.
2005-08-28 13:06:41 +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
Brecht Van Lommel
fa443a5f01 Bugfix; the IK solver would crash if there were 0 DOF's in the chain. 2005-08-27 23:04:37 +00:00
Stephen Swaney
adc1d7137a patch #2911 - tp_getset for Lamp module.
A nice juicy chunk of new style attribute handling from Ken Hughes.

Thanks, Ken.
2005-08-27 18:44:56 +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
Brecht Van Lommel
8f5bff6051 Make IK DOF stiffness work in range 0.0-1.0, for consistency. 2005-08-27 14:27:05 +00:00
Brecht Van Lommel
ae9dcb3dc2 Update SConscript.
Fix some warnings.
Merge with latest soc code.

What changed in IK lib:

Fully restructured, with components now as follows:
  - IK_Solver: C <=> C++ interface
  - IK_QSegment: base class for bone/segment with 0
    to 3 DOF
  - IK_QTask: base class for a task (currently there's
    a position and a rotation task)
  - IK_QJacobian: the Jacobian matrix, with SVD
    decomposition, damping, etc
  - IK_QJacobianSolver: the iterative solver

The exponential map parametrization is no longer used,
instead we have now:
  - 3DOF and 2DOF XZ segments: directly update matrix
    with Rodrigues' formula
  - Other: Euler angles (no worries about singularities
    here)

Computation of the Jacobian inverse has also changed:
  - The SVD algorithm is now based on LAPACK code,
    instead of NR, to avoid some problems with rounding
    errors.
  - When the problem is underconstrained (as is the case
    most of the time), the SVD is computed for the transpose
    of the Jacobian (faster).
  - A new damping algorithm called the Selectively Damped
    Least Squares is used, result in faster and more
    stable convergence.
  - Stiffness is implemented as if a weighted psuedo-inverse
    was used.

Tree structure support.

Rotation limits:
  - 3DOF and 2DOF XZ segments limits are based on a swing
    (direct axis-angle over XZ) and twist/roll (rotation
    over Y) decomposition. The swing region is an ellipse
    on a sphere.
  - Rotation limits are implemented using an inner clamping
    loop: as long as there is a violation, a violating DOF
    is clamped and removed from the Jacobian, and the solution
    is recomputed.

Convergence checking is based now on the max norm of angle
change, or the maximum number of iterations.
2005-08-27 13:45:19 +00:00
Brecht Van Lommel
fa0bbaf380 Another file missed in IK commit. 2005-08-27 13:27:49 +00:00
Ton Roosendaal
8d36b517f9 Forgot to add new files... 2005-08-27 13:10:41 +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
a7f2ebf06c Second commit for Brecht's IK work.
(Moto needs 'make install' before you can do IK lib btw)
2005-08-27 12:45:29 +00:00
Ton Roosendaal
665a6b2d95 First commit of Brecht's new IK work. This only does the IK module.
Don't start compiling yet!
2005-08-27 12:44:41 +00:00
Ton Roosendaal
669c4dbecb Fixes, as reported by Basse
- Softbody Mesh didnt update when it was child of armature-posing
- Bone Stick drawing didn't draw selected in Solid + Object mode.
- WeightPaint + Subsurf (nice that it works!) didn't update on Bone
  selection
2005-08-26 17:48:46 +00:00
Daniel Dunbar
1046dfb136 - tsk tsk, ll suffix for constants is not C standard, doesn't
work on msvc
2005-08-26 16:07:44 +00:00
Ton Roosendaal
8fb7bbacad accidentally left in testing printf. 2005-08-25 20:32:49 +00:00
Martin Poirier
6c9d743ef4 Based on a suggestion from Zr, using line line intersection for single axis projection.
This makes perspective handling a bit better.
2005-08-25 18:03:19 +00:00
Ton Roosendaal
8d940dfafe Random() issues with rendering...
- AO and soft shadow AreaLight tables were generated without fixed seed,
  causing animations to give unwanted amounts of noise.
- Made sure these tables now are calculated before render, with fixed seed
- Then found out the BLI_rand() has very bad seeding... it showed up as
  patterns. After some experimenting, found a nice method using noise.c
  hash tables. For compatibility with old code, named it BLI_srandom() to
  use this next to the BLI_srand(). This follows libc rand() and random()
  naming convention.
- Then of course threading should work... so made a BLI_thread_rand version
  of the calls. Now supports up to 16 threads, comments added in .h and .c

Result is stable animation render with AO and soft shadow. But, please
test and feedback!
2005-08-25 13:11:04 +00:00
Ton Roosendaal
c9f01eefcd iBug fix #2965
Switching scene in Edit Mode crashed. Accessed the DAG without it being
initialized yet.
2005-08-24 21:12:58 +00:00
Johnny Matthews
a51896b591 Move the settings in the Mesh Tools panel to the new toolsettings struct in Scene. These settings are now saved per scene. 2005-08-24 20:37:25 +00:00
Ton Roosendaal
a978c122ee Making compiler happy;
- removed unused variables
- #if 0 around unused calls
- init of uninitialized vars
2005-08-24 20:26:28 +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
Chris Want
bc3f228bc9 Variable was defined in a header file (constant_Type), resulting in
'multiply defined symbol' warning on IRIX for every file that
included that file. Moved to a C source file.
2005-08-23 22:12:06 +00:00
Jens Ole Wund
1ac5239764 help MSVC6 projects for edgehash files 2005-08-23 21:49:30 +00:00
Daniel Dunbar
9759296483 - more fixes for wpaint mode, need to patch mesh modifier as well
- change wpaint to flush changes during painting... can see this
   is going to be a problem because will also redeform. what to
   do, what to do...
2005-08-23 21:04:17 +00:00
Daniel Dunbar
81f995b741 - disabled incremental subsurf support (during object mode) for the
time being, misses features for texture/color drawing and I don't
   have time to finish at the moment. can return once UV/colors are
   incorporated into subdivision.
2005-08-23 20:39:58 +00:00
Ton Roosendaal
ad9099ea5d Fix for reading older files... it didn't always convert OK for the new
deformation options of Armatures, causing bones not to deform.

It was caused by using the old "boneclass" variable and SKINNABLE.
Apparently the boneclass can have any value in older files. Will be killed.

Please note; in files created after last sunday, with setting "No deform" on a
Bone, that setting has to be done again.
2005-08-23 20:19:01 +00:00
Daniel Dunbar
7396075ef1 - add option to drawMappedFaces to draw with colors (from tface or mcol)
- convert weightpaint/vertexpaint to draw using drawMappedFaces, slightly
   hacky because during weightpaint mcol's get overridden in order to
   have them propogate through modifiers. should work fine.
 - add NULL check in shaded draw, prevents crash w/ dupliframe
2005-08-23 20:04:10 +00:00
Martin Poirier
e12e2469c8 Bretch's patch for 2D transform. Thanks
Using new transform code to handle UV window.

With the ground work done, Transform could more easily be extended to handle IPO window now.

Tracker item: http://projects.blender.org/tracker/?func=detail&atid=127&aid=2946&group_id=9
2005-08-23 18:13:30 +00:00
Erwin Coumans
207cbbd535 don't need Object.h 2005-08-23 16:50:53 +00:00
Johnny Matthews
2540ca88e8 Quad Adjacent edge subdivide type moved to Mesh Tools panel rather than pupmenu on all subdiv calls. This is a session value like beauty and will revert to path each time you load blender. 2005-08-23 14:13:00 +00:00
Erwin Coumans
056a33ac69 new game-menu option 'Record Game Physics to Ipo'
including implementation. hope it works, and doesn't break to much.
it bakes physics objects transform into ipo, every frame of the running gameengine.
When you disable and run the game again, it clears the ipo's again. just for physics objects at the moment.

(perhaps some better UI in the future?)
2005-08-23 13:16:02 +00:00
Daniel Dunbar
0192536102 - added iterator to edgehash
- updated decimator to make edges
2005-08-23 02:29:22 +00:00
Chris Want
3c1887036a Added (non-default) Makefile option to build blender with tweak mode.
To build with this option, set:

export NAN_TWEAK_MODE=true
2005-08-23 02:28:01 +00:00
Daniel Dunbar
4ad5cdf91e - subsurf getVertCos returned verts in wrong order since
shuffling of code... led to fun and crazy results (maybe
   less fun for les artiste)
2005-08-23 02:05:45 +00:00
Chris Want
d6b4392710 On windows/gcc (aka. FREE_WINDOWS), build the blenderplayer whenever
blender is configured to build with the gameengine.
2005-08-23 01:31:11 +00:00
Ton Roosendaal
50315dc100 Another painful editing issue solved!
Adding Ipos on a Constraint just was working totally insane. Here's how
it works now in the constraint Panel:

- Button "Show" will make the IpoWindow show the Constraint Ipo
 (it didn't before, when IpoWindow was not set to correct mode)

- Button "Key" will insert a key point on current frame (and show it in
  IpoWindow)

Note that both options will create an Action too, if not existed yet.
So, without opening an IpoWindow you can already animate Constraints.
(Todo: use the auto key option to always insert on changing slider)

And; selecting a Bone will update the Constraint IpoWindow too. Note
however, that when theres multiple Constraint Ipos on a Bone, it only
shows the first... will solve that later.
2005-08-22 21:58:55 +00:00
Daniel Dunbar
931d0fc235 - switch modifiers_isDeformedByArmature to also include
virtual modifiers
2005-08-22 20:25:54 +00:00
Daniel Dunbar
3d7ed80ed4 - added modifiers_isDeformedByArmature function 2005-08-22 20:24:59 +00:00
Erwin Coumans
43b59afebb more preparation for physics recording to ipo keyframes 2005-08-22 18:31:19 +00:00
Johnny Matthews
3b8e94ac6b This commit introduces 2 new filling methods for subdividing quads which have only 2 adjacent edges selected. Path, Fan and Innerverts. ATM whenever a call is made to any subdivide calling tool, you will be asked for the type by a pupmenu. This will be replaced (perhaps) by a panel setting... 2005-08-22 18:05:40 +00:00
Ton Roosendaal
a5bc9582cb Three little feats;
- Vpaint and Wpaint now use our own custom cursor, this was a very old
  plan anyway. It uses the 'knife' now, we need a good brush icon for it!
- On scaling bones in editmode, the deform distance info gets scaled now
  too when no "Envelope" draw mode was set.
- Disabled front buffer drawing of objects with CTRL+select in Edit Mode.
  Uses a regular redraw now (like for select in Object Mode btw)
2005-08-22 17:52:52 +00:00
Erwin Coumans
65a52fc419 - prepared for automatic game physics -> animation (ipo) conversion (this allows to use bullet for animation)
- default the m_edgecode to 65535, the wireframe was invisible. when is the edgecode available again ?
- added an extra condition, nearsensor is not yet working for bullet, but it crashed.
2005-08-22 15:47:56 +00:00
Ton Roosendaal
838d938522 Some fixes;
- Armature deform options "Envelope" and "Vertexgroup" didn't combine. One
  Vertexgroup added disabled all Envelopes
- "Clear" option in WPaint Panel now sends refresh to deform
- Same for Undo in Wpaint
2005-08-21 22:01:20 +00:00
Brecht Van Lommel
af935e597f Use new BLI_edgehash_* functions in unwrapper. 2005-08-21 21:39:44 +00:00
Ton Roosendaal
bfc5fedb79 Much wanted; Constraint "move up" and "move down" buttons, in the Panel! 2005-08-21 21:20:53 +00:00
Daniel Dunbar
dd7bcb94bf - sillyness... added drawMappedEdges for mesh
- revert to drawLooseEdges instead of general drawEdgesFlag
 - ditched TFace edge flags, done dynamically now which also
   means don't need to recalc surface on flag changes
 - added BLI_edgehash, guess what it does
2005-08-21 20:48:45 +00:00
Ton Roosendaal
5a381a5a12 Made weight-painting more bearable :)
- Hotkey CTRL+TAB toggles weightpaint on/off
- If Mesh has no vertex groups yet, it still accepts Weight Paint mode.
  Then, on a first painting stroke it creates a default group.
- When combining WeightPaint mode with Bone selecting, if you select a
  Bone without vertex group it draws Mesh dark blue. On a first painting
  stroke it then also creates a new group, with the Bone name.
2005-08-21 20:09:50 +00:00
Daniel Dunbar
d2f6ff1900 - bug fix, last edge wasn't flagged correctly on make_edges 2005-08-21 19:01:30 +00:00
Ton Roosendaal
6ad0c922af Control over Armature deform. Three new options are added for it;
Armature Panel
- "Vertex Groups"
- "Envelope"

Bones Panel
- "Mult"

The logic works as follows;
- Set "Vertex Groups" will enable vertex group based deform (default)
- Set "Envelope" will enable Bone Envelopes to deform
- Set both will apply Envelope deform on vertices without VertexGroups

- Set the per-Bone "Mult" option to have Envelopes work on top of a
  VertexGroup
- The per-Bone "Deform" option (was called "Skinnable") will dis/enable
  the Bone to deform for all situations.

The old convention was that, without any vertex groups, the Bones deformed
with bone-distances. I can't patch that... so you have to enable it by
hand in older files. Not too bad, since this option was unusable before
anyway. :)
2005-08-21 18:53:12 +00:00
Daniel Dunbar
a669c9d6d1 - edge draw experiment didn't turn out to be useful, removed and reverted
to old.
 - updated fasterdraw() to work with edges
2005-08-21 17:57:06 +00:00