Cycles: Always assign the proper value for volume bounces.

I don't see a reason not to do this, and this also fixes update problems when 3D View rendering is running (no volume shader), and then a volume shader gets added.
Bake-API: more MEM_callocN replacements by MEM_mallocN

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D561
Fix T41657: Text Editor highlight bug when a very long line scrolls

Based on patch by randon (Dun Liang), but no need to recompute lengths here, we already have the info.
T41650

Typo in material localization code.
Cleanup: Silence compiler warning.
Fix T41620

Issue here is that indices of edges will be incorrect when index of
vertices forming the edge is 3-0 or 2-0.

There are still issues here at uv edges where seam polygons intersect
each other but to solve that we need a better pass that detects uv edges
and pushes polygons along the "normal" of the edge instead of scaling
the polygon itself.
Support more object types scene-scale (on creation)

- lamp
- camera
- font
- empty & effector

Also fix inconsistency with apply transform
(modified shape-keys for meshes but not curve/lattice)
Cycles: Rebuild BVH from scratch if loading cache failed

Before this Cycles used to try using the cache even so it knew for the
fact that reading it from the disk failed. This change doesn't make it
more stable if someone will try to trick Cycles and give malformed data
but it solves general cases when Blender crashed during the cache write
and will preserve rendering from crashing when trying to use that partial
cache.
Expose preview setting operators on menus for sequencer and timeline
(could not find them anywhere before)
Fix opencollada not compiling after recent changes.
Cleanup: Event defines -> enums.

Also made all event type values as hexadecimal (mixing decimal, hexa and char values
is a nice way to make mistakes)!
Events: Fix ISKEYBOARD macro seeing INPUTCHANGE, WINDEACTIVATE and TIMER events
as keyboard ones!!!

Note: better solution would be to move those 'internal' events to the 0x5xxx area,
but need to talk with the team to be sure this won't break something first.
Fix T41665, stroke jittering used when setting the clone cursor
BMesh: report errors for invalid operator use

- invalid htype's into a slot
- duplicate htype's args to BMO_op_vinitf
Fix editmesh-connect with hidden geometry

- ignore hidden faces & verts
- when cutting a pair, select edges co-linear to the cut.

Also support creating a buffer from hidden elem's even if BMO_FLAG_RESPECT_HIDE is enabled.
(if the hflag used includes BM_ELEM_HIDDEN).
Fix editmesh-connect with adjacent vert selection

The result of running connect wasn't deterministic when adjacent vertices selected.
Fix second part of T41068 -- reflection mapping was wrong

Few things:
- reflect() takes arguments in this order: N, I, it was swapped
  in the previous code for some reason.

- Normal and view vectors are to be normalized. For the view
  vector we're now using shade_view() in order to deal with the
  ortho camera. However, Cycles does not support ortho camera
  for reflection, but this is easy to do in a separate commit.

- Reflection vector is to be in the world space. Kudos to
  Antony Riakiotakis for figuring this out!
Support window coordinates in cycles nodes.
A bit of a code cleanup in GLSL shader
Hacky fix for cleanup rBc23733d290c095ab77310b55c75293465891d5b8