BGE: Fix for [#33839] "a logic.joysticks Crashes BGE" reported by Josiah Lane (solarlune).

On a scene change the SCA_JoystickManager gets destroyed which in turn means all of it's joystick instances are released. Since SCA_PythonJoystick was just using a borrowed reference, this allowed the joystick to be freed. Now the joystick's refcount is incremented so that the SCA_PythonJoystick's joystick reference will survive across scene changes.

git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@53733 954f8c5b-7b00-dc11-b283-0030488c597c
replace inline with BLI_INLINE define.


git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@53735 954f8c5b-7b00-dc11-b283-0030488c597c
patch [#33738] Extend Selection option unified and added to few operators
from Sebastian Nell (codemanx), with minor edits


git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@53736 954f8c5b-7b00-dc11-b283-0030488c597c
Packed and generated images support for Cycles

This commit adds support of packed and generated images
for Cycles when using SVM backend. Movies are still not
supported. This changes also doesn't touch OSL which is
much less trivial to adopt for any images which are not
saved to disk.

Implementation details:

- When adding images to Image Manager is now possible
  to mark image as builtin. Builtin images will bypass
  OIIO loader and will use special loading callbacks.

- Callbacks are set by Blender Session and they're
  using C++ RNA interface to obtain needed data (pixels,
  dimensions, is_float flag).

- Image Manager assumes file path is used as reference
  to a builtin images, but in fact currently image
  datablock name is used for reference. This makes it
  easy to find an image in BlendData database.

- Added some extra properties to Image RNA:
  * channels, which denotes actual number of channels
    in ImBuf. This is needed to treat image's pixels
    correct (before it wasn't possible because API
    used internal number of channels for pixels which
    is in fact doesn't correlate with image depth)
  * is_float, which is truth if image is stored in
    float buffer of ImBuf.

- Implemented string lookup for C++ RNA collections
  for cases there's no manual lookup function.

OSL is not supported because it used own image loading
and filtering routines and there's seems to be no API
to feed pre-loaded pixels directly to the library.

Think we'll either need to add some API to support
such kind of feeding or consider OSL does not have
support of packed images at all.

Movies are not supported at this moment because of lack
of RNA API to load specified frame. It's not difficult
to solve, just need to consider what to best here:
* Either write some general python interface for ImBuf
  and use it via C++ API, or
* Write a PY API function which will return pixels for
  given frame, or
* Use bad-level BKE_* call

Anyway, small steps, further improvements later.

Reviewed by Brecht, thanks!

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

Ancient annoying thing for zooming in 2d views: when a view was restricted to keep
aspect ratio, it only allowed vertical or horizontal MMB-drag zooms, depending 
portrait or landscape size of editors. Same for trackpad and magic mouse.

Now vertical zoom drag always works for editors like buttons, nodes.



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

"Pack Blender Libraries" now first does a check if the .blend files are all used
with relative paths. This to prevent bad things happen on unpacking.



git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@53739 954f8c5b-7b00-dc11-b283-0030488c597c
Bug fix #33842

Old bug:

Image Editor, Generated Image, use "Replace" operator failed, was mising correct
signal to handle type change to "From File".



git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@53740 954f8c5b-7b00-dc11-b283-0030488c597c
Patch #33837: ffmpeg1.1 and libav9.1 compatibility update

Patch makes it possible to compile blender with recent ffmpeg
and libav libraries, mainly by getting rid of deprecated API.

Original patch by Campbell Barton with own modifications to
support compilation with older ffmpeg versions.

This patch could break compatibility of FFV1 videos playing
back in older players, mainly because of alpha support changes.
Preserving compatibility with such players became a headache
and think it's high time to get rid of workarounds here.

git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@53741 954f8c5b-7b00-dc11-b283-0030488c597c
code cleanup: style and replace (float)sin, (float)cos with sinf, cosf


git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@53742 954f8c5b-7b00-dc11-b283-0030488c597c
quiet compiler warning with string formatting in CParser::Term


git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@53743 954f8c5b-7b00-dc11-b283-0030488c597c
Big refactor of bl_i18n_utils, switching to an object-based model. Still a bit wip.

Notes:
* Most tools here have been updated, only a few (unused :p ) features should be missing. But some updates are rough for now, and performances are globally worse currently, will address this later (this is only really noticeable when you work over the whole repo, anyway ;) ).
* This update breaks "edit translations" addon, will fix it later, once core (i.e. this module) is considered stable again!

git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@53744 954f8c5b-7b00-dc11-b283-0030488c597c
minor cleanup to debug drawing code in the BGE, dont convert strings to STR_String, only to get them back as regular strings.


git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@53745 954f8c5b-7b00-dc11-b283-0030488c597c
Mac HiDPI ("retina") handling:

OK - so you have this nice crisp screen, and still you want to add extra 
monitors to the laptop! That means Blender should switch back and forth to HiDPI 
modes, when you move a window to another monitor.

This code makes the pixelsize scale factor a window property, and handles
an event when a window moves to another monitor. It then changes the
native pixelsize nicely and refreshes entire UI.

You can also have one Blender window on high, and other on low resolution.

Stretching a Blender window from 1 monitor to the other works too, but that
is Apple magic handling it.



git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@53746 954f8c5b-7b00-dc11-b283-0030488c597c
patch from Harley Acheson to remove multiple inline defines.


git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@53747 954f8c5b-7b00-dc11-b283-0030488c597c
Buildbot: fix for missing CUDA compute after recent changes

Issue was caused by how CUDA devices availability done in Cycles.
Basically, if there's no WITH_CUDA_BINARIES buildtime, nvcc becomes
mandatory dependency.

Since kernels are building in separate target now, this logic broke
a bit.

Perhaps condition in util_cuda shall be changed to be a bit smarter,
but for now just work-around by enabling CUDA binaries when building
Cycles. Made it empty arch list to be sure no kernels will try to
re-compile after cudakernels target is done.

git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@53748 954f8c5b-7b00-dc11-b283-0030488c597c
reduce customdata lookups for UV drawing and tools.


git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@53749 954f8c5b-7b00-dc11-b283-0030488c597c
minor speedup for construct_param_handle_subsurfed() break out of texface_from_original_index() early and dont get the offset for each vertex.


git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@53750 954f8c5b-7b00-dc11-b283-0030488c597c
speedup for EDBM_uv_vert_map_create(), reduce customdata lookups. also remove redundant check for hidden faces.


git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@53751 954f8c5b-7b00-dc11-b283-0030488c597c
BGE: Adding preliminary alpha shadow support for Simple shadow maps. They do not work in the viewport nor do they work for Variance shadow maps.

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