From 470ad6fc0e729e335718d1152e2348db159e4514 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 20 Jun 2012 10:54:56 +0000 Subject: Do not check result of BKE_tracking_marker_get -- it shall always 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. --- source/blender/editors/mask/mask_relationships.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'source/blender/editors/mask/mask_relationships.c') diff --git a/source/blender/editors/mask/mask_relationships.c b/source/blender/editors/mask/mask_relationships.c index 7ba3c27e18d..a1f2539ce7c 100644 --- a/source/blender/editors/mask/mask_relationships.c +++ b/source/blender/editors/mask/mask_relationships.c @@ -44,6 +44,7 @@ #include "WM_types.h" #include "ED_screen.h" +#include "ED_clip.h" /* frame remapping functions */ #include "ED_mask.h" /* own include */ #include "mask_intern.h" /* own include */ @@ -104,21 +105,25 @@ static int mask_parent_set_exec(bContext *C, wmOperator *UNUSED(op)) MovieClip *clip; MovieTrackingTrack *track; MovieTrackingMarker *marker; - MovieTrackingObject *tracking; + MovieTrackingObject *tracking_object; /* done */ + int framenr; + 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 == (marker = BKE_tracking_marker_get(track, sc->user.framenr))) || - (NULL == (tracking = BKE_tracking_object_get_active(&clip->tracking)))) + (NULL == (tracking_object = BKE_tracking_object_get_active(&clip->tracking)))) { 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); BKE_mask_coord_from_movieclip(clip, &sc->user, parmask_pos, marker_pos_ofs); @@ -138,7 +143,7 @@ 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; - strcpy(point->parent.parent, tracking->name); + strcpy(point->parent.parent, tracking_object->name); strcpy(point->parent.sub_parent, track->name); copy_v2_v2(point->parent.parent_orig, parmask_pos); -- cgit v1.2.3