Fix T46687: Animating tracks properties from objects didn't use proper path

This commit is contained in:
Sergey Sharybin 2015-11-04 20:01:33 +05:00
parent 7db2979dcf
commit 321a609caa

@ -55,8 +55,8 @@
#include "WM_api.h" #include "WM_api.h"
static ListBase *tracking_tracksbase_from_track(MovieClip *clip, static MovieTrackingObject *tracking_object_from_track(MovieClip *clip,
MovieTrackingTrack *track) MovieTrackingTrack *track)
{ {
MovieTracking *tracking = &clip->tracking; MovieTracking *tracking = &clip->tracking;
ListBase *tracksbase = &tracking->tracks; ListBase *tracksbase = &tracking->tracks;
@ -67,16 +67,26 @@ static ListBase *tracking_tracksbase_from_track(MovieClip *clip,
MovieTrackingObject *object = tracking->objects.first; MovieTrackingObject *object = tracking->objects.first;
while (object) { while (object) {
if (BLI_findindex(&object->tracks, track) != -1) { if (BLI_findindex(&object->tracks, track) != -1) {
return &object->tracks; return object;
break;
} }
object = object->next; object = object->next;
} }
} }
return tracksbase; return NULL;
} }
static ListBase *tracking_tracksbase_from_plane_track( 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, MovieClip *clip,
MovieTrackingPlaneTrack *plane_track) MovieTrackingPlaneTrack *plane_track)
{ {
@ -89,13 +99,25 @@ static ListBase *tracking_tracksbase_from_plane_track(
MovieTrackingObject *object = tracking->objects.first; MovieTrackingObject *object = tracking->objects.first;
while (object) { while (object) {
if (BLI_findindex(&object->plane_tracks, plane_track) != -1) { if (BLI_findindex(&object->plane_tracks, plane_track) != -1) {
return &object->plane_tracks; return object;
break;
} }
object = object->next; object = object->next;
} }
} }
return plane_tracks_base; 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)) static char *rna_tracking_path(PointerRNA *UNUSED(ptr))
@ -125,10 +147,21 @@ static void rna_tracking_defaultSettings_searchUpdate(Main *UNUSED(bmain), Scene
static char *rna_trackingTrack_path(PointerRNA *ptr) static char *rna_trackingTrack_path(PointerRNA *ptr)
{ {
MovieClip *clip = (MovieClip *)ptr->id.data;
MovieTrackingTrack *track = (MovieTrackingTrack *)ptr->data; MovieTrackingTrack *track = (MovieTrackingTrack *)ptr->data;
char name_esc[sizeof(track->name) * 2]; MovieTrackingObject *object = tracking_object_from_track(clip, track);
BLI_strescape(name_esc, track->name, sizeof(name_esc)); char track_name_esc[sizeof(track->name) * 2];
return BLI_sprintfN("tracking.tracks[\"%s\"]", name_esc); BLI_strescape(track_name_esc, track->name, sizeof(track_name_esc));
if (object == NULL) {
return BLI_sprintfN("tracking.tracks[\"%s\"]", track_name_esc);
}
else {
char object_name_esc[sizeof(object->name) * 2];
BLI_strescape(object_name_esc, object->name, sizeof(object_name_esc));
return BLI_sprintfN("tracking.objects[\"%s\"].tracks[\"%s\"]",
object_name_esc,
track_name_esc);
}
} }
static void rna_trackingTracks_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) static void rna_trackingTracks_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
@ -291,10 +324,21 @@ static void rna_trackingPlaneMarker_frame_set(PointerRNA *ptr, int value)
static char *rna_trackingPlaneTrack_path(PointerRNA *ptr) static char *rna_trackingPlaneTrack_path(PointerRNA *ptr)
{ {
MovieClip *clip = (MovieClip *)ptr->id.data;
MovieTrackingPlaneTrack *plane_track = (MovieTrackingPlaneTrack *)ptr->data; MovieTrackingPlaneTrack *plane_track = (MovieTrackingPlaneTrack *)ptr->data;
char name_esc[sizeof(plane_track->name) * 2]; char track_name_esc[sizeof(plane_track->name) * 2];
BLI_strescape(name_esc, plane_track->name, sizeof(name_esc)); MovieTrackingObject *object = tracking_object_from_plane_track(clip, plane_track);
return BLI_sprintfN("tracking.plane_tracks[\"%s\"]", name_esc); 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);
}
else {
char object_name_esc[sizeof(object->name) * 2];
BLI_strescape(object_name_esc, object->name, sizeof(object_name_esc));
return BLI_sprintfN("tracking.objects[\"%s\"].plane_tracks[\"%s\"]",
object_name_esc,
track_name_esc);
}
} }
static void rna_trackingPlaneTrack_name_set(PointerRNA *ptr, const char *value) static void rna_trackingPlaneTrack_name_set(PointerRNA *ptr, const char *value)