Fix T38466: F12 / ctrl F12 shortcuts not showing in Render menu.

This is tricking the keymap system a bit to make it match, this use_viewport
option has no effect when invoked from the info space.
PyAPI: mathutils.Vector.cross now works for 2d vectors (returns a float)

also fixed crash when running on large vectors (raises exception now)
Fix T38478: pin panel, then ctrl+click to collapse others incorrectly unpinned panels.
Fix T38476: incorrect hair draw type after editing particle system in edit mode.
Fix T38340 and T38473: fixed Scene pointers in Composite and Defocus nodes don't get updated based on context.

As discussed in T38340 the solution is to use the current scene from
context whenever feasible.

Composite does not use node->id at all now, the scene which owns the
compositing node tree is retrieved from context instead.

Defocus node->id is made editable by the user. By default it is not set,
which also will make it use the contextual scene and camera info.
The node->id pointer in Defocus is **not** cleared in older blend files.
This is done for backward compatibility: the node will then behave as
before in untouched scenes.

File Output nodes also don't store scene in node->id. This is only needed
when creating a new node for initializing the file format.

Reviewers: brecht, jbakker, mdewanchand

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D290
Scanfill: malloc arrays and zero init members
Scanfill: avoid converting int<>intptr_t for displist indices
Fix T36769: fluid sim modifier can crash blender

Crash only happened when the number of openmp threads were greater than the resolution.
Quiet warning
Scanfill: use poly_nr as an index rather then index + 1
Fix compilation
Building elbeem without openmp failed
Fix player stubs after change in compositor
Add debug print to ID update tagging
Code cleanup: replace magic constants with more verbose bitnames
Fix T35247: Particle texture behaves incorrectly after changing the number of particles

Root of the issue goes to the order of particle initialization which does
texture evaluation (which does depend on particle coordinate) and particle
birth coordinate calculation. So basically what happened is:

* Changing number of particles re-allocated all the particles,
  which sets their coordinate to (0,0,0)
* Texture evaluation used this non-initialized coordinate
* Coordinates were calculated for particles

Reshuffled code a bit so now texture evaluation happens after particles.
coordinate calculation. Basically moved texture evaluation to particle
reset function. Reset happens after initialization anyway and it does
know particle coordinates. Also, if reset is being called without init
then it's also kind of logical to re-evaluate texture because particle
coordinates might change.
Fix T35810: Texture faces display white in 3D view, when used as a Particle Object

This in fact seems some kind of video driver limitation, because it worked fine
on windows but failed on linux here. The guess is that textures doesn't always
work on display lists, or we simply do have some wrong OGL context somewhere.

This is a workaround for until bigger viewport draw refactor is done (as Brecht
mentioned display lists are deprecated in new OGL anyway).
Fix T35328: Disk caches of multiple particle systems on a single object overwrite each other

It was intended to work actually using particle cache's stack index
but this index might have been calculated incorrect in special case:

* With default cube scene, add particle system to the cube
* Add disk cache to the particle system
* Save file and reload it
* Add another particle system and enable disk cache

This would lead to two point caches with the same stack index of zero.
This happened because point cache indices list wasn't stored in the
.blend file so once you've reload your file blender doesn't know anything
about number or point caches used.

And what was even more confusing is that point cache indices list was
trying to be load from the file, but this failed because it wasn't in the
file.

This commit solves the root of the issue which is ability of producing
.blend file with two point caches using the same disk cache. This is
done by making it sure that point cache indices list is stored in the
.blend file. And also made it so disabling disk cache will tag it to
recalculate stack index.

Old broken files wouldn't magically start working, but fixing them is
rather simple manually by toggling Disk Cache option.

Reviewers: lukastoenne, brecht

CC: sergof

Differential Revision: https://developer.blender.org/D286
Cycles Network rendering, remove some exception throwing, replace with saner error handling

This patch adds a network_error() function more alike how other devices handle error's

- it adds a check for errors on load_kernels to make sure we do not crash if rendering without a server.
- it uses the non throwing variation of boost::asio::read.

Reviewers: brecht

Reviewed By: brecht

CC: brecht

Differential Revision: https://developer.blender.org/D86
Fix lamps drawing only partially in OpenGL render.

It should draw lamps entirely, this happened due to hack to hide object centers.