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
Fixes localview and view-local layers

- Drawing grease pencil fail without scene-lock.
- Converting to curve failed without scene-lock.
- Outliner drag into viewport failed with local-view.
Hacky fixes can apply to more then one compiler.
TODO: really get rid of any and all bare #include <windows.h> in
the codebase in favour of central BLI_winstuff.h.
Better fix for T41464: Material Boundary bug in Freestyle.

The problem addressed here is that there was no mean to check if an iterator
points the last of the elements being iterated over.  Such checking is necessary
to reliably dereference the iterator (i.e., calling the operator*() method of the
underlying C++ iterator object).

Now Interface0DIterator and StrokeVertexIterator have an .at_last property
to check if an iterator points the last element.  Using this new API feature,
the present commit partly reverts the previous commit rBeb8964fb7f19 to
better address T41464.

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

Author: flokkievids (Folkert de Vries)

Reviewed by: kjym3 (Tamito Kajiyama)
Fix T41682.

Bring back shading in texture painting.

This works now but it uses 3 texture units instead of two. Most GPUs of
DirectX 8 (OpenGL 1.4 should cover that) functionality even should have
those, but some old GPUs might not work with that. In any case, I hope
we will be moving to OpenGL 2.1 requirement soon anyway where 4-8
texture units are usually the norm.
Fix erase alpha not having any output on viewport after last commit.
Add missing update tag to material when adding texture slots.
Cleanup: Use function call and delete obsolete comment.
Fix set black/white points didn't operate in the linear space
Fix FileSelector drawing missing some files
Fix FileSelector dividers disappearing

Was clamped to short
Skip distortion of the grease pencil associated with the track
Fix T41695: No label in UV/Image editor waveform mode

That's indeed rather creepy to show only icon for the enum where
all the elements have the same exact icon.
Fix T41691: Blender-internal crash (counting edges)