Fix T41147: Static BVH shading problem
Fix T41079: Solid black render of object with negative scale and smooth shading

In both cases the issue was caused by negative scaled objects with single mesh
users for which scale gets applied when using static BVH.

Since the on-fly normals calculation land normals for such cases weren't flipped
leading them to point to a wrong direction.

Added a special object flag for this, which is a bit of a bummer because now
we've got less bits for real useful things, but this is the only way to get
proper normals without adding more complexity in the on-fly calculations.
Fix for mixup in startup.blend data init when userprefs.blend was missing

Rename UI_init_userdef_factory to BLO_update_defaults_userpref_blend
This closely matches BLO_update_defaults_startup_blend so makes sense for them to be together.
Cleanup: BKE_scene_set_name mixed G.main & bmain arg
Fix T41116: Motion Blur causes random black surfaces on rigged models
Fix T41115: Motion Blur renders Objects Black - But not in Viewport Preview

This actually extends previous fix to normals and makes it all much nicer now.

Worth doing some intense testing, quick one worked just fine but there always
could be some corner cases.
Fix T41156: UILayout.prop_enum() does not observe "text" parameter override

We do have odd behaviors with name and expanded enums, but in this case it did
not made any sense at all! :)

Note the error was not in RNA, but in C UILayout api itself...
Occlusion Query based selection.

This patch creates an interface for selection mechanisms in opengl. This
makes it possible to switch between occlusion query based or select
rendermode based selection transparently.

This is really useful on graphics drivers that do not accelerate the
select rendermode path (some ATI cards are notorious for this, and the
new path is used by default there), since occlusion queries are always
hardware accelerated due to their use in games.

The option can be found under system - selection. Auto just enables
occlusion queries for ATI users while the rest of the options enforce
one of the two methods always.

There is just one known change, previous code enforced nearest bone to
always get selected, even when mouse selecting near the same position, I
couldn't replicate the behaviour though.

patch by me with edits and review by Campbell.

Thanks!
Fix T41157

Was an issue with python interpretation error. Second part of the bug is
fixed by Campbell.
also minor UI tweak for occlusion UI.
Extended mathutils.Vector.orthogonal() to accept a 2D vector.

Reviewer: Campbell Barton

Differential revision: https://developer.blender.org/D668
Bake-API: Test for cyclic node connection

If the active image node contributes to the final material shader
(meaning it's either directly or indirectly connected to an Output Node)
the user will receive an alert about circular dependency.

Similar to what we do for Blender internal the baking will still happen,
but the user will receive the alert which should prevent the image
saving to happen if the result was not intentional.

Core function to check for node output written by Lukas Toenne.

Reviewers: lukastoenne, campbellbarton

Differential Revision: https://developer.blender.org/D673
Buildbot: rework to support branch selection.

Issue with previous code was that branch selected was applied to all repositories.
To be able to control branch on a per-repo basis, we need to use codebases instead.

This commit only enables branch (master/testbuild) and revision selection for master,
we probably do not need this for submodules currently (easy to enable anyway).

Note: tested on local buildbot setup, for linux only (up to build step, have no build env).
Editmesh: Add option to tear boundary vertices when dissolving
Texture painting:

Add ability to select UV layer from the layer panel.
Buildbot: fix to previous commit, to handle svn libs...
Updates/fixes for new UI messages.
Buildbot: more fixes, this time to upload logic.

We do not want testbuild to override 'official' (master) builds!
Revert "Buildbot: more fixes, this time to upload logic."

This reverts commit b1e1646d945d8f7e15c7828a9a5fb0fc4f516f51.

Sorry, was a bit too quick on this one... :/
Buildbot: proper fix for 'testbuild overriding master builds' issue.
initial intersect code
initial isect
intersection script