Fix T39635: Crash convening curve to mesh
Code cleanup: remove paranoid NULL check
Matcaps.

Instead of setting color every time, just set it on material enable.
Handles all cases of surfaces. Thanks to Campbell for pointing out!
Mempool: delay allocating an initial chunk, its not always used
BMesh: minor speedup, avoid calloc+assign, assign all members instead
BMesh: bmesh_sfme now initializes the copy
Mempool: simplify memory chunk list building
DerivedMesh: replace edgehash with edgeset
Dyntopo: replace GHash with GSet, saves some memory
GHash/Edgehash: make simple iterator checking functions inline.

also remove NULL check, only a few areas made use of this.
Cycles-Bake: 1st round of code-review

For the individual commits:
https://github.com/dfelinto/blender-git/tree/bake-cycles-0.1

Documentation:
http://wiki.blender.org/index.php/User:Dfelinto/CyclesBaking

Open Issues:
https://github.com/dfelinto/blender-git/issues?labels=bake-cycles&page=1&state=open

Supported Features:
------------------
* Margin
* User Interface (no more need to fiddle with Python scripts)
* Selected to Active
* Cage Extrusion
* Custom Cage
* File Formats (save as PNG, JPG, OpenEXR, Tiff, Targa and BMP)
* Color Depth/Mode: RGB/RGBA - 8/16/32
* Normal swizzle (change the axis that gets mapped to RGB)
* Normal space (save as tangent, world, object)

Supported Passes:
-----------------
Data Passes
* Normal
* UV
* Diffuse/Glossy/Transmission/Subsurface/Emit Color

Light Passes
* AO
* Combined
* Shadow
* Diffuse/Glossy/Transmission/Subsurface/Emit Direct/Indirect
* Environment

Implementation Notes:
---------------------
Baking for Cycles was implemented in two fronts:

In Blender we created a new operator that will try to bake using the current engine.
So far only Cycles has this implemented, but other engines (even the Blender Internal) could go through this API/pipeline.
The operator is responsible for the image handling, normal space
transformation, populate the UVs, loop over faces, ...

In Cycles we extended the baking functionality available for environment
and displacement for the other render passes (not all of them since some
of them doesn't make sense for baking).

The API is simple. Blender send a populated array of BakePixels to the
renderer, and gets back an array of floats with the result.

BakePixel is tjhe following struct:

struct BakePixel {
    int primitive_id;
    float u, v;
    float dudx, dudy;
    float dvdx, dvdy;
};
Cycles-Bake: divide the in/direct passes by the color passes

Otherwise the in/direct passes are 'contamined' by the texture/color of
the faces.
Cycles-Bake: fix rna warnings
Cycles-Bake: prevent crash when closing Blender
Cycles-Bake: Using aa_samples instead of samples
Cycles-Bake: [review] style cleanups (Python)
Cycles-Bake: [review] style cleanups (Cycles)
Cycles-Bake: [review] style cleanup
Cycles-Bake: [review] store u and v as uv[2]
Cycles-Bake: [review] float promotion cleanup, store swizzle sign as float