Reference/Release Notes/2.40/Code

From Blender Developer Wiki
Jump to: navigation, search

Code Notes

<section begin=2.40-Source code-Armatures notes />

Armature and Animation Coder Notes

 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!
 The huge commit is caused by cleaning up globals from struct Global. Many
 variables were unused or just not needed anymore. Did that to move the ugly
 G.zbuf to where it belongs, in the View3D space struct. :)
 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.
 Most work was on trying to unwind the spaghetti for editing ipos. Too much
 history and bad design got added here. Most evident changes:
 - made generic 'context' for detecting which Ipo is being edited, or to
   assign ipos or to retrieve ipo curves.
 - made generic insertkey() for all ipo types, including actions
 - shuffled a lot of code around to make things more logical. Also made
   sure local functions are not exported
 
 The implementation is based on a 8x8x8 Octree, where vertex locations are
 stored. Vertices on the threshold boundary of an Octree node are filled in
 the neighbour nodes as well, ensuring that the lookup works with threshold.
 The current size of the Octree gives good speedup, even for 128k vertices
 it only needs 256 lookup cycles per checked vertex.
 Same code could be used for the bevel tool for example.
 
 src/meshtools.c:
 int mesh_octree_table(Object *ob, float *co, char mode)  
 - mode 's' or 'e' is "start octree" or "end octree"
 - mode 'u' is "use", it then returns an index nr of the found vertex.
   (return -1 if not found)
 Various stuff in one commit;
 
 - Added (BKE_utildefines.h) POINTER_TO_INT(poin) and INT_TO_POINTER(int)
   defines, to help fixing issues with switch to 64 bits systems. This
   assumes that a) not more than 16GB mem is used and b) that address
   space is below the 1<<35 value. The latter has to be confirmed, but it
   seems to conform the current 64 bits generation of OSs (for mallocs).
 
   Needless to say; use long if you want to store pointers! This is for
   temporal fixing.
 
 - Added editmesh version for mesh-octree lookups, not used yet.
 
 - Better Matrix to Eul, code submitted by Brecht. No time yet to do it
   really nice (like a Mat3ToEulCompat(mat, eul, eulc))


Dependency Graph

This section is all about things that have gone on 'under the hood' stuff that will be of interest to open source developers, but not to the typical end user.

http://blender.org/cms/Dependency_Graph.633.0.html

 New button type: ROUNDBOX This replaces drawing with uiRoundBox()
 or glRect() in button Panels.
 Done Modifier and Constraints.
 
 Syntax:
 
 The last 4 free variables in the uiDefBut() call are:
 - float, corner-rounding (0.0-pixels),
 - not used,
 - short: roundbox type (bits, 1 2 4 8 for clockwise corners starting left/top)
 - short: color shade offset (color range 0-255)

Boundbox select

 Boundbox select object mode optimisation.
 
 Changed selectprojektie (and renamed to view3d_opengl_select as suggested by Ton)
 to accept a buffer size, so boundbox can adapt it's buffer size to the number of object
 in scene. Also, the loop is done more smartly, since glSelect fills the buffer in the same 
 order as the drawing order, so we save lops of looping on unselected object (which used
 to go through all the buffer before finding that they weren't selected).
 
 This scheme could probably be applied to all the other loops using glSelect. (good project
 for newbie coders)


button code cleanup

 LetterRip
 Log:
  - 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.

<section end=2.40-Source code-Armatures notes />

Contrabutions

<section begin=2.40-Release Notes-Source code-Contributors /> Credits Developers who contributed to this release:

  • Alexander Ewering (3D Text improvements, bug fixes)
  • Alfredo de Greef (Radiance file support, Yafray export fixes)
  • Andrea Weikert (string library, bug fixes)
  • Austin Benesh (Python Scripts)
  • Bill Currie - Bug FIx
  • Brecht Van Lommel (IK Engine, LCSM and UV Editing, bug fixes)
  • Campbell Barton (BVH I/O Update, Archimap unwrapper, BPython API)
  • Chris Burt (Radial Blend texture)
  • Chris Want (Tuhopuu cvs support, Makefiles, bug fixes)
  • Daniel Dunbar (Mesh drawing recode, Modifier stack)
  • DJ Capelis (Linux platform maintenance, bug fixes, 64 bits support)
  • Eckhard M. Jaeger - tweaks to modifier UI
  • Erwin Coumans (Bullet Physics, Game engine fixes)
  • Jean-Luc Peurriere (Dependency Graph, OSX platform maintenance, bug fixes)
  • Jens Ole Wundt (Softbody improvements, Image paint, bug fixes)
  • Janne Karhu (Particles upgrade groundwork)
  • Jiri Hnidek (Window merging tool, Blender-Verse, bug fixes)
  • Johnny Matthews (Meshedit Subdivide Core, Edgeslide, Widgetmaker Script, Python api)
  • Joilnen Leite (Sort by extension on window file select)
  • Jospeph Gilbert (Python Armature API, Python Mathutils, bug fixes
  • Jorge Bernal - game compiling fix)
  • Ken Hughes (Python API Mesh module, bug fixes)
  • Kent Mein (libtiff support, various small fixes)
  • Marc Freixas (Boolean recode)
  • Martin Poirier (Transform tools, bug fixes)
  • Matt Ebb (Lamps, Camera and Object center visualisations, sequence strip cutting, text UI controls and menu updates)
  • Matthew Plough - SWAP_COPY
  • Mika Saari (Unicode character support for Font Object)
  • Nathan Letwory (Bug fixes)
  • Nils Thuerey (Fluid Simulation)
  • Pontus Lidman (Python script)
  • Roland Hess (Floor Constraint, Ghost Bug fix)
  • Simon Clitherow (Bug fixes, Window platform maintenance)
  • Shaul Kedem (File compression,Sequencer frame reversal)
  • Stephen Swaney (Python API, bug fixes)
  • Stephane Soppero (Python API)
  • Tom Musgrove (Python scripts, Release logs, Buttons code cleaning)
  • Ton Roosendaal (Animation recode project, particles, hair, bug fixes)
  • Toni Alatalo (Python API, bug fixes)
  • Vidar Madsen (Fix for animating static particles)
  • Willian P. Germano (Python API, bug fixes, docs)
  • Yehoshua Sapir (Python script)

<section end=2.40-Release Notes-Source code-Contributors />