Particle settings can now be pinned too:
* Particle system's are comparable to texture slots, which can
only exist within an id block. Particle settings on the other
hand are idblocks which should be pinnable just like textures.
* When particle settings are pinned only properties that make
sense without the actual particle system are shown in the
particle panel.

Correct texture pinning:
* Now texture pinning works consistently for all textures.
* The only problem is that there is no way to pin textures if there are
no textures in the context path, so it's for example impossible to pin
the texture of a displace modifier without adding a texture somewhere
else and selecting that texture first. I my opinion this is quite
counter productive so perhaps a dedicated "only textures" texture
context option is needed after all.

So, it turns out that dupliframes weren't that bad to restore... the
old version didn't do truly accurate transform freezing as it didn't
update ancestors too. However, as a modelling tool, this will probably
suffice.

* All the various index-related issues should finally be sorted now.
It seems you cannot just partially implement some of these active
index getter/setters...
* Standardised the call used by PoseLib operators to get the Object
from which they get the active PoseLib data from
* PoseLib operators which require some existing data to work now use a
poll() which checks for this
* Added back the operator used to make standard actions into ones
usable by PoseLib
* Added a dummy operator for the apply active pose button which really
just calls the same backend functions as "Browse Interactive", but
which has a nicer frontend (naming + description) for the purpose of
being used in this way
* Also, removed some useless code from here

