diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/makesrna/intern/rna_tracking.c | 79 |
1 files changed, 10 insertions, 69 deletions
diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c index b0f6879656a..b85be15ef07 100644 --- a/source/blender/makesrna/intern/rna_tracking.c +++ b/source/blender/makesrna/intern/rna_tracking.c @@ -55,71 +55,6 @@ #include "WM_api.h" -static MovieTrackingObject *tracking_object_from_track(MovieClip *clip, - MovieTrackingTrack *track) -{ - MovieTracking *tracking = &clip->tracking; - ListBase *tracksbase = &tracking->tracks; - /* TODO: it's a bit difficult to find list track came from knowing just - * movie clip ID and MovieTracking structure, so keep this naive - * search for a while */ - if (BLI_findindex(tracksbase, track) == -1) { - MovieTrackingObject *object = tracking->objects.first; - while (object) { - if (BLI_findindex(&object->tracks, track) != -1) { - return object; - } - object = object->next; - } - } - return NULL; -} - -static ListBase *tracking_tracksbase_from_track(MovieClip *clip, - MovieTrackingTrack *track) -{ - MovieTracking *tracking = &clip->tracking; - MovieTrackingObject *object = tracking_object_from_track(clip, track); - if (object != NULL) { - return &object->tracks; - } - return &tracking->tracks; -} - -static MovieTrackingObject *tracking_object_from_plane_track( - MovieClip *clip, - MovieTrackingPlaneTrack *plane_track) -{ - MovieTracking *tracking = &clip->tracking; - ListBase *plane_tracks_base = &tracking->plane_tracks; - /* TODO: it's a bit difficult to find list track came from knowing just - * movie clip ID and MovieTracking structure, so keep this naive - * search for a while */ - if (BLI_findindex(plane_tracks_base, plane_track) == -1) { - MovieTrackingObject *object = tracking->objects.first; - while (object) { - if (BLI_findindex(&object->plane_tracks, plane_track) != -1) { - return object; - } - object = object->next; - } - } - return NULL; -} - -static ListBase *tracking_tracksbase_from_plane_track( - MovieClip *clip, - MovieTrackingPlaneTrack *plane_track) -{ - MovieTracking *tracking = &clip->tracking; - MovieTrackingObject *object = tracking_object_from_plane_track(clip, - plane_track); - if (object != NULL) { - return &object->plane_tracks; - } - return &tracking->plane_tracks; -} - static char *rna_tracking_path(PointerRNA *UNUSED(ptr)) { return BLI_sprintfN("tracking"); @@ -149,7 +84,8 @@ static char *rna_trackingTrack_path(PointerRNA *ptr) { MovieClip *clip = (MovieClip *)ptr->id.data; MovieTrackingTrack *track = (MovieTrackingTrack *)ptr->data; - MovieTrackingObject *object = tracking_object_from_track(clip, track); + MovieTrackingObject *object = + BKE_tracking_find_object_for_track(&clip->tracking, track); char track_name_esc[sizeof(track->name) * 2]; BLI_strescape(track_name_esc, track->name, sizeof(track_name_esc)); if (object == NULL) { @@ -255,7 +191,8 @@ static void rna_trackingTrack_name_set(PointerRNA *ptr, const char *value) { MovieClip *clip = (MovieClip *)ptr->id.data; MovieTrackingTrack *track = (MovieTrackingTrack *)ptr->data; - ListBase *tracksbase = tracking_tracksbase_from_track(clip, track); + ListBase *tracksbase = + BKE_tracking_find_tracks_list_for_track(&clip->tracking, track); BLI_strncpy(track->name, value, sizeof(track->name)); BKE_tracking_track_unique_name(tracksbase, track); } @@ -327,7 +264,9 @@ static char *rna_trackingPlaneTrack_path(PointerRNA *ptr) MovieClip *clip = (MovieClip *)ptr->id.data; MovieTrackingPlaneTrack *plane_track = (MovieTrackingPlaneTrack *)ptr->data; char track_name_esc[sizeof(plane_track->name) * 2]; - MovieTrackingObject *object = tracking_object_from_plane_track(clip, plane_track); + MovieTrackingObject *object = + BKE_tracking_find_object_for_plane_track(&clip->tracking, + plane_track); BLI_strescape(track_name_esc, plane_track->name, sizeof(track_name_esc)); if (object == NULL) { return BLI_sprintfN("tracking.plane_tracks[\"%s\"]", track_name_esc); @@ -345,7 +284,9 @@ static void rna_trackingPlaneTrack_name_set(PointerRNA *ptr, const char *value) { MovieClip *clip = (MovieClip *)ptr->id.data; MovieTrackingPlaneTrack *plane_track = (MovieTrackingPlaneTrack *)ptr->data; - ListBase *plane_tracks_base = tracking_tracksbase_from_plane_track(clip, plane_track); + ListBase *plane_tracks_base = + BKE_tracking_find_tracks_list_for_plane_track(&clip->tracking, + plane_track); BLI_strncpy(plane_track->name, value, sizeof(plane_track->name)); BKE_tracking_plane_track_unique_name(plane_tracks_base, plane_track); } |