- Even preserves thickness but can give unsightly loops
- Smooth gives nicer shape but can give unsightly feather/spline mismatch for 'S' shapes created by beziers.
This is an example where smooth works much nicer.
http://www.graphicall.org/ftp/ideasman42/mask_compare.png
Useful in cases when masking stuff like self-intersecting
ropes. This could probably be smarter option, but can't
currently think about robust approach here.
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.
- 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.
- use Alt to modify all mask feather at once while dragging.
- copying a multi-user mask from the interface works now.
- show masks when UV editing isnt used, rather then checking editmode (would give some odd/annoying image space header).
- add a fake mask user by default.
- moving points with LMB drag no longer selects them.
It was wrongly calculated bucket number per side in cases when some
of segments is filling the whole bounding box across some of dimension.
Solved by limiting buckets at least to 1 in such cases.
Made some minor optimization such as:
- Avoid using "%" operation in loops, replace with a check
for index "overflow".
- Use pre-computed values for scaling feather coordinates
to 0 .. 1 space.
This allowed to reach couple of milliseconds of boost.
Another change is to use higher number of buckets (up to 512).
This doesn't took significantly more memory (like uses only 10MB
of memory for average splines) and allows to have 30-50x boost
for average splines.
Use dynamically calculated number of buckets for this, to be
sure segments would fit two buckets.
Also fixed intersection detection in some cases when edge is
shared between two buckets -- it is possible that such edge
would cross third bucket and intersect edge from there.
Real fix would be to find a point which is definitely now on loop
to be collapsed, but that's for a bit later. This commit should
remove possible stoppers.
This implements simple function which collapses internal loops
caused by self-intersections into a singularity.
This loops can't be removed because rasterizer expects points
of feather be aligned with points from spline itself.
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.
return valid marker. If not -- let blender crash, because that means
something went really bad and silencing this isn't good idea.
Also made mask parenting to tracking data aware of clip's start frame.
- Re-arrange functions in headers and implementation file to make them
more grouped by entity they're operating with. Also order of functions
in implementation file should match order of functions in header for
easier navigation.
- Rename some functions to match conventions of naming public functions.
- Some code de-duplication, still some room for improvements tho.
- Split main 2D tracking functions into smaller steps to make it more clear.
Accidentally OpenMP was disabled in some of previous commits, re-enable it.