Fix #31747, broken image sequence loading after r47432.

The image file name function was updating the iuser->framenr using a supposed cfra parameter. However, the actual cfra is unknown when loading movies or sequences, so the iuser->framenr value itself was passed in its place, leading to incremental addition of the iuser frame offset. Removed the cfra parameter altogether from the image path function. This should instead be done separately if necessary, it's not an inherent part of constructing the image file name.

git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@47657 954f8c5b-7b00-dc11-b283-0030488c597c
Fix for compositor image node draw function. The image user pointer needs to be constructed explicitly from the node storage pointer.

git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@47658 954f8c5b-7b00-dc11-b283-0030488c597c
Missed NULL-pointer checks in poll some functions

git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@47659 954f8c5b-7b00-dc11-b283-0030488c597c
fix for un-initialized memory use for modal inset/bevel.


git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@47660 954f8c5b-7b00-dc11-b283-0030488c597c
Fix for Tile group nodes with internally unconnected outputs, this was crashing due to missing constant value operations for such outputs. The SocketProxyNode now checks connection of the input socket on conversion, so this also simplifies usage of proxy nodes quite a bit.

git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@47662 954f8c5b-7b00-dc11-b283-0030488c597c
code cleanup: rename flag --> dflag (draw flag), since this is overly generic name and was passed about to many functions.


git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@47664 954f8c5b-7b00-dc11-b283-0030488c597c
mango request
- optionally display the histogram as lines (not filled areas).
- expand the enum for faster access.
- keep the sample line displayed after doing the line sample (running again clears).


git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@47667 954f8c5b-7b00-dc11-b283-0030488c597c
Applied and completed a compositor patch by Brecht to use signalling and waiting in scheduling and worker threads instead of continuous loops with sleep times. This should help reduce unnecessary wait times in Tile.

git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@47671 954f8c5b-7b00-dc11-b283-0030488c597c
Synchronize changes with tomato branch



git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@47672 954f8c5b-7b00-dc11-b283-0030488c597c
mango request - add alpha to histogram & sample line.


git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@47674 954f8c5b-7b00-dc11-b283-0030488c597c
Woops, some diff file was accidentally commited.



git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@47676 954f8c5b-7b00-dc11-b283-0030488c597c
change RNA_struct_find_function to accept a type rather then a PointerRNA, add a check duplicate functions are not defined.


git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@47680 954f8c5b-7b00-dc11-b283-0030488c597c
Fix #31778. BKE_image_user_frame_calc can be called with iuser==NULL in some circumstances now, so needs to check that.

git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@47682 954f8c5b-7b00-dc11-b283-0030488c597c
style cleanup: use capital camel case names for typedef's


git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@47683 954f8c5b-7b00-dc11-b283-0030488c597c
Support for per-track Grease Pencil datablocks for motion tracking

