Fix for Freestyle stroke rendering performed for each SSS material.
Code cleanup and structural improvements for dupli generation.

This is a first step toward improving our dupli system. It implements a more
generic way of treating the various methods of dupli generation by adding a few
structs:
  * DupliContext holds a number of arguments commonly used in the recursive dupli functions and defines a recursion state for generating sub-duplis (nested groups). It also helps to prevent bloated argument lists.
  * DupliGenerator is a type struct that unifies the different dupli creation methods (groups, frames, verts, text chars, faces, particles). (As with context there should be no overhead from pointer indirection because everything can still be inlined inside anim.c)

Beside making the code more easily understandable this implementation should
also help to avoid weird side effects from custom matrix hacks by defining
clearly what a generator does. The DupliContext is deliberately made const, so a
generator can not simply add hidden matrix or flag modifications that are hard
to track down.

The result container for the generated duplis is stored in the context instead
of being passed explicitly. This means the generators are oblivious to the
storage of duplis, all they need to do is call the make_dupli function. This
will allow us to implement more efficient ways of storing DupliObject instances,
such as MemPools or batches. These can be implemented alongside the current
ListBase so we can improve dupli bottlenecks without having to replace each and
every dupli use case at once.

Differential Revision: https://developer.blender.org/D189
Fix for dupli's using float for id's and signed/unsigned conversion

Enable strict flags exposed some strange issues.
Fix T38128: snapping to node border uses node centers.

This was caused by recent change to transform locations being changed
to the upper-left corner of nodes (rBa857a6f).
Fix T38303: same names with different case sorted unpredictable in the file browser.

The string comparison was in lower case, so the same strings with different case
were considered the same which can make qsort give different results on each
sort since it's not a stable sort. Now take case into account in comparison.
Fix T38300: Bevel didn't always reconstruct faces properly.

With new subdivision method for making the vertex mesh, we always
subdivide the edges between the new vertices around a vertex
(we used to not subdivide edges between two non-beveled edges).
This fixes a bug related to this change.
Fix T38302: sequencer animation data lost in original scene when copying scene.
Fix T38303: Inconsistent sorting of names in Append/Link view
Revert "Fix T38303: Inconsistent sorting of names in Append/Link view"

This reverts commit ba49d7e0e338b2b85cc162d265280bac8dc859cc.
Fix T38298: crash saving float image with 3 channels from exr to png/jpeg.
Fix T38265: transferring vertex weights from an object with modifiers not working.

It was using the modified mesh for the vertex coordinates, and the unmodified mesh
for the vertex weights, which can't work and crashed in some cases, now it used the
modified mesh for both.

Perhaps an option should be added to indicate if you want to transfer from the
unmodified mesh or transfer to the modified mesh, but I think this fix makes it
works as intended when this was implemented.
Enable XDND on FreeBSD
Replace XOR swapping by default ("naive", with extra var) one.

Ref: http://en.wikipedia.org/wiki/XOR_swap_algorithm, modern compilers/CPUs are much more efficient with "naive" algo than XOR one.
Doubled check, for me in an optimized build, XOR is several times slower than naive algo.
Timing macros: remove the (void)0 at the end of TIMEIT_BLOCK_INIT,
it prevents declaring/using more than one of these timing blocks in a same code block
(C rule, no var declaration and code mixing)...
Fix T38229: 3D view shadeless display not supported with GLSL, so hide in UI.
Optimize tessellation code (min 20% better, up to 300% with some CD layers to tessellate).

The main idea is to store (during tessellation) or recreate (during tessdata update) a tessfaceverts-to-loops mapping, and then update all tessdata
in one pass, instead of calling `BKE_mesh_loops_to_mface_corners` repeatedly for all tfaces!

Differential Revision: https://developer.blender.org/D226

Reviewed by Campbell, thanks a lot!
Minor cleanup from latest coverity checks - if we have a previous curve, we can safely assume we also have a previous stroke!

Better to assert here, than checking this randomly...
Code Cleanup: use bool for return values and correct comments

also remove CDDM_Check, theres no need for it.
Code Cleanup: reduce sign conversion
Add missing struct Lattice declaration.