Fix T39546: blender crash on open recent file, when tracking is still in progress
Fix T39378: Revert, Recover Last Session and Load Factory Settings have no prompt.

Now they do, to make it harder to accidentally press them and lose work.

Reviewed By: brecht, carter2422

Differential Revision: https://developer.blender.org/D440
Image and clip editor: change zoom step to end up at powers of two.

When you press zoom 3 times you will now get 2:1, 4:1, 8:1, etc. Fixes T36916.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D409
Make matcaps suck less

This commit does various changes for matcaps:

One is taking advantage of drawing with pbvh (which would only happen
with dyntopo previously) and drawing with partial redraw during
sculpting.

The second one is support for masks. To make this work in the special
case of multires, which uses flat shading, I use the only available flat
shaded builtins in OpenGL 2.0 which are color and secondary color.

Abusing colors in that way is also essential for flat shading to work if
we are to use pbvh draw in multires, since it is the color that is being
interpolated flatly, not the normal (which can only interpolated
smoothly). The pbvh drawing code for multires used last triangle
element's normal to compute the shading which would only produce smooth
results. This could change if we did the shading in the vertex shader
for flat shaded primitives, but this is more complex and makes it harder
to have one shader to rule the mole.

Also increased the brightness of the default diffuse color for
sculpting. This should be useful since artists like to tweak the
lighting settings and it will give them the full dynamic range of the
lights, but also it helps with correct brightness of sculpted matcaps.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D435
Revert 7955cb78d it causes GPU_pbvh_buffers_diffuse_changed to always
return false, causing update of all pbvh nodes all the time.
Fix T39550: polygons.active has bad default
Sculpt: the thread controls where unintentianlly greyed out along with capabilities.has_gravity condition
Fix some redrawing and possibly other issues in dyntopo:

When node face gets deleted, added or exchanged, the nodes should update
their draw buffers, normals and bounding boxes. This was not being done
before so there were graphical glitches apparent, especially in collapse
mode.
Fix bpy.so linking on Mac OS X

D345 from Aleksandr Derbenev
Fix for building with MSVC2008
Dyntopo: Delete OpenGL buffers of nodes that do not have any more
triangles.

It is possible to end up with such nodes using brushes in aggressive
collapse mode. Those nodes should normally be cleaned up, since they can
never be actually reused (adding more geometry to a node requires the
node having some geometry to begin with) but until we support dynamic
nodes, better delete those to avoid binding graphics driver resources.

If such zero elements buffers were used, GL error out of memory would be
reported.
Code cleanup: use uint64_t for BLI_rand
Fix for BLI_rng_shuffle_array noted by mont29
Code cleanup: avoid redundant lookups for subwindows
UI: support for dragging popups title area
Fix T39545: "Track selected markers", does not stop at end of video

Issue was cauzed by some weird clamping of current frame. Not sure
why it was here at the first point -- it's from the day0 of movie
clip datablock.
Fix T39547: Toggling render passes on active scene does not update
render layer nodes in a pinned tree from different scene.

The way these updates work is a nasty legacy hack:
https://developer.blender.org/diffusion/B/browse/master/source/blender/nodes/composite/node_composite_tree.c$277

This function is called //very frequently// by the get_from_context
method. However, this does not get called for pinned node trees, so
when showing a different scene's compositing nodes in the editor they
may not get updated correctly.

Now moved this update call out of get_from_context so it happens in any
case. Will be called no more frequently than before (on every redraw).
Eventually the depsgraph should handle this more precisely, it's just a
simple ID dependency anyway ...
Cycles: add dedicated UV Map node, easier to find and has convenient auto complete.

Fixes T37954.

Reviewed By: brecht, dingto

Differential Revision: https://developer.blender.org/D230
Rename "BLI_cpu.h" to "BLI_system.h" and add to it BLI_getpid() helper.

There is not much sense to have a whole BLI file just to check SSE2 on CPUs...
So idea is to rename it to more generic "BLI_system", and add to it more system-related
utils, like e.g. an include helper for getpid(), which allows to hide unix/windows
internals from rest of the code...

Reviewers: campbellbarton

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D439
Fix T39521: Render with two Blender processes on same computer: compression issues?

We need to salt temp exr filenames with pid, else several instances of Blender rendering
the same scene on same machine and using "Save Buffers" option would use the same files!