BMesh: minor change to looping
View3D: refactor ED_view3d_draw_offscreen and view3d_main_area_draw_objects

de-duplicate object drawing code between offscreen buffer and regular view3d.

Also skip drawing grease pencil and setting pixelspace when drawing from lamps.
Fix for sculpt mode last-stroke applying obmat twice
Code cleanup: RAS_ILightObject is class, not a struct.

Patch by John Pavel.
Differential Revision: https://developer.blender.org/D459
Slight modification to previous color wheel tweak.

Do not use compat version, we do not have a valid previous value really
to use here.
Code cleanup: quiet warnings & style
LinkList stack macros to swap and pop into a separate stack.
Revert "Fix T39484: Time line: highlighted area for frame range one frame too short."

This reverts own commit e9d733a8bd9ebf803d4afac419670974792a3c0d.

Turns out there is no consensus here, better to open a design task. :/
Split Normals I (1/5): basis for split normals (nearly nothing user-visible here):

* Add a new calcLoopNormals function to DerivedMesh struct, and implement it for CDDM and CCGDM (subsurf).
  EditDerivedBMesh (edit mode DM) only gets a dummy one in this commit.
* Add a tessellated version of CD_LOOPNORMAL layer (CD_TESSLOOPNORMAL), with relevant code to handle it
  (tessellation, rna access, etc.).
* Change auto_smooth options of Mesh (angle now in radian internaly, and toggle is now used to enable/disable
  split normals in DM creation process). Note BI render code is not touched here, hence its behavior regarding
  this option is now incoherent, will be addressed in a separate commit.

Reviewers: campbellbarton

CC: brecht

Differential Revision: https://developer.blender.org/D365
Split Normals I (2/5): Add basic BMesh support of split normals.

* Merely a re-implementation of core split algorithm for BMesh, taking advantage of topological data available.
* This code needs valid loop indices, so added BM_LOOP support to BM_mesh_elem_index_ensure() & co.

Reviewers: campbellbarton

Reviewed By: campbellbarton

CC: brecht

Differential Revision: https://developer.blender.org/D366
Split Normals I (3/5): Add 3Dview shading support of split normals.

Mostly monkey coding in gpu ("modern" VBO drawing) and DM variants ("legacy" drawing) code...

Reviewers: brecht

Reviewed By: brecht

CC: campbellbarton

Differential Revision: https://developer.blender.org/D367
Split Normals I (4/5): Add support of split normals to BI renderer.

Note that this commit completely replaces old behavior of the auto_smooth feature in BI.

Also note that split normals are only handled when no "advanced geometry post-processing" is used
(something like Displace will obviously break it, since it has to re-compute normals after displacement...).

Reviewers: brecht

Reviewed By: brecht

CC: campbellbarton

Differential Revision: https://developer.blender.org/D368
Split Normals I (5/5): Add support of split normals to Cycles.

Idea and code by Brecht, many thanks!

Reviewers: brecht

Reviewed By: brecht

CC: campbellbarton, dingto

Differential Revision: https://developer.blender.org/D369
Compile fix for Windows.
Fix T39430, incorrect color management in paint cursor when using
texture nodes.

Adopt a similar system to texture sampling for painting.
Cleanup:

Naming:

Change pressure to size_pressure, it notes correctly that this value is
updated and expected to be used for size updating only.
Change name of cursor function and since it is used for uv sculpting
only now move to the relevant file. Also cleanup unneeded functionality
from function.

Stroke:

Separate updating of stroke variables to invariants (updated when
stroke->init = false) and variants.
Reduce overhead when sampling texture images for brushes. The tests can
be cached and reused.
OSX/cmake: fix a recently reported dependency issue
Fix for crash un-indenting in the text editor
Cycles: Show Auto Smooth and Angle in the UI, after Split Normals are in.