Fix T38645 - Mouse reversed in standalone player with kde

Reviewers: moguri

Differential Revision: https://developer.blender.org/D344
Code cleanup: use lowercase names for vars
MSVC: resolve utf8 encoding issue with some codepages
Fix T38769: Python missing access to text materials
T38763 Fix: avoid NPE When no custom properties are defined
Fix an uncaught exception on OSX, perhaps general with popups
Partial fix for T3817: BGE crashing when using LibNew.

The BGE needs to use BKE_main_new() isntead of calloc for
allocating a Main struct since the threaded depsgraph changes.
OSX/scons: Fix language menu not showing up in prefs:
The languages file was not installed to locale due it has
no extension, using ditto now
NDOF: fix for use with locked offset

- when locked to cursor or object. fallback to orbit and allow zoom.
- correct speed calculation in perspective mode.
NDOF: Auto-Depth preference was used while orbiting
NDOF: various fixes for view3d

- allow zooming when in ortho+user mode
- fix for using VIEW3D_OT_ndof_orbit_zoom when the camera is locked.
- fix for locked camera changing the dist value when used with ndof.
- de-duplicate ndof_pan_zoom and ndof_all operators
Fix for recent changes with NDOF
Fix T38786: Curve unable to make segment
Fix T38756: Regression with vertex slide responding to mouse events
Fix T38795: Mesh Analysis overhang faces show gray
OSX: add debug mesg to bl_locale_pgettext for later indeep investigation
Fix T38800: Setting UV projector caused zero user objects

Don't change user count when setting modifier objects
Support for generic OSL shader parameters in the Cycles standalone XML
reader.

To make a generic OSL shader connectable to other nodes, the parameters
must be declared via "input" and "output" child elements:

  <osl_shader name="tex" src="./osl/stripes.osl">
    <input name="Stripes" type="int" />
    <output name="ColorOut" type="color" />
  </osl_shader>

`name` must be the same as the OSL shader parameter name.
`type` must be one of float, int, color, vector, point, normal, closure,
       string (matching cycles socket types)

Beyond this the OSL script nodes then work just like all other nodes.

OSL parameter sockets can be connected to other cycles nodes:

  <connect from="checker color" to="tex Stripes" />
  <connect from="tex ColorOut" to="floor_closure color" />

They can set default values for the input sockets by attributes of the
main node element:

  <osl_shader name="tex" src="./osl/stripes.osl" Stripes="3" >
    <input name="Stripes" type="int" />
    <output name="ColorOut" type="color" />
  </osl_shader>

This system of specifying custom attributes should probably be changed,
since it can easily create name conflicts and arbitrarily long elements.
But that is a different issue to be solved for all nodes in general.
OSX/scons: cp needs the targetdir to be created ( ditto does it itself ),
changing the order of commands let us use cp again
Image: color grid - correct abs() use with ints