Commit Graph

40 Commits

Author SHA1 Message Date
0102d57c1d Slide mask spline segment to define it's curvature
This actually implements the idea used in Gimp which is grabbing
an arbitrary point on the spline and dragging it, ensuring spline
goes over this point. This is really useful way to tweak spline
curvature.

Currently only affects on a closest handle, meaning no weighting
on changes for both handles which are adjacent to the same segment
will happen just yet,

Another limitation is that currently such a slide is a big jumpy
when you start sliding. This is because projection is not used
to calculate u value because projection used to fail a lot for
me here and didn't find a nice solution for this yet. But this is
to be improved for sure!
2014-04-03 18:20:17 +06:00
617557b08e Code cleanup: remove TRUE/FALSE & WITH_BOOL_COMPAT define 2014-04-01 15:22:28 +11:00
1af69b6df3 Implement asymmetric and free handles type for masks
Summary:
The title actually says it all, it's just possible to
have independent free handles for mask splines. Also
it's now possible to have aligned handles displayed
as independent handles.

Required changes in quite a few places, but they're
rather straightforward.

From user perspective there's one really visible change
which is removed Handle Type menu from the panel. With
asymmetric handles it's not clear which handle type to
display there. So now the only way to change handle type
is via V-key menu.

Rewrote normal evaluation function to make it deal
with new type of handles we support. Now it works in
the following way:

- Offset the original spline by maximal weight
- Calculate vector between corresponding U positions
  on offset and original spline
- Normalize this vector.

Seems to be giving more adequate results and doesn't
tend to self-intersect as much as old behavior used to,

There're still some changes which needed to be done, but
which are planned for further patch:

- Support colors and handle size via themes.
- Make handles color-coded, just the same as done for
  regular bezier splines in 3D viewport.

Additional changes to make roto workflow even better:
- Use circles to draw handles
- Support AA for handles
- Change click-create-drag to change curvature of the
  spline instead of adjusting point position.

Reviewers: campbellbarton

CC: sebastian_k, hype, cronk

Differential Revision: http://developer.blender.org/D121
2014-03-28 17:54:38 +06:00
1d12c3fd53 Implement clipboard for mask splines
So now it's possible to copy-paste splines between layers.

Implementation is pretty much straightforward and duplicates
some logic which we've got in sequencer/tracking clipboards.

Will work on a common routine for clipboards later, for now
it's not so much crucial to have.
2014-01-27 15:42:46 +06:00
03dbae07d3 Mask primitives
Currently only circle and square, might be easily
extended in the future.

New primitives are creating at cursor location.
This also implied adding 2d cursor to space clip.

Also fix set 2D cursor location which didn't work
in image editor's mask mode since 2.67.

TODO: draw_image_cursor better be moved to some
      more generic file, but it's not so much
      important for now and might be solved later.

Thanks Campbell for the review!
2013-08-26 20:23:26 +00:00
1c2a657eee Duplicate operator for masks
Topic says it all :)

Jut implemented operator to duplicate mask points
and segments between them (exactly the same behavior
as Curve object duplication in edit mode).

