Fix T53523: Keyframes for Marker weight stay, even if the track itself is deleted
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 19 Dec 2017 11:51:45 +0000 (12:51 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 19 Dec 2017 11:51:45 +0000 (12:51 +0100)
Was using wrong prefix for the RNA path fix.

source/blender/editors/space_clip/clip_utils.c

index e901b9f8026b9565881a48bf7739835c364db423..500ec90f011a19239c8a818740342cf6b41b2b2e 100644 (file)
@@ -178,37 +178,36 @@ void clip_delete_track(bContext *C, MovieClip *clip, MovieTrackingTrack *track)
        MovieTrackingTrack *act_track = BKE_tracking_track_get_active(tracking);
        ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
        bool has_bundle = false;
-       char track_name_escaped[MAX_NAME], prefix[MAX_NAME * 2];
        const bool used_for_stabilization = (track->flag & (TRACK_USE_2D_STAB | TRACK_USE_2D_STAB_ROT));
-
-       if (track == act_track)
+       if (track == act_track) {
                tracking->act_track = NULL;
-
-       /* handle reconstruction display in 3d viewport */
-       if (track->flag & TRACK_HAS_BUNDLE)
+       }
+       /* Handle reconstruction display in 3d viewport. */
+       if (track->flag & TRACK_HAS_BUNDLE) {
                has_bundle = true;
-
+       }
        /* Make sure no plane will use freed track */
        BKE_tracking_plane_tracks_remove_point_track(tracking, track);
-
        /* Delete f-curves associated with the track (such as weight, i.e.) */
-       BLI_strescape(track_name_escaped, track->name, sizeof(track_name_escaped));
-       BLI_snprintf(prefix, sizeof(prefix), "tracks[\"%s\"]", track_name_escaped);
-       BKE_animdata_fix_paths_remove(&clip->id, prefix);
+       /* Escaped object name, escaped track name, rest of the path. */
+       char rna_path[MAX_NAME * 4 + 64];
+       BKE_tracking_get_rna_path_for_track(tracking,
+                                           track,
+                                           rna_path, sizeof(rna_path));
+       BKE_animdata_fix_paths_remove(&clip->id, rna_path);
 
        BKE_tracking_track_free(track);
        BLI_freelinkN(tracksbase, track);
-
+       /* Send notifiers. */
        WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip);
-
        if (used_for_stabilization) {
                WM_event_add_notifier(C, NC_MOVIECLIP | ND_DISPLAY, clip);
        }
-
-       DAG_id_tag_update(&clip->id, 0);
-
-       if (has_bundle)
+       if (has_bundle) {
                WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+       }
+       /* Inform dependency graph. */
+       DAG_id_tag_update(&clip->id, 0);
 }
 
 void clip_delete_marker(bContext *C, MovieClip *clip, MovieTrackingTrack *track,