Commit Graph

44 Commits

Author SHA1 Message Date
Sergey Sharybin 24ce60cfe4 Merge plane track feature from tomato branch
This commit includes all the changes made for plane tracker
in tomato branch.

Movie clip editor changes:

- Artist might create a plane track out of multiple point
  tracks which belongs to the same track (minimum amount of
  point tracks is 4, maximum is not actually limited).

  When new plane track is added, it's getting "tracked"
  across all point tracks, which makes it stick to the same
  plane point tracks belong to.

- After plane track was added, it need to be manually adjusted
  in a way it covers feature one might to mask/replace.

  General transform tools (G, R, S) or sliding corners with
  a mouse could be sued for this. Plane corner which
  corresponds to left bottom image corner has got X/Y axis
  on it (red is for X axis, green for Y).

- Re-adjusting plane corners makes plane to be "re-tracked"
  for the frames sequence between current frame and next
  and previous keyframes.

- Kayframes might be removed from the plane, using Shit-X
  (Marker Delete) operator. However, currently manual
  re-adjustment or "re-track" trigger is needed.

Compositor changes:

- Added new node called Plane Track Deform.

- User selects which plane track to use (for this he need
  to select movie clip datablock, object and track names).

- Node gets an image input, which need to be warped into
  the plane.

- Node outputs:
  * Input image warped into the plane.
  * Plane, rasterized to a mask.

Masking changes:

- Mask points might be parented to a plane track, which
  makes this point deforming in a way as if it belongs
  to the tracked plane.

Some video tutorials are available:
- Coder video: http://www.youtube.com/watch?v=vISEwqNHqe4
- Artist video: https://vimeo.com/71727578

This is mine and Keir's holiday code project :)
2013-08-16 09:46:30 +00:00
Sergey Sharybin 4863feb956 Changes to mask evaluation
- BKE_mask_update_scene was only used with do_newframe=FALSE,
  removed this argument.

- Made it so BKE_mask_update_scene is able to handle LIB_ID_RECALC_DATA
  case. Namely, if mask ID is tagged for data update it means shapekeys
  will be re-evaluated (as if do_newframe=true).

  If mask id only tagged for LIB_ID_RECALC, then no shapekey evaluation
  happens (same as it used to behave before).

  This means, doing DAG_id_tag_update(&mask->id, OB_RECALC_DATA) will
  lead to shapekeys re-evaluation which is really needed in such
  operators as clearing shapekeys (and cleaning shapekeys which is
  in tomato branch yet).

  This is a bit silly to use OB_RECALC_DATA sine mask is not an OB,
  but could not see better way to do it now.

This fixes missing mask re-evaluation after clearing shapekey,
would expect no other functional changes.
2013-06-10 13:07:02 +00:00
Sergey Sharybin 80a6654a81 Masks api improvements
- Added MaskLayer.splines.new (which creates single spline
  and returns pointer to it).
- Added MaskLayer.splines.remove() to remove given spline.
- Added MaskSpline.points.new() which creates new point
  in the origin and returns pointer to it.
- Added MaskSpline.points.remove() to remove given point.
2013-05-23 10:50:55 +00:00
Campbell Barton 8238cd6992 use unsigned int, for mask rasterizer. 2013-05-08 12:54:47 +00:00
Sergey Sharybin fdfa5910b5 Fix #34040: Moving Normal Node with enabled Cycles Material Preview crashes
Issue was caused by couple of circumstances:

- Normal Map node requires tesselated faces to compute tangent space
- All temporary meshes needed for Cycles export were adding to G.main
- Undo pushes would temporary set meshes tessfaces to NULL
- Moving node will cause undo push and tree re-evaluate fr preview

All this leads to threading conflict between preview render and undo
system.

Solved it in  way that all temporary meshes are adding to that exact
Main which was passed to Cycles via BlendData. This required couple
of mechanic changes like adding extra parameter to *_add() functions
and adding some *_ex() functions to make it possible RNA adds objects
to Main passed to new() RNA function.