Originally was needed to reach easy way of defining masks used for tracking
(do eliminate textures which doesn't belong to feature when tracking.

Implemented as alternative to GP datablock for clip and added switch between
per-clip and per-track GP datablocks -- internal limitations of GP doesn't
allow to display all GP datablocks easily.  So either you see.edit GP associated
with clip or with track.

GP strokes associated with track are relative to track's position, following
tracks during tracking and could be shared between several tracks.

Masking code presents in libmv and there's rasterizer of GP datablocks for
masks in blender's tracking module, but they still need to be glued together.

Some documentation cound be found at this page:

http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Motion_Tracker#Grease_Pencil

git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@47684 954f8c5b-7b00-dc11-b283-0030488c597c
Initial Ceres integration into Blender

Currently only put sources of Ceres library into extern/libmv/third_party and
setup CMake and SCons building systems.

Integration details:

- Even CMake build files are not re-used from Ceres's trunk: they're using some
  automatic stuff detection like glog, pthreads, protobuf and so and it's not
  so clear how to re-use that files without modifications.
  And IMO it's easier if build files are getting re-generated automatically to
  match Blender-specific setup rather than keeping changes made locally in
  Blender in sync when re-bundling Ceres library. Especially in case when it's
  already needed to support SCons build system.
- Integrated only actual sources, all tests were stripped. Probably it'll be nice
  to have them, but they'll need clear integration with current module test stuff
  in Blender.
- Suitesparse was disabled. It'll help a lot having it, but there are some difficulties
  making cholmod working fine on windows. Would be added in future
- collections_port.cc was also stripped. It's not used by Ceres's upstream and
  it gives compilation error (undefined uint32 -- looks like namespace issue).
- Currently all schur eliminators are included. Not sure if it makes sense,
  also not sure if it makes sense having them switchable on and off -- IMO better
  to have single configuration which works and does not require special tweaks
  after everything was set up.

To bundle updated version of Ceres:
- Go to extern/libmv/third_party/ceres folder
- Run ./bundle.sh

This will checkout fresh Ceres snapshot of Windows branch (which is currently
most interesting from integration into Blender POV), apply all patches listed
in patches/series and copy needed files into Blender's working copy. This will
also re-generate CMake/SCons build rules.

If you'll need extra files from Ceres repository which are not present in
Blender, you'll need to copy them manually and then run ./mkfiles.sh from
extern/libmv/third_party/ceres folder which will update list of files used
by Blender.

Thanks to Leir Mierle and Sameer Agarwal (and all others who helped developing
Ceres) this library and thanks to Keir Mierle with help integrating it into Blender!

git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@47685 954f8c5b-7b00-dc11-b283-0030488c597c
Planar tracking support for motion tracking
===========================================

Major list of changes done in tomato branch:

- Add a planar tracking implementation to libmv
  This adds a new planar tracking implementation to libmv. The
  tracker is based on Ceres[1], the new nonlinear minimizer that
  myself and Sameer released from Google as open source. Since
  the motion model is more involved, the interface is
  different than the RegionTracker interface used previously
  in Blender.

  The start of a C API in libmv-capi.{cpp,h} is also included.

- Migrate from pat_{min,max} for markers to 4 corners representation

  Convert markers in the movie clip editor / 2D tracker from using
  pat_min and pat_max notation to using the a more general, 4-corner
  representation.

  There is still considerable porting work to do; in particular
  sliding from preview widget does not work correct for rotated
  markers.

  All other areas should be ported to new representation:

  * Added support of sliding individual corners. LMB slide + Ctrl
    would scale the whole pattern
  * S would scale the whole marker, S-S would scale pattern only
  * Added support of marker's rotation which is currently rotates
    only patterns around their centers or all markers around median,

    Rotation or other non-translation/scaling transformation of search
    area doesn't make sense.

  * Track Preview widget would display transformed pattern which
    libmv actually operates with.

- "Efficient Second-order Minimization" for the planar tracker

  This implements the "Efficient Second-order Minimization"
  scheme, as supported by the existing translation tracker.
  This increases the amount of per-iteration work, but
  decreases the number of iterations required to converge and
  also increases the size of the basin of attraction for the
  optimization.

- Remove the use of the legacy RegionTracker API from Blender,
  and replaces it with the new TrackRegion API. This also
  adds several features to the planar tracker in libmv:

  * Do a brute-force initialization of tracking similar to "Hybrid"
    mode in the stable release, but using all floats. This is slower
    but more accurate. It is still necessary to evaluate if the
    performance loss is worth it. In particular, this change is
    necessary to support high bit depth imagery.

  * Add support for masks over the search window. This is a step
    towards supporting user-defined tracker masks. The tracker masks
    will make it easy for users to make a mask for e.g. a ball.

    Not exposed into interface yet/

  * Add Pearson product moment correlation coefficient checking (aka
    "Correlation" in the UI. This causes tracking failure if the
    tracked patch is not linearly related to the template.

  * Add support for warping a few points in addition to the supplied
    points. This is useful because the tracking code deliberately
    does not expose the underlying warp representation. Instead,
    warps are specified in an aparametric way via the correspondences.

- Replace the old style tracker configuration panel with the
  new planar tracking panel. From a users perspective, this means:

  * The old "tracking algorithm" picker is gone. There is only 1
    algorithm now. We may revisit this later, but I would much
    prefer to have only 1 algorithm. So far no optimization work
    has been done so the speed is not there yet.

  * There is now a dropdown to select the motion model. Choices:

        * Translation
        * Translation, rotation
        * Translation, scale
        * Translation, rotation, scale
        * Affine
        * Perspective

  * The old "Hybrid" mode is gone; instead there is a toggle to
    enable or disable translation-only tracker initialization. This
    is the equivalent of the hyrbid mode before, but rewritten to work
    with the new planar tracking modes.

  * The pyramid levels setting is gone. At a future date, the planar
    tracker will decide to use pyramids or not automatically. The
    pyramid setting was ultimately a mistake; with the brute force
    initialization it is unnecessary.

- Add light-normalized tracking

  Added the ability to normalize patterns by their average value while
  tracking, to make them invariant to global illumination changes.

Additional details could be found at wiki page [2]

  [1] http://code.google.com/p/ceres-solver
  [2] http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Motion_Tracker

git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@47686 954f8c5b-7b00-dc11-b283-0030488c597c
Commit patch from Stephan Kassemeyer sent to ML

This patch aims to solve unaligned operation assert
happens in Eigen library.

This is short-term solution which in fact shall be reverted
as soon as real solution would be added to Ceres. Meanwhile
this should be acceptable to have for a while.

git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@47687 954f8c5b-7b00-dc11-b283-0030488c597c
Bump subversion so iteration through all markers would happen
only for old files which actually needs to be ported to 4 corners
representation.

git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@47688 954f8c5b-7b00-dc11-b283-0030488c597c
Fix compilation without libmv

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