PoseLib UI and Bugfixes:
- Added operator button to show the current pose. This runs on top of
the interactive pose browse functionality, so the tooltip may be a bit
obtuse...
- Specifying a pose for the Pose browse functionality to set now works
correctly. Previously, some old depsgraph hacks were actually
interferring with correct updating (only the armature updated
correctly, but deforms didn't occur)
- Fixed a case of accessing freed memory, which I'm surprised no
static checkers have reportedly picked up on yet, or that nobody has
really had issues with (probably due to low memory "turnaround" so
far)

Ugly hack to get PoseLib UI working ok (problem mentioned in log for
r34883).

Full description:
When defining an operator button in the UI layout code, trying to set
the value for such an operator's enum properties, where said enum uses
a dynamically generated list of items (which depends on using context
info), will "fail". No context info will be passed to the callbacks
used to generate this list of items, as PROP_ENUM_NO_CONTEXT is still
set on the operator properties (it seems these will only get cleared
when the operator actually runs, which is far too late already for
this usage) so RNA_property_enum_items() will pass NULL instead of a
context pointer *even* when one exists!

I'm not sure of why we even need this flag. It seems to have caused a
few other rounds of problems already, from quick searches I did on
this matter...

This presents a UI from which PoseLibs can be assigned/removed from
Objects. From here, it is also possible to see the list of poses and
add/remove poses from this list.

Known Issues:
- [Py/RNA/Operators BUG ALERT!] If after immediately starting Blender
you try to remove a pose from the PoseLib using the UI buttons, you'll
get a an error the first time you do so (but not for subsequent
attempts). This seems to be caused by the "pose" enum (dynamically
generated) of the POSELIB_OT_pose_remove operator, which does not seem
to be getting initialised when the operator's exec gets called without
the invoke having been called previously
- Changing the active Pose Library still seems to be broken (to be
fixed soon)

Todos:
- Operator button to make the selected pose get shown in the 3d view
- Restore the "validate action" operator and add that to this panel
- Rename pose access

- Do not use old anchor toggling operator. It used to set brush flags to
unawaliable state.
- Also changed dynamic space bar menu, so it now also wouldn't allow to
set brush stroke flags to unavaliable state.

Also tried to remove use_anchor, use_space, use_restore_mesh and
use_airbrush, so user would be unable to set flags to unavaliable state,
but it was quite difficult for non-sculpt paint modes. They don't support
all of stroke methods, so brush.stroke_method can't be used for them.

- Use the same logic as for BEZIERs when making segment of between
first and last NURBS' control points (toggle cyclic flag)
- Show U/V selection menu only for surface objects. There's no
much logic in asking U/V direction for simple curves.
- Set active spline when two segments were joined.

Custom properties are now supported by Pose Library. They will get
saved and restored correctly during previewing and pose adding.

To do this, I've changed PoseLib over from using the "LocRotScale"
Builtin Keying Set to the "Whole Character" one instead. One
consequence of this, is that now entire poses are stored in the Pose
Lib, irrespective of whether you only selected part of a pose to store
(i.e. facial controls only, or hand poses only). If this is enough of
a problem, I'll make a second Keying Set that does take selections
into account, and use that here instead.

UI Tweaks: Text field in Rename Markers popup now gets focus when the
popup appears, saving an extra click

I've separated out the "XXX"-'d event-adding-hack section from the
search-menu code into a separate API function (as recommended there).
This call is used to make sure that textboxes in popups can get
activated by default, to allow typing immediately.

This commit will switch blender to use tangent space generated within
the two files mikktspace.h and mikktspace.c. These are standalone files
which can be redistributed into any other application and regenerate the
same tangent spaces. The implementation is independent of the ordering
of faces and the vertex ordering of faces.

Very nasty UI code issue: since every button is re-defined on a
redraw, having UI redraws while using a button was not possible.

This was solved long ago by copying over data from previous button.

However, this fails when buttons have callbacks with its own (or
a parent button) pointer.

This bug reporter found crashes in draw-overlap UI mode, this
draws entire UI over for every menu redraws, making previous button
pointers invalid. (for triple buffer, the UI is not redrawn, only
the menus).

In general: all systems falling back to old swapbuffers would have
suffered some instability because of this.

Fix is that now the old button gets lifted out from the previous
list and inserted in the new list. Works fine, but needs some tests!

Also in this commit: TIFF endian switching not needed for 16 bits tiff.

DopeSheet: Add menu entries and hotkeys to select all keyframes
left/right to current frame in dope sheet

This commit separates out this selection functionality out of the
click-selection operator into a separate operator, so that hotkeys and
menu entries can be assigned to it.

This is based on an idea+patch (#23738) submitted by Torsten Rupp
(rupp), though I've ultimately decided not to go with the suggested
implementation as I don't think this fits that well under the "column"
select operator.

Crash was caused by keeping active segment index even when this
segment had been deleted. Fixed this and also changed behaviour
of creating new CV for case nothing is selected: new segment with
BEZIER type would be created.

Small addition to particle grid distribution:
* New option to distribute particles in a hexagonal grid.
* This is much more stable for fluids than normal grid distribution and looks quite nice otherwise too :)
* Also some small scale code cleanup of grid distribution code.

Small update for billboards:
* Renamed the old split uv's animate option "time" to "age" and added a new option to change the used split frame by frame. These are good changes were suggested/implied by Hannu Hoffren over 3 years ago in his tutorial video! (oh my how time flies)
* Also cleaned up the billboard ui quite a bit. For example now the uv channels can be properly chosen from the existing channels.

Fix for [#25857] create_dupli_list incorrect behaviour with particle systems
* Particle duplis are now always created with render percentage if G.rendering is set.
* This is not yet a perfect solution (hair for example won't yet work correctly), but
it's good to have even partial functionality here until a proper way to handle this
is implemented.

Small particle effectors update:
* Greetings from farsthary: particle rotation is now taken into account for particle effector direction.
** This gives all kinds of new possibilities as he shows in his blog http://farsthary.wordpress.com/2011/02/08/vortex-particle-simple-tut/.
**The only modification I made to his patch was to use the actual rotated particle direction as the effector direction as this defaults to the particle velocity vector, so no actual new options are needed.
* I also added an "effector amount" setting for particle effectors so that only a part of the particles can be considered as effectors. This makes it possible to create simple "farsthary vortexes" with only one particle system.
* Also some tiny reorganization of the falloff min/max values for a nicer ui.

Removed limitation of armatured-only objects for sculpting -- now all
deformation modifiers are allowed in sculpt mode. Use crazyspace corrections
like from transformation modules was used to support all deformation modifiers.

Internal change: all crazyspace-related functions were noved to crazyspace.c

P.S. Brush could make quite unexpected deformation for meshes which are
deformed in specified way. Got patch for this and discussing with Brecht
if it's really needed or maybe it could be done in better way.

Save one memory block allocation/disposing when propagating changes from
deformed PBVH to the base mesh.

It's not real bottleneck, but crazyspace corrections looks nicer now.
Real bottleneck is normals re-calculation, which calls plenty of
fsqrt's. We could avoid this for some modifiers (which don't use
normals), but such checking would make code less controllable.

fix for more warnings.
- modifier code was using sizeof() without knowing the sizeof the array when clearing the modifier type array.
- use BLI_snprintf rather then sprintf where the size of the string is known.
- particle drawing code kept a reference to stack float values (not a problem at the moment but would crash if accessed later).

Particles todo item: particle textures
* Effecting particle properties with textures was possible in 2.49,
but not in 2.5 anymore.
* Now particles have their own textures (available in texture panel
for objects with particle systems), which are totally separate from
the material textures.
* Currently a basic set of particle properties is available for
texture control. Some others could still be added, but the whole
system is not intended as an "change anything with a texture" as
this kind of functionality will be provided with node particles in
the future much better.
* Combined with the previously added "particle texture coordinates"
this new functionality also solves the problem of animating particle
properties through the particle lifetime nicely.
* Currently the textures only use the intensity of the texture in
"multiply" blending mode, so in order for the textures to effect
a particle parameter there has to be a non-zero value defined for
the parameter in the particle settings. Other blend modes can be
added later if they're considered useful enough.