Fix T40510, revert openmp thread count to how it was in
2.70 for non Apple systems.

Also refactored the code that restores the previous openmp thread count.
The logic here was weird, mostly due to all the commit madness with
Apple openmp support. The restored thread count though should not depend
on the on/off state of threaded sculpting (since it has to do with
systems other than sculpting only). For OSX threads are restored to the
system thread count but Jens should recheck here.
BMesh: avoid recursion for BM_mesh_edgenet, runs out stack memory on large nets
Fix mempool bottleneck alloc & freeing a single item

Would continuously reinitialize the first chunk of the mempool,
now check for at least 2 blocks.
Fix T40538: Multi-button canceling edit-text could leave edited value
Fix T40543: Duplicators draw with 'Render Only'
Fix T40529: Euler Rotation F-Curve Handlers wrong behaviour on moving keyframes
Revert "Fix T40382: 2D stabilization uses disabled markers"

It's not that trivial to support disapearing tracks in the sequence,
and since we're having ongoing 2D stabilization rework patch wouldn't
want to start doing rather bigger changes here now.

Let's just stick to legacy behavior for this release.

This reverts commits 91429d0, 543ce85
Fix cycles CUDA error when trying to use >= 100 image textures.
Fix T40547: Can't read single channel EXRs

The root of the issue goes to the fact that we only can
read RGB EXR files, but they could be YCbCr or just Luma.
Added support for this two cases.

Note: internally EXR would still be 3 channels, so no
big memory save would happen here, at least yet.
Fix T40534: Multi-button editing, hard to distinguish sliders
Quiet assert in debug mode, deleting mask/gpencil keys
Fix T40057: invisible hair particles slowing down mesh edits

Skip doing particle update in object_handle_update if object is in
edit mode.

Object will be re-evaluated on exit from edit mode anyway, so it's
_expected_ to be a safe change.
Fix T40549: box selection starting point in the file requester.

We need to 'reset' mouse coordinates to the one it was when the gesture handling started,
else org coords are where the tweak event is created, which gives a noticeable gap
(several pixels) and unwanted behavior like the one retported about file box selection.
Fix for slowdown converting mesh to curve with large polygons

Walk the linked list rather then doing index lookups.
Usual UI message handling...
Fix T40498 invalid textures flickering.

Issue here is most likely sampler uniforms and textures not being
updated properly when zero binding is created. Solution for now is to
allow zero binding but when this happens use sexy pink invalid texture
instead :p.
Fix wrong memory write in partial render update with Save Buffers enabled

No idea why this issue hasn't been spotted before. Took several hours to
figure out where exactly wrong memory access happens..

P.S. I really want to switch ImBuf->rect from int* to unsigned char*...
Curve: skip curves when matching bevel-fac (like 2.70)
Fix T40551: Boolean Modifier distorts UVs

Mapping to original face was never working 100% reliably actually,
now use more robust method for this.
style cleanup