This was tricky to pass Main to RNA function and IMO that's not so
nice to pass main to function, so ended up with such decision:

- Object.to_mesh() will add temp mesh to G.main
- Added Main.meshes.new_from_object() which does the same as to_mesh,
  but adds temporary mesh to specified Main.

So now all temporary meshes needed for preview render would be added
to preview_main which does not conflict with undo pushes.

Viewport render shall not be an issue because object sync happens from
main thread in this case.

It could be some issues with final render, but that's not so much
likely to happen, so shall be fine.

Thanks to Brecht for review!
2013-02-05 12:46:15 +00:00
Campbell Barton aa364bb366 fix incorrect macro for mask handle selection checking. 2012-09-15 06:10:48 +00:00
Campbell Barton e75f5c8208 quiet -Wmissing-prototypes warnings, and enable this warning by default for C with gcc.
helps for finding unused functions and making functions static, also did some minor code cleanup.
2012-09-15 01:52:28 +00:00
Campbell Barton 883117077b fix for 2 crashes freeing masks
- freeing a mask from RNA BKE_libblock_free() twice on the mask.
- loading a new blend file would only free the mask and not unlink it from nodes - it would access freed memory.
2012-09-14 01:15:08 +00:00
Campbell Barton 05755d307a fix [#31946] Masking doesn't respect pixel ratio 2012-09-13 05:29:38 +00:00
Campbell Barton d75a66674d code cleanup: remove deprecated defines and some struct members 2012-09-06 00:33:59 +00:00
Campbell Barton 52310bd4a7 code cleanup: remove dead assignments, gave mask vars clearer names & moved some mask evaluation funcs into mask_evaluate.c 2012-08-26 18:09:01 +00:00
Campbell Barton d35957ba94 code cleanup: split out mask spline evaluation into its own file. 2012-08-26 13:41:40 +00:00
Campbell Barton 869382403a mask: skip self intersection on drawing when fill is disabled, since it was only drawing on one side of an unfilled spline. 2012-08-21 09:20:35 +00:00
Campbell Barton 5e78327b92 fix for mask feather intersection checks not working right for non-filled, feathered masks.
now do intersection checks for both sides of the feather.
2012-08-20 16:34:14 +00:00
Sergey Sharybin b282b5275c Mask feather self-intersection check
Enable self-intersection check for preview. In own tests average
time for this operation on mango files was ~0.0015sec, and it was
like 20 splines max which still gives pretty smooth performance
on my core quad machine.

Would think let's check how it works for now, if it'll give some
issues here, would just avoid tessellation on every redraw by
storing tessellation in some cache (probably in mask user).

Another change is related on a way which loop to collapse.
Changed length check with AABB size check. A bit slower but
should be a bit more predictable.
2012-08-06 13:53:38 +00:00
Campbell Barton 2044b62370 resolve some issues with curve resolution calculaction
- resolution could become so high that it would wrap around  to a negative number, now check for small numbers before doing float division.
- resolution was being calculated in some cases when it already met the clamp value - now this is skipped.
2012-08-04 20:17:22 +00:00
Campbell Barton 4c02549d5d remove references to raskter from compositor and BKE mask. 2012-07-31 16:04:47 +00:00
Campbell Barton 2e51811950 use the same rasterizer as the compositor for the sequencer. 2012-07-31 15:45:01 +00:00
Campbell Barton 9a2d862123 clamp mask resolution, the occasional crash would happen failing to alloc when adding feather points very close together. 2012-07-27 11:05:08 +00:00
Campbell Barton c42b23030b copy support for mask datablocks 2012-07-27 08:18:11 +00:00
Campbell Barton 2b133b14ab mask/image viewer now works with non 1:1 image aspect, editing masks in the image viewer should be generally usable now though still some TODO's left. 2012-07-25 20:39:49 +00:00
Campbell Barton f4cff34392 disable feather collapse during drawing, its very slow. 2012-07-17 09:56:10 +00:00
Campbell Barton f9e63430ac use calculated spline resoltion rather then fixed at 32. 2012-07-16 14:17:01 +00:00
Campbell Barton a2e2489f61 correct own naming error BLI -> BKE 2012-07-16 08:53:11 +00:00
Campbell Barton fc3cd6eb80 replace masking rasterizer with a more simple geometry based rasterizer (for the compositor).
notes:
- uncomment  #define USE_RASKTER in BKE_mask.h to use the previous mask rasterizer.
- slightly slower for regular masks but significantly faster for feather.
- main benefit is that it threads well so works nice for tile compositor.
- feather is lower quality, can use some improvements here.
- feather can also use some interpolation enhancements, will do later.
2012-07-14 15:29:05 +00:00
Campbell Barton 8ce53a2a98 new mask rasterizer written to take advantage of the compositors threading, mostly functional but disabled by default (still a little wip). 2012-07-12 20:10:41 +00:00
Campbell Barton 83d2314edf ability to calculate mask curve and feather with predefined resolution (*_ex functions) 2012-07-11 20:18:46 +00:00
Peter Larabell 492d9aabe0 some code refactors in raskter.c to sync it with build where mask tiling is being developed. Also adds a bit more mask tiling code. 2012-07-10 04:51:08 +00:00
Sergey Sharybin facc2429ab Mask node: create a copy of layers to be rasterized in initExecution
This creates a list of splines to be rasterized in nitExecution which
is being called from main thread. This should resolve possible threading
issues discovered in tomato branch.
2012-07-04 07:10:23 +00:00
Campbell Barton 238d3fa4bb mask re-key feature - mango request. ability to reset selected points shape key data.
useful if you add many keys to one part of a curve, then later want to key another part - but dont want to continuously make the same corrections.
2012-06-22 11:53:49 +00:00
Campbell Barton 54156e2b82 option to disable feather, since its so slow - for interactively editing masks its useful to be able to disable.
also rename RNA to 'use_antialiasing'
2012-06-21 12:27:57 +00:00
Peter Larabell ceffc2cd50 add Anti-Aliasing (very rough draft algorithm, NOT FINAL version) to raskter lib. Code is still quite messy but will be replaced when final algo comes in anyway. 2012-06-13 19:57:23 +00:00
Campbell Barton c83d37ccc0 mango request
- highlight active mask layers.
- remove keyframes when all layer data is removed.
2012-06-13 08:35:50 +00:00
Campbell Barton 16dededdf3 remove input socket of mask node, this wasnt used. 2012-06-12 18:36:49 +00:00
Campbell Barton b33c5168f4 mask animation keys now editable in the dope sheet (duplicate, transform, delete, select- etc). 2012-06-08 14:31:38 +00:00
Campbell Barton 4413903370 support for subframe animation evaluation for masks. 2012-06-08 09:35:51 +00:00
Campbell Barton bdf9e02346 new sequence strip type for masks. 2012-06-07 18:24:36 +00:00
Bastien Montagne 32530c2827 Quite some warnings... 2012-06-07 18:21:07 +00:00
Campbell Barton 052e34cc3d fix for bug where auto-handles were not calculated correctly for animated curves. 2012-06-06 20:26:26 +00:00
Campbell Barton 3e8ad394af code cleanup: remove unused mask args 2012-06-06 20:05:58 +00:00
Campbell Barton 465b11e971 operator to reset feather weights on all shape keys 2012-06-05 19:39:12 +00:00
Campbell Barton fe58f668a1 mask point slide now accounts for scaled bezier weights, 2012-06-05 12:51:11 +00:00
Campbell Barton ae8103240d mask editing
- clear feather weights (alt+s)
- fix for glitch where placing the feather would jitter.
2012-06-05 09:37:44 +00:00
Campbell Barton 070d2122b0 mask header from tomato/ 2012-06-04 15:45:04 +00:00