Tracking: Add missing animation fix when deleting plane track
This commit is contained in:
@@ -139,6 +139,8 @@ void clip_graph_tracking_iterate(struct SpaceClip *sc, bool selected_only, bool
|
||||
void clip_delete_track(struct bContext *C, struct MovieClip *clip, struct MovieTrackingTrack *track);
|
||||
void clip_delete_marker(struct bContext *C, struct MovieClip *clip, struct MovieTrackingTrack *track, struct MovieTrackingMarker *marker);
|
||||
|
||||
void clip_delete_plane_track(struct bContext *C, struct MovieClip *clip, struct MovieTrackingPlaneTrack *plane_track);
|
||||
|
||||
void clip_view_center_to_point(SpaceClip *sc, float x, float y);
|
||||
|
||||
void clip_draw_cfra(struct SpaceClip *sc, struct ARegion *ar, struct Scene *scene);
|
||||
|
||||
@@ -196,7 +196,7 @@ void clip_delete_track(bContext *C, MovieClip *clip, MovieTrackingTrack *track)
|
||||
track,
|
||||
rna_path, sizeof(rna_path));
|
||||
BKE_animdata_fix_paths_remove(&clip->id, rna_path);
|
||||
|
||||
/* Delete track itself. */
|
||||
BKE_tracking_track_free(track);
|
||||
BLI_freelinkN(tracksbase, track);
|
||||
/* Send notifiers. */
|
||||
@@ -224,6 +224,28 @@ void clip_delete_marker(bContext *C, MovieClip *clip, MovieTrackingTrack *track,
|
||||
}
|
||||
}
|
||||
|
||||
void clip_delete_plane_track(bContext *C,
|
||||
MovieClip *clip,
|
||||
MovieTrackingPlaneTrack *plane_track)
|
||||
{
|
||||
MovieTracking *tracking = &clip->tracking;
|
||||
ListBase *plane_tracks_base = BKE_tracking_get_active_plane_tracks(tracking);
|
||||
/* Delete f-curves associated with the track (such as weight, i.e.) */
|
||||
/* Escaped object name, escaped track name, rest of the path. */
|
||||
char rna_path[MAX_NAME * 4 + 64];
|
||||
BKE_tracking_get_rna_path_for_plane_track(tracking,
|
||||
plane_track,
|
||||
rna_path, sizeof(rna_path));
|
||||
BKE_animdata_fix_paths_remove(&clip->id, rna_path);
|
||||
/* Delete the plane track itself. */
|
||||
BKE_tracking_plane_track_free(plane_track);
|
||||
BLI_freelinkN(plane_tracks_base, plane_track);
|
||||
/* TODO(sergey): Any notifiers to be sent here? */
|
||||
(void) C;
|
||||
/* Inform dependency graph. */
|
||||
DAG_id_tag_update(&clip->id, 0);
|
||||
}
|
||||
|
||||
void clip_view_center_to_point(SpaceClip *sc, float x, float y)
|
||||
{
|
||||
int width, height;
|
||||
|
||||
@@ -226,7 +226,6 @@ static int delete_track_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
MovieClip *clip = ED_space_clip_get_clip(sc);
|
||||
MovieTracking *tracking = &clip->tracking;
|
||||
bool changed = false;
|
||||
|
||||
/* Delete selected plane tracks. */
|
||||
ListBase *plane_tracks_base = BKE_tracking_get_active_plane_tracks(tracking);
|
||||
for (MovieTrackingPlaneTrack *plane_track = plane_tracks_base->first,
|
||||
@@ -235,14 +234,11 @@ static int delete_track_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
plane_track = next_plane_track)
|
||||
{
|
||||
next_plane_track = plane_track->next;
|
||||
|
||||
if (PLANE_TRACK_VIEW_SELECTED(plane_track)) {
|
||||
BKE_tracking_plane_track_free(plane_track);
|
||||
BLI_freelinkN(plane_tracks_base, plane_track);
|
||||
clip_delete_plane_track(C, clip, plane_track);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* Remove selected point tracks (they'll also be removed from planes which
|
||||
* uses them).
|
||||
*/
|
||||
@@ -257,14 +253,11 @@ static int delete_track_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* Nothing selected now, unlock view so it can be scrolled nice again. */
|
||||
sc->flag &= ~SC_LOCK_SELECTION;
|
||||
|
||||
if (changed) {
|
||||
WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip);
|
||||
}
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user