fix [#36047] Recalculate normals produces faulty normals on certain simple meshes

The mesh in the report had 3 faces-user-edges, resolve the problem by not walking over these edges.
also don't recurse anymore (avoids realloc's).


git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@58065 954f8c5b-7b00-dc11-b283-0030488c597c
edit on own commit r57801, don't check the size of dynamic arrays


git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@58066 954f8c5b-7b00-dc11-b283-0030488c597c
re-arrange space_userpref_keymap, no need to use a subclass here, just import the module and call draw_keymaps().

- making this change now because some addons developers are interested in showing keymap UI in their addons prefs and using the class involved making a fake class instance which isnt needed.


git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@58068 954f8c5b-7b00-dc11-b283-0030488c597c
fix [#36043] Missing Tooltip for Excluded Paths field of Auto Run Python Scripts in User Preferences -> File

also select more/less were flipped for mesh menu compared to everywhere else.


git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@58069 954f8c5b-7b00-dc11-b283-0030488c597c
Fix #36042: Subdividing a cyclic spline shifts start/end points

Issue goes back to 2.4x days at least (but very much likely the
issue is even older). It's caused by subdivision code was starting
to iterate points from previous one, which shifted all the points
by one.

Reshuffled code so now iteration starts from first spline point.

Thanks to Campbell for review and tests! :)

git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@58070 954f8c5b-7b00-dc11-b283-0030488c597c
move normal recalculation into its own source file.


git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@58071 954f8c5b-7b00-dc11-b283-0030488c597c
remove unused normal-recalc flags.


git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@58072 954f8c5b-7b00-dc11-b283-0030488c597c
Partial fix for #36024, don't always reset the node editor tree pointer if the type is undefined. This can happen if the tree type is defined by addon or script, in which case the tree type would be unknown the first time the context is checked, but registered right afterward. Also unknown tree types are handled fine, they just display dummy nodes in red warning color.

git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@58074 954f8c5b-7b00-dc11-b283-0030488c597c
Fix #36024. This part fixes user counting for node editor trees. The user count previously would only work correctly for node trees which are part of material, scene, etc. or linked by group nodes. Any
custom pynodes tree edited directly as library data would get a 0 user count on reload and subsequently not be saved. Now the node space follows the same pattern as the image space: the node tree(s) user
count gets incremented on file load and opening in the editor ensures a real user. This leads to 1 "unreal" user for the editor (dropped on reload), but seems to be the only viable solution atm.

git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@58075 954f8c5b-7b00-dc11-b283-0030488c597c
Fix bevel bugs 34445 and 35109, copying over edge data.

The bugs were about not respecting edge smoothness and
not respecting edge crease.  This change copies the
edge attributes from a beveled edge to the two outside
edges of the bevel.


git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@58076 954f8c5b-7b00-dc11-b283-0030488c597c
fix/improve normal calculation, noticed when checking on the previous bugfix.
- normals depended on the meshes rotation, so you could rotate Suzzane and in some cases one of the eye normals would be flipped.
- normals depended on the meshes placement in relation to the meshes center, now find the outer most face by each face-island center.


git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@58077 954f8c5b-7b00-dc11-b283-0030488c597c
Attempt to fix #35057, disable threading if diameter of the brush
becomes too small. Typically this would happen if the number of buckets
is clipped to the maximum value. This avoids thread overhead.

A better fix might be to do bucket-brush intersection on main thread and
dispatch threads to process bucket hits as they become available. This
way only one thread at most would end up being used in such cases
anyway. A better task scheduler is needed for that though, leaving for
after GSOC.

git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@58079 954f8c5b-7b00-dc11-b283-0030488c597c
Fix #35960, #36044: blender internal viewport rendering crash while editing data.
Now the viewport rendering thread will lock the main thread while it is exporting
objects to render data. This is not ideal if you have big scenes that might block
the UI, but Cycles does the same, and it's fairly quick because the same evaluated
mesh can be used as for viewport drawing. It's the only way to get things stable
until the thread safe dependency graph is here.

This adds a mechanism to the job system for jobs to lock the main thread, using a
new 'ticket mutex lock' which is a mutex lock that gives priority to the first
thread that tries to lock the mutex.

Still to solve: undo/redo crashes.

git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@58080 954f8c5b-7b00-dc11-b283-0030488c597c
Fix #36059: region overlap did not show scopes overlapping in the image editor.
It's only enabled for some particular regions, this one makes sense to show.

git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@58081 954f8c5b-7b00-dc11-b283-0030488c597c
Fix #35979, #35937, #35739: undo crashes and missing updates with blender
internal viewport rendering. Lots of tweaks here, mainly:

* Stop 3D viewport render and free database before undo.
* Accumulate update flags rather than replace them each time it rerenders, to
  avoid previous updates getting lost.
* Don't check against Render struct view parameters for changes, those are set
  in the job thread which might not run before the next update call.

git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@58082 954f8c5b-7b00-dc11-b283-0030488c597c
Fix #36063: cycles 3D viewport was incorrectly influenced by blender internal
material halo settings.

git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@58083 954f8c5b-7b00-dc11-b283-0030488c597c
Fix #35969: blender internal and cycles not updating mesh while in edit mode.
Patch for blender internal made by Campbell.

git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@58084 954f8c5b-7b00-dc11-b283-0030488c597c
move keymap ui into modules, its not loaded on startup anymore.


git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@58085 954f8c5b-7b00-dc11-b283-0030488c597c
Fix #36064: cycles direct/indirect light passes with materials that have zero
RGB color components gave non-grey results when you might no expect it.

What happens is that some of the color channels are zero in the direct light
pass because their channel is zero in the color pass. The direct light pass is
defined as lighting divided by the color pass, and we can't divide by zero. We
do a division after all samples are added together to ensure that multiplication
in the compositor gives the exact combined pass even with antialiasing, DoF, ..

Found a simple tweak here, instead of setting such channels to zero it will set
it to the average of other non-zero color channels, which makes the results look
like the expected grey.

git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@58086 954f8c5b-7b00-dc11-b283-0030488c597c
fix [#35806] Unable to check "Correct UVs" option in "Loop Cut and Slide" (Keymap Editor)


git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@58087 954f8c5b-7b00-dc11-b283-0030488c597c