Fix T40445: Disabled modifiers prevent cage edit mode.

No valid reason to make non-mapping modifiers break edit cage,
when they are disabled in 3DView/edit mode!
Fix T37618 Bevel mismatched offsets and bad profile plane.

Used a different technique to resolve "impossible" offset cases
that makes more consistency. Also changed the plane in which
the profile lies for the case with only one beveled edge and
more than 3 other edges.
Fix EdgeSlide behavior with boundry edges

- would flip in opposite directions sometimes on the same loop
- some vertices would get directions from adjacent vertices
Fix incorrect flag checks for project-paint face winding
Fix uninitialized var in recent change to cursor drawing
Add debug define for timing polyfill
Cycles: Small optimization for scenes without Transparent Shaders, helps a few percent.

Differential Revision: https://developer.blender.org/D570
Code cleanup, unused variables and comments.
Fix a typo in a comment.
Fix T40315: Boolean modifier with Freestyle edges.

The helper function `make_freestyle_edge_mark_hash()` was referring to the
original mesh to determine Freestyle edge marks for individual derived mesh edges.
This is no longer necessary now that derived meshes deliver CD_FREESTYLE_EDGE
and CD_FREESTYLE_FACE layers of their own.  The reference of the original mesh
was also inappropriate since the edges coming from one of the operands of a boolean
modifier don't have proper CD_ORIGINDEX values but ORIGINDEX_NONE's.

Many thanks to Sergey Sharybin for patch contributions and discussions.
Sync changes with buildbot server
Fix T40447: Creating Rigid Bodies is rejected for meshes without polys.

This check prevents using empty (no faces) meshes as rigid bodies.
While the idea makes sense, it also prevents using modifier-constructed
meshes, where faces are added only by the modifiers.

Further the check is very easy to circumvent, by removing faces after
making the rigid body, or by assigning a different mesh datablock
afterward.

Suggested by Fabian Emmes (@der_fab).
Fix T40459: Gauss table can be NULL when ending the blur node operation,
which must not be passed to MEM_freeN.
Fix T40342 smooth shading flag in dyntopo does not work under MSVC.

Classic case of integer flag AND-ing result passed to boolean and
failing.
Freestyle: Minor fixes.

- Fixed a typo in docstring.
- Replaced int with boolean constants.
- Updated lists of base classes for used-defined unary 0D/1D functions.
Keep active layer when setting up tracking scene

When you hit "setup tracking scene" in MCE, the active layer usually switches
to the layer where the ground has been created, thus he shadow layer.

New objects are created or appended on that layer which means they will be
default be rendered as shadows only. This behaviour requires muscle memory
and is confusing for new users. This patch is changing the behaviour in a
way that the active layer is remembered from before setting up the scene.

Patch by gottfried, thanks!

Reviewers: sebastian_k, sergey

Differential Revision: https://developer.blender.org/D574
Fix possible issues when blender is compiled without Cycles
Improve behavior of Setup Tracking Scene when default nodes exists in the tree
Fix T40457: Subsurf modifier with Freestyle edges

You can't use ORIG index as an index to copy CD from source DM.
Fix compilation error non non-linux architectures