- 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.
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
- 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
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.
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! :)
- 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
- 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!
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
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.
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.
- 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
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?)
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.
- 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)
- 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.
- 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
- 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
- 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.
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. :)