Does not copy animation, but that's tricky and likely
not needed anyway.
2013-08-21 10:12:42 +00:00
3de1458cdf Select more/less tool for mask splines 2013-07-20 10:24:16 +00:00
da7ce6a3cc use UI_view2d_getscale() to get the scale for image cursor drawing and ED_mask_pixelspace_factor(). - was getting the image width/height when its not needed before. 2012-12-14 16:51:02 +00:00
06baaeee22 Fix #32658: left mouse button selection did not work well in the graph and mask
editors. Ctrl+Click to add a point and vertex slide now work with right mouse
button in this case, consistent with the 3D view.
2012-09-27 15:30:20 +00:00
05755d307a fix [#31946] Masking doesn't respect pixel ratio 2012-09-13 05:29:38 +00:00
f1acd6ac3e code cleanup: pass mouse position as int[2] rather then wmEvent 2012-07-27 15:15:55 +00:00
bef3be5326 code cleanup: mask keys now dont use space-clip keys - could give troubles later on. 2012-07-27 11:56:36 +00:00
61469d2e3e code cleanup: remove unneeded 'struct' qualifiers 2012-07-26 22:47:05 +00:00
ff078d309e change clip utility function arguments to take space data and region rather then the context.
this allows a fix to be applied that corrects the helper line in the image view when transforming a mask.
2012-07-26 22:41:40 +00:00
f39a21c36f add ED_space_image_get_size_fl, ED_space_clip_get_size_fl 2012-07-26 11:47:47 +00:00
77e7ca6aa8 mask/image editor now works for border select and lasso 2012-07-26 09:54:52 +00:00
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
927af4ccc9 mask transform now works in the image space 2012-07-25 19:36:59 +00:00
7fba5779ed match function names for clip/image spaces 2012-07-25 16:30:53 +00:00
f83ea3fa85 fix some crashes with mask/image transfor, a few more areas working now. 2012-07-25 16:03:08 +00:00
071a1034d6 add mask keymap to image window.
debug prints for events when --debug-events is used to help track down why a key is/isnt used.
2012-07-25 14:46:38 +00:00
c3a8894f57 wip mask/image commit, mostly internal function & added some TODO's 2012-07-25 10:39:54 +00:00
8509e94d3a initial commit for supporting masks in the image view, currently active seq strip is used as the mask source.
also unify mask drawing code for clip/sequencer/image
2012-07-24 19:29:24 +00:00
7949f0057f generalize mask poll functions and sequencer mask code. 2012-07-24 09:53:29 +00:00
6e6dd576a8 Operator to move mask layers up and down in the list 2012-07-11 10:37:38 +00:00
4149ea5f50 Last spell checking (for now).
Only mysterious courant from bpy.types.ParticleSettings.courant_target reamins...
2012-07-04 15:52:07 +00:00
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
4b955a60ed Cleanup up space clip API:
- Remove clip/mask specific size/aspect getters, they shall just
  use the same size/aspect ratio.
- Made size getter (and some other public functions) accept context
  instead of SpaceClip. Currently only SpaceClip is being get from
  this context, but later it'll be helpful when adding support of
  editing mask without opening clip in clip editor (in this case
  using render resolution for mask would be ideal, but this
  requires knowing scene in size getter).
- Rearrange some functions in clip_editor.c for easier navigation
  in the file.
2012-06-20 10:28:51 +00:00
4f044f4ec1 Changes in clip editor's public api to make it's more clear
whether getting of some property happens or this property is
being changed.

Also made it more clear whether affecting property belongs
to clip or mask datablock.
2012-06-19 14:26:29 +00:00
14a68d3a5f Mark context as const when it's possible and avoid typecasts from const bContext* to bContext* 2012-06-19 14:09:44 +00:00
99f7c06d7e added mask tool to recalculate handles (Ctrl+N) 2012-06-13 14:09:20 +00:00
56c5c63f57 code cleanup: doxy comment filename corrections 2012-06-08 23:43:11 +00:00
36db2a2cff initial support for editing masks in the sequencer, currently only draw the mask. 2012-06-07 19:24:49 +00:00
465b11e971 operator to reset feather weights on all shape keys 2012-06-05 19:39:12 +00:00
8c71157af6 shrink/fatten transform for mask - adjusts the feather weight.
works in proportional editmode too.
2012-06-05 14:13:14 +00:00
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
d46a6dc59c abbreviate mask-editing to mask-edit 2012-06-04 17:30:54 +00:00
c517247fc6 include cleanup, also raskter wasn't building on osx 2012-06-04 17:27:22 +00:00
0f1fd51c21 picky change - rename keymap since there is no 'mask editor' 2012-06-04 17:13:38 +00:00
115322ef08 mask merge (initial copy of editor files) 2012-06-04 15:36:16 +00:00