diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-04-30 20:19:20 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-04-30 20:19:20 +0400 |
commit | f111131ca68359e928056eff09a03d0eee8c681a (patch) | |
tree | 866483646a4fca238c0d1f4e22ff1bcb1ed0d6d2 /source/blender/blenkernel/intern | |
parent | 323aedb81e8f606cfb1357053891e989ff393099 (diff) |
Camera tracking: initial commit of dopesheet view for clip editor
- Displays dopesheet information for selected tracks, and currently does not
support any kind of editing.
- Changed regions to use the whole main region for such views as curves and dopesheet.
This allows to have own panels with tools/properties in this area.
- Active clip is getting synchronized between different clip editor editors in the
same screen, so updating of curve/dopesheet views happens automatically when one
changes current clip in one of this editors.
- Panels in toolbox and properties panels are now separated to rely on current view
mode, but some operators and poll functions still need to be updated.
- Added new screen called "Movie Tracking" where layout is configured to
display timeline, main clip window, curves and dopesheet.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/movieclip.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/tracking.c | 60 |
2 files changed, 61 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 14db68e434a..d2219484ff4 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -453,7 +453,7 @@ static MovieClip *movieclip_alloc(const char *name) MovieClip *BKE_movieclip_file_add(const char *name) { MovieClip *clip; - MovieClipUser user; + MovieClipUser user = {0}; int file, len, width, height; const char *libname; char str[FILE_MAX], strtest[FILE_MAX]; diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index e511cd362de..316cb4b6159 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -632,6 +632,12 @@ static void tracking_objects_free(ListBase *objects) BLI_freelistN(objects); } +static void tracking_dopesheet_free(MovieTrackingDopesheet *dopesheet) +{ + BLI_freelistN(&dopesheet->channels); + dopesheet->tot_channel = 0; +} + void BKE_tracking_free(MovieTracking *tracking) { tracking_tracks_free(&tracking->tracks); @@ -643,6 +649,8 @@ void BKE_tracking_free(MovieTracking *tracking) if (tracking->camera.intrinsics) BKE_tracking_distortion_destroy(tracking->camera.intrinsics); + + tracking_dopesheet_free(&tracking->dopesheet); } static MovieTrackingTrack *duplicate_track(MovieTrackingTrack *track) @@ -1352,6 +1360,8 @@ void BKE_tracking_sync(MovieTrackingContext *context) newframe = context->user.framenr - 1; context->sync_frame = newframe; + + BKE_tracking_update_dopesheet(tracking); } void BKE_tracking_sync_user(MovieClipUser *user, MovieTrackingContext *context) @@ -3033,3 +3043,53 @@ MovieTrackingObject *BKE_tracking_named_object(MovieTracking *tracking, const ch return NULL; } + +/*********************** dopesheet functions *************************/ + +static int channels_alpha_sort(void *a, void *b) +{ + MovieTrackingDopesheetChannel *channel_a = a; + MovieTrackingDopesheetChannel *channel_b = b; + + if (BLI_strcasecmp(channel_a->track->name, channel_b->track->name) > 0) + return 1; + else + return 0; +} + +void BKE_tracking_update_dopesheet(MovieTracking *tracking) +{ + MovieTrackingObject *object = BKE_tracking_active_object(tracking); + MovieTrackingDopesheet *dopesheet = &tracking->dopesheet; + MovieTrackingTrack *track; + ListBase *tracksbase = BKE_tracking_object_tracks(tracking, object); + ListBase old_channels; + + old_channels = dopesheet->channels; + dopesheet->channels.first = dopesheet->channels.last = NULL; + dopesheet->tot_channel = 0; + + for (track = tracksbase->first; track; track = track->next) { + if (TRACK_SELECTED(track) && (track->flag & TRACK_HIDDEN) == 0) { + MovieTrackingDopesheetChannel *channel, *old_channel; + + channel = MEM_callocN(sizeof(MovieTrackingDopesheetChannel), "tracking dopesheet channel"); + channel->track = track; + + /* copy flags from current dopsheet information to new one */ + for (old_channel = old_channels.first; old_channel; old_channel = old_channel->next) { + if (old_channel->track == track) { + channel->flag = old_channel->flag; + break; + } + } + + BLI_addtail(&dopesheet->channels, channel); + dopesheet->tot_channel++; + } + } + + BLI_sortlist(&dopesheet->channels, channels_alpha_sort); + + BLI_freelistN(&old_channels); +} |