D605: Fixes for proper handling of wchar_t paths in MinGW.

* Fixed different not-in-sync #ifdef blocks for struct stat variants under Windows.

Comments have been left to indicate the portions of BLI_fileops.h and
BLI_fileops_types.h that need to stay in sync.

* Added BLI_wstat() to de-duplicate #ifdef blocks for stat() variants on Windows.

* Fix for opendir() and associate functions in MinGW not working properly with
non-ASCII, MBCS-compatible paths.

MinGW (FREE_WINDOWS) has opendir() and _wopendir(), and only the
latter accepts a path name of wchar_t type. Rather than messing up with
extra #ifdef's here and there, Blender's own implementations of opendir()
and related functions are used to properly support paths with non-ASCII,
MBCS-compatible characters.

Tested with MSVC 2013 Express, MinGW32 (gcc 4.6.2) and MinGW-w64 (gcc 4.7.1).


Differential Revision: https://developer.blender.org/D605

Reviewed By: campbellbarton
Fix T40756 Select Linked by Particle System matches ignores selected
psys.

This is inconsistent with other comparable cases like materials, where
the active slot is used to define matching objects.
Fix compiler error in Cycles Beckmann sampling precomputation: strict
compiler flags don't allow implicit double -> float casting.

Code was added in rB8fbd71e.
Fix T40764: Keyframed Render Layers Don't Work as Intended
Use specified exception mask for buildinfo

This way we only catch exceptions which we're intended to
and if something bad happens (like missing import due to
refactor or so) we'll see them instantly.
T39690: Modifications to Blender's 'temp dir' system.

Current temporary data of Blender suffers one major issue - default 'temp' dir on Windows is never
automatically cleaned up, and can end being quite big when used by Blender, especially when we have
to store per-process data (using getpid() in file names).

To address this, this patch:
* Divides tempdir paths in two, one for 'base' temp dir (the same as previous unique tempdir path),
  the other is a mkdtemp-generated sub-dir, specific to each Blender instance.
* Only uses base tempdir when we need some shallow persistance accross Blender sessions - and we always
  reuse the same filename (quit.blend...) or generate small file (crash reports...).
* Uses temp sub-dir for heavy files like pointcache or renderEXRs (Save Buffer option).
* Erases temp sub-dir on quit or crash.

To get this working it also adds a working 'recursive delete' to BLI_delete() under Windows.

Note that, as in current code, the 'recover render result' hack-feature that was possible
with SaveBuffer option is still removed. A real renderresult cache feature will be added
soon, though.

Reviewers: campbellbarton, brecht, sergey

Reviewed By: campbellbarton, sergey

CC: sergey

Differential Revision: https://developer.blender.org/D531
Add ED_paint.h, split out ED_sculpt.h

also rename some functions to match our convention
BMesh: we actually can set loop indices too while converting from Mesh to BMesh...
Use toolbar tabs for node categories instead of just a long list of
panels.

Patch by @Severin (with minor modifications by me). As discussed in
{D535} the node editor does not have real modal operator tools like the
3D view or image editors for instance, so it makes sense to utilise it
this way. Tabs really help in this area due to the large amount of node
types and categories. Further tweaks could be made later if the need
arises.
Fix own typo in temp_data patch, (windows-only)

Don't know when this sneaked in, I did wrote that part of the patch on win VM with MSVC2013... :/

Note: letting asside warnings for now, then should not prevent building anyway.
OSX: Fix T40749, own mistake for m_lionStyleFullScreen condition
D319: Freestyle Python scripts update.

This revision is meant to update Freestyle's Python scripts to make full usage
of the new features of Python and Freestyle's Python API.

Freestyle's Python scripts are pretty old already, and were never given much
attention. With the 2.7x generation of Blender coming up, this is an excellent
time to update Freestyle's Python scripts, hopefully adding some new features
and achieving some speed improvements on the way.

Main goals:
* use for loops where possible
* general cleanup, making use of more recent python features (generators,
  ternary operator, ect.)
* update the documentation on the way (it's lacking atm)


Differential revision: https://developer.blender.org/D319

Author: flokkievids (Folkert de Vries)

Reviewed by: kjym3 (Tamito Kajiyama)
Polyfill2d: Correct boundbox check (Fix T40777)
Improve doxygen comment to include some type info to make it more useful
Ctrl-F now activates the filter-by-name functionality for Animation Editors
Fix compilation on OSX after own rB414c70435dcd...

Sigh, why can't all unix have same includes? :/
Switch allocator to thread-safe when rendering from the command line

This is needed because render threads would do some allocations like
part buffer allocation and so. This is likely harmless with the lock
free allocator (not on Windows tho), but when using guarded allocator
we need to be sure access to the list of MemHead is safe.
Followup for the previous commit

Need to do the same for render exec() because it doesn't
use the job system.
Freestyle: Fix for a couple of missing names in freestyle.chainingiterators.__all__.
Freestyle: Progress bar updates during mesh loading.