diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-08-16 13:46:30 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-08-16 13:46:30 +0400 |
commit | 24ce60cfe4511534e57a2dea3f24579c74bbdd29 (patch) | |
tree | 57df16e6d5f41545e1379f8a51e0e10fe6b2eef1 /source/blender/editors/mask | |
parent | cab2aef71ab44bc7d85cf4e2c1de607d02e0df7d (diff) |
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 :)
Diffstat (limited to 'source/blender/editors/mask')
-rw-r--r-- | source/blender/editors/mask/mask_relationships.c | 55 | ||||
-rw-r--r-- | source/blender/editors/mask/mask_shapekey.c | 1 |
2 files changed, 40 insertions, 16 deletions
diff --git a/source/blender/editors/mask/mask_relationships.c b/source/blender/editors/mask/mask_relationships.c index 2a1bdee32f7..6ced2423074 100644 --- a/source/blender/editors/mask/mask_relationships.c +++ b/source/blender/editors/mask/mask_relationships.c @@ -102,32 +102,53 @@ static int mask_parent_set_exec(bContext *C, wmOperator *UNUSED(op)) MaskLayer *masklay; /* parent info */ - SpaceClip *sc; - MovieClip *clip; + SpaceClip *sc = CTX_wm_space_clip(C); + MovieClip *clip = ED_space_clip_get_clip(sc); + MovieTracking *tracking; MovieTrackingTrack *track; - MovieTrackingMarker *marker; + MovieTrackingPlaneTrack *plane_track; MovieTrackingObject *tracking_object; /* done */ - int framenr; + int framenr, parent_type; + float parmask_pos[2], orig_corners[4][2]; + char *sub_parent_name; - float marker_pos_ofs[2]; - float parmask_pos[2]; - - if ((NULL == (sc = CTX_wm_space_clip(C))) || - (NULL == (clip = sc->clip)) || - (NULL == (track = clip->tracking.act_track)) || - (NULL == (tracking_object = BKE_tracking_object_get_active(&clip->tracking)))) - { + if (ELEM(NULL, sc, clip)) { return OPERATOR_CANCELLED; } framenr = ED_space_clip_get_clip_frame_number(sc); - marker = BKE_tracking_marker_get(track, framenr); - add_v2_v2v2(marker_pos_ofs, marker->pos, track->offset); + tracking = &clip->tracking; + tracking_object = BKE_tracking_object_get_active(&clip->tracking); + + if (tracking_object == NULL) { + return OPERATOR_CANCELLED; + } + + if ((track = BKE_tracking_track_get_active(tracking)) != NULL) { + MovieTrackingMarker *marker = BKE_tracking_marker_get(track, framenr); + float marker_pos_ofs[2]; + + add_v2_v2v2(marker_pos_ofs, marker->pos, track->offset); - BKE_mask_coord_from_movieclip(clip, &sc->user, parmask_pos, marker_pos_ofs); + BKE_mask_coord_from_movieclip(clip, &sc->user, parmask_pos, marker_pos_ofs); + + sub_parent_name = track->name; + parent_type = MASK_PARENT_POINT_TRACK; + } + else if ((plane_track = BKE_tracking_plane_track_get_active(tracking)) != NULL) { + MovieTrackingPlaneMarker *plane_marker = BKE_tracking_plane_marker_get(plane_track, framenr); + + zero_v2(parmask_pos); + sub_parent_name = plane_track->name; + parent_type = MASK_PARENT_PLANE_TRACK; + memcpy(orig_corners, plane_marker->corners, sizeof(orig_corners)); + } + else { + return OPERATOR_CANCELLED; + } for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { MaskSpline *spline; @@ -144,10 +165,12 @@ static int mask_parent_set_exec(bContext *C, wmOperator *UNUSED(op)) if (MASKPOINT_ISSEL_ANY(point)) { point->parent.id_type = ID_MC; point->parent.id = &clip->id; + point->parent.type = parent_type; BLI_strncpy(point->parent.parent, tracking_object->name, sizeof(point->parent.parent)); - BLI_strncpy(point->parent.sub_parent, track->name, sizeof(point->parent.sub_parent)); + BLI_strncpy(point->parent.sub_parent, sub_parent_name, sizeof(point->parent.sub_parent)); copy_v2_v2(point->parent.parent_orig, parmask_pos); + memcpy(point->parent.parent_corners_orig, orig_corners, sizeof(point->parent.parent_corners_orig)); } } } diff --git a/source/blender/editors/mask/mask_shapekey.c b/source/blender/editors/mask/mask_shapekey.c index 93bdca93096..d5fbdca5b0a 100644 --- a/source/blender/editors/mask/mask_shapekey.c +++ b/source/blender/editors/mask/mask_shapekey.c @@ -38,6 +38,7 @@ #include "BKE_context.h" #include "BKE_depsgraph.h" #include "BKE_mask.h" +#include "BKE_report.h" #include "DNA_object_types.h" #include "DNA_mask_types.h" |